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.

712 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. 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. enum AVDiscard{
  188. //we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames)
  189. AVDISCARD_NONE =-16, ///< discard nothing
  190. AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi
  191. AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
  192. AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
  193. AVDISCARD_ALL = 48, ///< discard all
  194. };
  195. typedef struct AVStream {
  196. int index; /* stream index in AVFormatContext */
  197. int id; /* format specific stream id */
  198. AVCodecContext codec; /* codec context */
  199. /**
  200. * real base frame rate of the stream.
  201. * for example if the timebase is 1/90000 and all frames have either
  202. * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1
  203. */
  204. AVRational r_frame_rate;
  205. void *priv_data;
  206. /* internal data used in av_find_stream_info() */
  207. int64_t codec_info_duration;
  208. int codec_info_nb_frames;
  209. /* encoding: PTS generation when outputing stream */
  210. AVFrac pts;
  211. AVRational time_base;
  212. int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
  213. /* ffmpeg.c private use */
  214. int stream_copy; /* if TRUE, just copy stream */
  215. enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed
  216. //FIXME move stuff to a flags field?
  217. /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
  218. * MN:dunno if thats the right place, for it */
  219. float quality;
  220. /* decoding: position of the first frame of the component, in
  221. AV_TIME_BASE fractional seconds. */
  222. int64_t start_time;
  223. /* decoding: duration of the stream, in AV_TIME_BASE fractional
  224. seconds. */
  225. int64_t duration;
  226. char language[4]; /* ISO 639 3-letter language code (empty string if undefined) */
  227. /* av_read_frame() support */
  228. int need_parsing;
  229. struct AVCodecParserContext *parser;
  230. int64_t cur_dts;
  231. int last_IP_duration;
  232. int64_t last_IP_pts;
  233. /* av_seek_frame() support */
  234. AVIndexEntry *index_entries; /* only used if the format does not
  235. support seeking natively */
  236. int nb_index_entries;
  237. int index_entries_allocated_size;
  238. int64_t nb_frames; ///< number of frames in this stream if known or 0
  239. } AVStream;
  240. #define AVFMTCTX_NOHEADER 0x0001 /* signal that no header is present
  241. (streams are added dynamically) */
  242. #define MAX_STREAMS 20
  243. /* format I/O context */
  244. typedef struct AVFormatContext {
  245. const AVClass *av_class; /* set by av_alloc_format_context */
  246. /* can only be iformat or oformat, not both at the same time */
  247. struct AVInputFormat *iformat;
  248. struct AVOutputFormat *oformat;
  249. void *priv_data;
  250. ByteIOContext pb;
  251. int nb_streams;
  252. AVStream *streams[MAX_STREAMS];
  253. char filename[1024]; /* input or output filename */
  254. /* stream info */
  255. int64_t timestamp;
  256. char title[512];
  257. char author[512];
  258. char copyright[512];
  259. char comment[512];
  260. char album[512];
  261. int year; /* ID3 year, 0 if none */
  262. int track; /* track number, 0 if none */
  263. char genre[32]; /* ID3 genre */
  264. int ctx_flags; /* format specific flags, see AVFMTCTX_xx */
  265. /* private data for pts handling (do not modify directly) */
  266. /* This buffer is only needed when packets were already buffered but
  267. not decoded, for example to get the codec parameters in mpeg
  268. streams */
  269. struct AVPacketList *packet_buffer;
  270. /* decoding: position of the first frame of the component, in
  271. AV_TIME_BASE fractional seconds. NEVER set this value directly:
  272. it is deduced from the AVStream values. */
  273. int64_t start_time;
  274. /* decoding: duration of the stream, in AV_TIME_BASE fractional
  275. seconds. NEVER set this value directly: it is deduced from the
  276. AVStream values. */
  277. int64_t duration;
  278. /* decoding: total file size. 0 if unknown */
  279. int64_t file_size;
  280. /* decoding: total stream bitrate in bit/s, 0 if not
  281. available. Never set it directly if the file_size and the
  282. duration are known as ffmpeg can compute it automatically. */
  283. int bit_rate;
  284. /* av_read_frame() support */
  285. AVStream *cur_st;
  286. const uint8_t *cur_ptr;
  287. int cur_len;
  288. AVPacket cur_pkt;
  289. /* av_seek_frame() support */
  290. int64_t data_offset; /* offset of the first packet */
  291. int index_built;
  292. int mux_rate;
  293. int packet_size;
  294. int preload;
  295. int max_delay;
  296. #define AVFMT_NOOUTPUTLOOP -1
  297. #define AVFMT_INFINITEOUTPUTLOOP 0
  298. /* number of times to loop output in formats that support it */
  299. int loop_output;
  300. } AVFormatContext;
  301. typedef struct AVPacketList {
  302. AVPacket pkt;
  303. struct AVPacketList *next;
  304. } AVPacketList;
  305. extern AVInputFormat *first_iformat;
  306. extern AVOutputFormat *first_oformat;
  307. /* still image support */
  308. struct AVInputImageContext;
  309. typedef struct AVInputImageContext AVInputImageContext;
  310. typedef struct AVImageInfo {
  311. enum PixelFormat pix_fmt; /* requested pixel format */
  312. int width; /* requested width */
  313. int height; /* requested height */
  314. int interleaved; /* image is interleaved (e.g. interleaved GIF) */
  315. AVPicture pict; /* returned allocated image */
  316. } AVImageInfo;
  317. /* AVImageFormat.flags field constants */
  318. #define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */
  319. typedef struct AVImageFormat {
  320. const char *name;
  321. const char *extensions;
  322. /* tell if a given file has a chance of being parsing by this format */
  323. int (*img_probe)(AVProbeData *);
  324. /* read a whole image. 'alloc_cb' is called when the image size is
  325. known so that the caller can allocate the image. If 'allo_cb'
  326. returns non zero, then the parsing is aborted. Return '0' if
  327. OK. */
  328. int (*img_read)(ByteIOContext *,
  329. int (*alloc_cb)(void *, AVImageInfo *info), void *);
  330. /* write the image */
  331. int supported_pixel_formats; /* mask of supported formats for output */
  332. int (*img_write)(ByteIOContext *, AVImageInfo *);
  333. int flags;
  334. struct AVImageFormat *next;
  335. } AVImageFormat;
  336. void av_register_image_format(AVImageFormat *img_fmt);
  337. AVImageFormat *av_probe_image_format(AVProbeData *pd);
  338. AVImageFormat *guess_image_format(const char *filename);
  339. enum CodecID av_guess_image2_codec(const char *filename);
  340. int av_read_image(ByteIOContext *pb, const char *filename,
  341. AVImageFormat *fmt,
  342. int (*alloc_cb)(void *, AVImageInfo *info), void *opaque);
  343. int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img);
  344. extern AVImageFormat *first_image_format;
  345. extern AVImageFormat pnm_image_format;
  346. extern AVImageFormat pbm_image_format;
  347. extern AVImageFormat pgm_image_format;
  348. extern AVImageFormat ppm_image_format;
  349. extern AVImageFormat pam_image_format;
  350. extern AVImageFormat pgmyuv_image_format;
  351. extern AVImageFormat yuv_image_format;
  352. #ifdef CONFIG_ZLIB
  353. extern AVImageFormat png_image_format;
  354. #endif
  355. extern AVImageFormat jpeg_image_format;
  356. extern AVImageFormat gif_image_format;
  357. extern AVImageFormat sgi_image_format;
  358. /* XXX: use automatic init with either ELF sections or C file parser */
  359. /* modules */
  360. /* mpeg.c */
  361. extern AVInputFormat mpegps_demux;
  362. int mpegps_init(void);
  363. /* mpegts.c */
  364. extern AVInputFormat mpegts_demux;
  365. int mpegts_init(void);
  366. /* rm.c */
  367. int rm_init(void);
  368. /* crc.c */
  369. int crc_init(void);
  370. /* img.c */
  371. int img_init(void);
  372. /* img2.c */
  373. int img2_init(void);
  374. /* asf.c */
  375. int asf_init(void);
  376. /* avienc.c */
  377. int avienc_init(void);
  378. /* avidec.c */
  379. int avidec_init(void);
  380. /* swf.c */
  381. int swf_init(void);
  382. /* mov.c */
  383. int mov_init(void);
  384. /* movenc.c */
  385. int movenc_init(void);
  386. /* flvenc.c */
  387. int flvenc_init(void);
  388. /* flvdec.c */
  389. int flvdec_init(void);
  390. /* jpeg.c */
  391. int jpeg_init(void);
  392. /* gif.c */
  393. int gif_init(void);
  394. /* au.c */
  395. int au_init(void);
  396. /* amr.c */
  397. int amr_init(void);
  398. /* wav.c */
  399. int ff_wav_init(void);
  400. /* raw.c */
  401. int pcm_read_seek(AVFormatContext *s,
  402. int stream_index, int64_t timestamp, int flags);
  403. int raw_init(void);
  404. /* mp3.c */
  405. int mp3_init(void);
  406. /* yuv4mpeg.c */
  407. int yuv4mpeg_init(void);
  408. /* ogg2.c */
  409. int ogg_init(void);
  410. /* ogg.c */
  411. int libogg_init(void);
  412. /* dv.c */
  413. int ff_dv_init(void);
  414. /* ffm.c */
  415. int ffm_init(void);
  416. /* rtsp.c */
  417. extern AVInputFormat redir_demux;
  418. int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f);
  419. /* 4xm.c */
  420. int fourxm_init(void);
  421. /* psxstr.c */
  422. int str_init(void);
  423. /* idroq.c */
  424. int roq_init(void);
  425. /* ipmovie.c */
  426. int ipmovie_init(void);
  427. /* nut.c */
  428. int nut_init(void);
  429. /* wc3movie.c */
  430. int wc3_init(void);
  431. /* westwood.c */
  432. int westwood_init(void);
  433. /* segafilm.c */
  434. int film_init(void);
  435. /* idcin.c */
  436. int idcin_init(void);
  437. /* flic.c */
  438. int flic_init(void);
  439. /* sierravmd.c */
  440. int vmd_init(void);
  441. /* matroska.c */
  442. int matroska_init(void);
  443. /* sol.c */
  444. int sol_init(void);
  445. /* electronicarts.c */
  446. int ea_init(void);
  447. /* nsvdec.c */
  448. int nsvdec_init(void);
  449. #include "rtp.h"
  450. #include "rtsp.h"
  451. /* yuv4mpeg.c */
  452. extern AVOutputFormat yuv4mpegpipe_oformat;
  453. /* utils.c */
  454. void av_register_input_format(AVInputFormat *format);
  455. void av_register_output_format(AVOutputFormat *format);
  456. AVOutputFormat *guess_stream_format(const char *short_name,
  457. const char *filename, const char *mime_type);
  458. AVOutputFormat *guess_format(const char *short_name,
  459. const char *filename, const char *mime_type);
  460. enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
  461. const char *filename, const char *mime_type, enum CodecType type);
  462. void av_hex_dump(FILE *f, uint8_t *buf, int size);
  463. void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
  464. void av_register_all(void);
  465. typedef struct FifoBuffer {
  466. uint8_t *buffer;
  467. uint8_t *rptr, *wptr, *end;
  468. } FifoBuffer;
  469. int fifo_init(FifoBuffer *f, int size);
  470. void fifo_free(FifoBuffer *f);
  471. int fifo_size(FifoBuffer *f, uint8_t *rptr);
  472. int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
  473. void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
  474. int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
  475. void fifo_realloc(FifoBuffer *f, unsigned int size);
  476. /* media file input */
  477. AVInputFormat *av_find_input_format(const char *short_name);
  478. AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
  479. int av_open_input_stream(AVFormatContext **ic_ptr,
  480. ByteIOContext *pb, const char *filename,
  481. AVInputFormat *fmt, AVFormatParameters *ap);
  482. int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
  483. AVInputFormat *fmt,
  484. int buf_size,
  485. AVFormatParameters *ap);
  486. /* no av_open for output, so applications will need this: */
  487. AVFormatContext *av_alloc_format_context(void);
  488. #define AVERROR_UNKNOWN (-1) /* unknown error */
  489. #define AVERROR_IO (-2) /* i/o error */
  490. #define AVERROR_NUMEXPECTED (-3) /* number syntax expected in filename */
  491. #define AVERROR_INVALIDDATA (-4) /* invalid data found */
  492. #define AVERROR_NOMEM (-5) /* not enough memory */
  493. #define AVERROR_NOFMT (-6) /* unknown format */
  494. #define AVERROR_NOTSUPP (-7) /* operation not supported */
  495. int av_find_stream_info(AVFormatContext *ic);
  496. int av_read_packet(AVFormatContext *s, AVPacket *pkt);
  497. int av_read_frame(AVFormatContext *s, AVPacket *pkt);
  498. int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags);
  499. int av_read_play(AVFormatContext *s);
  500. int av_read_pause(AVFormatContext *s);
  501. void av_close_input_file(AVFormatContext *s);
  502. AVStream *av_new_stream(AVFormatContext *s, int id);
  503. void av_set_pts_info(AVStream *s, int pts_wrap_bits,
  504. int pts_num, int pts_den);
  505. #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
  506. #define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
  507. #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non keyframes
  508. int av_find_default_stream_index(AVFormatContext *s);
  509. int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
  510. int av_add_index_entry(AVStream *st,
  511. int64_t pos, int64_t timestamp, int distance, int flags);
  512. int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags);
  513. /* media file output */
  514. int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
  515. int av_write_header(AVFormatContext *s);
  516. int av_write_frame(AVFormatContext *s, AVPacket *pkt);
  517. int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
  518. int av_write_trailer(AVFormatContext *s);
  519. void dump_format(AVFormatContext *ic,
  520. int index,
  521. const char *url,
  522. int is_output);
  523. int parse_image_size(int *width_ptr, int *height_ptr, const char *str);
  524. int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg);
  525. int64_t parse_date(const char *datestr, int duration);
  526. int64_t av_gettime(void);
  527. /* ffm specific for ffserver */
  528. #define FFM_PACKET_SIZE 4096
  529. offset_t ffm_read_write_index(int fd);
  530. void ffm_write_write_index(int fd, offset_t pos);
  531. void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size);
  532. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
  533. int get_frame_filename(char *buf, int buf_size,
  534. const char *path, int number);
  535. int filename_number_test(const char *filename);
  536. /* grab specific */
  537. int video_grab_init(void);
  538. int audio_init(void);
  539. /* DV1394 */
  540. int dv1394_init(void);
  541. int dc1394_init(void);
  542. #ifdef HAVE_AV_CONFIG_H
  543. #include "os_support.h"
  544. int strstart(const char *str, const char *val, const char **ptr);
  545. int stristart(const char *str, const char *val, const char **ptr);
  546. void pstrcpy(char *buf, int buf_size, const char *str);
  547. char *pstrcat(char *buf, int buf_size, const char *s);
  548. void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem);
  549. #ifdef __GNUC__
  550. #define dynarray_add(tab, nb_ptr, elem)\
  551. do {\
  552. typeof(tab) _tab = (tab);\
  553. typeof(elem) _elem = (elem);\
  554. (void)sizeof(**_tab == _elem); /* check that types are compatible */\
  555. __dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\
  556. } while(0)
  557. #else
  558. #define dynarray_add(tab, nb_ptr, elem)\
  559. do {\
  560. __dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\
  561. } while(0)
  562. #endif
  563. time_t mktimegm(struct tm *tm);
  564. struct tm *brktimegm(time_t secs, struct tm *tm);
  565. const char *small_strptime(const char *p, const char *fmt,
  566. struct tm *dt);
  567. struct in_addr;
  568. int resolve_host(struct in_addr *sin_addr, const char *hostname);
  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. int match_ext(const char *filename, const char *extensions);
  576. #endif /* HAVE_AV_CONFIG_H */
  577. #ifdef __cplusplus
  578. }
  579. #endif
  580. #endif /* AVFORMAT_H */