annotate Plugins/Input/shorten/avformat.h @ 916:4be0046a09e4 trunk

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