Mercurial > audlegacy-plugins
annotate src/ffmpeg/libavformat/avformat.h @ 823:a195f1259a6b trunk
[svn] - merge VFS support from wma plugin.
| author | nenolod |
|---|---|
| date | Mon, 12 Mar 2007 14:12:00 -0700 |
| parents | a35b692388f6 |
| children | 3cbdc6e19d7c |
| rev | line source |
|---|---|
| 808 | 1 /* |
| 2 * copyright (c) 2001 Fabrice Bellard | |
| 3 * | |
| 4 * This file is part of FFmpeg. | |
| 5 * | |
| 6 * FFmpeg is free software; you can redistribute it and/or | |
| 7 * modify it under the terms of the GNU Lesser General Public | |
| 8 * License as published by the Free Software Foundation; either | |
| 9 * version 2.1 of the License, or (at your option) any later version. | |
| 10 * | |
| 11 * FFmpeg is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 * Lesser General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU Lesser General Public | |
| 17 * License along with FFmpeg; if not, write to the Free Software | |
| 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 19 */ | |
| 20 | |
| 21 #ifndef AVFORMAT_H | |
| 22 #define AVFORMAT_H | |
| 23 | |
| 823 | 24 #include <audacious/util.h> |
| 25 #include <audacious/vfs.h> | |
| 26 | |
| 808 | 27 #ifdef __cplusplus |
| 28 extern "C" { | |
| 29 #endif | |
| 30 | |
| 31 #define LIBAVFORMAT_VERSION_INT ((50<<16)+(6<<8)+0) | |
| 32 #define LIBAVFORMAT_VERSION 50.6.0 | |
| 33 #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT | |
| 34 | |
| 35 #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) | |
| 36 | |
| 37 #include <time.h> | |
| 38 #include <stdio.h> /* FILE */ | |
| 39 #include "avcodec.h" | |
| 40 | |
| 41 #include "avio.h" | |
| 42 | |
| 43 /* packet functions */ | |
| 44 | |
| 45 #ifndef MAXINT64 | |
| 46 #define MAXINT64 int64_t_C(0x7fffffffffffffff) | |
| 47 #endif | |
| 48 | |
| 49 #ifndef MININT64 | |
| 50 #define MININT64 int64_t_C(0x8000000000000000) | |
| 51 #endif | |
| 52 | |
| 53 typedef struct AVPacket { | |
| 54 int64_t pts; ///< presentation time stamp in time_base units | |
| 55 int64_t dts; ///< decompression time stamp in time_base units | |
| 56 uint8_t *data; | |
| 57 int size; | |
| 58 int stream_index; | |
| 59 int flags; | |
| 60 int duration; ///< presentation duration in time_base units (0 if not available) | |
| 61 void (*destruct)(struct AVPacket *); | |
| 62 void *priv; | |
| 63 int64_t pos; ///< byte position in stream, -1 if unknown | |
| 64 } AVPacket; | |
| 65 #define PKT_FLAG_KEY 0x0001 | |
| 66 | |
| 67 void av_destruct_packet_nofree(AVPacket *pkt); | |
| 68 void av_destruct_packet(AVPacket *pkt); | |
| 69 | |
| 70 /* initialize optional fields of a packet */ | |
| 71 static inline void av_init_packet(AVPacket *pkt) | |
| 72 { | |
| 73 pkt->pts = AV_NOPTS_VALUE; | |
| 74 pkt->dts = AV_NOPTS_VALUE; | |
| 75 pkt->pos = -1; | |
| 76 pkt->duration = 0; | |
| 77 pkt->flags = 0; | |
| 78 pkt->stream_index = 0; | |
| 79 pkt->destruct= av_destruct_packet_nofree; | |
| 80 } | |
| 81 | |
| 82 int av_new_packet(AVPacket *pkt, int size); | |
| 83 int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); | |
| 84 int av_dup_packet(AVPacket *pkt); | |
| 85 | |
| 86 /** | |
| 87 * Free a packet | |
| 88 * | |
| 89 * @param pkt packet to free | |
| 90 */ | |
| 91 static inline void av_free_packet(AVPacket *pkt) | |
| 92 { | |
| 93 if (pkt && pkt->destruct) { | |
| 94 pkt->destruct(pkt); | |
| 95 } | |
| 96 } | |
| 97 | |
| 98 /*************************************************/ | |
| 99 /* fractional numbers for exact pts handling */ | |
| 100 | |
| 101 /* the exact value of the fractional number is: 'val + num / den'. num | |
| 102 is assumed to be such as 0 <= num < den */ | |
| 103 typedef struct AVFrac { | |
| 104 int64_t val, num, den; | |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
105 } AVFrac; |
| 808 | 106 |
| 107 /*************************************************/ | |
| 108 /* input/output formats */ | |
| 109 | |
| 110 struct AVFormatContext; | |
| 111 | |
| 112 /* this structure contains the data a format has to probe a file */ | |
| 113 typedef struct AVProbeData { | |
| 114 const char *filename; | |
| 115 unsigned char *buf; | |
| 116 int buf_size; | |
| 117 } AVProbeData; | |
| 118 | |
| 119 #define AVPROBE_SCORE_MAX 100 ///< max score, half of that is used for file extension based detection | |
| 120 | |
| 121 typedef struct AVFormatParameters { | |
| 122 AVRational time_base; | |
| 123 int sample_rate; | |
| 124 int channels; | |
| 125 int width; | |
| 126 int height; | |
| 127 enum PixelFormat pix_fmt; | |
| 128 struct AVImageFormat *image_format; | |
| 129 int channel; /* used to select dv channel */ | |
| 130 const char *device; /* video, audio or DV device */ | |
| 131 const char *standard; /* tv standard, NTSC, PAL, SECAM */ | |
| 132 int mpeg2ts_raw:1; /* force raw MPEG2 transport stream output, if possible */ | |
| 133 int mpeg2ts_compute_pcr:1; /* compute exact PCR for each transport | |
| 134 stream packet (only meaningful if | |
| 135 mpeg2ts_raw is TRUE */ | |
| 136 int initial_pause:1; /* do not begin to play the stream | |
| 137 immediately (RTSP only) */ | |
| 138 int prealloced_context:1; | |
| 139 enum CodecID video_codec_id; | |
| 140 enum CodecID audio_codec_id; | |
| 141 } AVFormatParameters; | |
| 142 | |
| 143 #define AVFMT_NOFILE 0x0001 /* no file should be opened */ | |
| 144 #define AVFMT_NEEDNUMBER 0x0002 /* needs '%d' in filename */ | |
| 145 #define AVFMT_SHOW_IDS 0x0008 /* show format stream IDs numbers */ | |
| 146 #define AVFMT_RAWPICTURE 0x0020 /* format wants AVPicture structure for | |
| 147 raw picture data */ | |
| 148 #define AVFMT_GLOBALHEADER 0x0040 /* format wants global header */ | |
| 149 #define AVFMT_NOTIMESTAMPS 0x0080 /* format doesnt need / has any timestamps */ | |
| 150 | |
| 151 typedef struct AVOutputFormat { | |
| 152 const char *name; | |
| 153 const char *long_name; | |
| 154 const char *mime_type; | |
| 155 const char *extensions; /* comma separated extensions */ | |
| 156 /* size of private data so that it can be allocated in the wrapper */ | |
| 157 int priv_data_size; | |
| 158 /* output support */ | |
| 159 enum CodecID audio_codec; /* default audio codec */ | |
| 160 enum CodecID video_codec; /* default video codec */ | |
| 161 int (*write_header)(struct AVFormatContext *); | |
| 162 int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); | |
| 163 int (*write_trailer)(struct AVFormatContext *); | |
| 164 /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ | |
| 165 int flags; | |
| 166 /* currently only used to set pixel format if not YUV420P */ | |
| 167 int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); | |
| 168 int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush); | |
| 169 /* private fields */ | |
| 170 struct AVOutputFormat *next; | |
| 171 } AVOutputFormat; | |
| 172 | |
| 173 typedef struct AVInputFormat { | |
| 174 const char *name; | |
| 175 const char *long_name; | |
| 176 /* size of private data so that it can be allocated in the wrapper */ | |
| 177 int priv_data_size; | |
| 178 /* tell if a given file has a chance of being parsing by this format */ | |
| 179 int (*read_probe)(AVProbeData *); | |
| 180 /* read the format header and initialize the AVFormatContext | |
| 181 structure. Return 0 if OK. 'ap' if non NULL contains | |
| 182 additionnal paramters. Only used in raw format right | |
| 183 now. 'av_new_stream' should be called to create new streams. */ | |
| 184 int (*read_header)(struct AVFormatContext *, | |
| 185 AVFormatParameters *ap); | |
| 186 /* read one packet and put it in 'pkt'. pts and flags are also | |
| 187 set. 'av_new_stream' can be called only if the flag | |
| 188 AVFMTCTX_NOHEADER is used. */ | |
| 189 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); | |
| 190 /* close the stream. The AVFormatContext and AVStreams are not | |
| 191 freed by this function */ | |
| 192 int (*read_close)(struct AVFormatContext *); | |
| 193 /** | |
| 194 * seek to a given timestamp relative to the frames in | |
| 195 * stream component stream_index | |
| 196 * @param stream_index must not be -1 | |
| 197 * @param flags selects which direction should be preferred if no exact | |
| 198 * match is available | |
| 199 */ | |
| 200 int (*read_seek)(struct AVFormatContext *, | |
| 201 int stream_index, int64_t timestamp, int flags); | |
| 202 /** | |
| 203 * gets the next timestamp in AV_TIME_BASE units. | |
| 204 */ | |
| 205 int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, | |
| 206 int64_t *pos, int64_t pos_limit); | |
| 207 /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */ | |
| 208 int flags; | |
| 209 /* if extensions are defined, then no probe is done. You should | |
| 210 usually not use extension format guessing because it is not | |
| 211 reliable enough */ | |
| 212 const char *extensions; | |
| 213 /* general purpose read only value that the format can use */ | |
| 214 int value; | |
| 215 | |
| 216 /* start/resume playing - only meaningful if using a network based format | |
| 217 (RTSP) */ | |
| 218 int (*read_play)(struct AVFormatContext *); | |
| 219 | |
| 220 /* pause playing - only meaningful if using a network based format | |
| 221 (RTSP) */ | |
| 222 int (*read_pause)(struct AVFormatContext *); | |
| 223 | |
| 224 /* private fields */ | |
| 225 struct AVInputFormat *next; | |
| 226 } AVInputFormat; | |
| 227 | |
| 228 typedef struct AVIndexEntry { | |
| 229 int64_t pos; | |
| 230 int64_t timestamp; | |
| 231 #define AVINDEX_KEYFRAME 0x0001 | |
| 232 int flags:2; | |
| 233 int size:30; //yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align) | |
| 234 int min_distance; /* min distance between this and the previous keyframe, used to avoid unneeded searching */ | |
| 235 } AVIndexEntry; | |
| 236 | |
| 237 typedef struct AVStream { | |
| 238 int index; /* stream index in AVFormatContext */ | |
| 239 int id; /* format specific stream id */ | |
| 240 AVCodecContext *codec; /* codec context */ | |
| 241 /** | |
| 242 * real base frame rate of the stream. | |
| 243 * for example if the timebase is 1/90000 and all frames have either | |
| 244 * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 | |
| 245 */ | |
| 246 AVRational r_frame_rate; | |
| 247 void *priv_data; | |
| 248 /* internal data used in av_find_stream_info() */ | |
| 249 int64_t codec_info_duration; | |
| 250 int codec_info_nb_frames; | |
| 251 /* encoding: PTS generation when outputing stream */ | |
| 252 AVFrac pts; | |
| 253 | |
| 254 /** | |
| 255 * this is the fundamental unit of time (in seconds) in terms | |
| 256 * of which frame timestamps are represented. for fixed-fps content, | |
| 257 * timebase should be 1/framerate and timestamp increments should be | |
| 258 * identically 1. | |
| 259 */ | |
| 260 AVRational time_base; | |
| 261 int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */ | |
| 262 /* ffmpeg.c private use */ | |
| 263 int stream_copy; /* if TRUE, just copy stream */ | |
| 264 enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed | |
| 265 //FIXME move stuff to a flags field? | |
| 266 /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame | |
| 267 * MN:dunno if thats the right place, for it */ | |
| 268 float quality; | |
| 269 /* decoding: position of the first frame of the component, in | |
| 270 AV_TIME_BASE fractional seconds. */ | |
| 271 int64_t start_time; | |
| 272 /* decoding: duration of the stream, in AV_TIME_BASE fractional | |
| 273 seconds. */ | |
| 274 int64_t duration; | |
| 275 | |
| 276 char language[4]; /* ISO 639 3-letter language code (empty string if undefined) */ | |
| 277 | |
| 278 /* av_read_frame() support */ | |
| 279 int need_parsing; ///< 1->full parsing needed, 2->only parse headers dont repack | |
| 280 struct AVCodecParserContext *parser; | |
| 281 | |
| 282 int64_t cur_dts; | |
| 283 int last_IP_duration; | |
| 284 int64_t last_IP_pts; | |
| 285 /* av_seek_frame() support */ | |
| 286 AVIndexEntry *index_entries; /* only used if the format does not | |
| 287 support seeking natively */ | |
| 288 int nb_index_entries; | |
| 289 unsigned int index_entries_allocated_size; | |
| 290 | |
| 291 int64_t nb_frames; ///< number of frames in this stream if known or 0 | |
| 292 | |
| 293 #define MAX_REORDER_DELAY 4 | |
| 294 int64_t pts_buffer[MAX_REORDER_DELAY+1]; | |
| 295 } AVStream; | |
| 296 | |
| 297 #define AVFMTCTX_NOHEADER 0x0001 /* signal that no header is present | |
| 298 (streams are added dynamically) */ | |
| 299 | |
| 300 #define MAX_STREAMS 20 | |
| 301 | |
| 302 /* format I/O context */ | |
| 303 typedef struct AVFormatContext { | |
| 304 const AVClass *av_class; /* set by av_alloc_format_context */ | |
| 305 /* can only be iformat or oformat, not both at the same time */ | |
| 306 struct AVInputFormat *iformat; | |
| 307 struct AVOutputFormat *oformat; | |
| 308 void *priv_data; | |
| 309 ByteIOContext pb; | |
| 310 int nb_streams; | |
| 311 AVStream *streams[MAX_STREAMS]; | |
| 312 char filename[1024]; /* input or output filename */ | |
| 313 /* stream info */ | |
| 314 int64_t timestamp; | |
| 315 char title[512]; | |
| 316 char author[512]; | |
| 317 char copyright[512]; | |
| 318 char comment[512]; | |
| 319 char album[512]; | |
| 320 int year; /* ID3 year, 0 if none */ | |
| 321 int track; /* track number, 0 if none */ | |
| 322 char genre[32]; /* ID3 genre */ | |
| 323 | |
| 324 int ctx_flags; /* format specific flags, see AVFMTCTX_xx */ | |
| 325 /* private data for pts handling (do not modify directly) */ | |
| 326 /* This buffer is only needed when packets were already buffered but | |
| 327 not decoded, for example to get the codec parameters in mpeg | |
| 328 streams */ | |
| 329 struct AVPacketList *packet_buffer; | |
| 330 | |
| 331 /* decoding: position of the first frame of the component, in | |
| 332 AV_TIME_BASE fractional seconds. NEVER set this value directly: | |
| 333 it is deduced from the AVStream values. */ | |
| 334 int64_t start_time; | |
| 335 /* decoding: duration of the stream, in AV_TIME_BASE fractional | |
| 336 seconds. NEVER set this value directly: it is deduced from the | |
| 337 AVStream values. */ | |
| 338 int64_t duration; | |
| 339 /* decoding: total file size. 0 if unknown */ | |
| 340 int64_t file_size; | |
| 341 /* decoding: total stream bitrate in bit/s, 0 if not | |
| 342 available. Never set it directly if the file_size and the | |
| 343 duration are known as ffmpeg can compute it automatically. */ | |
| 344 int bit_rate; | |
| 345 | |
| 346 /* av_read_frame() support */ | |
| 347 AVStream *cur_st; | |
| 348 const uint8_t *cur_ptr; | |
| 349 int cur_len; | |
| 350 AVPacket cur_pkt; | |
| 351 | |
| 352 /* av_seek_frame() support */ | |
| 353 int64_t data_offset; /* offset of the first packet */ | |
| 354 int index_built; | |
| 355 | |
| 356 int mux_rate; | |
| 357 int packet_size; | |
| 358 int preload; | |
| 359 int max_delay; | |
| 360 | |
| 361 #define AVFMT_NOOUTPUTLOOP -1 | |
| 362 #define AVFMT_INFINITEOUTPUTLOOP 0 | |
| 363 /* number of times to loop output in formats that support it */ | |
| 364 int loop_output; | |
| 365 | |
| 366 int flags; | |
| 367 #define AVFMT_FLAG_GENPTS 0x0001 ///< generate pts if missing even if it requires parsing future frames | |
| 368 #define AVFMT_FLAG_IGNIDX 0x0002 ///< ignore index | |
| 369 | |
| 370 int loop_input; | |
| 371 /* decoding: size of data to probe; encoding unused */ | |
| 372 unsigned int probesize; | |
| 373 } AVFormatContext; | |
| 374 | |
| 375 typedef struct AVPacketList { | |
| 376 AVPacket pkt; | |
| 377 struct AVPacketList *next; | |
| 378 } AVPacketList; | |
| 379 | |
| 380 extern AVInputFormat *first_iformat; | |
| 381 extern AVOutputFormat *first_oformat; | |
| 382 | |
| 383 /* still image support */ | |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
384 struct AVInputImageContext; |
|
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
385 typedef struct AVInputImageContext AVInputImageContext; |
| 808 | 386 |
| 387 typedef struct AVImageInfo { | |
| 388 enum PixelFormat pix_fmt; /* requested pixel format */ | |
| 389 int width; /* requested width */ | |
| 390 int height; /* requested height */ | |
| 391 int interleaved; /* image is interleaved (e.g. interleaved GIF) */ | |
| 392 AVPicture pict; /* returned allocated image */ | |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
393 } AVImageInfo; |
| 808 | 394 |
| 395 /* AVImageFormat.flags field constants */ | |
| 396 #define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */ | |
| 397 | |
| 398 typedef struct AVImageFormat { | |
| 399 const char *name; | |
| 400 const char *extensions; | |
| 401 /* tell if a given file has a chance of being parsing by this format */ | |
| 402 int (*img_probe)(AVProbeData *); | |
| 403 /* read a whole image. 'alloc_cb' is called when the image size is | |
| 404 known so that the caller can allocate the image. If 'allo_cb' | |
| 405 returns non zero, then the parsing is aborted. Return '0' if | |
| 406 OK. */ | |
| 407 int (*img_read)(ByteIOContext *, | |
| 408 int (*alloc_cb)(void *, AVImageInfo *info), void *); | |
| 409 /* write the image */ | |
| 410 int supported_pixel_formats; /* mask of supported formats for output */ | |
| 411 int (*img_write)(ByteIOContext *, AVImageInfo *); | |
| 412 int flags; | |
| 413 struct AVImageFormat *next; | |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
414 } AVImageFormat; |
| 808 | 415 |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
416 void av_register_image_format(AVImageFormat *img_fmt); |
|
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
417 AVImageFormat *av_probe_image_format(AVProbeData *pd); |
|
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
418 AVImageFormat *guess_image_format(const char *filename); |
| 808 | 419 enum CodecID av_guess_image2_codec(const char *filename); |
| 420 int av_read_image(ByteIOContext *pb, const char *filename, | |
| 421 AVImageFormat *fmt, | |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
422 int (*alloc_cb)(void *, AVImageInfo *info), void *opaque); |
|
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
423 int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img); |
| 808 | 424 |
|
822
a35b692388f6
[svn] - i don't want to hear about deprecation, thanks.
nenolod
parents:
814
diff
changeset
|
425 extern AVImageFormat *first_image_format; |
| 808 | 426 |
| 427 /* XXX: use automatic init with either ELF sections or C file parser */ | |
| 428 /* modules */ | |
| 429 | |
| 430 /* utils.c */ | |
| 431 void av_register_input_format(AVInputFormat *format); | |
| 432 void av_register_output_format(AVOutputFormat *format); | |
| 433 AVOutputFormat *guess_stream_format(const char *short_name, | |
| 434 const char *filename, const char *mime_type); | |
| 435 AVOutputFormat *guess_format(const char *short_name, | |
| 436 const char *filename, const char *mime_type); | |
| 437 enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, | |
| 438 const char *filename, const char *mime_type, enum CodecType type); | |
| 439 | |
| 440 void av_hex_dump(FILE *f, uint8_t *buf, int size); | |
| 441 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); | |
| 442 | |
| 443 void av_register_all(void); | |
| 444 | |
| 445 /* media file input */ | |
| 446 AVInputFormat *av_find_input_format(const char *short_name); | |
| 447 AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); | |
| 448 int av_open_input_stream(AVFormatContext **ic_ptr, | |
| 449 ByteIOContext *pb, const char *filename, | |
| 450 AVInputFormat *fmt, AVFormatParameters *ap); | |
| 451 int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, | |
| 452 AVInputFormat *fmt, | |
| 453 int buf_size, | |
| 454 AVFormatParameters *ap); | |
| 823 | 455 int av_open_input_vfsfile(AVFormatContext **ic_ptr, const char *fn, VFSFile *fd, |
| 456 AVInputFormat *fmt, | |
| 457 int buf_size, | |
| 458 AVFormatParameters *ap); | |
| 808 | 459 /* no av_open for output, so applications will need this: */ |
| 460 AVFormatContext *av_alloc_format_context(void); | |
| 461 | |
| 462 #define AVERROR_UNKNOWN (-1) /* unknown error */ | |
| 463 #define AVERROR_IO (-2) /* i/o error */ | |
| 464 #define AVERROR_NUMEXPECTED (-3) /* number syntax expected in filename */ | |
| 465 #define AVERROR_INVALIDDATA (-4) /* invalid data found */ | |
| 466 #define AVERROR_NOMEM (-5) /* not enough memory */ | |
| 467 #define AVERROR_NOFMT (-6) /* unknown format */ | |
| 468 #define AVERROR_NOTSUPP (-7) /* operation not supported */ | |
| 469 | |
| 470 int av_find_stream_info(AVFormatContext *ic); | |
| 471 int av_read_packet(AVFormatContext *s, AVPacket *pkt); | |
| 472 int av_read_frame(AVFormatContext *s, AVPacket *pkt); | |
| 473 int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); | |
| 474 int av_read_play(AVFormatContext *s); | |
| 475 int av_read_pause(AVFormatContext *s); | |
| 476 void av_close_input_file(AVFormatContext *s); | |
| 477 AVStream *av_new_stream(AVFormatContext *s, int id); | |
| 478 void av_set_pts_info(AVStream *s, int pts_wrap_bits, | |
| 479 int pts_num, int pts_den); | |
| 480 | |
| 481 #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward | |
| 482 #define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes | |
| 483 #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non keyframes | |
| 484 | |
| 485 int av_find_default_stream_index(AVFormatContext *s); | |
| 486 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); | |
| 487 int av_add_index_entry(AVStream *st, | |
| 488 int64_t pos, int64_t timestamp, int size, int distance, int flags); | |
| 489 int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags); | |
| 490 void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); | |
| 491 | |
| 492 /* media file output */ | |
| 493 int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); | |
| 494 int av_write_header(AVFormatContext *s); | |
| 495 int av_write_frame(AVFormatContext *s, AVPacket *pkt); | |
| 496 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); | |
| 497 int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); | |
| 498 | |
| 499 int av_write_trailer(AVFormatContext *s); | |
| 500 | |
| 501 void dump_format(AVFormatContext *ic, | |
| 502 int index, | |
| 503 const char *url, | |
| 504 int is_output); | |
| 505 int parse_image_size(int *width_ptr, int *height_ptr, const char *str); | |
| 506 int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg); | |
| 507 int64_t parse_date(const char *datestr, int duration); | |
| 508 | |
| 509 int64_t av_gettime(void); | |
| 510 | |
| 511 /* ffm specific for ffserver */ | |
| 512 #define FFM_PACKET_SIZE 4096 | |
| 513 offset_t ffm_read_write_index(int fd); | |
| 514 void ffm_write_write_index(int fd, offset_t pos); | |
| 515 void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size); | |
| 516 | |
| 517 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); | |
| 518 | |
| 519 int av_get_frame_filename(char *buf, int buf_size, | |
| 520 const char *path, int number); | |
| 521 int av_filename_number_test(const char *filename); | |
| 522 | |
| 523 /* grab specific */ | |
| 524 int video_grab_init(void); | |
| 525 int audio_init(void); | |
| 526 | |
| 527 /* DV1394 */ | |
| 528 int dv1394_init(void); | |
| 529 int dc1394_init(void); | |
| 530 | |
| 531 #ifdef HAVE_AV_CONFIG_H | |
| 532 | |
| 533 #include "os_support.h" | |
| 534 | |
| 535 int strstart(const char *str, const char *val, const char **ptr); | |
| 536 int stristart(const char *str, const char *val, const char **ptr); | |
| 537 void pstrcpy(char *buf, int buf_size, const char *str); | |
| 538 char *pstrcat(char *buf, int buf_size, const char *s); | |
| 539 | |
| 540 void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem); | |
| 541 | |
| 542 #ifdef __GNUC__ | |
| 543 #define dynarray_add(tab, nb_ptr, elem)\ | |
| 544 do {\ | |
| 545 typeof(tab) _tab = (tab);\ | |
| 546 typeof(elem) _elem = (elem);\ | |
| 547 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ | |
| 548 __dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\ | |
| 549 } while(0) | |
| 550 #else | |
| 551 #define dynarray_add(tab, nb_ptr, elem)\ | |
| 552 do {\ | |
| 553 __dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\ | |
| 554 } while(0) | |
| 555 #endif | |
| 556 | |
| 557 time_t mktimegm(struct tm *tm); | |
| 558 struct tm *brktimegm(time_t secs, struct tm *tm); | |
| 559 const char *small_strptime(const char *p, const char *fmt, | |
| 560 struct tm *dt); | |
| 561 | |
| 562 struct in_addr; | |
| 563 int resolve_host(struct in_addr *sin_addr, const char *hostname); | |
| 564 | |
| 565 void url_split(char *proto, int proto_size, | |
| 566 char *authorization, int authorization_size, | |
| 567 char *hostname, int hostname_size, | |
| 568 int *port_ptr, | |
| 569 char *path, int path_size, | |
| 570 const char *url); | |
| 571 | |
| 572 int match_ext(const char *filename, const char *extensions); | |
| 573 | |
| 574 #endif /* HAVE_AV_CONFIG_H */ | |
| 575 | |
| 576 #ifdef __cplusplus | |
| 577 } | |
| 578 #endif | |
| 579 | |
| 580 #endif /* AVFORMAT_H */ | |
| 581 |
