forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavcodec.pxd
More file actions
372 lines (282 loc) · 8.85 KB
/
Copy pathavcodec.pxd
File metadata and controls
372 lines (282 loc) · 8.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, int64_t
cdef extern from "libavcodec/avcodec.pyav.h" nogil:
cdef int avcodec_version()
cdef char* avcodec_configuration()
cdef char* avcodec_license()
cdef int64_t AV_NOPTS_VALUE
# AVCodecDescriptor.props
cdef enum:
AV_CODEC_PROP_INTRA_ONLY
AV_CODEC_PROP_LOSSY
AV_CODEC_PROP_LOSSLESS
AV_CODEC_PROP_REORDER
AV_CODEC_PROP_BITMAP_SUB
AV_CODEC_PROP_TEXT_SUB
#AVCodec.capabilities
cdef enum:
CODEC_CAP_DRAW_HORIZ_BAND
CODEC_CAP_DR1
CODEC_CAP_TRUNCATED
CODEC_CAP_HWACCEL
CODEC_CAP_DELAY
CODEC_CAP_SMALL_LAST_FRAME
CODEC_CAP_HWACCEL_VDPAU
CODEC_CAP_SUBFRAMES
CODEC_CAP_EXPERIMENTAL
CODEC_CAP_CHANNEL_CONF
CODEC_CAP_NEG_LINESIZES
CODEC_CAP_FRAME_THREADS
CODEC_CAP_SLICE_THREADS
CODEC_CAP_PARAM_CHANGE
CODEC_CAP_AUTO_THREADS
CODEC_CAP_VARIABLE_FRAME_SIZE
CODEC_CAP_INTRA_ONLY
CODEC_CAP_LOSSLESS
cdef enum:
FF_THREAD_FRAME
FF_THREAD_SLICE
cdef enum:
AV_CODEC_FLAG_GLOBAL_HEADER
AV_CODEC_FLAG_QSCALE
AV_CODEC_FLAG_TRUNCATED
cdef enum:
AV_PKT_FLAG_KEY
AV_PKT_FLAG_CORRUPT
cdef enum:
AV_FRAME_FLAG_CORRUPT
cdef enum:
FF_COMPLIANCE_VERY_STRICT
FF_COMPLIANCE_STRICT
FF_COMPLIANCE_NORMAL
FF_COMPLIANCE_UNOFFICIAL
FF_COMPLIANCE_EXPERIMENTAL
cdef enum AVCodecID:
AV_CODEC_ID_NONE
AV_CODEC_ID_MPEG2VIDEO
AV_CODEC_ID_MPEG1VIDEO
cdef enum AVDiscard:
AVDISCARD_NONE
AVDISCARD_DEFAULT
AVDISCARD_NONREF
AVDISCARD_BIDIR
AVDISCARD_NONINTRA
AVDISCARD_NONKEY
AVDISCARD_ALL
cdef struct AVCodec:
char *name
char *long_name
AVMediaType type
AVCodecID id
int capabilities
AVRational* supported_framerates
AVSampleFormat* sample_fmts
AVPixelFormat* pix_fmts
int* supported_samplerates
AVClass *priv_class
cdef int av_codec_is_encoder(AVCodec*)
cdef int av_codec_is_decoder(AVCodec*)
cdef struct AVCodecDescriptor:
AVCodecID id
char *name
char *long_name
int props
char **mime_types
AVCodecDescriptor* avcodec_descriptor_get(AVCodecID)
cdef struct AVCodecContext:
AVClass *av_class
AVMediaType codec_type
char codec_name[32]
unsigned int codec_tag
AVCodecID codec_id
int flags
int thread_count
int thread_type
int profile
AVDiscard skip_frame
AVFrame* coded_frame
int bit_rate
int bit_rate_tolerance
int mb_decision
int global_quality
int compression_level
int frame_number
int qmin
int qmax
int rc_max_rate
int rc_min_rate
int rc_buffer_size
float rc_max_available_vbv_use
float rc_min_vbv_overflow_use
AVRational framerate
AVRational time_base
int ticks_per_frame
int extradata_size
uint8_t *extradata
int delay
AVCodec *codec
# Video.
int width
int height
int coded_width
int coded_height
AVPixelFormat pix_fmt
AVRational sample_aspect_ratio
int gop_size # The number of pictures in a group of pictures, or 0 for intra_only.
int max_b_frames
int has_b_frames
# Audio.
AVSampleFormat sample_fmt
int sample_rate
int channels
int frame_size
int channel_layout
#: .. todo:: ``get_buffer`` is deprecated for get_buffer2 in newer versions of FFmpeg.
int get_buffer(AVCodecContext *ctx, AVFrame *frame)
void release_buffer(AVCodecContext *ctx, AVFrame *frame)
# User Data
void *opaque
cdef AVCodecContext* avcodec_alloc_context3(AVCodec *codec)
cdef void avcodec_free_context(AVCodecContext **ctx)
cdef AVClass* avcodec_get_class()
cdef int avcodec_copy_context(AVCodecContext *dst, const AVCodecContext *src)
cdef struct AVCodecDescriptor:
AVCodecID id
AVMediaType type
char *name
char *long_name
int props
cdef AVCodec* avcodec_find_decoder(AVCodecID id)
cdef AVCodec* avcodec_find_encoder(AVCodecID id)
cdef AVCodec* avcodec_find_decoder_by_name(char *name)
cdef AVCodec* avcodec_find_encoder_by_name(char *name)
cdef AVCodecDescriptor* avcodec_descriptor_get (AVCodecID id)
cdef AVCodecDescriptor* avcodec_descriptor_get_by_name (char *name)
cdef char* avcodec_get_name(AVCodecID id)
cdef char* av_get_profile_name(AVCodec *codec, int profile)
cdef int avcodec_open2(
AVCodecContext *ctx,
AVCodec *codec,
AVDictionary **options,
)
cdef int avcodec_is_open(AVCodecContext *ctx )
cdef int avcodec_close(AVCodecContext *ctx)
cdef int AV_NUM_DATA_POINTERS
# See: http://ffmpeg.org/doxygen/trunk/structAVFrame.html
cdef struct AVFrame:
uint8_t *data[4];
int linesize[4];
uint8_t **extended_data
int format # Should be AVPixelFormat or AVSampleFormat
int key_frame # 0 or 1.
AVPictureType pict_type
int interlaced_frame # 0 or 1.
int width
int height
int nb_samples # Audio samples
int sample_rate # Audio Sample rate
int channels # Number of audio channels
int channel_layout # Audio channel_layout
int64_t pts
int64_t pkt_dts
int pkt_size
uint8_t **base
void *opaque
AVDictionary *metadata
int flags
int decode_error_flags
cdef AVFrame* avcodec_alloc_frame()
cdef struct AVPacket:
int64_t pts
int64_t dts
uint8_t *data
int size
int stream_index
int flags
int duration
int64_t pos
void (*destruct)(AVPacket*)
cdef int avcodec_fill_audio_frame(
AVFrame *frame,
int nb_channels,
AVSampleFormat sample_fmt,
uint8_t *buf,
int buf_size,
int align
)
cdef void avcodec_free_frame(AVFrame **frame)
cdef void av_init_packet(AVPacket*)
cdef int av_new_packet(AVPacket*, int)
cdef int av_packet_ref(AVPacket *dst, const AVPacket *src)
cdef void av_packet_unref(AVPacket *pkt)
cdef enum AVSubtitleType:
SUBTITLE_NONE
SUBTITLE_BITMAP
SUBTITLE_TEXT
SUBTITLE_ASS
cdef struct AVSubtitleRect:
int x
int y
int w
int h
int nb_colors
uint8_t *data[4];
int linesize[4];
AVSubtitleType type
char *text
char *ass
int flags
cdef struct AVSubtitle:
uint16_t format
uint32_t start_display_time
uint32_t end_display_time
unsigned int num_rects
AVSubtitleRect **rects
int64_t pts
cdef int avcodec_decode_subtitle2(
AVCodecContext *ctx,
AVSubtitle *sub,
int *done,
AVPacket *pkt,
)
cdef int avcodec_encode_subtitle(
AVCodecContext *avctx,
uint8_t *buf,
int buf_size,
AVSubtitle *sub
)
cdef void avsubtitle_free(AVSubtitle*)
cdef void avcodec_get_frame_defaults(AVFrame* frame)
cdef void avcodec_flush_buffers(AVCodecContext *ctx)
# TODO: avcodec_default_get_buffer is deprecated for avcodec_default_get_buffer2 in newer versions of FFmpeg
cdef int avcodec_default_get_buffer(AVCodecContext *ctx, AVFrame *frame)
cdef void avcodec_default_release_buffer(AVCodecContext *ctx, AVFrame *frame)
# === New-style Transcoding
cdef int avcodec_send_packet(AVCodecContext *avctx, AVPacket *packet)
cdef int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
cdef int avcodec_send_frame(AVCodecContext *avctx, AVFrame *frame)
cdef int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
# === Parsers
cdef struct AVCodecParser:
int codec_ids[5]
cdef AVCodecParser* av_parser_next(AVCodecParser *c)
cdef struct AVCodecParserContext:
pass
cdef AVCodecParserContext *av_parser_init(int codec_id)
cdef int av_parser_parse2(
AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size,
int64_t pts, int64_t dts,
int64_t pos
)
cdef int av_parser_change(
AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size,
int keyframe
)
cdef void av_parser_close(AVCodecParserContext *s)
# custom
cdef set pyav_get_available_codecs()