mpeg: avoid double upconversion
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 13 Aug 2014 20:20:00 +0000 (23:20 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 13 Aug 2014 20:22:43 +0000 (23:22 +0300)
modules/demux/mpeg/es.c
modules/demux/mpeg/h264.c
modules/demux/mpeg/hevc.c

index 5f10f69..dacd452 100644 (file)
@@ -362,7 +362,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                               (double)(uint64_t)( stream_Size( p_demux->s ) );
                 /* The first few seconds are guaranteed to be very whacky,
                  * don't bother trying ... Too bad */
-                if( f_pos < 0.01 ||
+                if( f_pos < 0.01f ||
                     (p_sys->i_pts + p_sys->i_time_offset) < 8000000 )
                 {
                     return VLC_EGENERIC;
index 8e785fc..fa43994 100644 (file)
@@ -104,9 +104,9 @@ static int Open( vlc_object_t * p_this )
     p_sys->p_es        = NULL;
     p_sys->i_dts       = 0;
     p_sys->f_fps       = var_CreateGetFloat( p_demux, "h264-fps" );
-    if( p_sys->f_fps < 0.001 )
-        p_sys->f_fps = 0.001;
-    msg_Dbg( p_demux, "using %.2f fps", p_sys->f_fps );
+    if( p_sys->f_fps < 0.001f )
+        p_sys->f_fps = 0.001f;
+    msg_Dbg( p_demux, "using %.2f fps", (double) p_sys->f_fps );
 
     /* Load the mpegvideo packetizer */
     es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_H264 );
@@ -173,7 +173,7 @@ static int Demux( demux_t *p_demux)
 
             p_block_out = p_next;
 
-            p_sys->i_dts += (int64_t)((double)1000000.0 / p_sys->f_fps);
+            p_sys->i_dts += (int64_t)((float)CLOCK_FREQ / p_sys->f_fps);
         }
     }
     return 1;
index b564ea5..1701747 100644 (file)
@@ -115,7 +115,7 @@ static int Open( vlc_object_t * p_this )
     {
         p_sys->f_fps = ( p_sys->f_force_fps < 0.001f )? 0.001f:
             p_sys->f_force_fps;
-        msg_Dbg( p_demux, "using %.2f fps", p_sys->f_fps );
+        msg_Dbg( p_demux, "using %.2f fps", (double) p_sys->f_fps );
     }
     else
         p_sys->f_fps = 0.0f;
@@ -201,7 +201,7 @@ static int Demux( demux_t *p_demux)
             if( nal_type < 0x40 && p_sys->f_fps )
             {
                 es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_dts );
-                p_sys->i_dts += (int64_t)((double)1000000.0 / p_sys->f_fps);
+                p_sys->i_dts += (int64_t)((float)CLOCK_FREQ / p_sys->f_fps);
             }
 
             es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
@@ -278,7 +278,8 @@ static int32_t getFPS( demux_t *p_demux, block_t * p_block )
         if( num_units_in_tick )
         {
             p_sys->f_fps = ( (float) time_scale )/( (float) num_units_in_tick );
-            msg_Dbg(p_demux,"Using framerate %f fps from VPS", p_sys->f_fps);
+            msg_Dbg(p_demux,"Using framerate %f fps from VPS",
+                    (double) p_sys->f_fps);
         }
         else
         {