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
352 lines (271 loc) · 8.81 KB
/
Copy pathavcodec.pxd
File metadata and controls
352 lines (271 loc) · 8.81 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
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 void avcodec_register_all()
cdef int64_t AV_NOPTS_VALUE
cdef int CODEC_FLAG_GLOBAL_HEADER
# AVCodecDescriptor.props
cdef uint64_t AV_CODEC_PROP_INTRA_ONLY
cdef uint64_t AV_CODEC_PROP_LOSSY
cdef uint64_t AV_CODEC_PROP_LOSSLESS
cdef uint64_t AV_CODEC_PROP_REORDER
cdef uint64_t AV_CODEC_PROP_BITMAP_SUB
cdef uint64_t AV_CODEC_PROP_TEXT_SUB
#AVCodec.capabilities
cdef uint64_t CODEC_CAP_DRAW_HORIZ_BAND
cdef uint64_t CODEC_CAP_DR1
cdef uint64_t CODEC_CAP_TRUNCATED
cdef uint64_t CODEC_CAP_HWACCEL
cdef uint64_t CODEC_CAP_DELAY
cdef uint64_t CODEC_CAP_SMALL_LAST_FRAME
cdef uint64_t CODEC_CAP_HWACCEL_VDPAU
cdef uint64_t CODEC_CAP_SUBFRAMES
cdef uint64_t CODEC_CAP_EXPERIMENTAL
cdef uint64_t CODEC_CAP_CHANNEL_CONF
cdef uint64_t CODEC_CAP_NEG_LINESIZES
cdef uint64_t CODEC_CAP_FRAME_THREADS
cdef uint64_t CODEC_CAP_SLICE_THREADS
cdef uint64_t CODEC_CAP_PARAM_CHANGE
cdef uint64_t CODEC_CAP_AUTO_THREADS
cdef uint64_t CODEC_CAP_VARIABLE_FRAME_SIZE
cdef uint64_t CODEC_CAP_INTRA_ONLY
cdef uint64_t CODEC_CAP_LOSSLESS
cdef int AV_PKT_FLAG_KEY
cdef int FF_COMPLIANCE_VERY_STRICT
cdef int FF_COMPLIANCE_STRICT
cdef int FF_COMPLIANCE_NORMAL
cdef int FF_COMPLIANCE_UNOFFICIAL
cdef int FF_COMPLIANCE_EXPERIMENTAL
cdef enum AVCodecID:
AV_CODEC_ID_NONE
AV_CODEC_ID_MPEG2VIDEO
AV_CODEC_ID_MPEG1VIDEO
# See: http://ffmpeg.org/doxygen/trunk/structAVCodec.html
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 AVCodec* av_codec_next(AVCodec*)
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)
# See: http://ffmpeg.org/doxygen/trunk/structAVCodecContext.html
cdef struct AVCodecContext:
AVMediaType codec_type
char codec_name[32]
AVCodecID codec_id
int flags
int thread_count
int profile
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 time_base
int ticks_per_frame
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 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/structAVPicture.html
cdef struct AVPicture:
uint8_t **data
int *linesize
# See: http://ffmpeg.org/doxygen/trunk/structAVFrame.html
# This is a strict superset of AVPicture.
cdef struct AVFrame:
uint8_t **data
int *linesize
uint8_t **extended_data
int width
int height
int nb_samples # Audio samples
#int channels # Audio channels
int sample_rate #Audio Sample rate
int channel_layout # Audio channel_layout
int format # Should be AVPixelFormat or AV...Format
int key_frame # 0 or 1.
int64_t pts
int64_t pkt_pts
int64_t pkt_dts
int pkt_size
uint8_t **base
void *opaque
cdef AVFrame* avcodec_alloc_frame()
cdef int avpicture_alloc(
AVPicture *picture,
AVPixelFormat pix_fmt,
int width,
int height
)
cdef int avpicture_get_size(
AVPixelFormat format,
int width,
int height,
)
cdef int avpicture_fill(
AVPicture *picture,
uint8_t *buffer,
AVPixelFormat format,
int width,
int height
)
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_decode_video2(
AVCodecContext *ctx,
AVFrame *frame,
int *got_frame,
AVPacket *packet,
)
cdef int avcodec_decode_audio4(
AVCodecContext *ctx,
AVFrame *frame,
int *got_frame,
AVPacket *packet,
)
cdef int avcodec_encode_audio2(
AVCodecContext *ctx,
AVPacket *avpkt,
AVFrame *frame,
int *got_packet_ptr
)
cdef int avcodec_encode_video2(
AVCodecContext *ctx,
AVPacket *avpkt,
AVFrame *frame,
int *got_packet_ptr
)
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_free_packet(AVPacket*)
cdef void av_init_packet(AVPacket*)
cdef void av_packet_unref(AVPacket *pkt)
cdef int av_copy_packet(AVPacket *dst, AVPacket *src)
cdef int av_dup_packet(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
AVPicture pict
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 int avcodec_get_context_defaults3(
AVCodecContext *ctx,
AVCodec *codec
)
cdef int64_t av_frame_get_best_effort_timestamp(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)