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.

706 lines
22KB

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