Coverage report: /home/ellis/comp/core/ffi/ffmpeg/pkg.lisp

KindCoveredAll%
expression3210 1.4
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; pkg.lisp --- FFmpeg FFI
2
 
3
 ;; Bindings for FFmpeg libraries (libavcodec, libavutil, etc)
4
 
5
 ;;; Commentary:
6
 
7
 ;; ref: https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
8
 
9
 ;;; Code:
10
 (defpackage :ffmpeg
11
   (:use :cl :std :sb-alien)
12
   (:export :load-avcodec :load-avutil :load-avformat
13
    :load-swresample :load-swscale
14
    :load-avfilter :avcodec-open2
15
    :avcodec-version :avformat-version :avutil-version :avfilter-version
16
    :avformat-alloc-context
17
    :avformat-free-context
18
    :avcodec-alloc-context3
19
    :avcodec-free-context
20
    :avcodec-close
21
    :avsubtitle-free
22
    :avcodec-get-class
23
    :avcodec-get-subtitle-rect-class
24
    :av-codec-iterate
25
    :avcodec-find-decoder
26
    :avcodec-find-decoder-by-name
27
    :avcodec-find-encoder
28
    :avcodec-find-encoder-by-name
29
    :av-codec-is-encoder
30
    :av-codec-is-decoder
31
    :av-get-profile-name
32
    :av-codec-id :av-codec-id*
33
    :av-codec :av-codec-context
34
    :av-dictionary :av-class
35
    :av-subtitle
36
    :av-get-pcm-codec
37
    :avcodec-profile-name
38
    :av-get-exact-bits-per-sample
39
    :av-get-bits-per-sample
40
    :avcodec-get-name
41
    :avcodec-get-type
42
    :avcodec-descriptor-get
43
    :avcodec-descriptor-next
44
    :avcodec-descriptor-get-by-name
45
    :av-format-context
46
    :av-frame
47
    :av-codec-tag
48
    :av-dictionary-entry
49
    :av-rational
50
    :av-sample-format
51
    :av-pixel-format
52
    :av-color-primaries
53
    :av-color-transfer-characteristic
54
    :av-color-space
55
    :av-color-range
56
    :av-chroma-location
57
    :av-option-ranges
58
    :av-option-type
59
    :av-opt-flag
60
    :av-option-array-def
61
    :av-option
62
    :av-buffer
63
    :av-buffer-ref
64
    :av-class-category
65
    :avformat-open-input
66
    :avformat-get-riff-video-tags
67
    :avformat-get-riff-audio-tags
68
    :avformat-get-mov-video-tags
69
    :avformat-get-mov-audio-tags
70
    :avformat-write-header
71
    :avformat-network-init
72
    :avformat-network-deinit
73
    :avformat-get-class
74
    :avformat-stream-group-get-class
75
    :av-find-default-stream-index
76
    :av-dump-format
77
    :av-codec-get-tag
78
    :av-codec-get-id
79
    :av-get-output-timestamp
80
    :av-guess-codec
81
    :av-guess-format
82
    :av-write-frame
83
    :avformat-init-output
84
    :av-input-format
85
    :av-output-format
86
    :avformat-find-stream-info
87
    :av-dict-iterate
88
    :av-dict-get
89
    :av-dict-set-int
90
    :av-dict-set
91
    :av-dict-count
92
    :avformat-close-input
93
    :avformat-flush
94
    :av-read-play
95
    :av-read-pause
96
    :av-packet-alloc
97
    :av-packet
98
    :av-parser-init
99
    :av-codec-parser-context
100
    :av-codec-parser
101
    :av-packet-free
102
    :av-parser-close
103
    :av-parser-iterate
104
    :av-frame-free
105
    :av-log-set-level
106
    :av-log-get-level
107
    :+av-input-buffer-padding-size+
108
    :+av-nopts-value+
109
    :+av-time-base+
110
    :av-frame-alloc
111
    :av-parser-parse2
112
    :avcodec-send-packet
113
    :avcodec-send-frame
114
    :avcodec-receive-frame
115
    :avcodec-receive-packet
116
    :av-get-bytes-per-sample
117
    :averror
118
    :averror*
119
    :+av-error-max-string-size+
120
    :av-strerror
121
    :av-make-error-string
122
    :av-channel-layout-default
123
    :av-channel-layout))
124
            
125
 (in-package :ffmpeg)
126
 
127
 (define-alien-loader :avcodec "/usr/lib/")
128
 (define-alien-loader :avutil "/usr/lib/")
129
 (define-alien-loader :avformat "/usr/lib/")
130
 (define-alien-loader :avfilter "/usr/lib/")
131
 (define-alien-loader :swresample "/usr/lib/")
132
 (define-alien-loader :swscale "/usr/lib/")
133
 
134
 ;;; version
135
 (defar avcodec-version unsigned)
136
 (defar avformat-version unsigned)
137
 (defar avutil-version unsigned)
138
 (defar avfilter-version unsigned)
139
 
140
 ;;; avutil
