You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

711 lines
22KB

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