[xiph-commits] r9268 - trunk/ffmpeg2theora

j at motherfish-iii.xiph.org j at motherfish-iii.xiph.org
Wed May 11 02:35:00 PDT 2005


Author: j
Date: 2005-05-11 02:34:57 -0700 (Wed, 11 May 2005)
New Revision: 9268

Modified:
   trunk/ffmpeg2theora/ffmpeg2theora.c
Log:
update fps code to work with current version of ffmpegcvs

Modified: trunk/ffmpeg2theora/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.c	2005-05-11 06:22:02 UTC (rev 9267)
+++ trunk/ffmpeg2theora/ffmpeg2theora.c	2005-05-11 09:34:57 UTC (rev 9268)
@@ -144,13 +144,16 @@
         venc = &this->context->streams[this->video_index]->codec;
         vcodec = avcodec_find_decoder (venc->codec_id);
 
+#if LIBAVFORMAT_BUILD <= 4623
         fps = (double) venc->frame_rate / venc->frame_rate_base;
+#else
+        fps = (double) vstream->r_frame_rate.num / vstream->r_frame_rate.den;
+#endif
         if (fps > 10000)
             fps /= 1000;
 
         if(this->force_input_fps)
             fps=this->force_input_fps;
-
         if (vcodec == NULL || avcodec_open (venc, vcodec) < 0)
             this->video_index = -1;
 
@@ -277,6 +280,7 @@
             
         }
     }
+
     if (this->audio_index >= 0){
         astream = this->context->streams[this->audio_index];
         aenc = &this->context->streams[this->audio_index]->codec;
@@ -300,7 +304,7 @@
             this->audio_index = -1;
         }
     }
-    
+
     if (this->video_index >= 0 || this->audio_index >=0){
         AVFrame *frame=NULL;
         AVFrame *frame_tmp=NULL;
@@ -362,8 +366,13 @@
                 info.ti.fps_denominator = 1000000;
             }
             else {
+#if LIBAVFORMAT_BUILD <= 4623
                 info.ti.fps_numerator=venc->frame_rate;
                 info.ti.fps_denominator = venc->frame_rate_base;
+#else
+                info.ti.fps_numerator=vstream->r_frame_rate.num;
+                info.ti.fps_denominator = vstream->r_frame_rate.den;
+#endif
             }
             /* this is pixel aspect ratio */
             info.ti.aspect_numerator=this->aspect_numerator;



More information about the commits mailing list