[Ffmpeg-cvslog] CVS: ffmpeg/libavformat 4xm.c, 1.16, 1.17 asf-enc.c, 1.70, 1.71 asf.c, 1.78, 1.79 avformat.h, 1.118, 1.119 avidec.c, 1.69, 1.70 avienc.c, 1.103, 1.104 dc1394.c, 1.2, 1.3 dv.c, 1.41, 1.42 ffm.c, 1.37, 1.38 flvdec.c, 1.17, 1.18 gif.c, 1.17, 1.18 gifdec.c, 1.7, 1.8 grab.c, 1.33, 1.34 img.c, 1.39, 1.40 img2.c, 1.14, 1.15 mov.c, 1.78, 1.79 movenc.c, 1.37, 1.38 mpegts.c, 1.26, 1.27 nsvdec.c, 1.6, 1.7 nut.c, 1.47, 1.48 raw.c, 1.50, 1.51 rm.c, 1.45, 1.46 rtp.c, 1.15, 1.16 swf.c, 1.23, 1.24 utils.c, 1.141, 1.142 yuv4mpeg.c, 1.21, 1.22

Michael Niedermayer CVS michael
Sat Apr 30 23:44:03 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv21767/libavformat

Modified Files:
	4xm.c asf-enc.c asf.c avformat.h avidec.c avienc.c dc1394.c 
	dv.c ffm.c flvdec.c gif.c gifdec.c grab.c img.c img2.c mov.c 
	movenc.c mpegts.c nsvdec.c nut.c raw.c rm.c rtp.c swf.c 
	utils.c yuv4mpeg.c 
Log Message:
switch to native time bases


Index: 4xm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/4xm.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- 4xm.c	26 Apr 2005 10:01:17 -0000	1.16
+++ 4xm.c	30 Apr 2005 21:43:57 -0000	1.17
@@ -166,8 +166,6 @@
 
             fourxm->video_stream_index = st->index;
 
-            st->codec.frame_rate = fourxm->fps;
-            st->codec.frame_rate_base = 1.0;
             st->codec.codec_type = CODEC_TYPE_VIDEO;
             st->codec.codec_id = CODEC_ID_4XM;
             st->codec.codec_tag = 0;  /* no fourcc */

