Commit | Line | Data |
---|---|---|
de6d9b64 | 1 | |
4b1f4f23 J |
2 | #define LIBAV_VERSION_INT 0x000406 |
3 | #define LIBAV_VERSION "0.4.6" | |
92b3e125 | 4 | #define LIBAV_BUILD 4601 |
4b1f4f23 | 5 | |
de6d9b64 FB |
6 | #include "avcodec.h" |
7 | ||
de6d9b64 FB |
8 | #include "avio.h" |
9 | ||
10 | /* packet functions */ | |
11 | ||
12 | typedef struct AVPacket { | |
13 | INT64 pts; | |
14 | UINT8 *data; | |
15 | int size; | |
16 | int stream_index; | |
17 | int flags; | |
6d9872f4 | 18 | int duration; |
de6d9b64 | 19 | #define PKT_FLAG_KEY 0x0001 |
4606ac8d | 20 | #define PKT_FLAG_DROPPED_FRAME 0x0002 |
de6d9b64 FB |
21 | } AVPacket; |
22 | ||
23 | int av_new_packet(AVPacket *pkt, int size); | |
24 | void av_free_packet(AVPacket *pkt); | |
25 | ||
26 | /*************************************************/ | |
27 | /* output formats */ | |
28 | ||
29 | struct AVFormatContext; | |
30 | struct AVFormatInputContext; | |
31 | ||
32 | typedef struct AVFormatParameters { | |
33 | int frame_rate; | |
34 | int sample_rate; | |
35 | int channels; | |
36 | int width; | |
37 | int height; | |
4606ac8d | 38 | enum PixelFormat pix_fmt; |
de6d9b64 FB |
39 | } AVFormatParameters; |
40 | ||
41 | typedef struct AVFormat { | |
42 | const char *name; | |
43 | const char *long_name; | |
44 | const char *mime_type; | |
45 | const char *extensions; /* comma separated extensions */ | |
46 | ||
47 | /* output support */ | |
48 | enum CodecID audio_codec; /* default audio codec */ | |
49 | enum CodecID video_codec; /* default video codec */ | |
50 | int (*write_header)(struct AVFormatContext *); | |
51 | int (*write_packet)(struct AVFormatContext *, | |
52 | int stream_index, | |
10bb7023 | 53 | unsigned char *buf, int size, int force_pts); |
de6d9b64 FB |
54 | int (*write_trailer)(struct AVFormatContext *); |
55 | ||
56 | /* optional input support */ | |
57 | /* read the format header and initialize the AVFormatInputContext | |
58 | structure. Return 0 if OK. 'ap' if non NULL contains | |
59 | additionnal paramters. Only used in raw format right now */ | |
60 | int (*read_header)(struct AVFormatContext *, | |
61 | AVFormatParameters *ap); | |
62 | /* read one packet and put it in 'pkt'. pts and flags are also set */ | |
63 | int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); | |
64 | /* close the stream. The AVFormatContext and AVStreams are not | |
65 | freed by this function */ | |
66 | int (*read_close)(struct AVFormatContext *); | |
67 | /* seek at or before a given pts (given in microsecond). The pts | |
68 | origin is defined by the stream */ | |
69 | int (*read_seek)(struct AVFormatContext *, INT64 pts); | |
70 | int flags; | |
813cae4b FB |
71 | #define AVFMT_NOFILE 0x0001 /* no file should be opened */ |
72 | #define AVFMT_NEEDNUMBER 0x0002 /* needs '%d' in filename */ | |
de6d9b64 FB |
73 | struct AVFormat *next; |
74 | } AVFormat; | |
75 | ||
76 | typedef struct AVStream { | |
77 | int id; /* internal stream id */ | |
78 | AVCodecContext codec; /* codec context */ | |
76c0441b | 79 | int r_frame_rate; /* real frame rate of the stream */ |
de6d9b64 FB |
80 | void *priv_data; |
81 | } AVStream; | |
82 | ||
83 | #define MAX_STREAMS 20 | |
84 | ||
85 | /* format I/O context */ | |
86 | typedef struct AVFormatContext { | |
87 | struct AVFormat *format; | |
88 | void *priv_data; | |
89 | ByteIOContext pb; | |
90 | int nb_streams; | |
91 | AVStream *streams[MAX_STREAMS]; | |
92 | char filename[1024]; /* input or output filename */ | |
93 | /* stream info */ | |
94 | char title[512]; | |
95 | char author[512]; | |
96 | char copyright[512]; | |
97 | char comment[512]; | |
92b3e125 | 98 | int flags; /* format specific flags */ |
de6d9b64 FB |
99 | /* This buffer is only needed when packets were already buffered but |
100 | not decoded, for example to get the codec parameters in mpeg | |
101 | streams */ | |
102 | struct AVPacketList *packet_buffer; | |
103 | } AVFormatContext; | |
104 | ||
105 | typedef struct AVPacketList { | |
106 | AVPacket pkt; | |
107 | struct AVPacketList *next; | |
108 | } AVPacketList; | |
109 | ||
110 | extern AVFormat *first_format; | |
111 | ||
112 | /* rv10enc.c */ | |
113 | extern AVFormat rm_format; | |
114 | ||
115 | /* mpegmux.c */ | |
92b3e125 | 116 | #define AVF_FLAG_VCD 0x00000001 /* VCD compatible MPEG-PS */ |
de6d9b64 FB |
117 | extern AVFormat mpeg_mux_format; |
118 | ||
119 | /* asfenc.c */ | |
120 | extern AVFormat asf_format; | |
121 | ||
122 | /* avienc.c */ | |
123 | extern AVFormat avi_format; | |
124 | ||
6cea494e ZK |
125 | /* mov.c */ |
126 | extern AVFormat mov_format; | |
127 | extern AVFormat mp4_format; | |
128 | ||
de6d9b64 FB |
129 | /* jpegenc.c */ |
130 | extern AVFormat mpjpeg_format; | |
131 | extern AVFormat jpeg_format; | |
eea23282 | 132 | extern AVFormat single_jpeg_format; |
de6d9b64 FB |
133 | |
134 | /* swfenc.c */ | |
135 | extern AVFormat swf_format; | |
136 | ||
6cea494e ZK |
137 | /* gif.c */ |
138 | extern AVFormat gif_format; | |
139 | /* au.c */ | |
140 | extern AVFormat au_format; | |
141 | ||
de6d9b64 FB |
142 | /* wav.c */ |
143 | extern AVFormat wav_format; | |
144 | ||
1ea4f593 FB |
145 | /* crc.c */ |
146 | extern AVFormat crc_format; | |
147 | ||
de6d9b64 FB |
148 | /* img.c */ |
149 | extern AVFormat pgm_format; | |
6775c758 | 150 | extern AVFormat ppm_format; |
de6d9b64 FB |
151 | extern AVFormat pgmyuv_format; |
152 | extern AVFormat imgyuv_format; | |
6775c758 | 153 | |
de6d9b64 | 154 | extern AVFormat pgmpipe_format; |
6775c758 FB |
155 | extern AVFormat pgmyuvpipe_format; |
156 | extern AVFormat ppmpipe_format; | |
de6d9b64 FB |
157 | |
158 | /* raw.c */ | |
159 | extern AVFormat mp2_format; | |
160 | extern AVFormat ac3_format; | |
161 | extern AVFormat h263_format; | |
162 | extern AVFormat mpeg1video_format; | |
eea23282 | 163 | extern AVFormat mjpeg_format; |
5ed8fafc FB |
164 | extern AVFormat pcm_s16le_format; |
165 | extern AVFormat pcm_s16be_format; | |
166 | extern AVFormat pcm_u16le_format; | |
167 | extern AVFormat pcm_u16be_format; | |
168 | extern AVFormat pcm_s8_format; | |
169 | extern AVFormat pcm_u8_format; | |
170 | extern AVFormat pcm_mulaw_format; | |
171 | extern AVFormat pcm_alaw_format; | |
de6d9b64 FB |
172 | extern AVFormat rawvideo_format; |
173 | ||
174 | /* ffm.c */ | |
175 | extern AVFormat ffm_format; | |
176 | ||
177 | /* formats.c */ | |
178 | ||
179 | #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) | |
180 | #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) | |
181 | ||
182 | void register_avformat(AVFormat *format); | |
183 | AVFormat *guess_format(const char *short_name, const char *filename, const char *mime_type); | |
184 | ||
185 | int strstart(const char *str, const char *val, const char **ptr); | |
186 | void nstrcpy(char *buf, int buf_size, const char *str); | |
28338371 PG |
187 | /* This does what strncpy ought to do. */ |
188 | void strlcpy(char *dst, const char *src, int dst_size); | |
de6d9b64 FB |
189 | int match_ext(const char *filename, const char *extensions); |
190 | ||
191 | void register_all(void); | |
192 | ||
193 | INT64 gettime(void); | |
194 | ||
195 | typedef struct FifoBuffer { | |
196 | UINT8 *buffer; | |
197 | UINT8 *rptr, *wptr, *end; | |
198 | } FifoBuffer; | |
199 | ||
200 | int fifo_init(FifoBuffer *f, int size); | |
201 | void fifo_free(FifoBuffer *f); | |
202 | int fifo_size(FifoBuffer *f, UINT8 *rptr); | |
203 | int fifo_read(FifoBuffer *f, UINT8 *buf, int buf_size, UINT8 **rptr_ptr); | |
204 | void fifo_write(FifoBuffer *f, UINT8 *buf, int size, UINT8 **wptr_ptr); | |
205 | ||
96baaa6a FB |
206 | AVFormatContext *av_open_input_file(const char *filename, |
207 | const char *format_name, | |
208 | int buf_size, | |
209 | AVFormatParameters *ap); | |
de6d9b64 FB |
210 | int av_read_packet(AVFormatContext *s, AVPacket *pkt); |
211 | void av_close_input_file(AVFormatContext *s); | |
212 | ||
10bb7023 | 213 | int av_write_packet(AVFormatContext *s, AVPacket *pkt, int force_pts); |
de6d9b64 FB |
214 | |
215 | void dump_format(AVFormatContext *ic, | |
216 | int index, | |
217 | const char *url, | |
218 | int is_output); | |
219 | int parse_image_size(int *width_ptr, int *height_ptr, const char *str); | |
220 | INT64 gettime(void); | |
221 | INT64 parse_date(const char *datestr, int duration); | |
222 | ||
223 | /* ffm specific for ffserver */ | |
224 | #define FFM_PACKET_SIZE 4096 | |
225 | offset_t ffm_read_write_index(int fd); | |
226 | void ffm_write_write_index(int fd, offset_t pos); | |
227 | void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size); | |
228 | ||
229 | int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); | |
230 | ||
813cae4b FB |
231 | int get_frame_filename(char *buf, int buf_size, |
232 | const char *path, int number); | |
96baaa6a FB |
233 | |
234 | /* grab/output specific */ | |
235 | extern AVFormat video_grab_device_format; | |
236 | extern AVFormat audio_device_format; | |
237 | ||
238 | extern const char *v4l_device; | |
239 | extern const char *audio_device; |