4 #define FFMPEG_VERSION "0.4.5"
10 typedef struct AVPacket
{
16 #define PKT_FLAG_KEY 0x0001
19 int av_new_packet(AVPacket
*pkt
, int size
);
20 void av_free_packet(AVPacket
*pkt
);
22 /*************************************************/
25 struct AVFormatContext
;
26 struct AVFormatInputContext
;
28 typedef struct AVFormatParameters
{
37 typedef struct AVFormat
{
39 const char *long_name
;
40 const char *mime_type
;
41 const char *extensions
; /* comma separated extensions */
44 enum CodecID audio_codec
; /* default audio codec */
45 enum CodecID video_codec
; /* default video codec */
46 int (*write_header
)(struct AVFormatContext
*);
47 int (*write_packet
)(struct AVFormatContext
*,
49 unsigned char *buf
, int size
);
50 int (*write_trailer
)(struct AVFormatContext
*);
52 /* optional input support */
53 /* read the format header and initialize the AVFormatInputContext
54 structure. Return 0 if OK. 'ap' if non NULL contains
55 additionnal paramters. Only used in raw format right now */
56 int (*read_header
)(struct AVFormatContext
*,
57 AVFormatParameters
*ap
);
58 /* read one packet and put it in 'pkt'. pts and flags are also set */
59 int (*read_packet
)(struct AVFormatContext
*, AVPacket
*pkt
);
60 /* close the stream. The AVFormatContext and AVStreams are not
61 freed by this function */
62 int (*read_close
)(struct AVFormatContext
*);
63 /* seek at or before a given pts (given in microsecond). The pts
64 origin is defined by the stream */
65 int (*read_seek
)(struct AVFormatContext
*, INT64 pts
);
67 #define AVFMT_NOFILE 0x0001 /* no file should be opened */
68 struct AVFormat
*next
;
71 typedef struct AVStream
{
72 int id
; /* internal stream id */
73 AVCodecContext codec
; /* codec context */
77 #define MAX_STREAMS 20
79 /* format I/O context */
80 typedef struct AVFormatContext
{
81 struct AVFormat
*format
;
85 AVStream
*streams
[MAX_STREAMS
];
86 char filename
[1024]; /* input or output filename */
92 /* This buffer is only needed when packets were already buffered but
93 not decoded, for example to get the codec parameters in mpeg
95 struct AVPacketList
*packet_buffer
;
98 typedef struct AVPacketList
{
100 struct AVPacketList
*next
;
103 extern AVFormat
*first_format
;
106 extern AVFormat rm_format
;
109 extern AVFormat mpeg_mux_format
;
112 extern AVFormat asf_format
;
115 extern AVFormat avi_format
;
118 extern AVFormat mpjpeg_format
;
119 extern AVFormat jpeg_format
;
122 extern AVFormat swf_format
;
125 extern AVFormat wav_format
;
128 extern AVFormat pgm_format
;
129 extern AVFormat pgmyuv_format
;
130 extern AVFormat imgyuv_format
;
131 extern AVFormat pgmpipe_format
;
134 extern AVFormat mp2_format
;
135 extern AVFormat ac3_format
;
136 extern AVFormat h263_format
;
137 extern AVFormat mpeg1video_format
;
138 extern AVFormat pcm_format
;
139 extern AVFormat rawvideo_format
;
142 extern AVFormat ffm_format
;
146 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
147 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
149 void register_avformat(AVFormat
*format
);
150 AVFormat
*guess_format(const char *short_name
, const char *filename
, const char *mime_type
);
152 int strstart(const char *str
, const char *val
, const char **ptr
);
153 void nstrcpy(char *buf
, int buf_size
, const char *str
);
154 int match_ext(const char *filename
, const char *extensions
);
156 void register_all(void);
160 typedef struct FifoBuffer
{
162 UINT8
*rptr
, *wptr
, *end
;
165 int fifo_init(FifoBuffer
*f
, int size
);
166 void fifo_free(FifoBuffer
*f
);
167 int fifo_size(FifoBuffer
*f
, UINT8
*rptr
);
168 int fifo_read(FifoBuffer
*f
, UINT8
*buf
, int buf_size
, UINT8
**rptr_ptr
);
169 void fifo_write(FifoBuffer
*f
, UINT8
*buf
, int size
, UINT8
**wptr_ptr
);
171 AVFormatContext
*av_open_input_file(const char *filename
, int buf_size
);
172 int av_read_packet(AVFormatContext
*s
, AVPacket
*pkt
);
173 void av_close_input_file(AVFormatContext
*s
);
175 int av_write_packet(AVFormatContext
*s
, AVPacket
*pkt
);
177 void dump_format(AVFormatContext
*ic
,
181 int parse_image_size(int *width_ptr
, int *height_ptr
, const char *str
);
183 INT64
parse_date(const char *datestr
, int duration
);
185 /* ffm specific for ffserver */
186 #define FFM_PACKET_SIZE 4096
187 offset_t
ffm_read_write_index(int fd
);
188 void ffm_write_write_index(int fd
, offset_t pos
);
189 void ffm_set_write_index(AVFormatContext
*s
, offset_t pos
, offset_t file_size
);
191 int find_info_tag(char *arg
, int arg_size
, const char *tag1
, const char *info
);