8 typedef struct AVPacket {
14 #define PKT_FLAG_KEY 0x0001
17 int av_new_packet(AVPacket *pkt, int size);
18 void av_free_packet(AVPacket *pkt);
20 /*************************************************/
23 struct AVFormatContext;
24 struct AVFormatInputContext;
26 typedef struct AVFormatParameters {
35 typedef struct AVFormat {
37 const char *long_name;
38 const char *mime_type;
39 const char *extensions; /* comma separated extensions */
42 enum CodecID audio_codec; /* default audio codec */
43 enum CodecID video_codec; /* default video codec */
44 int (*write_header)(struct AVFormatContext *);
45 int (*write_packet)(struct AVFormatContext *,
47 unsigned char *buf, int size);
48 int (*write_trailer)(struct AVFormatContext *);
50 /* optional input support */
51 /* read the format header and initialize the AVFormatInputContext
52 structure. Return 0 if OK. 'ap' if non NULL contains
53 additionnal paramters. Only used in raw format right now */
54 int (*read_header)(struct AVFormatContext *,
55 AVFormatParameters *ap);
56 /* read one packet and put it in 'pkt'. pts and flags are also set */
57 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
58 /* close the stream. The AVFormatContext and AVStreams are not
59 freed by this function */
60 int (*read_close)(struct AVFormatContext *);
61 /* seek at or before a given pts (given in microsecond). The pts
62 origin is defined by the stream */
63 int (*read_seek)(struct AVFormatContext *, INT64 pts);
65 #define AVFMT_NOFILE 0x0001 /* no file should be opened */
66 #define AVFMT_NEEDNUMBER 0x0002 /* needs '%d' in filename */
67 struct AVFormat *next;
70 typedef struct AVStream {
71 int id; /* internal stream id */
72 AVCodecContext codec; /* codec context */
76 #define MAX_STREAMS 20
78 /* format I/O context */
79 typedef struct AVFormatContext {
80 struct AVFormat *format;
84 AVStream *streams[MAX_STREAMS];
85 char filename[1024]; /* input or output filename */
91 /* This buffer is only needed when packets were already buffered but
92 not decoded, for example to get the codec parameters in mpeg
94 struct AVPacketList *packet_buffer;
97 typedef struct AVPacketList {
99 struct AVPacketList *next;
102 extern AVFormat *first_format;
105 extern AVFormat rm_format;
108 extern AVFormat mpeg_mux_format;
111 extern AVFormat asf_format;
114 extern AVFormat avi_format;
117 extern AVFormat mpjpeg_format;
118 extern AVFormat jpeg_format;
119 extern AVFormat single_jpeg_format;
122 extern AVFormat swf_format;
125 extern AVFormat wav_format;
128 extern AVFormat pgm_format;
129 extern AVFormat ppm_format;
130 extern AVFormat pgmyuv_format;
131 extern AVFormat imgyuv_format;
133 extern AVFormat pgmpipe_format;
134 extern AVFormat pgmyuvpipe_format;
135 extern AVFormat ppmpipe_format;
138 extern AVFormat mp2_format;
139 extern AVFormat ac3_format;
140 extern AVFormat h263_format;
141 extern AVFormat mpeg1video_format;
142 extern AVFormat mjpeg_format;
143 extern AVFormat pcm_s16le_format;
144 extern AVFormat pcm_s16be_format;
145 extern AVFormat pcm_u16le_format;
146 extern AVFormat pcm_u16be_format;
147 extern AVFormat pcm_s8_format;
148 extern AVFormat pcm_u8_format;
149 extern AVFormat pcm_mulaw_format;
150 extern AVFormat pcm_alaw_format;
151 extern AVFormat rawvideo_format;
154 extern AVFormat ffm_format;
158 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
159 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
161 void register_avformat(AVFormat *format);
162 AVFormat *guess_format(const char *short_name, const char *filename, const char *mime_type);
164 int strstart(const char *str, const char *val, const char **ptr);
165 void nstrcpy(char *buf, int buf_size, const char *str);
166 int match_ext(const char *filename, const char *extensions);
168 void register_all(void);
172 typedef struct FifoBuffer {
174 UINT8 *rptr, *wptr, *end;
177 int fifo_init(FifoBuffer *f, int size);
178 void fifo_free(FifoBuffer *f);
179 int fifo_size(FifoBuffer *f, UINT8 *rptr);
180 int fifo_read(FifoBuffer *f, UINT8 *buf, int buf_size, UINT8 **rptr_ptr);
181 void fifo_write(FifoBuffer *f, UINT8 *buf, int size, UINT8 **wptr_ptr);
183 AVFormatContext *av_open_input_file(const char *filename, int buf_size);
184 int av_read_packet(AVFormatContext *s, AVPacket *pkt);
185 void av_close_input_file(AVFormatContext *s);
187 int av_write_packet(AVFormatContext *s, AVPacket *pkt);
189 void dump_format(AVFormatContext *ic,
193 int parse_image_size(int *width_ptr, int *height_ptr, const char *str);
195 INT64 parse_date(const char *datestr, int duration);
197 /* ffm specific for ffserver */
198 #define FFM_PACKET_SIZE 4096
199 offset_t ffm_read_write_index(int fd);
200 void ffm_write_write_index(int fd, offset_t pos);
201 void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size);
203 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
205 int get_frame_filename(char *buf, int buf_size,
206 const char *path, int number);