comparison avformat.h @ 186:2265d21a04c8 libavformat

added stream start time and duration API - AV_NOPTS_VALUE is no longer zero
author bellard
date Fri, 08 Aug 2003 17:49:27 +0000
parents 2438e76dde67
children 85def00971c3
comparison
equal deleted inserted replaced
185:d98ed04d62a6 186:2265d21a04c8
5 extern "C" { 5 extern "C" {
6 #endif 6 #endif
7 7
8 #define LIBAVFORMAT_VERSION_INT 0x000406 8 #define LIBAVFORMAT_VERSION_INT 0x000406
9 #define LIBAVFORMAT_VERSION "0.4.6" 9 #define LIBAVFORMAT_VERSION "0.4.6"
10 #define LIBAVFORMAT_BUILD 4605 10 #define LIBAVFORMAT_BUILD 4606
11 11
12 #include "avcodec.h" 12 #include "avcodec.h"
13 13
14 #include "avio.h" 14 #include "avio.h"
15 15
16 /* packet functions */ 16 /* packet functions */
17 17
18 #define AV_NOPTS_VALUE 0 18 #ifndef MAXINT64
19 #define MAXINT64 int64_t_C(0x7fffffffffffffff)
20 #endif
21
22 #ifndef MININT64
23 #define MININT64 int64_t_C(0x8000000000000000)
24 #endif
25
26 #define AV_NOPTS_VALUE MININT64
27 #define AV_TIME_BASE 1000000
19 28
20 typedef struct AVPacket { 29 typedef struct AVPacket {
21 int64_t pts; /* presentation time stamp in stream units (set av_set_pts_info) */ 30 int64_t pts; /* presentation time stamp in stream units (set av_set_pts_info) */
22 uint8_t *data; 31 uint8_t *data;
23 int size; 32 int size;
162 int index; /* stream index in AVFormatContext */ 171 int index; /* stream index in AVFormatContext */
163 int id; /* format specific stream id */ 172 int id; /* format specific stream id */
164 AVCodecContext codec; /* codec context */ 173 AVCodecContext codec; /* codec context */
165 int r_frame_rate; /* real frame rate of the stream */ 174 int r_frame_rate; /* real frame rate of the stream */
166 int r_frame_rate_base;/* real frame rate base of the stream */ 175 int r_frame_rate_base;/* real frame rate base of the stream */
167 uint64_t time_length; /* real length of the stream in miliseconds */
168 void *priv_data; 176 void *priv_data;
169 /* internal data used in av_find_stream_info() */ 177 /* internal data used in av_find_stream_info() */
170 int codec_info_state; 178 int codec_info_state;
171 int codec_info_nb_repeat_frames; 179 int codec_info_nb_repeat_frames;
172 int codec_info_nb_real_frames; 180 int codec_info_nb_real_frames;
175 /* ffmpeg.c private use */ 183 /* ffmpeg.c private use */
176 int stream_copy; /* if TRUE, just copy stream */ 184 int stream_copy; /* if TRUE, just copy stream */
177 /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame 185 /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
178 * MN:dunno if thats the right place, for it */ 186 * MN:dunno if thats the right place, for it */
179 float quality; 187 float quality;
188 /* decoding: position of the first frame of the component, in
189 AV_TIME_BASE fractional seconds. */
190 int64_t start_time;
191 /* decoding: duration of the stream, in AV_TIME_BASE fractional
192 seconds. */
193 int64_t duration;
180 } AVStream; 194 } AVStream;
181 195
182 #define MAX_STREAMS 20 196 #define MAX_STREAMS 20
183 197
184 /* format I/O context */ 198 /* format I/O context */
201 int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */ 215 int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
202 int pts_num, pts_den; /* value to convert to seconds */ 216 int pts_num, pts_den; /* value to convert to seconds */
203 /* This buffer is only needed when packets were already buffered but 217 /* This buffer is only needed when packets were already buffered but
204 not decoded, for example to get the codec parameters in mpeg 218 not decoded, for example to get the codec parameters in mpeg
205 streams */ 219 streams */
206 struct AVPacketList *packet_buffer; 220 struct AVPacketList *packet_buffer;
221
222 /* decoding: position of the first frame of the component, in
223 AV_TIME_BASE fractional seconds. NEVER set this value directly:
224 it is deduced from the AVStream values. */
225 int64_t start_time;
226 /* decoding: duration of the stream, in AV_TIME_BASE fractional
227 seconds. NEVER set this value directly: it is deduced from the
228 AVStream values. */
229 int64_t duration;
230 /* decoding: total file size. 0 if unknown */
231 int64_t file_size;
232 /* decoding: total stream bitrate in bit/s, 0 if not
233 available. Never set it directly if the file_size and the
234 duration are known as ffmpeg can compute it automatically. */
235 int bit_rate;
207 } AVFormatContext; 236 } AVFormatContext;
208 237
209 typedef struct AVPacketList { 238 typedef struct AVPacketList {
210 AVPacket pkt; 239 AVPacket pkt;
211 struct AVPacketList *next; 240 struct AVPacketList *next;
272 301
273 /* XXX: use automatic init with either ELF sections or C file parser */ 302 /* XXX: use automatic init with either ELF sections or C file parser */
274 /* modules */ 303 /* modules */
275 304
276 /* mpeg.c */ 305 /* mpeg.c */
306 extern AVInputFormat mpegps_demux;
277 int mpegps_init(void); 307 int mpegps_init(void);
278 308
279 /* mpegts.c */ 309 /* mpegts.c */
280 extern AVInputFormat mpegts_demux; 310 extern AVInputFormat mpegts_demux;
281 int mpegts_init(void); 311 int mpegts_init(void);