2 #define LIBAV_VERSION_INT 0x000406
3 #define LIBAV_VERSION "0.4.6"
4 #define LIBAV_BUILD 4600
10 /* packet functions */
12 typedef struct AVPacket
{
18 #define PKT_FLAG_KEY 0x0001
19 #define PKT_FLAG_DROPPED_FRAME 0x0002
22 int av_new_packet(AVPacket
*pkt
, int size
);
23 void av_free_packet(AVPacket
*pkt
);
25 /*************************************************/
28 struct AVFormatContext
;
29 struct AVFormatInputContext
;
31 typedef struct AVFormatParameters
{
37 enum PixelFormat pix_fmt
;
40 typedef struct AVFormat
{
42 const char *long_name
;
43 const char *mime_type
;
44 const char *extensions
; /* comma separated extensions */
47 enum CodecID audio_codec
; /* default audio codec */
48 enum CodecID video_codec
; /* default video codec */
49 int (*write_header
)(struct AVFormatContext
*);
50 int (*write_packet
)(struct AVFormatContext
*,
52 unsigned char *buf
, int size
, int force_pts
);
53 int (*write_trailer
)(struct AVFormatContext
*);
55 /* optional input support */
56 /* read the format header and initialize the AVFormatInputContext
57 structure. Return 0 if OK. 'ap' if non NULL contains
58 additionnal paramters. Only used in raw format right now */
59 int (*read_header
)(struct AVFormatContext
*,
60 AVFormatParameters
*ap
);
61 /* read one packet and put it in 'pkt'. pts and flags are also set */
62 int (*read_packet
)(struct AVFormatContext
*, AVPacket
*pkt
);
63 /* close the stream. The AVFormatContext and AVStreams are not
64 freed by this function */
65 int (*read_close
)(struct AVFormatContext
*);
66 /* seek at or before a given pts (given in microsecond). The pts
67 origin is defined by the stream */
68 int (*read_seek
)(struct AVFormatContext
*, INT64 pts
);
70 #define AVFMT_NOFILE 0x0001 /* no file should be opened */
71 #define AVFMT_NEEDNUMBER 0x0002 /* needs '%d' in filename */
72 struct AVFormat
*next
;
75 typedef struct AVStream
{
76 int id
; /* internal stream id */
77 AVCodecContext codec
; /* codec context */
81 #define MAX_STREAMS 20
83 /* format I/O context */
84 typedef struct AVFormatContext
{
85 struct AVFormat
*format
;
89 AVStream
*streams
[MAX_STREAMS
];
90 char filename
[1024]; /* input or output filename */
96 /* This buffer is only needed when packets were already buffered but
97 not decoded, for example to get the codec parameters in mpeg
99 struct AVPacketList
*packet_buffer
;
102 typedef struct AVPacketList
{
104 struct AVPacketList
*next
;
107 extern AVFormat
*first_format
;
110 extern AVFormat rm_format
;
113 extern AVFormat mpeg_mux_format
;
116 extern AVFormat asf_format
;
119 extern AVFormat avi_format
;
122 extern AVFormat mov_format
;
123 extern AVFormat mp4_format
;
126 extern AVFormat mpjpeg_format
;
127 extern AVFormat jpeg_format
;
128 extern AVFormat single_jpeg_format
;
131 extern AVFormat swf_format
;
134 extern AVFormat gif_format
;
136 extern AVFormat au_format
;
139 extern AVFormat wav_format
;
142 extern AVFormat pgm_format
;
143 extern AVFormat ppm_format
;
144 extern AVFormat pgmyuv_format
;
145 extern AVFormat imgyuv_format
;
147 extern AVFormat pgmpipe_format
;
148 extern AVFormat pgmyuvpipe_format
;
149 extern AVFormat ppmpipe_format
;
152 extern AVFormat mp2_format
;
153 extern AVFormat ac3_format
;
154 extern AVFormat h263_format
;
155 extern AVFormat mpeg1video_format
;
156 extern AVFormat mjpeg_format
;
157 extern AVFormat pcm_s16le_format
;
158 extern AVFormat pcm_s16be_format
;
159 extern AVFormat pcm_u16le_format
;
160 extern AVFormat pcm_u16be_format
;
161 extern AVFormat pcm_s8_format
;
162 extern AVFormat pcm_u8_format
;
163 extern AVFormat pcm_mulaw_format
;
164 extern AVFormat pcm_alaw_format
;
165 extern AVFormat rawvideo_format
;
168 extern AVFormat ffm_format
;
172 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
173 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
175 void register_avformat(AVFormat
*format
);
176 AVFormat
*guess_format(const char *short_name
, const char *filename
, const char *mime_type
);
178 int strstart(const char *str
, const char *val
, const char **ptr
);
179 void nstrcpy(char *buf
, int buf_size
, const char *str
);
180 int match_ext(const char *filename
, const char *extensions
);
182 void register_all(void);
186 typedef struct FifoBuffer
{
188 UINT8
*rptr
, *wptr
, *end
;
191 int fifo_init(FifoBuffer
*f
, int size
);
192 void fifo_free(FifoBuffer
*f
);
193 int fifo_size(FifoBuffer
*f
, UINT8
*rptr
);
194 int fifo_read(FifoBuffer
*f
, UINT8
*buf
, int buf_size
, UINT8
**rptr_ptr
);
195 void fifo_write(FifoBuffer
*f
, UINT8
*buf
, int size
, UINT8
**wptr_ptr
);
197 AVFormatContext
*av_open_input_file(const char *filename
,
198 const char *format_name
,
200 AVFormatParameters
*ap
);
201 int av_read_packet(AVFormatContext
*s
, AVPacket
*pkt
);
202 void av_close_input_file(AVFormatContext
*s
);
204 int av_write_packet(AVFormatContext
*s
, AVPacket
*pkt
, int force_pts
);
206 void dump_format(AVFormatContext
*ic
,
210 int parse_image_size(int *width_ptr
, int *height_ptr
, const char *str
);
212 INT64
parse_date(const char *datestr
, int duration
);
214 /* ffm specific for ffserver */
215 #define FFM_PACKET_SIZE 4096
216 offset_t
ffm_read_write_index(int fd
);
217 void ffm_write_write_index(int fd
, offset_t pos
);
218 void ffm_set_write_index(AVFormatContext
*s
, offset_t pos
, offset_t file_size
);
220 int find_info_tag(char *arg
, int arg_size
, const char *tag1
, const char *info
);
222 int get_frame_filename(char *buf
, int buf_size
,
223 const char *path
, int number
);
225 /* grab/output specific */
226 extern AVFormat video_grab_device_format
;
227 extern AVFormat audio_device_format
;
229 extern const char *v4l_device
;
230 extern const char *audio_device
;