forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavformat.pxd
More file actions
272 lines (214 loc) · 6.23 KB
/
avformat.pxd
File metadata and controls
272 lines (214 loc) · 6.23 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
from libc.stdint cimport int64_t, uint64_t
cdef extern from "libavformat/avformat.h" nogil:
cdef int avformat_version()
cdef char* avformat_configuration()
cdef char* avformat_license()
cdef int64_t INT64_MIN
cdef int AV_TIME_BASE
cdef int AVSEEK_FLAG_BACKWARD
cdef int AVSEEK_FLAG_BYTE
cdef int AVSEEK_FLAG_ANY
cdef int AVSEEK_FLAG_FRAME
cdef int AVIO_FLAG_WRITE
cdef enum AVMediaType:
AVMEDIA_TYPE_UNKNOWN
AVMEDIA_TYPE_VIDEO
AVMEDIA_TYPE_AUDIO
AVMEDIA_TYPE_DATA
AVMEDIA_TYPE_SUBTITLE
AVMEDIA_TYPE_ATTACHMENT
AVMEDIA_TYPE_NB
cdef struct AVStream:
int index
int id
AVCodecContext *codec
AVRational time_base
int64_t start_time
int64_t duration
int64_t nb_frames
int64_t cur_dts
AVDictionary *metadata
AVRational avg_frame_rate
AVRational sample_aspect_ratio
# http://ffmpeg.org/doxygen/trunk/structAVIOContext.html
cdef struct AVIOContext:
unsigned char* buffer
int buffer_size
int write_flag
int direct
int seekable
int max_packet_size
cdef int AVIO_FLAG_DIRECT
cdef int AVIO_SEEKABLE_NORMAL
cdef int SEEK_SET
cdef int SEEK_CUR
cdef int SEEK_END
cdef int AVSEEK_SIZE
cdef AVIOContext* avio_alloc_context(
unsigned char *buffer,
int buffer_size,
int write_flag,
void *opaque,
int(*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int(*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t(*seek)(void *opaque, int64_t offset, int whence)
)
# http://ffmpeg.org/doxygen/trunk/structAVInputFormat.html
cdef struct AVInputFormat:
const char *name
const char *long_name
const char *extensions
int flags
# const AVCodecTag* const *codec_tag
const AVClass *priv_class
cdef struct AVProbeData:
unsigned char *buf
int buf_size
const char *filename
cdef AVInputFormat* av_probe_input_format(
AVProbeData *pd,
int is_opened
)
# http://ffmpeg.org/doxygen/trunk/structAVOutputFormat.html
cdef struct AVOutputFormat:
const char *name
const char *long_name
const char *extensions
AVCodecID video_codec
AVCodecID audio_codec
AVCodecID subtitle_codec
int flags
# const AVCodecTag* const *codec_tag
const AVClass *priv_class
cdef int AVFMT_NOFILE
cdef int AVFMT_NEEDNUMBER
cdef int AVFMT_RAWPICTURE
cdef int AVFMT_GLOBALHEADER
cdef int AVFMT_NOTIMESTAMPS
cdef int AVFMT_VARIABLE_FPS
cdef int AVFMT_NODIMENSIONS
cdef int AVFMT_NOSTREAMS
cdef int AVFMT_ALLOW_FLUSH
cdef int AVFMT_TS_NONSTRICT
cdef int AVFMT_FLAG_CUSTOM_IO
cdef int AVFMT_FLAG_GENPTS
cdef int av_probe_input_buffer(
AVIOContext *pb,
AVInputFormat **fmt,
const char *filename,
void *logctx,
unsigned int offset,
unsigned int max_probe_size
)
cdef AVInputFormat* av_find_input_format(const char *name)
# http://ffmpeg.org/doxygen/trunk/structAVFormatContext.html
cdef struct AVFormatContext:
# Streams.
unsigned int nb_streams
AVStream **streams
AVInputFormat *iformat
AVOutputFormat *oformat
AVIOContext *pb
AVDictionary *metadata
char filename
int64_t start_time
int64_t duration
int bit_rate
int flags
int64_t max_analyze_duration
cdef AVFormatContext* avformat_alloc_context()
# .. c:function:: avformat_open_input(...)
#
# Options are passed via :func:`av.open`.
#
# .. seealso:: FFmpeg's docs: :ffmpeg:`avformat_open_input`
#
cdef int avformat_open_input(
AVFormatContext **ctx, # NULL will allocate for you.
char *filename,
AVInputFormat *format, # Can be NULL.
AVDictionary **options # Can be NULL.
)
cdef int avformat_close_input(AVFormatContext **ctx)
# .. c:function:: avformat_write_header(...)
#
# Options are passed via :func:`av.open`; called in
# :meth:`av.container.OutputContainer.start_encoding`.
#
# .. seealso:: FFmpeg's docs: :ffmpeg:`avformat_write_header`
#
cdef int avformat_write_header(
AVFormatContext *ctx,
AVDictionary **options # Can be NULL
)
cdef int av_write_trailer(AVFormatContext *ctx)
cdef int av_interleaved_write_frame(
AVFormatContext *ctx,
AVPacket *pkt
)
cdef int av_write_frame(
AVFormatContext *ctx,
AVPacket *pkt
)
cdef int avio_open(
AVIOContext **s,
char *url,
int flags
)
cdef int64_t avio_size(
AVIOContext *s
)
cdef AVOutputFormat* av_guess_format(
char *short_name,
char *filename,
char *mime_type
)
cdef int avformat_query_codec(
AVOutputFormat *ofmt,
AVCodecID codec_id,
int std_compliance
)
cdef int avio_close(AVIOContext *s)
cdef int avio_closep(AVIOContext **s)
cdef int avformat_find_stream_info(
AVFormatContext *ctx,
AVDictionary **options, # Can be NULL.
)
cdef AVStream* avformat_new_stream(
AVFormatContext *ctx,
AVCodec *c
)
cdef int avformat_alloc_output_context2(
AVFormatContext **ctx,
AVOutputFormat *oformat,
char *format_name,
char *filename
)
cdef int avformat_free_context(AVFormatContext *ctx)
cdef AVClass* avformat_get_class()
cdef void av_dump_format(
AVFormatContext *ctx,
int index,
char *url,
int is_output,
)
cdef int av_read_frame(
AVFormatContext *ctx,
AVPacket *packet,
)
cdef int av_seek_frame(
AVFormatContext *ctx,
int stream_index,
int64_t timestamp,
int flags
)
cdef int avformat_seek_file(
AVFormatContext *ctx,
int stream_index,
int64_t min_ts,
int64_t ts,
int64_t max_ts,
int flags
)
# custom
cdef set pyav_get_available_formats()