Commit 97413493 authored by michaelni's avatar michaelni

export pts from stream if available

store pts in stream if available (otherwise use frame_rate)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@923 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ffde2379
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#define LIBAVCODEC_VERSION_INT 0x000406 #define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6" #define LIBAVCODEC_VERSION "0.4.6"
#define LIBAVCODEC_BUILD 4621 #define LIBAVCODEC_BUILD 4622
#define LIBAVCODEC_BUILD_STR "4621" #define LIBAVCODEC_BUILD_STR "4622"
enum CodecID { enum CodecID {
CODEC_ID_NONE, CODEC_ID_NONE,
...@@ -318,6 +318,11 @@ typedef struct AVCodecContext { ...@@ -318,6 +318,11 @@ typedef struct AVCodecContext {
#define FF_DCT_MMX 3 #define FF_DCT_MMX 3
#define FF_DCT_MLIB 4 #define FF_DCT_MLIB 4
long long int pts; /* timestamp in micro seconds
for decoding: the timestamp from the stream or 0
for encoding: the timestamp which will be stored in the stream
if 0 then the frame_rate will be used */
//FIXME this should be reordered after kabis API is finished ... //FIXME this should be reordered after kabis API is finished ...
//TODO kill kabi //TODO kill kabi
/* /*
...@@ -330,7 +335,7 @@ typedef struct AVCodecContext { ...@@ -330,7 +335,7 @@ typedef struct AVCodecContext {
*/ */
unsigned long long int unsigned long long int
ull_res0,ull_res1,ull_res2,ull_res3,ull_res4,ull_res5, ull_res0,ull_res1,ull_res2,ull_res3,ull_res4,ull_res5,
ull_res6,ull_res7,ull_res8,ull_res9,ull_res10,ull_res11,ull_res12; ull_res6,ull_res7,ull_res8,ull_res9,ull_res10,ull_res11;
float float
flt_res0,flt_res1,flt_res2,flt_res3,flt_res4,flt_res5, flt_res0,flt_res1,flt_res2,flt_res3,flt_res4,flt_res5,
flt_res6,flt_res7,flt_res8,flt_res9,flt_res10,flt_res11,flt_res12; flt_res6,flt_res7,flt_res8,flt_res9,flt_res10,flt_res11,flt_res12;
......
...@@ -1315,6 +1315,9 @@ void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){ ...@@ -1315,6 +1315,9 @@ void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){
s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1; s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1;
} }
if(s->avctx->pts)
s->time= (s->avctx->pts*s->time_increment_resolution + 500*1000)/(1000*1000);
else
s->time= picture_number*(INT64)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate; s->time= picture_number*(INT64)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate;
time_div= s->time/s->time_increment_resolution; time_div= s->time/s->time_increment_resolution;
time_mod= s->time%s->time_increment_resolution; time_mod= s->time%s->time_increment_resolution;
...@@ -3994,6 +3997,8 @@ int mpeg4_decode_picture_header(MpegEncContext * s) ...@@ -3994,6 +3997,8 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
} }
} }
s->avctx->pts= s->time*1000LL*1000LL / s->time_increment_resolution;
if(check_marker(&s->gb, "before vop_coded")==0 && s->picture_number==0){ if(check_marker(&s->gb, "before vop_coded")==0 && s->picture_number==0){
printf("hmm, seems the headers arnt complete, trying to guess time_increment_bits\n"); printf("hmm, seems the headers arnt complete, trying to guess time_increment_bits\n");
for(s->time_increment_bits++ ;s->time_increment_bits<16; s->time_increment_bits++){ for(s->time_increment_bits++ ;s->time_increment_bits<16; s->time_increment_bits++){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment