Commit 4d3bc8d9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mpeg: avoid double upconversion

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