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.

682 lines
21KB

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