141
 (defconstant +av-nopts-value+ #x8000000000000000)
142
 (defconstant +av-time-base+ 1000000)
143
 (eval-when (:compile-toplevel)
144
   (defun mktag (a b c d)
145
     (logior a (ash b 8) (ash c 16) (ash d 24)))
146
   (defun fferrtag (a b c d)
147
     (- (mktag a b c d)))
148
   (defun fferrtag* (str)
149
     (- (mktag 
150
         (char-code (schar str 0)) 
151
         (char-code (schar str 1)) 
152
         (char-code (schar str 2)) 
153
         (char-code (schar str 3))))))
154
 
155
 (defconstant +av-error-max-string-size+ 64)
156
 
157
 (define-alien-enum (averror int)
158
   :bsf-not-found (fferrtag #xf8 (char-code #\B) (char-code #\S) (char-code #\F))
159
   :bug (fferrtag* "BUG!")
160
   :buffer-too-small (fferrtag* "BUFS")
161
   :decoder-not-found (fferrtag #xf8 (char-code #\D) (char-code #\E) (char-code #\C))
162
   :demuxer-not-found (fferrtag #xf8 (char-code #\D) (char-code #\E) (char-code #\M))
163
   :encoder-not-found (fferrtag #xf8 (char-code #\E) (char-code #\N) (char-code #\C))
164
   :eof (fferrtag* "EOF ")
165
   :exit (fferrtag* "EXIT")
166
   :external (fferrtag* "EXT ")
167
   :filter-not-found (fferrtag #xf8 (char-code #\F) (char-code #\I) (char-code #\L))
168
   :invaliddata (fferrtag* "INDA")
169
   :muxer-not-found (fferrtag #xf8 (char-code #\M) (char-code #\U) (char-code #\X))
170
   :option-not-found (fferrtag #xf8 (char-code #\O) (char-code #\P) (char-code #\T))
171
   :patchwelcome (fferrtag* "PAWE")
172
   :protocol-not-found (fferrtag #xf8 (char-code #\P) (char-code #\R) (char-code #\O))
173
   :stream-not-found (fferrtag #xf8 (char-code #\S) (char-code #\T) (char-code #\R))
174
   :bug2 (fferrtag* "BUG ")
175
   :unknown (fferrtag* "UNKN")
176
   :experimental (- #x2bb2afa8)
177
   :input-changed (- #x636e6701)
178
   :output-changed (- #x636e6702)
179
   :http-bad-request (fferrtag #xf8 (char-code #\4) (char-code #\0) (char-code #\0))
180
   :http-unauthorized (fferrtag #xf8 (char-code #\4) (char-code #\0) (char-code #\1))
181
   :http-forbidden (fferrtag #xf8 (char-code #\4) (char-code #\0) (char-code #\3))
182
   :http-not-found (fferrtag #xf8 (char-code #\4) (char-code #\0) (char-code #\4))
183
   :http-too-many-requests (fferrtag #xf8 (char-code #\4) (char-code #\2) (char-code #\9))
184
   :http-other-4xx (fferrtag #xf8 (char-code #\4) (char-code #\X) (char-code #\X))
185
   :http-server-error (fferrtag #xf8 (char-code #\5) (char-code #\X) (char-code #\X)))
186
 
187
 (defar av-strerror int (errnum int) (errbuf c-string) (errbuf-size size-t))
188
 ;; (defar av-make-error-string c-string (errbuf c-string) (errbuf-size size-t) (errnum int))
189
 
190
 (define-alien-enum (av-media-type int)
191
   :unknown -1
192
   :video 0
193
   :audio 1
194
   :data 2
195
   :subtitle 3
196
   :attachment 4)
197
 
198
 ;; dict.h
199
 (define-opaque av-dictionary)
200
 
201
 (define-alien-type av-dictionary-entry
202
     (struct av-dictionary-entry
203
       (key c-string)
204
       (val c-string)))
205
 
206
 ;; rational.h
207
 (define-alien-type av-rational
208
     (struct av-rational
209
       (num int)
210
       (den int)))
211
 
212
 ;; samplefmt.h
213
 (define-alien-enum (av-sample-format int)
214
   :none -1
215
   :u8 0
216
   :s16 1
217
   :s32 2
218
   :flt 3
219
   :dbl 4
220
   :u8p 5
221
   :s16p 6
222
   :s32p 7
223
   :fltp 8
224
   :dblp 9
225
   :s64 10
226
   :s64p 11)
227
 
228
 ;; pixfmt.h
229
 ;; TODO 2025-04-07: 
230
 (define-alien-enum (av-pixel-format int)
231
   :none -1
232
   :yuv420p 0
233
   :yuv422 1)
234
 
235
 (define-alien-enum (av-color-primaries int)
236
   :reserved0 0
237
   :bt709 1
238
   :unspecified 2
239
   :reserved 3
240
   :bt470m 4
241
   :bt470bg 5
242
   :smpte170m 6
243
   :smpte240m 7
244
   :film 8
245
   :bt2020 9
246
   :smpte428 10
247
    :smpte428-1 10
248
   :smpte431 11
249
   :smpte432 12
250
   :ebu3213 22
251
   :jedec-p22 22)
252
 
253
 (define-alien-enum (av-color-transfer-characteristic int)
254
   :reserved0 0
255
   :bt709 1
256
   :unspecified 2
257
   :reserved 3
258
   :gamma22 4
259
   :gamma28 5
260
   :smpte170m 6
261
   :smpte240m 7
262
   :linear 8
263
   :log 9
264
   :log-sort 10
265
   :iec61966-2-4 11
266
   :bt1361-ecg 12
267
   :iec61966-2-1 13
268
   :bt2020-10 14
269
   :bt2020-12 15
270
   :smpte2084 16
271
   :smptest2084 16
272
   :smpte428 17
273
   :smpte428-1 17
274
   :arib-std-b67 18)
275
 
276
 (define-alien-enum (av-color-space int)
277
   :rgb 0
278
   :bt709 1
279
   :unspecified 2
280
   :reserved 3
281
   :fcc 4
282
   :bt470bg 5
283
   :smpte170m 6
284
   :smpte240m 7
285
   :ycgco 8
286
   :ycocg 8
287
   :bt2020-ncl 9
288
   :bt2020-cl 10
289
   :smpte2085 11
290
   :chroma-derived-ncl 12
291
   :chroma-derived-cl 13
292
   :ictcp 14
293
   :ipt-c2 15
294
   :ycgco-re 16
295
   :ycgco-ro 17)
296
 
297
 (define-alien-enum (av-color-range int)
298
   :unspecified 0
299
   :mpeg 1
300
   :jpeg 2)
301
 
302
 (define-alien-enum (av-chroma-location int)
303
   :unspecified 0
304
   :left 1
305
   :center 2
306
   :topleft 3
307
   :top 4
308
   :bottomleft 5
309
   :bottom 6)
310
 
311
 ;; opt.h
312
 (define-opaque av-option-ranges)
313
 
314
 (define-alien-enum (av-option-type int)
315
   :flags 1
316
   :int 2
317
   :int64 3
318
   :double 4
319
   :float 5
320
   :string 6
321
   :rational 7
322
   :binary 8
323
   :dict 9
324
   :uint64 10
325
   :const 11
326
   :image-size 12
327
   :pixel-fmt 13
328
   :sample-fmt 14
329
   :video-rate 15
330
   :duration 16
331
   :color 17
332
   :bool 18
333
   :chlayout 19
334
   :uint 20
335
   :flag-array (ash 1 16))
336
 
337
 (define-alien-enum (av-opt-flag int)
338
   :encoding-param (ash 1 0)
339
   :decoding-param (ash 1 1)
340
   :audio-param (ash 1 3)
341
   :video-param (ash 1 4)
342
   :subtitle-param (ash 1 5)
343
   :export (ash 1 6)
344
   :readonly (ash 1 7)
345
   :bsf-param (ash 1 8)
346
   :runtime-param (ash 1 15)
347
   :filtering-param (ash 1 16)
348
   :deprecated (ash 1 17)
349
   :child-consts (ash 1 18))
350
 
351
 (define-alien-type av-option-array-def
352
     (struct av-option-array-def
353
       (def c-string)
354
       (size-min unsigned)
355
       (size-max unsigned)
356
       (sep char)))
357
 
358
 (define-alien-type av-option
359
     (struct av-option
360
       (name c-string)
361
       (help c-string)
362
       (offset int)
363
       (type av-option-type)
364
       (default-val (union nil 
365
                      (i64 (signed 64))
366
                      (dbl double)
367
                      (str c-string)
368
                      (q av-rational)
369
                      (arr (* av-option-array-def))))
370
       (min double)
371
       (max double)
372
       (flags int)
373
       (unit (* char))))
374
 
375
 ;; buffer.h
376
 (define-opaque av-buffer)
377
 
378
 (define-alien-type av-buffer-ref
379
     (struct av-buffer-ref
380
       (buffer (* av-buffer))
381
       (data (* (unsigned 8)))
382
       (size size-t)))
383
 
384
 ;; log.h
385
 (define-alien-enum (av-class-category int)
386
   :na 0
387
   :input 1
388
   :output 2
389
   :muxer 3
390
   :demuxer 4
391
   :encoder 5
392
   :decoder 6
393
   :filter 7
394
   :bitstream-filter 8
395
   :swscaler 9
396
   :swresampler 10
397
   :device-video-output 40
398
   :device-video-input 41
399
   :device-audio-output 42
400
   :device-audio-input 43
401
   :device-output 44
402
   :device-input 45
403
   ;; :nb 46 ;; not part of ABI/API
404
 )
405
 
406
 (define-alien-type av-class
407
     (struct av-class
408
       (class-name c-string)
409
       (item-name (* (function c-string (* t))))
410
       (option (* av-option))
411
       (version int)
412
       (log-level-offset-offset int)
413
       (parent-log-context-offset int)
414
       (category av-class-category)
415
       (get-category (* (function av-class-category (* t))))
416
       (query-ranges (* (function int (* (* av-option-ranges)) (* t) c-string int)))
417
       (child-next (* (function void (* t) (* t))))
418
                                         ; (* av-class)
419
       (child-class-iterate (* (function (* t) (* (* t)))))))
420
 
421
 (defar av-dict-iterate (* av-dictionary-entry) (m (* av-dictionary)) (prev (* av-dictionary-entry)))
422
 (defar av-dict-get (* av-dictionary-entry) 
423
   (m (* av-dictionary))  
424
   (key c-string)
425
   (prev (* av-dictionary-entry))
426
   (flags int))
427
 (defar av-dict-count int (m (* av-dictionary)))
428
 (defar av-dict-set int (pm (* (* av-dictionary))) (key c-string) (value c-string) (flags int))
429
 (defar av-dict-set-int int (pm (* (* av-dictionary))) (key c-string) (value long) (flags int))
430
 ;;; avformat
431
 (define-opaque av-codec-tag)
432
 
433
 (defconstant +av-num-data-pointers+ 8)
434
 
435
 (define-alien-enum (av-io-data-marker-type int)
436
   :header 0
437
   :sync-point 1
438
   :boundary-point 2
439
   :unknown 3
440
   :trailer 4
441
   :flush-point 5)
442
 
443
 (define-alien-type av-io-interrupt-cb
444
   (struct av-io-interrupt-cb
445
     (callback (* (function int (* t))))
446
     (opaque (* t))))
447
 
448
 (define-alien-type av-io-context
449
     (struct av-io-context
450
       (av-class (* av-class))
451
       (buffer (* unsigned-char))
452
       (buffer-size int)
453
       (buf-ptr (* unsigned-char))
454
       (buf-end (* unsigned-char))
455
       (opaque (* t))
456
       (read-packet (* (function int (* t) (* (unsigned 8)) int)))
457
       (write-packet (* (function int (* t) (* (unsigned 8)) int)))
458
       (seek (* (function (signed 64) (* t) (signed 64) int)))
459
       (pos (signed 64))
460
       (eof-reached int)
461
       (error int)
462
       (write-flag int)
463
       (max-packet-size int)
464
       (min-packet-size int)
465
       (checksum unsigned-long)
466
       (checksum-ptr (* unsigned-char))
467
       (update-checksum (* (function unsigned-long unsigned-long (* (unsigned 8)) unsigned-int)))
468
       (read-pause (* (function int (* t) int)))
469
       (read-seek (* (function (signed 64) (* t) int (signed 64) int)))
470
       (seekable int)
471
       (direct int)
472
       (protocol-whitelist c-string)
473
       (protocol-blacklist c-string)
474
       (write-data-type (* (function int (* t) (* (unsigned 8)) int av-io-data-marker-type (signed 64))))
475
       (ignore-boundary-point int)
476
       (buf-ptr-max (* unsigned-char))
477
       (bytes-read (signed 64))
478
       (bytes-written (signed 64))))
479
 
480
 (define-alien-type av-probe-data
481
     (struct av-probe-data
482
       (filename c-string)
483
       (buf (* unsigned-char))
484
       (buf-size int)
485
       (mime-type c-string)))
486
 
487
 (define-alien-enum (av-duration-estimation-method int)
488
   :pts 0
489
   :stream 1
490
   :bitrate 2)
491
 
492
 (define-alien-enum (av-codec-id int)
493
   :none 0
494
   :mpeg1video 1
495
   :mpeg2video 2
496
   :h261 3
497
   :h263 4
498
   :rv10 5
499
   :rv20 6
500
   :mjpeg 7
501
   :mjpegb 8
502
   :ljpeg 9
503
   :sp5x 10
504
   :jpegls 11
505
   :mpeg4 12
506
   :rawvideo 13
507
   :msmpeg4v1 14
508
   :msmpeg4v2 15
509
   :msmpeg4v3 16
510
   :wmv1 17
511
   :wmv2 18
512
   :h263p 19
513
   :h263i 20
514
   :flv1 21
515
   :svq1 22
516
   :svq3 23
517
   :dvvideo 24
518
   :huffyuv 25
519
   :cyuv 26
520
   :h264 27
521
   :indeo3 28
522
   :vp3 29
523
   :theora 30
524
   :asv1 31
525
   :asv2 32
526
   :ffv1 33
527
   :4xm 34
528
   :vcr1 35
529
   :cljr 36
530
   :mdec 37
531
   :roq 38
532
   :interplay-video 39
533
   :xan-wc3 40
534
   :xan-wc4 41
535
   :rpza 42
536
   :cinepak 43
537
   :ws-vqa 44
538
   :msrle 45
539
   :msvideo1 46
540
   :idcin 47
541
   :8bps 48
542
   :smc 49
543
   :flic 50
544
   :truemotion1 51
545
   :vmdvideo 52
546
   :mszh 53
547
   :zlib 54
548
   :qtrle 55
549
   :tscc 56
550
   :ulti 57
551
   :qdraw 58
552
   :vixl 59
553
   :qpeg 60
554
   :png 61
555
   :ppm 62
556
   :pbm 63
557
   :pgm 64
558
   :pgmyuv 65
559
   :pam 66
560
   :ffvhuff 67
561
   :rv30 68
562
   :rv40 69
563
   :vc1 70
564
   :wmv3 71
565
   :loco 72
566
   :wnv1 73
567
   :aasc 74
568
   :indeo2 75
569
   :fraps 76
570
   :truemotion2 77
571
   :bmp 78
572
   :cscd 79
573
   :mmvideo 80
574
   :zmbv 81
575
   :avs 82
576
   :smackvideo 83
577
   :nuv 84
578
   :kmvc 85
579
   :flashsv 86
580
   :cavs 87
581
   :jpeg2000 88
582
   :vmnc 89
583
   :vp5 90
584
   :vp6 91
585
   :vp6f 92
586
   :targa 93
587
   :dsicinvideo 94
588
   :tiertexseqvideo 95
589
   :tiff 96
590
   :gif 97
591
   :dxa 98
592
   :dnxhd 99
593
   :thp 100
594
   :sgi 101
595
   :c93 102
596
   :bethsoftvid 103
597
   :ptx 104
598
   :txd 105
599
   :vp6a 106
600
   :amv 107
601
   :vb 108
602
   :pcx 109
603
   :sunrast 110
604
   :indeo4 111
605
   :indeo5 112
606
   :mimic 113
607
   :rl2 114
608
   :escape124 115
609
   :dirac 116
610
   :bfi 117
611
   :cmv 118
612
   :motionpixels 119
613
   :tgv 120
614
   :tgq 121
615
   :tqi 122
616
   :aura 123
617
   :aura2 124
618
   :v210x 125
619
   :tmv 126
620
   :v210 127
621
   :dpx 128
622
   :mad 129
623
   :frwu 130
624
   :flashsv2 131
625
   :cdgraphics 132
626
   :r210 133
627
   :anm 134
628
   :binkvideo 135
629
   :iff-ilbm 136
630
   ;; #define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
631
   :iff-byterun1 136
632
   :kgv1 137
633
   :yop 138
634
   :vp8 139
635
   :pictor 140
636
   :ansi 141
637
   :a64-multi 142
638
   :a64-multi5 143
639
   :r10k 144
640
   :mxpeg 145
641
   :lagarith 146
642
   :prores 147
643
   :jv 148
644
   :dfa 149
645
   :wmv3image 150
646
   :vc1image 151
647
   :utvideo 152
648
   :bmv-video 153
649
   :vble 154
650
   :dxtory 155
651
   :v410 156
652
   :xwd 157
653
   :cdxl 158
654
   :xbm 159
655
   :zerocodec 160
656
   :mss1 161
657
   :msa1 162
658
   :tscc2 163
659
   :mts2 164
660
   :cllc 165
661
   :mss2 166
662
   :vp9 167
663
   :aic 168
664
   :escape130 169
665
   :g2m 170
666
   :webp 171
667
   :hnm4-video 172
668
   :hevc 173
669
   ;; #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
670
   :h265 173
671
   :fic 174
672
   :alias-pix 175
673
   :brender-pix 176
674
   :paf-video 177
675
   :exr 178
676
   :vp7 179
677
   :sanm 180
678
   :sgirle 181
679
   :mvc1 182
680
   :mvc2 183
681
   :hqx 184
682
   :tdsc 185
683
   :hq-hqa 186
684
   :hap 187
685
   :dds 188
686
   :dxv 189
687
   :screenpresso 190
688
   :rscc 191
689
   :avs2 192
690
   :pgx 193
691
   :avs3 194
692
   :msp2 195
693
   :vvc 196
694
   ;; #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC
695
   :h266 196
696
   :y41p 197
697
   :avrp 198
698
   :012v 199
699
   :avui 200
700
   :targa-y216 201
701
   :v308 202
702
   :v408 203
703
   :yuv4 204
704
   :avrn 205
705
   :cpia 206
706
   :xface 207
707
   :snow 208
708
   :smvjpeg 209
709
   :apng 210
710
   :daala 211
711
   :cfhd 212
712
   :truemotion2rt 213
713
   :m101 214
714
   :magicyuv 215
715
   :sheervideo 216
716
   :ylc 217
717
   :psd 218
718
   :pixlet 219
719
   :speedhq 220
720
   :fmvc 221
721
   :scpr 222
722
   :clearvideo 223
723
   :xpm 224
724
   :av1 225
725
   :bitpacked 226
726
   :mscc 227
727
   :srgc 228
728
   :svg 229
729
   :gdv 230
730
   :fits 231
731
   :imm4 232
732
   :prosumer 233
733
   :mwsc 234
734
   :wcmv 235
735
   :rasc 236
736
   :hymt 237
737
   :arbc 238
738
   :agm 239
739
   :lscr 240
740
   :vp4 241
741
   :imm5 242
742
   :mvdv 243
743
   :mvha 244
744
   :cdtoons 245
745
   :mv30 246
746
   :notchlc 247
747
   :pfm 248
748
   :mobiclip 249
749
   :photocd 250
750
   :ipu 251
751
   :argo 252
752
   :cri 253
753
   :simbiosis-imx 254
754
   :sga-video 255
755
   :gem 256
756
   :vbn 257
757
   :jpegxl 258
758
   :qoi 259
759
   :phm 260
760
   :radiance-hdr 261
761
   :wbmp 262
762
   :media100 263
763
   :vqc 264
764
   :pdv 265
765
   :evc 266
766
   :rtv1 267
767
   :vmix 268
768
   :lead 269
769
   ;; various PCM codecs
770
   :pcm-s16le 65536
771
   :pcm-s16be 65537
772
   :pcm-u16le 65538
773
   :pcm-u16be 65539
774
   :pcm-s8 65540
775
   :pcm-u8 65541
776
   :pcm-mulaw 65542
777
   :pcm-alaw 65543
778
   :pcm-s32le 65544
779
   :pcm-s32be 65545
780
   :pcm-u32le 65546
781
   :pcm-u32be 65547
782
   :pcm-s24le 65548
783
   :pcm-s24be 65549
784
   :pcm-u24le 65550
785
   :pcm-u24be 65551
786
   :pcm-s24daud 65552
787
   :pcm-zork 65553
788
   :pcm-s16le-planar 65554
789
   :pcm-dvd 65555
790
   :pcm-f32be 65556
791
   :pcm-f32le 65557
792
   :pcm-f64be 65558
793
   :pcm-f64le 65559
794
   :pcm-bluray 65560
795
   :pcm-lxf 65561
796
   :s302m 65562
797
   :pcm-s8-planar 65563
798
   :pcm-s24le-planar 65564
799
   :pcm-s32le-planar 65565
800
   :pcm-s16be-planar 65566
801
   :pcm-s64le 65567
802
   :pcm-s64be 65568
803
   :pcm-f16le 65569
804
   :pcm-f24le 65570
805
   :pcm-vidc 65571
806
   :pcm-sga 65572
807
   ;; various ADPCM codecs
808
   :adpcm-ima-qt #x11000
809
   :adpcm-ima-wav 69633
810
   :adpcm-ima-dk3 69634
811
   :adpcm-ima-dk4 69635
812
   :adpcm-ima-ws 69636
813
   :adpcm-ima-smjpeg 69637
814
   :adpcm-ms 69638
815
   :adpcm-4xm 69639
816
   :adpcm-xa 69640
817
   :adpcm-adx 69641
818
   :adpcm-ea 69642
819
   :adpcm-g726 69643
820
   :adpcm-ct 69644
821
   :adpcm-swf 69645
822
   :adpcm-yamaha 69646
823
   :adpcm-sbpro-4 69647
824
   :adpcm-sbpro-3 69648
825
   :adpcm-sbpro-2 69649
826
   :adpcm-thp 69650
827
   :adpcm-ima-amv 69651
828
   :adpcm-ea-r1 69652
829
   :adpcm-ea-r3 69653
830
   :adpcm-ea-r2 69654
831
   :adpcm-ima-ea-sead 69655
832
   :adpcm-ima-ea-eacs 69656
833
   :adpcm-ea-xas 69657
834
   :adpcm-ea-maxis-xa 69658
835
   :adpcm-ima-iss 69659
836
   :adpcm-g722 69660
837
   :adpcm-ima-apc 69661
838
   :adpcm-vima 69662
839
   :adpcm-afc 69663
840
   :adpcm-ima-oki 69664
841
   :adpcm-dtk 69665
842
   :adpcm-ima-rad 69666
843
   :adpcm-g726le 69667
844
   :adpcm-thp-le 69668
845
   :adpcm-psx 69669
846
   :adpcm-aica 69670
847
   :adpcm-ima-dat4 69671
848
   :adpcm-mtaf 69672
849
   :adpcm-agm 69673
850
   :adpcm-argo 69674
851
   :adpcm-ima-ssi 69675
852
   :adpcm-zork 69676
853
   :adpcm-ima-apm 69677
854
   :adpcm-ima-alp 69678
855
   :adpcm-ima-mtf 69679
856
   :adpcm-ima-cunning 69680
857
   :adpcm-ima-moflex 69681
858
   :adpcm-ima-acorn 69682
859
   :adpcm-xmd 69683
860
   ;; AMR
861
   :amr-nb #x12000
862
   :amr-wb 73729
863
   ;; RealAudio codecs
864
   :ra-144 #x13000
865
   :ra-288 77825
866
   ;; various DPCM codecs
867
   :roq-dpcm #x14000
868
   :interplay-dpcm 81921
869
   :xan-dpcm 81922
870
   :sol-dpcm 81923
871
   :sdx2-dpcm 81924
872
   :gremlin-dpcm 81925
873
   :derf-dpcm 81926
874
   :wady-dpcm 81927
875
   :cbd2-dpcm 81928
876
   ;; audio codecs
877
   :mp2 #x15000
878
   :mp3 86017
879
   :aac 86018
880
   :ac3 86019
881
   :dts 86020
882
   :vorbis 86021
883
   :dvaudio 86022
884
   :wmav1 86023
885
   :wmav2 86024
886
   :mace3 86025
887
   :mace6 86026
888
   :vmdaudio 86027
889
   :flac 86028
890
   :mp3adu 86029
891
   :mp3on4 86030
892
   :shorten 86031
893
   :alac 86032
894
   :westwood-snd1 86033
895
   :gsm 86034
896
   :qdm2 86035
897
   :cook 86036
898
   :truespeech 86037
899
   :tta 86038
900
   :smackaudio 86039
901
   :qcelp 86040
902
   :wavpack 86041
903
   :dsicinaudio 86042
904
   :imc 86043
905
   :musepack7 86044
906
   :mlp 86045
907
   :gsm-ms 86046
908
   :atrac3 86047
909
   :ape 86048
910
   :nellymoser 86049
911
   :musepack8 86050
912
   :speex 86051
913
   :wmavoice 86052
914
   :wmapro 86053
915
   :wmalossless 86054
916
   :atrac3p 86055
917
   :eac3 86056
918
   :sipr 86057
919
   :mp1 86058
920
   :twinvq 86059
921
   :truehd 86060
922
   :mp4als 86061
923
   :atrac1 86062
924
   :binkaudio-rdft 86063
925
   :binkaudio-dct 86064
926
   :aac-latm 86065
927
   :qdmc 86066
928
   :celt 86067
929
   :g723-1 86068
930
   :g729 86069
931
   :8svx-exp 86070
932
   :8svx-fib 86071
933
   :bmv-audio 86072
934
   :ralf 86073
935
   :iac 86074
936
   :ilbc 86075
937
   :opus 86076
938
   :comfort-noise 86077
939
   :tak 86078
940
   :metasound 86079
941
   :paf-audio 86080
942
   :on2avc 86081
943
   :dss-sp 86082
944
   :codec2 86083
945
   :ffwavesynth 86084
946
   :sonic 86085
947
   :sonic-ls 86086
948
   :evrc 86087
949
   :smv 86088
950
   :dsd-lsbf 86089
951
   :dsd-msbf 86090
952
   :dsd-lsbf-planar 86091
953
   :dsd-msbf-planar 86092
954
   :4gv 86093
955
   :interplay-acm 86094
956
   :xma1 86095
957
   :xma2 86096
958
   :dst 86097
959
   :atrac3al 86098
960
   :atrac3pal 86099
961
   :dolby-e 86100
962
   :aptx 86101
963
   :aptx-hd 86102
964
   :sbc 86103
965
   :atrac9 86104
966
   :hcom 86105
967
   :acelp-kelvin 86106
968
   :mpegh-3d-audio 86107
969
   :siren 86108
970
   :hca 86109
971
   :fastaudio 86110
972
   :msnsiren 86111
973
   :dfpwm 86112
974
   :bonk 86113
975
   :misc4 86114
976
   :apac 86115
977
   :ftr 86116
978
   :wavarc 86117
979
   :rka 86118
980
   :ac4 86119
981
   :osq 86120
982
   :qoa 86121
983
   :lc3 86122
984
   ;; subtitle codecs
985
   :dvd-subtitle #x17000
986
   :dvb-subtitle 94209
987
   :text 94210
988
   :xsub 94211
989
   :ssa 94212
990
   :mov-text 94213
991
   :hdmv-pgs-subtitle 94214
992
   :dvb-teletext 94215
993
   :srt 94216
994
   :microdvd 94217
995
   :eia-608 94218
996
   :jacosub 94219
997
   :sami 94220
998
   :realtext 94221
999
   :stl 94222
1000
   :subviewer1 94223
1001
   :subviewer 94224
1002
   :subrip 94225
1003
   :webvtt 94226
1004
   :mpl2 94227
1005
   :vplayer 94228
1006
   :pjs 94229
1007
   :ass 94230
1008
   :hdmv-text-subtitle 94231
1009
   :ttml 94232
1010
   :arib-caption 94233
1011
   ;; other specific kind of codecs (generally used for attachments)
1012
   :ttf #x18000
1013
   :scte-35 98305
1014
   :epg 98306
1015
   :bintext 98307
1016
   :xbin 98308
1017
   :idf 98309
1018
   :otf 98310
1019
   :smpte-klv 98311
1020
   :dvd-nav 98312
1021
   :timed-id3 98313
1022
   :bin-data 98314
1023
   :smpte-2038 98315
1024
   :lcevc 98316
1025
   :probe #x19000
1026
   :mpeg2ts #x20000
1027
   :mpeg4systems #x20001
1028
   :ffmetadata #x21000
1029
   :wrapped-avframe #x21001
1030
   :vnull #x21002
1031
   :anull #x21003)
1032
 
1033
 (defconstant +avprobe-score-max+ 100)
1034
 (define-alien-enum (avprobe-score int)
1035
   :retry (/ +avprobe-score-max+ 4)
1036
   :stream-retry (- (/ +avprobe-score-max+ 4) 1)
1037
   :extension 50
1038
   :mime 75
1039
   :max +avprobe-score-max+)
1040
 
1041
 (defconstant +avprobe-padding-size+ 32)
1042
 
1043
 (define-alien-enum (avfmt int)
1044
   :nofile #x0001
1045
   :neednumber #x0002
1046
   :experimental #x0004
1047
   :show-ids #x0008
1048
   :globalheader #x0040
1049
   :notimestamps #x0080
1050
   :generic-index #x0100
1051
   :ts-discont #x0200
1052
   :variable-fps #x0400
1053
   :nodimensions #x0800
1054
   :nostreams #x1000
1055
   :nobinsearch #x2000
1056
   :nogensearch #x4000
1057
   :no-byte-seek #x8000
1058
   :ts-nonstrict #x20000
1059
   :ts-negative #x40000
1060
   :seek-to-pts #x4000000)
1061
 
1062
 (define-alien-type av-profile
1063
     (struct av-profile
1064
       (profile int)
1065
       (name c-string)))
1066
 
1067
 (define-alien-type av-codec
1068
     (struct av-codec
1069
       (name c-string)
1070
       (long-name c-string)
1071
       (type av-media-type)
1072
       (id av-codec-id)
1073
       (capabilities int)
1074
       (max-lowres unsigned-char)
1075
       ;; deprecated
1076
       (supported-framerates (* av-rational))
1077
       (pix-fmts (* av-pixel-format))
1078
       (supported-samplerates (* int))
1079
       (sample-fmts (* av-sample-format))
1080
       ;; end deprecated
1081
       (priv-class (* av-class))
1082
       (profiles (* av-profile))))
1083
 
1084
 (define-opaque av-codec-internal) ;; ?where's the def?
1085
 
1086
 (define-alien-type av-output-format
1087
     (struct av-output-format
1088
       (name c-string)
1089
       (long-name c-string)
1090
       (mime-type c-string)
1091
       (extensions c-string)
1092
       (audio-codec av-codec-id)
1093
       (video-codec av-codec-id)
1094
       (subtitle-codec av-codec-id)
1095
       (flags int)
1096
       (codec-tags (* (* av-codec-tag)))
1097
       (priv-class (* av-class))))
1098
 
1099
 (define-alien-type av-input-format
1100
     (struct av-input-format
1101
       (name c-string)
1102
       (long-name c-string)
1103
       (flags int)
1104
       (extensions c-string)
1105
       (codec-tag (* (* av-codec-tag)))
1106
       (priv-class (* av-class))
1107
       (mime-type c-string)))
1108
 
1109
 (define-alien-type av-stream
1110
     (struct av-stream))
1111
 
1112
 (define-alien-type av-stream-group (struct av-stream-group))
1113
 
1114
 (define-alien-type av-chapter
1115
   (struct av-chapter
1116
     (id long)
1117
     (time-base av-rational)
1118
     (start long)
1119
     (end long)
1120
     (metadata (* av-dictionary))))
1121
 
1122
 (define-alien-enum (av-discard int)
1123
   :none -16
1124
   :default 0
1125
   :nonref 8
1126
   :bidir 16
1127
   :nonintra 24
1128
   :nonkey 32
1129
   :all 48)
1130
 
1131
 (define-alien-type av-program 
1132
   (struct av-program
1133
     (id int)
1134
     (flags int)
1135
     (discard av-discard)
1136
     (stream-index (* unsigned-int))
1137
     (nb-stream-indexes unsigned-int)
1138
     (metadata (* av-dictionary))
1139
     (program-num int)
1140
     (pmt-pid int)
1141
     (pcr-pid int)
1142
     (pmt-version int)
1143
     (start-time long)
1144
     (end-time long)
1145
     (pts-wrap-reference long)
1146
     (pts-wrap-behavior int)))
1147
 
1148
 (define-alien-type av-format-control-message
1149
     ;; (* av-format-context)
1150
   (* (function int (* t) int (* t) size-t)))
1151
 
1152
 #|
1153
 sizeof(AVFormatContext) must not be used outside libav*, use
1154
 avformat_alloc_context() to create an AVFormatContext.
1155
 
1156
 Fields can be accessed through AVOptions (av_opt*), the name string used
1157
 matches the associated command line parameter name and can be found in
1158
 libavformat/options_table.h.  The AVOption/command line parameter names differ
1159
 in some cases from the C structure field names for historic reasons or
1160
 brevity.
1161
 |#
1162
 
1163
 (define-alien-type av-format-context 
1164
     (struct av-format-context
1165
       (av-class (* av-class))
1166
       (iformat (* av-input-format))
1167
       (oformat (* av-output-format))
1168
       (priv-data (* t))
1169
       (pb (* av-io-context))
1170
       (ctx-flags int)
1171
       (nb-streams unsigned-int)
1172
       (streams (* (* av-stream)))
1173
       (nb-stream-groups unsigned-int)
1174
       (stream-groups (* (* av-stream-group)))
1175
       (nb-chapters unsigned-int)
1176
       (chapters (* (* av-chapter)))
1177
       (url c-string)
1178
       (start-time long)
1179
       (duration long)
1180
       (bit-rate long)
1181
       (packet-size unsigned-int)
1182
       (max-delay int)
1183
       (flags int)
1184
       (probesize long)
1185
       (max-analyze-duration long)
1186
       (key (* unsigned-char))
1187
       (keylen int)
1188
       (nb-programs unsigned-int)
1189
       (programs (* (* av-program)))
1190
       (video-codec-id av-codec-id)
1191
       (audio-codec-id av-codec-id)
1192
       (subtitle-codec-id av-codec-id)
1193
       (data-codec-id av-codec-id)
1194
       (metadata (* av-dictionary))
1195
       (start-time-realtime long)
1196
       (fps-probe-size int)
1197
       (error-recognition int)
1198
       (interrupt-callback av-io-interrupt-cb)
1199
       (debug int)
1200
       (max-streams int)
1201
       (max-index-size unsigned-int)
1202
       (max-picture-buffer unsigned-int)
1203
       (max-interleave-delta long)
1204
       (max-ts-probe int)
1205
       (max-chunk-duration int)
1206
       (max-chunk-size int)
1207
       (max-probe-packets int)
1208
       (strict-std-compliance int)
1209
       (event-flags int)
1210
       (avoid-negative-ts int)
1211
       (audio-preload int)
1212
       (use-wallclock-as-timestamps int)
1213
       (skip-estimate-duration-from-pts int)
1214
       (avio-flags int)
1215
       (duration-estimation-method av-duration-estimation-method)
1216
       (skip-initial-bytes long)
1217
       (correct-ts-overflow unsigned-int)
1218
       (seek2any int)
1219
       (flush-packets int)
1220
       (probe-score int)
1221
       (format-probesize int)
1222
       (codec-whitelist c-string)
1223
       (format-whitelist c-string)
1224
       (protocol-whitelist c-string)
1225
       (protocol-blacklist c-string)
1226
       (io-repositioned int)
1227
       (video-codec (* av-codec))
1228
       (audio-codec (* av-codec))
1229
       (subtitle-codec (* av-codec))
1230
       (data-codec (* av-codec))
1231
       (metadata-header-padding int)
1232
       (opaque (* t))
1233
       (control-message-cb av-format-control-message)
1234
       (output-ts-offset long)
1235
       (dump-separator (* unsigned-char))
1236
       ;; (* av-format-context)
1237
       (io-open (* (function int (* t) (* (* av-io-context)) c-string int (* (* av-dictionary)))))
1238
       ;; (* av-format-context)
1239
       (io-close2 (* (function int (* t) (* av-io-context))))))
1240
 
1241
 (define-alien-type av-open-callback
1242
   (* (function int 
1243
          (* av-format-context) (* (* av-io-context)) c-string int (* av-io-interrupt-cb) (* (* av-dictionary)))))
1244
 
1245
 ;;; avcodec
1246
 (defconstant +av-input-buffer-padding-size+ 64)
1247
 (define-alien-enum (av-codec-flag int)
1248
   :unaligned (ash 1 0)
1249
   :qscale (ash 1 1)
1250
   :4mv (ash 1 2)
1251
   :output-corrupt (ash 1 3)
1252
   :qpel (ash 1 4)
1253
   ;; :dropchanged (ash 1 5)
1254
   :recon-frame (ash 1 6)
1255
   :copy-opaque (ash 1 7)
1256
   :frame-duration (ash 1 8)
1257
   :pass1 (ash 1 9)
1258
   :pass2 (ash 1 10)
1259
   :loop-filter (ash 1 11)
1260
   :gray (ash 1 13)
1261
   :psnr (ash 1 15)
1262
   :interlaced-dct (ash 1 18)
1263
   :low-delay (ash 1 19)
1264
   :global-header (ash 1 22)
1265
   :bitexact (ash 1 23)
1266
   :ac-pred (ash 1 24)
1267
   :interlaced-me (ash 1 29)
1268
   :closer-gop (ash 1 31))
1269
 
1270
 (define-alien-enum (av-codec-flag2 int)
1271
   :fast (ash 1 0)
1272
   :no-output (ash 1 2)
1273
   :local-header (ash 1 3)
1274
   :chunks (ash 1 15)
1275
   :ignore-crop (ash 1 16)
1276
   :show-all (ash 1 22)
1277
   :export-mvs (ash 1 28)
1278
   :skip-manual (ash 1 29)
1279
   :ro-flush-noop (ash 1 30)
1280
   :icc-profiles (ash 1 31))
1281
 
1282
 (define-alien-enum (av-codec-export-data int)
1283
   :mvs (ash 1 0)
1284
   :prft (ash 1 1)
1285
   :video-enc-params (ash 1 2)
1286
   :film-grain (ash 1 3)
1287
   :enhancements (ash 1 4))
1288
 
1289
 (defconstant +av-get-buffer-flag-ref+ (ash 1 0))
1290
 (defconstant +av-get-encode-buffer-flag-ref+ (ash 1 0))
1291
 
1292
 (define-alien-enum (ff-cmp int)
1293
   :sad 0
1294
   :sse 1
1295
   :satd 2
1296
   :dct 3
1297
   :psnr 4
1298
   :bit 5
1299
   :rd 6
1300
   :zero 7
1301
   :vsad 8
1302
   :vsse 9
1303
   :nsse 10
1304
   :w53 11
1305
   :w97 12
1306
   :dctmax 13
1307
   :dct264 14
1308
   :media-sad 15
1309
   :chroma 256)
1310
 
1311
 (define-alien-enum (ff-mb-decision int)
1312
   :simple 0
1313
   :bits 1
1314
   :rd 2)
1315
 
1316
 (defconstant +ff-compression-default+ -1)
1317
 
1318
 (define-alien-enum (ff-bug int)
1319
   :autodetect 1
1320
   :xvid-ilace 4
1321
   :ump4 8
1322
   :no-padding 16
1323
   :amv 32
1324
   :qpel-chroma 64
1325
   :std-qpel 128
1326
   :qpel-chroma2 256
1327
   :direct-blocksize 512
1328
   :edge 1024
1329
   :hpel-chroma 2048
1330
   :dc-clip 4096
1331
   :ms 8192
1332
   :truncated 16384
1333
   :iedge 32768)
1334
 
1335
 (define-alien-enum (ff-ec int)
1336
   :guess-mvs 1
1337
   :deblock 2
1338
   :favor-inter 256)
1339
 
1340
 (define-alien-enum (ff-debug int)
1341
   :pict-info 1
1342
   :rc 2
1343
   :bitstream 4
1344
   :mb-type 8
1345
   :qp 16
1346
   :dct-coeff #x00000040
1347
   :skip #x00000080
1348
   :startcode #x00000100
1349
   :er #x00000400
1350
   :mmco #x00000800
1351
   :bugs #x00001000
1352
   :buffers #x00008000
1353
   :threads #x00010000
1354
   :green-md #x00800000
1355
   :nomc #x01000000)
1356
 
1357
 (define-alien-enum (ff-dct int)
1358
   :auto 0
1359
   :fastint 1
1360
   :int 2
1361
   :mmx 3
1362
   :altivec 5
1363
   :faan 6
1364
   :neon 7)
1365
 
1366
 (define-alien-enum (ff-idct int)
1367
   :auto 0
1368
   :int 1
1369
   :simple 2
1370
   :simplemmx 3
1371
   :arm 7
1372
   :altivec 8
1373
   :simplearm 10
1374
   :xvid 14
1375
   :simplearmv5te 16
1376
   :simplearmv6 17
1377
   :faan 20
1378
   :simpleneon 22
1379
   :simpleauto 128)
1380
 
1381
 (define-alien-enum (ff-thread int)
1382
   :frame 1
1383
   :slice)
1384
 
1385
 ;; (define-alien-enum (ff-profile int) ;; see defs.h
1386
 
1387
 (define-alien-enum (ff-codec-property int)
1388
   :lossless #x00000001
1389
   :closed-captions #x00000002
1390
   :film-grain #x00000004)
1391
 
1392
 
1393
 (define-alien-enum (ff-sub-charenc-mode int)
1394
   :do-nothing -1
1395
   :automatic 0
1396
   :pre-decoder 1
1397
   :ignore 2)
1398
 
1399
 ;; AVHWAccel..
1400
 (define-alien-enum (av-subtitle-type int)
1401
   :none 0
1402
   :bitmap 1
1403
   :text 2
1404
   :ass 3)
1405
 
1406
 (defconstant +av-subtitle-flag-forced+ #x00000001)
1407
 
1408
 (define-alien-enum (av-codec-config int)
1409
   :pix-format 0
1410
   :frame-rate 1
1411
   :sample-rate 2
1412
   :sample-format 3
1413
   :channel-layout 4
1414
   :color-range 5
1415
   :color-space 6)
1416
 
1417
 (define-alien-enum (av-picture-structure int)
1418
   :unknown 0
1419
   :top-field 1
1420
   :bottom-field 2
1421
   :frame 3)
1422
 
1423
 (define-alien-enum (parser-flag int)
1424
   :complete-frames #x0001
1425
   :once #x0002
1426
   :fetched-offset #x0004
1427
   :codec-ts #x1000)
1428
 
1429
 (define-opaque av-codec-parameters)
1430
 
1431
 (define-alien-type av-subtitle-rect
1432
   (struct av-subtitle-rect
1433
     (x int)
1434
     (y int)
1435
     (w int)
1436
     (h int)
1437
     (nb-colors int)))
1438
 
1439
 (define-alien-type av-subtitle
1440
     (struct av-subtitle
1441
       (format (unsigned 16))
1442
       (start-display-time (unsigned 32))
1443
       (end-display-time (unsigned 32))
1444
       (num-rects unsigned)
1445
       (rects (* (* av-subtitle-rect)))
1446
       (pts (signed 64))))
1447
 
1448
 (define-alien-enum (av-field-order int)
1449
   :unknown 0
1450
   :progressive 1
1451
   :tt 2
1452
   :bb 3
1453
   :tb 4
1454
   :bt 5)
1455
 
1456
 (define-alien-enum (av-packet-side-data-type int)
1457
   :palette 0
1458
   :new-extradata 1
1459
   :param-change 2
1460
   :h263-mb-info 3
1461
   :replaygain 4
1462
   :displaymatrix 5
1463
   :stereo3d 6
1464
   :audio-service-type 7
1465
   :quality-stats 8
1466
   :fallback-track 9
1467
   :cpb-properties 10
1468
   :skip-samples 11
1469
   :jp-dualmono 12
1470
   :strings-metadata 13
1471
   :subtitle-position 14
1472
   :matroska-blockadditional 15
1473
   :webvtt-identifier 16
1474
   :webvtt-settings 17
1475
   :metadata-update 18
1476
   :mpegts-stream-id 19
1477
   :mastering-display-metadata 20
1478
   :spherical 21
1479
   :content-light-level 22
1480
   :data-a53-cc 23
1481
   :encryption-init-info 24
1482
   :encryption-info 25
1483
   :afd 26
1484
   :prft 27
1485
   :icc-profile 28
1486
   :dovi-conf 29
1487
   :s12m-timecode 30
1488
   :dynamic-hdr10-plus 31
1489
   :iamf-mix-gain-param 32
1490
   :iamf-demixing-info-param 33
1491
   :iamf-recon-gain-info-param 34
1492
   :ambient-viewing-environment 35
1493
   :frame-cropping 36
1494
   :lcevc 37
1495
   :nb 38)
1496
 
1497
 (define-alien-enum (av-channel-order int)
1498
   :unspec 0
1499
   :native 1
1500
   :custom 2
1501
   :ambisonic 3)
1502
 
1503
 (define-alien-enum (av-channel int)
1504
   :none -1
1505
   :front-left 0
1506
   :front-right 1
1507
   :front-center 2
1508
   :low-frequency 3
1509
   :back-left 4
1510
   :back-right 5
1511
   :front-left-of-center 6
1512
   :front-right-of-center 7
1513
   :back-center 8
1514
   :side-left 9
1515
   :side-right 10
1516
   :top-center 11
1517
   :top-front-left 12
1518
   :top-front-right 13
1519
   :top-front-center 14
1520
   :top-back-left 15
1521
   :top-back-center 16
1522
   :top-back-right 17
1523
   :stereo-left 29
1524
   :stereo-right 30
1525
   :wide-left 31
1526
   :wide-right 32
1527
   :surround-direct-left 33
1528
   :surround-direct-right 34
1529
   :low-frequency-2 35
1530
   :top-side-left 36
1531
   :top-side-right 37
1532
   :bottom-front-center 38
1533
   :bottom-front-left 39
1534
   :bottom-front-right 40
1535
   :side-surround-left 41
1536
   :side-surround-right 42
1537
   :top-surround-left 43
1538
   :top-surround-right 44
1539
   :unused #x200
1540
   :unknown #x300
1541
   :ambisonic-base #x400
1542
   :ambisonic-end #x7ff)
1543
 
1544
 (define-alien-type av-channel-custom
1545
     (struct av-channel-custom
1546
       (id av-channel)
1547
       (name (array char 16))
1548
       (opaque (* t))))
1549
 
1550
 (define-alien-type av-channel-layout
1551
     (struct av-channel-layout
1552
       (order av-channel-order)
1553
       (nb-channels int)
1554
       (u (union nil
1555
            (mask (unsigned 64))
1556
            (map (* av-channel-custom))))
1557
       (opaque (* t))))
1558
 
1559
 (define-alien-enum (av-audio-service-type int)
1560
   :main 0
1561
   :effects 1
1562
   :visually-impaired 2
1563
   :hearing-impaired 3
1564
   :dialogue 4
1565
   :commentary 5
1566
   :emergency 6
1567
   :voice-over 7
1568
   :karaoke 8)
1569
 
1570
 (define-alien-enum (av-frame-side-data-type int)
1571
   :panscan 0
1572
   :a53-cc 1
1573
   :stereo3d 2
1574
   :matrixencoding 3
1575
   :downmix-info 4
1576
   :replaygain 5
1577
   :displaymatrix 6
1578
   :afd 7
1579
   :motion-vectors 8
1580
   :skip-samples 9
1581
   :audio-service-type 10
1582
   :mastering-display-metadata 11
1583
   :gop-timecode 12
1584
   :spherical 13
1585
   :content-light-level 14
1586
   :icc-profile 15
1587
   :s12m-timecode 16
1588
   :dynamic-hdr-plus 17
1589
   :regions-of-interest 18
1590
   :video-enc-params 19
1591
   :sei-unregistered 20
1592
   :film-grain-params 21
1593
   :detection-bboxes 22
1594
   :dovi-rpu-buffer 23
1595
   :dovi-metadata 24
1596
   :dynamic-hdr-vivid 25
1597
   :ambient-viewing-environment 26
1598
   :video-hint 27
1599
   :lcevc 28
1600
   :view-id 29)
1601
 
1602
 (define-alien-type av-packet-side-data
1603
     (struct av-packet-side-data
1604
       (data (* (unsigned 8)))
1605
       (size size-t)
1606
       (type av-packet-side-data-type)))
1607
 
1608
 (define-alien-type av-packet
1609
     (struct av-packet
1610
       (buf (* av-buffer-ref))
1611
       (pts (signed 64))
1612
       (dts (signed 64))
1613
       (data (* (unsigned 8)))
1614
       (size int)
1615
       (stream-index int)
1616
       (flags int)
1617
       (side-data (* av-packet-side-data))
1618
       (side-data-elems int)
1619
       (duration (signed 64))
1620
       (pos (signed 64))
1621
       (opaque (* t))
1622
       (opaque-ref (* av-buffer-ref))
1623
       (time-base av-rational)))
1624
 
1625
 (define-alien-type rc-override
1626
     (struct rc-override
1627
       (start-frame int)
1628
       (end-frame int)
1629
       (qscale int)
1630
       (quality-factor float)))
1631
 
1632
 (define-alien-type av-codec-descriptor
1633
     (struct av-codec-descriptor
1634
       (id av-codec-id)
1635
       (type av-media-type)
1636
       (name c-string)
1637
       (long-name c-string)
1638
       (props int)
1639
       (mime-types (* c-string))
1640
       (profiles (* av-profile))))
1641
 
1642
 (define-alien-type av-frame-side-data
1643
     (struct av-frame-side-data
1644
       (type av-frame-side-data-type)
1645
       (data (* (unsigned 8)))
1646
       (size size-t)
1647
       (metadata (* av-dictionary))
1648
       (buf (* av-buffer-ref))))
1649
 
1650
 (define-alien-enum (av-picture-type int)
1651
   :none 0
1652
   :i 1
1653
   :p 2
1654
   :b 3
1655
   :s 4
1656
   :si 5
1657
   :sp 6
1658
   :bi 7)
1659
 
1660
 (define-alien-type av-frame
1661
     (struct av-frame
1662
       (data (array unsigned-char 8))
1663
       (linesize (array int 8))
1664
       (extended-data (* (* unsigned-char)))
1665
       (width int)
1666
       (height int)
1667
       (nb-samples int)
1668
       (format int)
1669
       (pict-type av-picture-type)
1670
       (sample-aspect-ratio av-rational)
1671
       (pts long)
1672
       (pkt-dts long)
1673
       (time-base av-rational)
1674
       (quality int)
1675
       (opaque (* t))
1676
       (repeat-pict int)
1677
       (sample-rate int)
1678
       (buf (array av-buffer-ref 8))
1679
       (extended-buf (* (* av-buffer-ref)))
1680
       (nb-extended-buf int)
1681
       (side-data (* (* av-frame-side-data)))
1682
       (nb-side-data int)
1683
       (flags int)
1684
       (color-range av-color-range)
1685
       (color-primaries av-color-primaries)
1686
       (color-trc av-color-transfer-characteristic)
1687
       (colorspace av-color-space)
1688
       (chroma-location av-chroma-location)
1689
       (best-effort-timestamp long)
1690
       (metadata (* av-dictionary))
1691
       (decode-error-flags int)
1692
       (hw-frames-ctx (* av-buffer-ref))
1693
       (opaque-ref (* av-buffer-ref))
1694
       (crop-top size-t)
1695
       (crop-bottom size-t)
1696
       (crop-left size-t)
1697
       (crop-right size-t)
1698
       (private-ref (* av-buffer-ref))
1699
       (ch-layout av-channel-layout)
1700
       (duration long)))
1701
                 
1702
       
1703
 (defconstant +av-parser-pts-nb+ 4)
1704
 
1705
 (define-alien-type av-codec-parser-context
1706
   (struct av-codec-parser-context
1707
     (priv-data (* t))
1708
     ;; (* av-codec-parser)
1709
     (parser (* t))
1710
     (frame-offset (signed 64))
1711
     (cur-offset (signed 64))
1712
     (next-frame-offset (signed 64))
1713
     (pict-type int)
1714
     (repeat-pict int)
1715
     (pts (signed 64))
1716
     (dts (signed 64))
1717
     (last-pts (signed 64))
1718
     (last-dts (signed 64))
1719
     (fetch-timestamp int)
1720
     (cur-frame-start-index int)
1721
     (cur-frame-offset (array (signed 64) #.+av-parser-pts-nb+))
1722
     (cur-frame-pts (array (signed 64) #.+av-parser-pts-nb+))
1723
     (cur-frame-dts (array (signed 64) #.+av-parser-pts-nb+))
1724
     (flags int)
1725
     (offset (signed 64))
1726
     (cur-frame-end (array (signed 64) #.+av-parser-pts-nb+ ))
1727
     (key-frame int)
1728
     (dts-sync-point int)
1729
     (dts-ref-dts-delta int)
1730
     (pts-dts-delta int)
1731
     (cur-frame-pos (array (signed 64) #.+av-parser-pts-nb+))
1732
     (pos (signed 64))
1733
     (last-pos (signed 64))
1734
     (duration int)
1735
     (field-order av-field-order)
1736
     (picture-structure av-picture-structure)
1737
     (output-picture-number int)
1738
     (width int)
1739
     (height int)
1740
     (coded-width int)
1741
     (coded-height int)
1742
     (format int)))
1743
 
1744
 ;; main api structure
1745
 (define-alien-type av-codec-context
1746
   (struct av-codec-context
1747
     (av-class (* av-class))
1748
     (log-level-offset int)
1749
     (codec-type av-media-type)
1750
     (codec (* av-codec))
1751
     (codec-id av-codec-id)
1752
     (codec-tag unsigned-int)
1753
     (priv-data (* t))
1754
     (internal (* av-codec-internal))
1755
     (opaque (* t))
1756
     (bit-rate (signed 64))
1757
     (flags int)
1758
     (flags2 int)
1759
     (extradata (* unsigned-char))
1760
     (extradata-size int)
1761
     (time-base av-rational)
1762
     (pkt-timebase av-rational)
1763
     (framerate av-rational)
1764
     (delay int)
1765
     (width int)
1766
     (height int)
1767
     (codec-width int)
1768
     (codec-height int)
1769
     (sample-aspect-ratio av-rational)
1770
     (pix-fmt av-pixel-format)
1771
     (sw-pix-fmt av-pixel-format)
1772
     (color-primaries av-color-primaries)
1773
     (color-trc av-color-transfer-characteristic)
1774
     (colorspace av-color-space)
1775
     (color-range av-color-range)
1776
     (chroma-sample-location av-chroma-location)
1777
     (field-order av-field-order)
1778
     (refs int)
1779
     (has-b-frames int)
1780
     (slice-flags int)
1781
     ;; (* av-codec-context)
1782
     (draw-horiz-band (* (function void (* t)
1783
                             (* av-frame)
1784
                           (array int #.+av-num-data-pointers+)
1785
                           int int int)))
1786
     ;; (* av-codec-context)
1787
     (get-format (* (function av-pixel-format (* t) (* av-pixel-format))))
1788
     (max-b-frames int)
1789
     (b-quant-factor float)
1790
     (b-quant-offset float)
1791
     (i-quant-factor float)
1792
     (i-quant-offset float)
1793
     (lumi-masking float)
1794
     (temporal-cplx-masking float)
1795
     (spatial-cplx-masking float)
1796
     (p-masking float)
1797
     (dark-masking float)
1798
     (nsse-weight int)
1799
     (me-cmp int)
1800
     (me-sub-cmp int)
1801
     (mb-cmp int)
1802
     (ildct-cmp int)
1803
     (dia-size int)
1804
     (last-predictor-count int)
1805
     (me-pre-cmp int)
1806
     (pre-dia-size int)
1807
     (me-subpel-quality int)
1808
     (me-range int)
1809
     (mb-decision int)
1810
     (intra-matrix (* (unsigned 16)))
1811
     (inter-matrix (* (unsigned 16)))
1812
     (chroma-intra-matrix (* (unsigned 16)))
1813
     (intra-dc-precision int)
1814
     (mb-lmin int)
1815
     (mb-lmax int)
1816
     (bidir-refine int)
1817
     (keyint-min int)
1818
     (gop-size int)
1819
     (mv0-threshold int)
1820
     (slices int)
1821
     (smaple-rate int)
1822
     (sample-fmt av-sample-format)
1823
     (ch-layout av-channel-layout)
1824
     (frame-size int)
1825
     (block-align int)
1826
     (cutoff int)
1827
     (audio-service-type av-audio-service-type)
1828
     (request-sample-fmt av-sample-format)
1829
     (initial-padding int)
1830
     (trailing-padding int)
1831
     (seek-preroll int)
1832
     ;; (* av-codec-context)
1833
     (get-buffer2 (* (function int (* t) (* av-frame) int)))
1834
     (bit-rate-tolerance int)
1835
     (global-quality int)
1836
     (compression-level int)
1837
     (qcompress float)
1838
     (qblur float)
1839
     (qmin int)
1840
     (qmax int)
1841
     (max-qdiff int)
1842
     (rc-buffer-size int)
1843
     (rc-override-count int)
1844
     (rc-override (* rc-override))
1845
     (rc-max-rate (signed 64))
1846
     (rc-min-rate (signed 64))
1847
     (rc-max-available-vbv-use float)
1848
     (rc-min-vbv-overflow-use float)
1849
     (rc-initial-buffer-occupancy int)
1850
     (trellis int)
1851
     (stats-out (* char))
1852
     (stats-in (* char))
1853
     (workaround-bugs int)
1854
     (strict-std-compliance int)
1855
     (error-concealment int)
1856
     (debug int)
1857
     (err-recognition int)
1858
     (hwaccel (* t)) ;; (* av-hw-accel)
1859
     (hwaccel-context (* t))
1860
     (hw-frames-ctx (* av-buffer-ref))
1861
     (hw-device-ctx (* av-buffer-ref))
1862
     (hwaccel-flags int)
1863
     (extra-hw-frames int)
1864
     (error (array (unsigned 64) #.+av-num-data-pointers+))
1865
     (dct-algo int)
1866
     (idct-algo int)
1867
     (bits-per-coded-sample int)
1868
     (bits-per-raw-sample int)
1869
     (thread-count int)
1870
     (thread-type int)
1871
     (active-thread-type int)
1872
     ;; (* (function int (* av-codec-context) (* (function int (* av-codec-context) (* t))) (* t) (* int) int int))
1873
     (execute (* (function int (* t) (* (function int (* t) (* t))) (* t) (* int) int int)))
1874
     ;; (* (function int (* av-codec-context) (* (function int (* av-codec-context) (* t) int int)) (* t) (* int) int))
1875
     (execute2 (* (function int (* t) (* (function int (* t) (* t) int int)) (* t) (* int) int)))
1876
     (profile int)
1877
     (level int)
1878
     (properties unsigned)
1879
     (skip-loop-filter av-discard)
1880
     (skip-idct av-discard)
1881
     (skip-frame av-discard)
1882
     (skip-alpha int)
1883
     (skip-top int)
1884
     (skip-bottom int)
1885
     (lowres int)
1886
     (codec-descriptor (* av-codec-descriptor))
1887
     (sub-charenc (* char))
1888
     (sub-charenc-mode int)
1889
     (subtitle-header-size int)
1890
     (subtitle-header (* unsigned-char))
1891
     (dump-separator (* unsigned-char))
1892
     (codec-whitelist (* char))
1893
     (codec-side-data (* av-packet-side-data))
1894
     (nb-coded-side-data int)
1895
     (export-side-data int)
1896
     (max-pixels (signed 64))
1897
     (apply-cropping int)
1898
     (discard-damaged-percentage int)
1899
     (max-samples (signed 64))
1900
     ;; (* av-codec-context)
1901
     (get-encoded-buffer (* (function int (* t) (* av-packet) int)))
1902
     (frame-num (signed 64))
1903
     (side-data-prefer-packet (* int))
1904
     (nb-side-data-prefer-packet unsigned)
1905
     (decoded-side-data (* (* av-frame-side-data)))
1906
     (nb-decoded-side-data int)))
1907
 
1908
 (define-alien-type av-codec-parser
1909
     (struct av-codec-parser
1910
       (codec-ids (array int 7))
1911
       (priv-data-size int)
1912
       (parser-init (* (function int (* av-codec-parser-context))))
1913
       (parser-parse (* (function int 
1914
                            (* av-codec-parser-context)
1915
                            (* av-codec-context)
1916
                          (* (* unsigned-char))
1917
                          (* int)
1918
                          (* unsigned-char)
1919
                          int)))
1920
       (parser-close (* (function void (* av-codec-parser-context))))
1921
       (split (* (function int (* av-codec-context) (* unsigned-char) int)))))
1922
 
1923
 (defar av-get-packet int
1924
   (s (* av-io-context))
1925
   (pkt (* av-packet))
1926
   (size int))
1927
 
1928
 (defar av-append-packet int
1929
   (s (* av-io-context))
1930
   (pkt (* av-packet))
1931
   (size int))
1932
 
1933
 (defar avformat-alloc-context (* av-format-context))
1934
 (defar avformat-free-context void (ctx (* av-format-context)))
1935
 (defar avformat-init-output int (s (* av-format-context)) (options (* (* av-dictionary))))
1936
 (defar avformat-find-stream-info int (ic (* av-format-context)) (opts (* (* av-dictionary))))
1937
 (defar av-write-frame int (s (* av-format-context)) (pkt (* av-packet)))
1938
 (defar av-guess-format (* av-output-format)
1939
   (short-name c-string)
1940
   (filename c-string)
1941
   (mime-type c-string))
1942
 (defar av-guess-codec av-codec-id
1943
   (fmt (* av-output-format))
1944
   (short-name c-string)
1945
   (filename c-string)
1946
   (mime-type c-string)
1947
   (type av-media-type))
1948
 (defar av-get-output-timestamp int 
1949
   (s (* av-format-context)) 
1950
   (stream int)
1951
   (dts (* (signed 64)))
1952
   (wall (* (signed 64))))
1953
 (defar av-codec-get-id av-codec-id
1954
   (tags (* (* av-codec-tag)))
1955
   (tag unsigned-int))
1956
 (defar av-codec-get-tag unsigned-int
1957
   (tags (* (* av-codec-tag)))
1958
   (id av-codec-id))
1959
 (defar av-dump-format void
1960
   (ic (* av-format-context))
1961
   (index int)
1962
   (url c-string)
1963
   (is-output int))
1964
 (defar avformat-get-riff-video-tags (* av-codec-tag))
1965
 (defar avformat-get-riff-audio-tags (* av-codec-tag))
1966
 (defar avformat-get-mov-video-tags (* av-codec-tag))
1967
 (defar avformat-get-mov-audio-tags (* av-codec-tag))
1968
 (defar avformat-open-input int 
1969
   (ps (* (* av-format-context)))
1970
   (url c-string)
1971
   (fmt (* av-input-format))
1972
   (options (* (* av-dictionary))))
1973
 (defar avformat-flush int (s (* av-format-context)))
1974
 (defar av-read-play int (s (* av-format-context)))
1975
 (defar av-read-pause int (s (* av-format-context)))
1976
 (defar avformat-close-input void (s (* (* av-format-context))))
1977
 (defar avformat-write-header int
1978
   (s (* av-format-context))
1979
   (options (* (* av-dictionary))))
1980
 (defar av-find-default-stream-index int (s (* av-format-context)))
1981
 (defar avformat-network-init int)
1982
 (defar avformat-network-deinit int)
1983
 (defar avformat-get-class (* av-class))
1984
 (defar avformat-stream-group-get-class (* av-class))
1985
 ;; (defar avformat-stream-group-name c-string (type av-stream-group-params-type))
1986
 ;; (defar avformat-new-stream (* av-stream) (s (* av-format-context)) (c (* av-codec)))
1987
 ;; (defar avformat-new-program (* av-program) (s (* av-format-context)) (id int))
1988
 
1989
 (defar av-opt-set-defaults void (s (* t)))
1990
 (defar av-opt-set int (obj (* t)) (name c-string) (val c-string) (search-flags int))
1991
 (defar av-opt-set-int int (obj (* t)) (name c-string) (val int) (search-flags int))
1992
 (defar av-opt-set-double int (obj (* t)) (name c-string) (val double) (search-flags int))
1993
 ;; (defar av-opt-set-q int (obj (* t)) (name c-string) (val av-rational) (search-flags int))
1994
 (defar av-opt-set-image-size int (obj (* t)) (name c-string) (val (* unsigned-char)) (size int) (search-flags int))
1995
 (defar av-opt-set-pixel-fmt int (obj (* t)) (name c-string) (fmt av-pixel-format) (search-flags int))
1996
 (defar av-opt-set-sample-fmt int (obj (* t)) (name c-string) (fmt av-sample-format) (search-flags int))
1997
 ;; (defar av-opt-set-video-rate int (obj (* t)) (name c-string) (val av-rational) (search-flags int))
1998
 (defar av-opt-set-chlayout int (obj (* t)) (name c-string) (val (* av-channel-layout)) (search-flags int))
1999
 (defar av-opt-set-dict-val int (obj (* t)) (name c-string) (val (* av-dictionary)) (search-flags int))
2000
 (defar av-opt-set-array int (obj (* t)) (name c-string) (search-flags int)
2001
   (start-elem unsigned-int) (nb-elems unsigned-int) (val-type av-option-type) (val (* t)))
2002
 
2003
 (defar av-opt-get int (obj (* t)) (name c-string) (search-flags int) (out-val (* (* unsigned-char))))
2004
 (defar av-opt-get-int int (obj (* t)) (name c-string) (search-flags int) (out-val (* int)))
2005
 (defar av-opt-get-double int (obj (* t)) (name c-string) (search-flags int) (out-val (* double)))
2006
 (defar av-opt-get-q int (obj (* t)) (name c-string) (search-flags int) (out-val (* av-rational)))
2007
 (defar av-opt-get-image-size int (obj (* t)) (name c-string) (search-flags int) (w-out (* int)) (h-out (* int)))
2008
 (defar av-opt-get-pixel-fmt int (obj (* t)) (name c-string) (search-flags int) (out-val (* av-pixel-format)))
2009
 (defar av-opt-get-sample-fmt int (obj (* t)) (name c-string) (search-flags int) (out-val (* av-sample-format)))
2010
 (defar av-opt-get-video-rate int (obj (* t)) (name c-string) (search-flags int) (out-val (* av-rational)))
2011
 (defar av-opt-get-chlayout int (obj (* t)) (name c-string) (search-flags int) (out-val (* av-channel-layout)))
2012
 (defar av-opt-get-dict-val int (obj (* t)) (name c-string) (search-flags int) (out-val (* (* av-dictionary))))
2013
 (defar av-opt-get-array-size int (obj (* t)) (name c-string) (search-flags int) (out-val (* unsigned-int)))
2014
 (defar av-opt-get-array int (obj (* t)) (name c-string) (search-flags int) (start-elem unsigned-int) (nb-elems unsigned-int) (out-type av-option-type) (out-val (* t)))
2015
 (defar av-opt-flag-is-set int (obj (* t)) (field-name c-string) (flag-name c-string))
2016
 (defar av-free void (obj (* t)))
2017
 (defar avcodec-free-context void (ctx (* (* av-codec-context))))
2018
 (defar avcodec-close int (ctx (* av-codec-context)))
2019
 (defar avsubtitle-free void (sub (* av-subtitle)))
2020
 (defar avcodec-get-class (* av-class))
2021
 (defar avcodec-alloc-context3 (* av-codec-context) (codec (* av-codec)))
2022
 (defar avcodec-get-subtitle-rect-class (* av-class))
2023
 (defar avcodec-open2 int (avctx (* av-codec-context)) (codec (* av-codec)) (options (* (* av-dictionary))))
2024
 (defar avcodec-get-type av-media-type (codec-id av-codec-id))
2025
 (defar avcodec-get-name c-string (codec-id av-codec-id))
2026
 (defar av-get-bits-per-sample int (codec-id av-codec-id))
2027
 (defar av-get-exact-bits-per-sample int (codec-id av-codec-id))
2028
 (defar avcodec-profile-name c-string (codec-id av-codec-id) (profile int))
2029
 (defar av-get-pcm-codec av-codec-id (fmt av-sample-format) (be int))
2030
 (defar av-codec-iterate (* av-codec) (opaque (* (* t))))
2031
 (defar avcodec-find-decoder (* av-codec) (id av-codec-id))
2032
 (defar avcodec-find-decoder-by-name (* av-codec) (name c-string))
2033
 (defar avcodec-find-encoder (* av-codec) (id av-codec-id))
2034
 (defar avcodec-find-encoder-by-name (* av-codec) (name c-string))
2035
 (defar av-codec-is-encoder int (codec (* av-codec)))
2036
 (defar av-codec-is-decoder int (codec (* av-codec)))
2037
 (defar av-get-profile-name c-string (codec (* av-codec)) (profile int))
2038
 (defar avcodec-descriptor-get (* av-codec-descriptor) (id av-codec-id))
2039
 (defar avcodec-descriptor-next (* av-codec-descriptor) (prev (* av-codec-descriptor)))
2040
 (defar avcodec-descriptor-get-by-name (* av-codec-descriptor) (name c-string))
2041
 
2042
 (defar avcodec-send-packet int (avctx (* av-codec-context)) (avpkt (* av-packet)))
2043
 (defar avcodec-receive-frame int (avctx (* av-codec-context)) (avpkt (* av-frame)))
2044
 
2045
 (defar avcodec-send-frame int (avctx (* av-codec-context)) (avpkt (* av-frame)))
2046
 (defar avcodec-receive-packet int (avctx (* av-codec-context)) (avpkt (* av-packet)))
2047
 
2048
 (defar av-frame-alloc (* av-frame))
2049
 (defar av-packet-alloc (* av-packet))
2050
 (defar av-packet-free void (pkt (* av-packet)))
2051
 (defar av-frame-free void (frame (* av-frame)))
2052
 
2053
 (defar av-parser-iterate (* av-codec-parser) (opaque (* (* t))))
2054
 (defar av-parser-init (* av-codec-parser-context) (codec-id int))
2055
 (defar av-parser-close void (parser (* av-codec-parser-context)))
2056
 
2057
 (defar av-parser-parse2 int
2058
   (s (* av-codec-parser-context))
2059
   (avctx (* av-codec-context))
2060
   (poutbuf (* (* unsigned-char)))
2061
   (poutbuf-size (* int))
2062
   (buf (* unsigned-char))
2063
   (buf-size int)
2064
   (pts unsigned-long)
2065
   (dts unsigned-long)
2066
   (pos unsigned-long))
2067
 (defar av-log-get-level int)
2068
 (defar av-log-set-level void (level int))
2069
 ;; va-list
2070
 (defar av-log-set-callback void
2071
   (callback (* (function void (* t) int c-string (* t)))))
2072
 (defar av-get-bytes-per-sample int
2073
   (sample-fmt av-sample-format))
2074
 (defar av-channel-layout-default void (ch-layout (* av-channel-layout)) (nb-channels int))