Index: asf-enc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/asf-enc.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- asf-enc.c	23 Mar 2005 13:30:27 -0000	1.70
+++ asf-enc.c	30 Apr 2005 21:43:57 -0000	1.71
@@ -740,7 +740,7 @@
             duration = (codec->frame_number * (int64_t)codec->frame_size * int64_t_C(10000000)) /
                 codec->sample_rate;
         } else {
-            duration = av_rescale(codec->frame_number * (int64_t)codec->frame_rate_base, 10000000, codec->frame_rate);
+            duration = av_rescale(codec->frame_number * (int64_t)codec->time_base.num, 10000000, codec->time_base.den);
         }
     } else {
         duration = pts * 10000;

Index: asf.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/asf.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- asf.c	24 Apr 2005 17:21:11 -0000	1.78
+++ asf.c	30 Apr 2005 21:43:58 -0000	1.79
@@ -196,9 +196,9 @@
             if (!asf_st)
                 goto fail;
             st->priv_data = asf_st;
-            st->start_time = asf->hdr.preroll * (int64_t)AV_TIME_BASE / 1000;
+            st->start_time = asf->hdr.preroll;
             st->duration = asf->hdr.send_time / 
-                (10000000 / AV_TIME_BASE) - st->start_time;
+                (10000000 / 1000) - st->start_time;
             get_guid(pb, &g);
             if (!memcmp(&g, &audio_stream, sizeof(GUID))) {
                 type = CODEC_TYPE_AUDIO;
@@ -217,9 +217,6 @@
 
             get_le32(pb);
 	    st->codec.codec_type = type;
-            /* 1 fps default (XXX: put 0 fps instead) */
-            st->codec.frame_rate = 1000; 
-            st->codec.frame_rate_base = 1;
             if (type == CODEC_TYPE_AUDIO) {
                 get_wav_header(pb, &st->codec, type_specific_size);
                 st->need_parsing = 1;

Index: avformat.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avformat.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- avformat.h	9 Apr 2005 15:32:58 -0000	1.118
+++ avformat.h	30 Apr 2005 21:43:58 -0000	1.119
@@ -5,7 +5,7 @@
 extern "C" {
 #endif
 
-#define LIBAVFORMAT_BUILD       4623
+#define LIBAVFORMAT_BUILD       4624
 
 #define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT
 #define LIBAVFORMAT_VERSION     FFMPEG_VERSION
@@ -98,8 +98,7 @@
 #define AVPROBE_SCORE_MAX 100
 
 typedef struct AVFormatParameters {
-    int frame_rate;
-    int frame_rate_base;
+    AVRational time_base;
     int sample_rate;
     int channels;
     int width;
@@ -225,8 +224,7 @@
     int index;    /* stream index in AVFormatContext */
     int id;       /* format specific stream id */
     AVCodecContext codec; /* codec context */
-    int r_frame_rate;     /* real frame rate of the stream */
-    int r_frame_rate_base;/* real frame rate base of the stream */
+    AVRational r_frame_rate;     /* real frame rate of the stream */
     void *priv_data;
     /* internal data used in av_find_stream_info() */
     int64_t codec_info_duration;     

Index: avidec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avidec.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- avidec.c	24 Mar 2005 21:27:54 -0000	1.69
+++ avidec.c	30 Apr 2005 21:43:58 -0000	1.70
@@ -221,7 +221,7 @@
             nb_frames = get_le32(pb);
 
             st->start_time = 0;
-            st->duration = av_rescale(nb_frames, ast->scale*(int64_t)AV_TIME_BASE, ast->rate);
+            st->duration = nb_frames;
             get_le32(pb); /* buffer size */
             get_le32(pb); /* quality */
             ast->sample_size = get_le32(pb); /* sample ssize */
@@ -232,8 +232,6 @@
                 codec_type = CODEC_TYPE_VIDEO;
 
                 ast->sample_size = 0;
-                st->codec.frame_rate = ast->rate;
-                st->codec.frame_rate_base = ast->scale;
                 break;
             case MKTAG('a', 'u', 'd', 's'):
                 codec_type = CODEC_TYPE_AUDIO;

Index: avienc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avienc.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- avienc.c	20 Apr 2005 09:42:47 -0000	1.103
+++ avienc.c	30 Apr 2005 21:43:58 -0000	1.104
@@ -271,8 +271,8 @@
         *au_scale=stream->frame_size;
         *au_rate= stream->sample_rate;
     }else if(stream->codec_type == CODEC_TYPE_VIDEO){
-        *au_scale= stream->frame_rate_base;
-        *au_rate = stream->frame_rate;
+        *au_scale= stream->time_base.num;
+        *au_rate = stream->time_base.den;
     }else{
         *au_scale= stream->block_align ? stream->block_align*8 : 8;
         *au_rate = stream->bit_rate;
@@ -343,7 +343,7 @@
     nb_frames = 0;
 
     if(video_enc){
-        put_le32(pb, (uint32_t)(int64_t_C(1000000) * video_enc->frame_rate_base / video_enc->frame_rate));
+        put_le32(pb, (uint32_t)(int64_t_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
     } else {
 	put_le32(pb, 0);
     }
@@ -390,9 +390,9 @@
             put_le16(pb, 0); /* language */
             put_le32(pb, 0); /* initial frame */
             
-            put_le32(pb, stream->frame_rate_base); /* scale */
-            put_le32(pb, stream->frame_rate); /* rate */
-            av_set_pts_info(s->streams[i], 64, stream->frame_rate_base, stream->frame_rate);
+            put_le32(pb, stream->time_base.num); /* scale */
+            put_le32(pb, stream->time_base.den); /* rate */
+            av_set_pts_info(s->streams[i], 64, stream->time_base.num, stream->time_base.den);
 
             put_le32(pb, 0); /* start */
             avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */

Index: dc1394.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/dc1394.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dc1394.c	24 Apr 2005 17:21:11 -0000	1.2
+++ dc1394.c	30 Apr 2005 21:43:58 -0000	1.3
@@ -72,7 +72,7 @@
 	     break;
 	     
     for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
-         if (fps->frame_rate == av_rescale(1000, ap->frame_rate, ap->frame_rate_base))
+         if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
 	     break;
     
     /* create a video stream */
@@ -82,8 +82,8 @@
     av_set_pts_info(vst, 64, 1, 1000);
     vst->codec.codec_type = CODEC_TYPE_VIDEO;
     vst->codec.codec_id = CODEC_ID_RAWVIDEO;
-    vst->codec.frame_rate = fps->frame_rate;
-    vst->codec.frame_rate_base = 1000;
+    vst->codec.time_base.den = fps->frame_rate;
+    vst->codec.time_base.num = 1000;
     vst->codec.width = fmt->width;
     vst->codec.height = fmt->height;
     vst->codec.pix_fmt = fmt->pix_fmt;

Index: dv.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/dv.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- dv.c	26 Apr 2005 11:04:34 -0000	1.41
+++ dv.c	30 Apr 2005 21:43:58 -0000	1.42
@@ -591,9 +591,8 @@
     if (sys) {
         avctx = &c->vst->codec;
 	
-	avctx->frame_rate = sys->frame_rate;
-        avctx->frame_rate_base = sys->frame_rate_base;
         av_set_pts_info(c->vst, 64, sys->frame_rate_base, sys->frame_rate);
+        avctx->time_base= (AVRational){sys->frame_rate_base, sys->frame_rate};
         avctx->width = sys->width;
         avctx->height = sys->height;
         avctx->pix_fmt = sys->pix_fmt;

Index: ffm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/ffm.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- ffm.c	24 Feb 2005 19:08:50 -0000	1.37
+++ ffm.c	30 Apr 2005 21:43:58 -0000	1.38
@@ -163,8 +163,8 @@
         /* specific info */
         switch(codec->codec_type) {
         case CODEC_TYPE_VIDEO:
-            put_be32(pb, codec->frame_rate_base);
-            put_be32(pb, codec->frame_rate);
+            put_be32(pb, codec->time_base.num);
+            put_be32(pb, codec->time_base.den);
             put_be16(pb, codec->width);
             put_be16(pb, codec->height);
             put_be16(pb, codec->gop_size);
@@ -235,7 +235,7 @@
     if (st->codec.codec_type == CODEC_TYPE_AUDIO) {
         duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0);
     } else {
-        duration = (1000000.0 * st->codec.frame_rate_base / (float)st->codec.frame_rate);
+        duration = (1000000.0 * st->codec.time_base.num / (float)st->codec.time_base.den);
     }
 
     pts = fst->pts;
@@ -480,8 +480,8 @@
         /* specific info */
         switch(codec->codec_type) {
         case CODEC_TYPE_VIDEO:
-            codec->frame_rate_base = get_be32(pb);
-            codec->frame_rate = get_be32(pb);
+            codec->time_base.num = get_be32(pb);
+            codec->time_base.den = get_be32(pb);
             codec->width = get_be16(pb);
             codec->height = get_be16(pb);
             codec->gop_size = get_be16(pb);

Index: flvdec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/flvdec.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- flvdec.c	17 Mar 2005 01:25:01 -0000	1.17
+++ flvdec.c	30 Apr 2005 21:43:58 -0000	1.18
@@ -102,8 +102,7 @@
             return AVERROR_NOMEM;
 
         av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */
-        st->codec.frame_rate_base= 1;
-        st->codec.frame_rate= 1000;
+        st->codec.time_base= (AVRational){1,1000};
     }
 //    av_log(NULL, AV_LOG_DEBUG, "%d %X %d \n", is_audio, flags, st->discard);
     if(  (st->discard >= AVDISCARD_NONKEY && !((flags >> 4)==1 ||  is_audio))

Index: gif.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/gif.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gif.c	29 Dec 2004 18:31:28 -0000	1.17
+++ gif.c	30 Apr 2005 21:43:58 -0000	1.18
@@ -316,7 +316,7 @@
     } else {
         width = video_enc->width;
         height = video_enc->height;
-//        rate = video_enc->frame_rate;
+//        rate = video_enc->time_base.den;
     }
 
     /* XXX: is it allowed ? seems to work so far... */
@@ -349,7 +349,7 @@
     /* XXX: should use delay, in order to be more accurate */
     /* instead of using the same rounded value each time */
     /* XXX: don't even remember if I really use it for now */
-    jiffies = (70*enc->frame_rate_base/enc->frame_rate) - 1;
+    jiffies = (70*enc->time_base.num/enc->time_base.den) - 1;
 
     put_le16(pb, jiffies);
 

Index: gifdec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/gifdec.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gifdec.c	8 Jan 2005 14:21:32 -0000	1.7
+++ gifdec.c	30 Apr 2005 21:43:58 -0000	1.8
@@ -557,8 +557,8 @@
 
     st->codec.codec_type = CODEC_TYPE_VIDEO;
     st->codec.codec_id = CODEC_ID_RAWVIDEO;
-    st->codec.frame_rate = 5;
-    st->codec.frame_rate_base = 1;
+    st->codec.time_base.den = 5;
+    st->codec.time_base.num = 1;
     /* XXX: check if screen size is always valid */
     st->codec.width = s->screen_width;
     st->codec.height = s->screen_height;

Index: grab.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/grab.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- grab.c	8 Jan 2005 14:21:32 -0000	1.33
+++ grab.c	30 Apr 2005 21:43:58 -0000	1.34
@@ -68,13 +68,13 @@
     const char *video_device;
     int j;
 
-    if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0)
+    if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
         return -1;
     
     width = ap->width;
     height = ap->height;
-    frame_rate      = ap->frame_rate;
-    frame_rate_base = ap->frame_rate_base;
+    frame_rate      = ap->time_base.den;
+    frame_rate_base = ap->time_base.num;
 
     if((unsigned)width > 32767 || (unsigned)height > 32767)
         return -1;
@@ -265,8 +265,8 @@
     st->codec.codec_id = CODEC_ID_RAWVIDEO;
     st->codec.width = width;
     st->codec.height = height;
-    st->codec.frame_rate      = frame_rate;
-    st->codec.frame_rate_base = frame_rate_base;
+    st->codec.time_base.den      = frame_rate;
+    st->codec.time_base.num = frame_rate_base;
 
     return 0;
  fail:

Index: img.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/img.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- img.c	8 Jan 2005 14:21:32 -0000	1.39
+++ img.c	30 Apr 2005 21:43:58 -0000	1.40
@@ -132,15 +132,13 @@
         s->is_pipe = 0;
     else
         s->is_pipe = 1;
-        
-    if (!ap || !ap->frame_rate) {
-        st->codec.frame_rate      = 25;
-        st->codec.frame_rate_base = 1;
+
+    if (!ap || !ap->time_base.num) {
+        st->codec.time_base= (AVRational){1,25};
     } else {
-        st->codec.frame_rate      = ap->frame_rate;
-        st->codec.frame_rate_base = ap->frame_rate_base;
+        st->codec.time_base= ap->time_base;
     }
-    
+ 
     if (!s->is_pipe) {
         if (find_image_range(&first_index, &last_index, s->path) < 0)
             goto fail;
@@ -149,9 +147,7 @@
         s->img_number = first_index;
         /* compute duration */
         st->start_time = 0;
-        st->duration = ((int64_t)AV_TIME_BASE * 
-                        (last_index - first_index + 1) * 
-                        st->codec.frame_rate_base) / st->codec.frame_rate;
+        st->duration = last_index - first_index + 1;
         if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0)
             goto fail;
         if (url_fopen(f, buf, URL_RDONLY) < 0)
@@ -236,7 +232,7 @@
     } else {
         /* XXX: computing this pts is not necessary as it is done in
            the generic code too */
-        pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.frame_rate_base, s1->streams[0]->time_base.den, s1->streams[0]->codec.frame_rate) / s1->streams[0]->time_base.num;
+        pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec.time_base.den) / s1->streams[0]->time_base.num;
         s->img_count++;
         s->img_number++;
         return 0;

Index: img2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/img2.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- img2.c	25 Apr 2005 18:29:06 -0000	1.14
+++ img2.c	30 Apr 2005 21:43:58 -0000	1.15
@@ -186,12 +186,10 @@
         st->need_parsing= 1;
     }
         
-    if (!ap || !ap->frame_rate) {
-        st->codec.frame_rate      = 25;
-        st->codec.frame_rate_base = 1;
+    if (!ap || !ap->time_base.num) {
+        av_set_pts_info(st, 60, 1, 25);
     } else {
-        st->codec.frame_rate      = ap->frame_rate;
-        st->codec.frame_rate_base = ap->frame_rate_base;
+        av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
     }
     
     if(ap && ap->width && ap->height){
@@ -207,9 +205,7 @@
         s->img_number = first_index;
         /* compute duration */
         st->start_time = 0;
-        st->duration = ((int64_t)AV_TIME_BASE * 
-                        (last_index - first_index + 1) * 
-                        st->codec.frame_rate_base) / st->codec.frame_rate;
+        st->duration = last_index - first_index + 1;
     }
     
     if(ap->video_codec_id){

Index: mov.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mov.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- mov.c	30 Mar 2005 00:36:30 -0000	1.78
+++ mov.c	30 Apr 2005 21:43:58 -0000	1.79
@@ -867,8 +867,8 @@
             st->codec.color_table_id = get_be16(pb); /* colortable id */
 
 /*          These are set in mov_read_stts and might already be set!
-            st->codec.frame_rate      = 25;
-            st->codec.frame_rate_base = 1;
+            st->codec.time_base.den      = 25;
+            st->codec.time_base.num = 1;
 */
 	    size -= (16+8*4+2+32+2*2);
 #if 0
@@ -1342,10 +1342,10 @@
 #if 0 //We calculate an average instead, needed by .mp4-files created with nec e606 3g phone
 
         if (!i && st->codec.codec_type==CODEC_TYPE_VIDEO) {
-            st->codec.frame_rate_base = sample_duration ? sample_duration : 1;
-            st->codec.frame_rate = c->streams[c->fc->nb_streams-1]->time_scale;
+            st->codec.time_base.num = sample_duration ? sample_duration : 1;
+            st->codec.time_base.den = c->streams[c->fc->nb_streams-1]->time_scale;
 #ifdef DEBUG
-            av_log(NULL, AV_LOG_DEBUG, "VIDEO FRAME RATE= %i (sd= %i)\n", st->codec.frame_rate, sample_duration);
+            av_log(NULL, AV_LOG_DEBUG, "VIDEO FRAME RATE= %i (sd= %i)\n", st->codec.time_base.den, sample_duration);
 #endif
         }
 #endif
@@ -1355,21 +1355,21 @@
     if(duration>0)
     {
         av_reduce(
-            &st->codec.frame_rate, 
-            &st->codec.frame_rate_base, 
+            &st->codec.time_base.den, 
+            &st->codec.time_base.num, 
             c->streams[c->fc->nb_streams-1]->time_scale * total_sample_count,
             duration,
             INT_MAX
         );
 
 #ifdef DEBUG
-        av_log(NULL, AV_LOG_DEBUG, "FRAME RATE average (video or audio)= %f (tot sample count= %i ,tot dur= %i timescale=%d)\n", (float)st->codec.frame_rate/st->codec.frame_rate_base,total_sample_count,duration,c->streams[c->fc->nb_streams-1]->time_scale);
+        av_log(NULL, AV_LOG_DEBUG, "FRAME RATE average (video or audio)= %f (tot sample count= %i ,tot dur= %i timescale=%d)\n", (float)st->codec.time_base.den/st->codec.time_base.num,total_sample_count,duration,c->streams[c->fc->nb_streams-1]->time_scale);
 #endif
     }
     else
     {
-        st->codec.frame_rate_base = 1;
-        st->codec.frame_rate = c->streams[c->fc->nb_streams-1]->time_scale;
+        st->codec.time_base.num = 1;
+        st->codec.time_base.den = c->streams[c->fc->nb_streams-1]->time_scale;
     }
     return 0;
 }

Index: movenc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/movenc.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- movenc.c	27 Mar 2005 00:16:17 -0000	1.37
+++ movenc.c	30 Apr 2005 21:43:58 -0000	1.38
@@ -1181,8 +1181,8 @@
         if(mov->tracks[i].entry <= 0) continue;
 
         if(mov->tracks[i].enc->codec_type == CODEC_TYPE_VIDEO) {
-            mov->tracks[i].timescale = mov->tracks[i].enc->frame_rate;
-            mov->tracks[i].sampleDuration = mov->tracks[i].enc->frame_rate_base;
+            mov->tracks[i].timescale = mov->tracks[i].enc->time_base.den;
+            mov->tracks[i].sampleDuration = mov->tracks[i].enc->time_base.num;
         }
         else if(mov->tracks[i].enc->codec_type == CODEC_TYPE_AUDIO) {
             /* If AMR, track timescale = 8000, AMR_WB = 16000 */
@@ -1257,10 +1257,10 @@
 static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
 {
     int AudioRate = s->streams[1]->codec.sample_rate;
-    int FrameRate = ((s->streams[0]->codec.frame_rate) * (0x10000))/ (s->streams[0]->codec.frame_rate_base);
+    int FrameRate = ((s->streams[0]->codec.time_base.den) * (0x10000))/ (s->streams[0]->codec.time_base.num);
  
     //printf("audiorate = %d\n",AudioRate);
-    //printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec.frame_rate,s->streams[0]->codec.frame_rate_base,FrameRate);
+    //printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec.time_base.den,s->streams[0]->codec.time_base.num,FrameRate);
 
     put_be32(pb, 0x94 ); /* size */
     put_tag(pb, "uuid");

Index: mpegts.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mpegts.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mpegts.c	16 Feb 2005 23:04:11 -0000	1.26
+++ mpegts.c	30 Apr 2005 21:43:58 -0000	1.27
@@ -1208,7 +1208,7 @@
         ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0];
         s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
         st->codec.bit_rate = s->bit_rate;
-        st->start_time = ts->cur_pcr * 1000000.0 / 27.0e6;
+        st->start_time = ts->cur_pcr;
 #if 0
         printf("start=%0.3f pcr=%0.3f incr=%d\n",
                st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);

Index: nsvdec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/nsvdec.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- nsvdec.c	26 Apr 2005 21:46:46 -0000	1.6
+++ nsvdec.c	30 Apr 2005 21:43:58 -0000	1.7
@@ -300,8 +300,7 @@
     PRINT(("NSV NSVf chunk_size %ld\n", size));
     PRINT(("NSV NSVf file_size %Ld\n", file_size));
 
-    duration = get_le32(pb); /* in ms */
-    nsv->duration = duration * AV_TIME_BASE / 1000; /* convert */
+    nsv->duration = duration = get_le32(pb); /* in ms */
     PRINT(("NSV NSVf duration %Ld ms\n", duration));
     // XXX: store it in AVStreams
 
@@ -448,10 +447,8 @@
             st->codec.bits_per_sample = 24; /* depth XXX */
 
             av_set_pts_info(st, 64, framerate.den, framerate.num);
-            st->codec.frame_rate = framerate.num;
-            st->codec.frame_rate_base = framerate.den;
             st->start_time = 0;
-            st->duration = nsv->duration;
+            st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den);
         }
         if (atag != T_NONE) {
 #ifndef DISABLE_AUDIO
@@ -467,7 +464,7 @@
             st->codec.codec_tag = atag;
             st->codec.codec_id = codec_get_id(nsv_codec_audio_tags, atag);
             st->start_time = 0;
-            st->duration = nsv->duration;
+//            st->duration = nsv->duration; //FIXME
             
             st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */
             /* XXX:FIXME */

Index: nut.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/nut.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- nut.c	24 Apr 2005 17:21:11 -0000	1.47
+++ nut.c	30 Apr 2005 21:43:58 -0000	1.48
@@ -599,8 +599,8 @@
 
 	if (codec->codec_type == CODEC_TYPE_VIDEO)
 	{
-	    nom = codec->frame_rate;
-	    denom = codec->frame_rate_base;
+	    nom = codec->time_base.den;
+	    denom = codec->time_base.num;
 	}
 	else
 	{
@@ -1001,9 +1001,6 @@
         st->codec.sample_aspect_ratio.num= get_v(bc);
         st->codec.sample_aspect_ratio.den= get_v(bc);
         get_v(bc); /* csp type */
-
-        st->codec.frame_rate = nom;
-        st->codec.frame_rate_base = denom;
     }
     if (class == 32) /* AUDIO */
     {

Index: raw.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/raw.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- raw.c	26 Feb 2005 03:36:03 -0000	1.50
+++ raw.c	30 Apr 2005 21:43:59 -0000	1.51
@@ -63,8 +63,7 @@
             av_set_pts_info(st, 64, 1, st->codec.sample_rate);
             break;
         case CODEC_TYPE_VIDEO:
-            st->codec.frame_rate      = ap->frame_rate;
-            st->codec.frame_rate_base = ap->frame_rate_base;
+            av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
             st->codec.width = ap->width;
             st->codec.height = ap->height;
 	    st->codec.pix_fmt = ap->pix_fmt;
@@ -238,12 +237,10 @@
     /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
     if (st->codec.codec_id == CODEC_ID_MJPEG || 
         st->codec.codec_id == CODEC_ID_MPEG4) {
-        if (ap && ap->frame_rate) {
-            st->codec.frame_rate      = ap->frame_rate;
-            st->codec.frame_rate_base = ap->frame_rate_base;
+        if (ap && ap->time_base.num) {
+            av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
         } else {
-            st->codec.frame_rate      = 25;
-            st->codec.frame_rate_base = 1;
+            av_set_pts_info(st, 64, 1, 25);
         }
     }
     return 0;

Index: rm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/rm.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- rm.c	24 Apr 2005 22:08:31 -0000	1.45
+++ rm.c	30 Apr 2005 21:43:59 -0000	1.46
@@ -316,7 +316,7 @@
             break;
         case CODEC_TYPE_VIDEO:
             rm->video_stream = stream;
-            stream->frame_rate = (float)codec->frame_rate / (float)codec->frame_rate_base;
+            stream->frame_rate = (float)codec->time_base.den / (float)codec->time_base.num;
             /* XXX: dummy values */
             stream->packet_max_size = 4096;
             stream->nb_packets = 0;
@@ -641,8 +641,8 @@
             start_time = get_be32(pb); /* start time */
             get_be32(pb); /* preroll */
             duration = get_be32(pb); /* duration */
-            st->start_time = start_time * (AV_TIME_BASE / 1000);
-            st->duration = duration * (AV_TIME_BASE / 1000);
+            st->start_time = start_time;
+            st->duration = duration;
             get_str8(pb, buf, sizeof(buf)); /* desc */
             get_str8(pb, buf, sizeof(buf)); /* mimetype */
             codec_data_size = get_be32(pb);
@@ -670,7 +670,7 @@
                     goto fail1;
                 st->codec.width = get_be16(pb);
                 st->codec.height = get_be16(pb);
-                st->codec.frame_rate_base= 1;
+                st->codec.time_base.num= 1;
                 fps= get_be16(pb);
                 st->codec.codec_type = CODEC_TYPE_VIDEO;
                 get_be32(pb);
@@ -682,7 +682,7 @@
                 get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
                 
 //                av_log(NULL, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
-                st->codec.frame_rate = fps * st->codec.frame_rate_base;
+                st->codec.time_base.den = fps * st->codec.time_base.num;
                 /* modification of h263 codec version (!) */
 #ifdef WORDS_BIGENDIAN
                 h263_hack_version = ((uint32_t*)st->codec.extradata)[1];

Index: rtp.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/rtp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- rtp.c	29 May 2004 02:06:32 -0000	1.15
+++ rtp.c	30 Apr 2005 21:43:59 -0000	1.16
@@ -610,7 +610,7 @@
 
         /* 90 KHz time stamp */
         s->timestamp = s->base_timestamp + 
-            av_rescale((int64_t)s->cur_timestamp * st->codec.frame_rate_base, 90000, st->codec.frame_rate);
+            av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
         rtp_send_data(s1, s->buf, q - s->buf);
 
         buf1 += len;
@@ -635,7 +635,7 @@
 
         /* 90 KHz time stamp */
         s->timestamp = s->base_timestamp + 
-            av_rescale((int64_t)s->cur_timestamp * st->codec.frame_rate_base, 90000, st->codec.frame_rate);
+            av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
         rtp_send_data(s1, buf1, len);
 
         buf1 += len;

Index: swf.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/swf.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- swf.c	29 Dec 2004 18:31:28 -0000	1.23
+++ swf.c	30 Apr 2005 21:43:59 -0000	1.24
@@ -348,8 +348,8 @@
         swf->video_type = video_enc->codec_id;
         width = video_enc->width;
         height = video_enc->height;
-        rate = video_enc->frame_rate;
-        rate_base = video_enc->frame_rate_base;
+        rate = video_enc->time_base.den;
+        rate_base = video_enc->time_base.num;
     }
 
     if (!audio_enc ) {
@@ -767,8 +767,8 @@
         if (tag < 0) {
             if ( ast || vst ) {
                 if ( vst && ast ) {
-                    vst->codec.frame_rate = ast->codec.sample_rate / swf->samples_per_frame;
-                    vst->codec.frame_rate_base = 1;
+                    vst->codec.time_base.den = ast->codec.sample_rate / swf->samples_per_frame;
+                    vst->codec.time_base.num = 1;
                 }
                 break;
             }
@@ -789,8 +789,8 @@
                 vst->codec.codec_type = CODEC_TYPE_VIDEO;
                 vst->codec.codec_id = CODEC_ID_FLV1;
                 if ( swf->samples_per_frame ) {
-                    vst->codec.frame_rate = 1000. / swf->ms_per_frame;
-                    vst->codec.frame_rate_base = 1;
+                    vst->codec.time_base.den = 1000. / swf->ms_per_frame;
+                    vst->codec.time_base.num = 1;
                 }
             }
         } else if ( ( tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2 ) && !ast) {

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- utils.c	25 Apr 2005 18:29:06 -0000	1.141
+++ utils.c	30 Apr 2005 21:43:59 -0000	1.142
@@ -632,8 +632,13 @@
     *pden = 0;
     switch(st->codec.codec_type) {
     case CODEC_TYPE_VIDEO:
-        *pnum = st->codec.frame_rate_base;
-        *pden = st->codec.frame_rate;
+        if(st->codec.time_base.num*1000 <= st->codec.time_base.den){
+            *pnum = st->time_base.num;
+            *pden = st->time_base.den;
+        }else{
+            *pnum = st->codec.time_base.num;
+            *pden = st->codec.time_base.den;
+        }
         if (pc && pc->repeat_pict) {
             *pden *= 2;
             *pnum = (*pnum) * (2 + pc->repeat_pict);
@@ -683,7 +688,6 @@
                                AVCodecParserContext *pc, AVPacket *pkt)
 {
     int num, den, presentation_delayed;
-
     /* handle wrapping */
     if(st->cur_dts != AV_NOPTS_VALUE){
         if(pkt->pts != AV_NOPTS_VALUE)
@@ -789,15 +793,6 @@
             break;
         }
     }
-
-    /* convert the packet time stamp units */
-    if(pkt->pts != AV_NOPTS_VALUE)
-        pkt->pts = av_rescale(pkt->pts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den);
-    if(pkt->dts != AV_NOPTS_VALUE)
-        pkt->dts = av_rescale(pkt->dts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den);
-
-    /* duration field */
-    pkt->duration = av_rescale(pkt->duration, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den);
 }
 
 void av_destruct_packet_nofree(AVPacket *pkt)
@@ -1066,8 +1061,7 @@
             break;
         if (pkt->stream_index == 0 && st->parser &&
             (pkt->flags & PKT_FLAG_KEY)) {
-            int64_t dts= av_rescale(pkt->dts, st->time_base.den, AV_TIME_BASE*(int64_t)st->time_base.num);
-            av_add_index_entry(st, st->parser->frame_offset, dts, 
+            av_add_index_entry(st, st->parser->frame_offset, pkt->dts, 
                             0, AVINDEX_KEYFRAME);
         }
         av_free_packet(pkt);
@@ -1406,7 +1400,7 @@
    compute the global bitrate if possible */
 static void av_update_stream_timings(AVFormatContext *ic)
 {
-    int64_t start_time, end_time, end_time1;
+    int64_t start_time, start_time1, end_time, end_time1;
     int i;
     AVStream *st;
 
@@ -1415,10 +1409,12 @@
     for(i = 0;i < ic->nb_streams; i++) {
         st = ic->streams[i];
         if (st->start_time != AV_NOPTS_VALUE) {
-            if (st->start_time < start_time)
-                start_time = st->start_time;
+            start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q);
+            if (start_time1 < start_time)
+                start_time = start_time1;
             if (st->duration != AV_NOPTS_VALUE) {
-                end_time1 = st->start_time + st->duration;
+                end_time1 = start_time1
+                          + av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
                 if (end_time1 > end_time)
                     end_time = end_time1;
             }
@@ -1447,8 +1443,10 @@
     for(i = 0;i < ic->nb_streams; i++) {
         st = ic->streams[i];
         if (st->start_time == AV_NOPTS_VALUE) {
-            st->start_time = ic->start_time;
-            st->duration = ic->duration;
+            if(ic->start_time != AV_NOPTS_VALUE)
+                st->start_time = av_rescale_q(ic->start_time, AV_TIME_BASE_Q, st->time_base);
+            if(ic->duration != AV_NOPTS_VALUE)
+                st->duration = av_rescale_q(ic->duration, AV_TIME_BASE_Q, st->time_base);
         }
     }
 }
@@ -1475,9 +1473,9 @@
         ic->file_size != 0)  {
         filesize = ic->file_size;
         if (filesize > 0) {
-            duration = (int64_t)((8 * AV_TIME_BASE * (double)filesize) / (double)ic->bit_rate);
             for(i = 0; i < ic->nb_streams; i++) {
                 st = ic->streams[i];
+                duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);
                 if (st->start_time == AV_NOPTS_VALUE ||
                     st->duration == AV_NOPTS_VALUE) {
                     st->start_time = 0;
@@ -1538,22 +1536,11 @@
         st = ic->streams[pkt->stream_index];
         if (pkt->pts != AV_NOPTS_VALUE) {
             if (st->start_time == AV_NOPTS_VALUE)
-                st->start_time = av_rescale(pkt->pts, st->time_base.num * (int64_t)AV_TIME_BASE, st->time_base.den);
+                st->start_time = pkt->pts;
         }
         av_free_packet(pkt);
     }
 
-    /* we compute the minimum start_time and use it as default */
-    start_time = MAXINT64;
-    for(i = 0; i < ic->nb_streams; i++) {
-        st = ic->streams[i];
-        if (st->start_time != AV_NOPTS_VALUE &&
-            st->start_time < start_time)
-            start_time = st->start_time;
-    }
-    if (start_time != MAXINT64)
-        ic->start_time = start_time;
-    
     /* estimate the end time (duration) */
     /* XXX: may need to support wrapping */
     filesize = ic->file_size;
@@ -1581,7 +1568,7 @@
         read_size += pkt->size;
         st = ic->streams[pkt->stream_index];
         if (pkt->pts != AV_NOPTS_VALUE) {
-            end_time = av_rescale(pkt->pts, st->time_base.num * (int64_t)AV_TIME_BASE, st->time_base.den);
+            end_time = pkt->pts;
             duration = end_time - st->start_time;
             if (duration > 0) {
                 if (st->duration == AV_NOPTS_VALUE ||
@@ -1592,37 +1579,7 @@
         av_free_packet(pkt);
     }
     
-    /* estimate total duration */
-    end_time = MININT64;
-    for(i = 0;i < ic->nb_streams; i++) {
-        st = ic->streams[i];
-        if (st->duration != AV_NOPTS_VALUE) {
-            end_time1 = st->start_time + st->duration;
-            if (end_time1 > end_time)
-                end_time = end_time1;
-        }
-    }
-    
-    /* update start_time (new stream may have been created, so we do
-       it at the end */
-    if (ic->start_time != AV_NOPTS_VALUE) {
-        for(i = 0; i < ic->nb_streams; i++) {
-            st = ic->streams[i];
-            if (st->start_time == AV_NOPTS_VALUE)
-                st->start_time = ic->start_time;
-        }
-    }
-
-    if (end_time != MININT64) {
-        /* put dummy values for duration if needed */
-        for(i = 0;i < ic->nb_streams; i++) {
-            st = ic->streams[i];
-            if (st->duration == AV_NOPTS_VALUE && 
-                st->start_time != AV_NOPTS_VALUE)
-                st->duration = end_time - st->start_time;
-        }
-        ic->duration = end_time - ic->start_time;
-    }
+    fill_all_stream_timings(ic);
 
     url_fseek(&ic->pb, 0, SEEK_SET);
 }
@@ -1753,6 +1710,16 @@
     int64_t last_dts[MAX_STREAMS];
     int64_t best_duration[MAX_STREAMS];
 
+    for(i=0;i<ic->nb_streams;i++) {
+        st = ic->streams[i];
+        if(st->codec.codec_type == CODEC_TYPE_VIDEO){
+/*            if(!st->time_base.num)
+                st->time_base= */
+            if(!st->codec.time_base.num)
+                st->codec.time_base= st->time_base;
+        }
+    }
+
     for(i=0;i<MAX_STREAMS;i++){
         last_dts[i]= AV_NOPTS_VALUE;
         best_duration[i]= INT64_MAX;
@@ -1768,8 +1735,8 @@
             if (!has_codec_parameters(&st->codec))
                 break;
             /* variable fps and no guess at the real fps */
-            if(   st->codec.frame_rate >= 1000LL*st->codec.frame_rate_base
-               && best_duration[i]== INT64_MAX)
+            if(   st->codec.time_base.den >= 1000LL*st->codec.time_base.num
+               && best_duration[i]== INT64_MAX && st->codec.codec_type == CODEC_TYPE_VIDEO)
                 break;
         }
         if (i == ic->nb_streams) {
@@ -1874,18 +1841,18 @@
             if(st->codec.codec_id == CODEC_ID_RAWVIDEO && !st->codec.codec_tag && !st->codec.bits_per_sample)
                 st->codec.codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec.pix_fmt);
 
-            if(best_duration[i] < INT64_MAX && st->codec.frame_rate_base*1000 <= st->codec.frame_rate){
+            if(best_duration[i] < INT64_MAX && st->codec.time_base.num*1000 <= st->codec.time_base.den){
                 int int_fps;
 
-                st->r_frame_rate= st->codec.frame_rate;
-                st->r_frame_rate_base= av_rescale(best_duration[i], st->codec.frame_rate, AV_TIME_BASE);
-                av_reduce(&st->r_frame_rate, &st->r_frame_rate_base, st->r_frame_rate, st->r_frame_rate_base, 1<<15);
+                st->r_frame_rate.num= st->time_base.den;
+                st->r_frame_rate.den= st->time_base.num*best_duration[i];
+                av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->r_frame_rate.num, st->r_frame_rate.den, 1<<15);
                 
-                int_fps= av_rescale(st->r_frame_rate, 1, st->r_frame_rate_base);
+                int_fps= av_rescale(st->r_frame_rate.num, 1, st->r_frame_rate.den); // 1/0
                 
-                if(int_fps>0 && av_rescale(st->r_frame_rate, 1, int_fps) == st->r_frame_rate_base){
-                    st->r_frame_rate= int_fps;
-                    st->r_frame_rate_base= 1;
+                if(int_fps>0 && av_rescale(st->r_frame_rate.num, 1, int_fps) == st->r_frame_rate.den){
+                    st->r_frame_rate.num= int_fps;
+                    st->r_frame_rate.den= 1;
                 }               
             }
 
@@ -1898,8 +1865,7 @@
                     float coded_frame_rate, est_frame_rate;
                     est_frame_rate = ((double)st->codec_info_nb_frames * AV_TIME_BASE) / 
                         (double)st->codec_info_duration ;
-                    coded_frame_rate = (double)st->codec.frame_rate /
-                        (double)st->codec.frame_rate_base;
+                    coded_frame_rate = 1.0/av_q2d(st->codec.time_base);
 #if 0
                     printf("telecine: coded_frame_rate=%0.3f est_frame_rate=%0.3f\n", 
                            coded_frame_rate, est_frame_rate);
@@ -1909,15 +1875,14 @@
                        higher level as it can change in a film */
                     if (coded_frame_rate >= 24.97 && 
                         (est_frame_rate >= 23.5 && est_frame_rate < 24.5)) {
-                        st->r_frame_rate = 24000;
-                        st->r_frame_rate_base = 1001;
+                        st->r_frame_rate = (AVRational){24000, 1001};
                     }
                 }
             }
             /* if no real frame rate, use the codec one */
-            if (!st->r_frame_rate){
-                st->r_frame_rate      = st->codec.frame_rate;
-                st->r_frame_rate_base = st->codec.frame_rate_base;
+            if (!st->r_frame_rate.num){
+                st->r_frame_rate.num = st->codec.time_base.den;
+                st->r_frame_rate.den = st->codec.time_base.num;
             }
         }
     }
@@ -2098,7 +2063,7 @@
             break;
         case CODEC_TYPE_VIDEO:
             av_frac_init(&st->pts, 0, 0, 
-                         (int64_t)st->time_base.num * st->codec.frame_rate);
+                         (int64_t)st->time_base.num * st->codec.time_base.den);
             break;
         default:
             break;
@@ -2117,13 +2082,7 @@
 /*    if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
         return -1;*/
             
-    if(pkt->pts != AV_NOPTS_VALUE)
-        pkt->pts = av_rescale(pkt->pts, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
-    if(pkt->dts != AV_NOPTS_VALUE)
-        pkt->dts = av_rescale(pkt->dts, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
-
     /* duration field */
-    pkt->duration = av_rescale(pkt->duration, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
     if (pkt->duration == 0) {
         compute_frame_duration(&num, &den, st, NULL, pkt);
         if (den && num) {
@@ -2178,7 +2137,7 @@
         }
         break;
     case CODEC_TYPE_VIDEO:
-        av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec.frame_rate_base);
+        av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec.time_base.num);
         break;
     default:
         break;
@@ -2776,6 +2735,7 @@
  * @param pkt packet to dump
  * @param dump_payload true if the payload must be displayed too
  */
+ //FIXME needs to know the time_base
 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
 {
     fprintf(f, "stream #%d:\n", pkt->stream_index);

Index: yuv4mpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/yuv4mpeg.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- yuv4mpeg.c	26 Apr 2005 09:06:39 -0000	1.21
+++ yuv4mpeg.c	30 Apr 2005 21:43:59 -0000	1.22
@@ -36,7 +36,7 @@
     width = st->codec.width;
     height = st->codec.height;
 
-    av_reduce(&raten, &rated, st->codec.frame_rate, st->codec.frame_rate_base, (1UL<<31)-1);
+    av_reduce(&raten, &rated, st->codec.time_base.den, st->codec.time_base.num, (1UL<<31)-1);
     
     aspectn = st->codec.sample_aspect_ratio.num;
     aspectd = st->codec.sample_aspect_ratio.den;
@@ -323,8 +323,7 @@
     st->codec.width = width;
     st->codec.height = height;
     av_reduce(&raten, &rated, raten, rated, (1UL<<31)-1);
-    st->codec.frame_rate = raten;
-    st->codec.frame_rate_base = rated;
+    av_set_pts_info(st, 64, rated, raten);
     st->codec.pix_fmt = pix_fmt;
     st->codec.codec_type = CODEC_TYPE_VIDEO;
     st->codec.codec_id = CODEC_ID_RAWVIDEO;





More information about the ffmpeg-cvslog mailing list