Coverage report: /home/ellis/comp/core/ffi/ffmpeg/pkg.lisp
Kind | Covered | All | % |
expression | 3 | 210 | 1.4 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; pkg.lisp --- FFmpeg FFI
3
;; Bindings for FFmpeg libraries (libavcodec, libavutil, etc)
7
;; ref: https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
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
23
:avcodec-get-subtitle-rect-class
26
:avcodec-find-decoder-by-name
28
:avcodec-find-encoder-by-name
32
:av-codec-id :av-codec-id*
33
:av-codec :av-codec-context
34
:av-dictionary :av-class
38
:av-get-exact-bits-per-sample
39
:av-get-bits-per-sample
42
:avcodec-descriptor-get
43
:avcodec-descriptor-next
44
:avcodec-descriptor-get-by-name
53
:av-color-transfer-characteristic
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
74
:avformat-stream-group-get-class
75
:av-find-default-stream-index
79
:av-get-output-timestamp
86
:avformat-find-stream-info
99
:av-codec-parser-context
107
:+av-input-buffer-padding-size+
114
:avcodec-receive-frame
115
:avcodec-receive-packet
116
:av-get-bytes-per-sample
119
:+av-error-max-string-size+
121
:av-make-error-string
122
:av-channel-layout-default
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/")
135
(defar avcodec-version unsigned)
136
(defar avformat-version unsigned)
137
(defar avutil-version unsigned)
138
(defar avfilter-version unsigned)
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)
148
(defun fferrtag* (str)
150
(char-code (schar str 0))
151
(char-code (schar str 1))
152
(char-code (schar str 2))
153
(char-code (schar str 3))))))
155
(defconstant +av-error-max-string-size+ 64)
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)))
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))
190
(define-alien-enum (av-media-type int)
199
(define-opaque av-dictionary)
201
(define-alien-type av-dictionary-entry
202
(struct av-dictionary-entry
207
(define-alien-type av-rational
213
(define-alien-enum (av-sample-format int)
230
(define-alien-enum (av-pixel-format int)
235
(define-alien-enum (av-color-primaries int)
253
(define-alien-enum (av-color-transfer-characteristic int)
276
(define-alien-enum (av-color-space int)
290
:chroma-derived-ncl 12
291
:chroma-derived-cl 13
297
(define-alien-enum (av-color-range int)
302
(define-alien-enum (av-chroma-location int)
312
(define-opaque av-option-ranges)
314
(define-alien-enum (av-option-type int)
335
:flag-array (ash 1 16))
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)
346
:runtime-param (ash 1 15)
347
:filtering-param (ash 1 16)
348
:deprecated (ash 1 17)
349
:child-consts (ash 1 18))
351
(define-alien-type av-option-array-def
352
(struct av-option-array-def
358
(define-alien-type av-option
363
(type av-option-type)
364
(default-val (union nil
369
(arr (* av-option-array-def))))
376
(define-opaque av-buffer)
378
(define-alien-type av-buffer-ref
379
(struct av-buffer-ref
380
(buffer (* av-buffer))
381
(data (* (unsigned 8)))
385
(define-alien-enum (av-class-category int)
397
:device-video-output 40
398
:device-video-input 41
399
:device-audio-output 42
400
:device-audio-input 43
403
;; :nb 46 ;; not part of ABI/API
406
(define-alien-type av-class
408
(class-name c-string)
409
(item-name (* (function c-string (* t))))
410
(option (* av-option))
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))))
419
(child-class-iterate (* (function (* t) (* (* t)))))))
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))
425
(prev (* av-dictionary-entry))
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))
431
(define-opaque av-codec-tag)
433
(defconstant +av-num-data-pointers+ 8)
435
(define-alien-enum (av-io-data-marker-type int)
443
(define-alien-type av-io-interrupt-cb
444
(struct av-io-interrupt-cb
445
(callback (* (function int (* t))))
448
(define-alien-type av-io-context
449
(struct av-io-context
450
(av-class (* av-class))
451
(buffer (* unsigned-char))
453
(buf-ptr (* unsigned-char))
454
(buf-end (* unsigned-char))
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)))
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)))
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))))
480
(define-alien-type av-probe-data
481
(struct av-probe-data
483
(buf (* unsigned-char))
485
(mime-type c-string)))
487
(define-alien-enum (av-duration-estimation-method int)
492
(define-alien-enum (av-codec-id int)
630
;; #define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
669
;; #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
694
;; #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC
769
;; various PCM codecs
788
:pcm-s16le-planar 65554
798
:pcm-s24le-planar 65564
799
:pcm-s32le-planar 65565
800
:pcm-s16be-planar 65566
807
;; various ADPCM codecs
808
:adpcm-ima-qt #x11000
813
:adpcm-ima-smjpeg 69637
831
:adpcm-ima-ea-sead 69655
832
:adpcm-ima-ea-eacs 69656
834
:adpcm-ea-maxis-xa 69658
847
:adpcm-ima-dat4 69671
856
:adpcm-ima-cunning 69680
857
:adpcm-ima-moflex 69681
858
:adpcm-ima-acorn 69682
866
;; various DPCM codecs
868
:interplay-dpcm 81921
924
:binkaudio-rdft 86063
952
:dsd-lsbf-planar 86091
953
:dsd-msbf-planar 86092
968
:mpegh-3d-audio 86107
985
:dvd-subtitle #x17000
991
:hdmv-pgs-subtitle 94214
1008
:hdmv-text-subtitle 94231
1011
;; other specific kind of codecs (generally used for attachments)
1027
:mpeg4systems #x20001
1029
:wrapped-avframe #x21001
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)
1039
:max +avprobe-score-max+)
1041
(defconstant +avprobe-padding-size+ 32)
1043
(define-alien-enum (avfmt int)
1046
:experimental #x0004
1048
:globalheader #x0040
1049
:notimestamps #x0080
1050
:generic-index #x0100
1052
:variable-fps #x0400
1053
:nodimensions #x0800
1057
:no-byte-seek #x8000
1058
:ts-nonstrict #x20000
1059
:ts-negative #x40000
1060
:seek-to-pts #x4000000)
1062
(define-alien-type av-profile
1067
(define-alien-type av-codec
1070
(long-name c-string)
1071
(type av-media-type)
1074
(max-lowres unsigned-char)
1076
(supported-framerates (* av-rational))
1077
(pix-fmts (* av-pixel-format))
1078
(supported-samplerates (* int))
1079
(sample-fmts (* av-sample-format))
1081
(priv-class (* av-class))
1082
(profiles (* av-profile))))
1084
(define-opaque av-codec-internal) ;; ?where's the def?
1086
(define-alien-type av-output-format
1087
(struct av-output-format
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)
1096
(codec-tags (* (* av-codec-tag)))
1097
(priv-class (* av-class))))
1099
(define-alien-type av-input-format
1100
(struct av-input-format
1102
(long-name c-string)
1104
(extensions c-string)
1105
(codec-tag (* (* av-codec-tag)))
1106
(priv-class (* av-class))
1107
(mime-type c-string)))
1109
(define-alien-type av-stream
1112
(define-alien-type av-stream-group (struct av-stream-group))
1114
(define-alien-type av-chapter
1117
(time-base av-rational)
1120
(metadata (* av-dictionary))))
1122
(define-alien-enum (av-discard int)
1131
(define-alien-type av-program
1135
(discard av-discard)
1136
(stream-index (* unsigned-int))
1137
(nb-stream-indexes unsigned-int)
1138
(metadata (* av-dictionary))
1145
(pts-wrap-reference long)
1146
(pts-wrap-behavior int)))
1148
(define-alien-type av-format-control-message
1149
;; (* av-format-context)
1150
(* (function int (* t) int (* t) size-t)))
1153
sizeof(AVFormatContext) must not be used outside libav*, use
1154
avformat_alloc_context() to create an AVFormatContext.
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
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))
1169
(pb (* av-io-context))
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)))
1181
(packet-size unsigned-int)
1185
(max-analyze-duration long)
1186
(key (* unsigned-char))
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)
1201
(max-index-size unsigned-int)
1202
(max-picture-buffer unsigned-int)
1203
(max-interleave-delta long)
1205
(max-chunk-duration int)
1206
(max-chunk-size int)
1207
(max-probe-packets int)
1208
(strict-std-compliance int)
1210
(avoid-negative-ts int)
1212
(use-wallclock-as-timestamps int)
1213
(skip-estimate-duration-from-pts int)
1215
(duration-estimation-method av-duration-estimation-method)
1216
(skip-initial-bytes long)
1217
(correct-ts-overflow unsigned-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)
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))))))
1241
(define-alien-type av-open-callback
1243
(* av-format-context) (* (* av-io-context)) c-string int (* av-io-interrupt-cb) (* (* av-dictionary)))))
1246
(defconstant +av-input-buffer-padding-size+ 64)
1247
(define-alien-enum (av-codec-flag int)
1248
:unaligned (ash 1 0)
1251
:output-corrupt (ash 1 3)
1253
;; :dropchanged (ash 1 5)
1254
:recon-frame (ash 1 6)
1255
:copy-opaque (ash 1 7)
1256
:frame-duration (ash 1 8)
1259
:loop-filter (ash 1 11)
1262
:interlaced-dct (ash 1 18)
1263
:low-delay (ash 1 19)
1264
:global-header (ash 1 22)
1265
:bitexact (ash 1 23)
1267
:interlaced-me (ash 1 29)
1268
:closer-gop (ash 1 31))
1270
(define-alien-enum (av-codec-flag2 int)
1272
:no-output (ash 1 2)
1273
:local-header (ash 1 3)
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))
1282
(define-alien-enum (av-codec-export-data int)
1285
:video-enc-params (ash 1 2)
1286
:film-grain (ash 1 3)
1287
:enhancements (ash 1 4))
1289
(defconstant +av-get-buffer-flag-ref+ (ash 1 0))
1290
(defconstant +av-get-encode-buffer-flag-ref+ (ash 1 0))
1292
(define-alien-enum (ff-cmp int)
1311
(define-alien-enum (ff-mb-decision int)
1316
(defconstant +ff-compression-default+ -1)
1318
(define-alien-enum (ff-bug int)
1327
:direct-blocksize 512
1335
(define-alien-enum (ff-ec int)
1340
(define-alien-enum (ff-debug int)
1346
:dct-coeff #x00000040
1348
:startcode #x00000100
1354
:green-md #x00800000
1357
(define-alien-enum (ff-dct int)
1366
(define-alien-enum (ff-idct int)
1381
(define-alien-enum (ff-thread int)
1385
;; (define-alien-enum (ff-profile int) ;; see defs.h
1387
(define-alien-enum (ff-codec-property int)
1388
:lossless #x00000001
1389
:closed-captions #x00000002
1390
:film-grain #x00000004)
1393
(define-alien-enum (ff-sub-charenc-mode int)
1400
(define-alien-enum (av-subtitle-type int)
1406
(defconstant +av-subtitle-flag-forced+ #x00000001)
1408
(define-alien-enum (av-codec-config int)
1417
(define-alien-enum (av-picture-structure int)
1423
(define-alien-enum (parser-flag int)
1424
:complete-frames #x0001
1426
:fetched-offset #x0004
1429
(define-opaque av-codec-parameters)
1431
(define-alien-type av-subtitle-rect
1432
(struct av-subtitle-rect
1439
(define-alien-type 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)))
1448
(define-alien-enum (av-field-order int)
1456
(define-alien-enum (av-packet-side-data-type int)
1464
:audio-service-type 7
1470
:strings-metadata 13
1471
:subtitle-position 14
1472
:matroska-blockadditional 15
1473
:webvtt-identifier 16
1476
:mpegts-stream-id 19
1477
:mastering-display-metadata 20
1479
:content-light-level 22
1481
:encryption-init-info 24
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
1497
(define-alien-enum (av-channel-order int)
1503
(define-alien-enum (av-channel int)
1511
:front-left-of-center 6
1512
:front-right-of-center 7
1519
:top-front-center 14
1527
:surround-direct-left 33
1528
:surround-direct-right 34
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
1541
:ambisonic-base #x400
1542
:ambisonic-end #x7ff)
1544
(define-alien-type av-channel-custom
1545
(struct av-channel-custom
1547
(name (array char 16))
1550
(define-alien-type av-channel-layout
1551
(struct av-channel-layout
1552
(order av-channel-order)
1555
(mask (unsigned 64))
1556
(map (* av-channel-custom))))
1559
(define-alien-enum (av-audio-service-type int)
1562
:visually-impaired 2
1570
(define-alien-enum (av-frame-side-data-type int)
1581
:audio-service-type 10
1582
:mastering-display-metadata 11
1585
:content-light-level 14
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
1596
:dynamic-hdr-vivid 25
1597
:ambient-viewing-environment 26
1602
(define-alien-type av-packet-side-data
1603
(struct av-packet-side-data
1604
(data (* (unsigned 8)))
1606
(type av-packet-side-data-type)))
1608
(define-alien-type av-packet
1610
(buf (* av-buffer-ref))
1613
(data (* (unsigned 8)))
1617
(side-data (* av-packet-side-data))
1618
(side-data-elems int)
1619
(duration (signed 64))
1622
(opaque-ref (* av-buffer-ref))
1623
(time-base av-rational)))
1625
(define-alien-type rc-override
1630
(quality-factor float)))
1632
(define-alien-type av-codec-descriptor
1633
(struct av-codec-descriptor
1635
(type av-media-type)
1637
(long-name c-string)
1639
(mime-types (* c-string))
1640
(profiles (* av-profile))))
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)))
1647
(metadata (* av-dictionary))
1648
(buf (* av-buffer-ref))))
1650
(define-alien-enum (av-picture-type int)
1660
(define-alien-type av-frame
1662
(data (array unsigned-char 8))
1663
(linesize (array int 8))
1664
(extended-data (* (* unsigned-char)))
1669
(pict-type av-picture-type)
1670
(sample-aspect-ratio av-rational)
1673
(time-base av-rational)
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)))
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))
1695
(crop-bottom size-t)
1698
(private-ref (* av-buffer-ref))
1699
(ch-layout av-channel-layout)
1703
(defconstant +av-parser-pts-nb+ 4)
1705
(define-alien-type av-codec-parser-context
1706
(struct av-codec-parser-context
1708
;; (* av-codec-parser)
1710
(frame-offset (signed 64))
1711
(cur-offset (signed 64))
1712
(next-frame-offset (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+))
1725
(offset (signed 64))
1726
(cur-frame-end (array (signed 64) #.+av-parser-pts-nb+ ))
1728
(dts-sync-point int)
1729
(dts-ref-dts-delta int)
1731
(cur-frame-pos (array (signed 64) #.+av-parser-pts-nb+))
1733
(last-pos (signed 64))
1735
(field-order av-field-order)
1736
(picture-structure av-picture-structure)
1737
(output-picture-number int)
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)
1754
(internal (* av-codec-internal))
1756
(bit-rate (signed 64))
1759
(extradata (* unsigned-char))
1760
(extradata-size int)
1761
(time-base av-rational)
1762
(pkt-timebase av-rational)
1763
(framerate av-rational)
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)
1781
;; (* av-codec-context)
1782
(draw-horiz-band (* (function void (* t)
1784
(array int #.+av-num-data-pointers+)
1786
;; (* av-codec-context)
1787
(get-format (* (function av-pixel-format (* t) (* av-pixel-format))))
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)
1797
(dark-masking float)
1804
(last-predictor-count int)
1807
(me-subpel-quality int)
1810
(intra-matrix (* (unsigned 16)))
1811
(inter-matrix (* (unsigned 16)))
1812
(chroma-intra-matrix (* (unsigned 16)))
1813
(intra-dc-precision int)
1822
(sample-fmt av-sample-format)
1823
(ch-layout av-channel-layout)
1827
(audio-service-type av-audio-service-type)
1828
(request-sample-fmt av-sample-format)
1829
(initial-padding int)
1830
(trailing-padding 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)
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)
1851
(stats-out (* char))
1853
(workaround-bugs int)
1854
(strict-std-compliance int)
1855
(error-concealment 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))
1863
(extra-hw-frames int)
1864
(error (array (unsigned 64) #.+av-num-data-pointers+))
1867
(bits-per-coded-sample int)
1868
(bits-per-raw-sample 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)))
1878
(properties unsigned)
1879
(skip-loop-filter av-discard)
1880
(skip-idct av-discard)
1881
(skip-frame av-discard)
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)))
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))
1920
(parser-close (* (function void (* av-codec-parser-context))))
1921
(split (* (function int (* av-codec-context) (* unsigned-char) int)))))
1923
(defar av-get-packet int
1924
(s (* av-io-context))
1928
(defar av-append-packet int
1929
(s (* av-io-context))
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)
1941
(mime-type c-string))
1942
(defar av-guess-codec av-codec-id
1943
(fmt (* av-output-format))
1944
(short-name c-string)
1946
(mime-type c-string)
1947
(type av-media-type))
1948
(defar av-get-output-timestamp int
1949
(s (* av-format-context))
1951
(dts (* (signed 64)))
1952
(wall (* (signed 64))))
1953
(defar av-codec-get-id av-codec-id
1954
(tags (* (* av-codec-tag)))
1956
(defar av-codec-get-tag unsigned-int
1957
(tags (* (* av-codec-tag)))
1959
(defar av-dump-format void
1960
(ic (* av-format-context))
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)))
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))
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)))
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))
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)))
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)))
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)))
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)))
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))
2066
(pos unsigned-long))
2067
(defar av-log-get-level int)
2068
(defar av-log-set-level void (level int))
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))