File size: 8,735 Bytes
06555b5 |
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 |
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 void avformat_network_init()
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
AVCodecParameters *codecpar
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 r_frame_rate
AVRational sample_aspect_ratio
int nb_side_data
AVPacketSideData *side_data
# 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
void *opaque
# http://ffmpeg.org/doxygen/trunk/structAVIOInterruptCB.html
cdef struct AVIOInterruptCB:
int (*callback)(void*)
void *opaque
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, const 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
int avformat_query_codec(const AVOutputFormat *oformat, AVCodecID codec_id, int std_compliance)
# AVInputFormat.flags and AVOutputFormat.flags
cdef enum:
AVFMT_NOFILE
AVFMT_NEEDNUMBER
AVFMT_SHOW_IDS
AVFMT_GLOBALHEADER
AVFMT_NOTIMESTAMPS
AVFMT_GENERIC_INDEX
AVFMT_TS_DISCONT
AVFMT_VARIABLE_FPS
AVFMT_NODIMENSIONS
AVFMT_NOSTREAMS
AVFMT_NOBINSEARCH
AVFMT_NOGENSEARCH
AVFMT_NO_BYTE_SEEK
AVFMT_ALLOW_FLUSH
AVFMT_TS_NONSTRICT
AVFMT_TS_NEGATIVE
AVFMT_SEEK_TO_PTS
# AVFormatContext.flags
cdef enum:
AVFMT_FLAG_GENPTS
AVFMT_FLAG_IGNIDX
AVFMT_FLAG_NONBLOCK
AVFMT_FLAG_IGNDTS
AVFMT_FLAG_NOFILLIN
AVFMT_FLAG_NOPARSE
AVFMT_FLAG_NOBUFFER
AVFMT_FLAG_CUSTOM_IO
AVFMT_FLAG_DISCARD_CORRUPT
AVFMT_FLAG_FLUSH_PACKETS
AVFMT_FLAG_BITEXACT
AVFMT_FLAG_SORT_DTS
AVFMT_FLAG_FAST_SEEK
AVFMT_FLAG_SHORTEST
AVFMT_FLAG_AUTO_BSF
cdef int av_probe_input_buffer(
AVIOContext *pb,
AVInputFormat **fmt,
const char *filename,
void *logctx,
unsigned int offset,
unsigned int max_probe_size
)
cdef int av_find_best_stream(
AVFormatContext *ic,
AVMediaType type,
int wanted_stream_nb,
int related_stream,
AVCodec **decoder_ret,
int flags
)
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
AVIOInterruptCB interrupt_callback
AVDictionary *metadata
char filename
int64_t start_time
int64_t duration
int bit_rate
int flags
int64_t max_analyze_duration
void *opaque
int (*io_open)(
AVFormatContext *s,
AVIOContext **pb,
const char *url,
int flags,
AVDictionary **options
)
int (*io_close2)(
AVFormatContext *s,
AVIOContext *pb
)
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 void avio_flush(AVIOContext *s)
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
)
cdef AVRational av_guess_frame_rate(
AVFormatContext *ctx,
AVStream *stream,
AVFrame *frame
)
cdef AVRational av_guess_sample_aspect_ratio(
AVFormatContext *ctx,
AVStream *stream,
AVFrame *frame
)
cdef const AVInputFormat* av_demuxer_iterate(void **opaque)
cdef const AVOutputFormat* av_muxer_iterate(void **opaque)
# custom
cdef set pyav_get_available_formats()
|