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