[vlc-commits] Let the value from --rate use the same code path than a value set at runtime .
Laurent Aimar
git at videolan.org
Sat Jun 25 23:33:04 CEST 2011
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jun 25 23:29:55 2011 +0200| [3756098af4a7256280536fde899a7c97316b7a3d] | committer: Laurent Aimar
Let the value from --rate use the same code path than a value set at runtime.
It closes #4861.
It fixes playback when the rate cannot be respected (like with dvb/udp/...)
or need to be requested to the access_demux (rtsp).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3756098af4a7256280536fde899a7c97316b7a3d
---
src/input/input.c | 15 ++++++++-------
src/input/var.c | 2 --
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index d3af598..0094846 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -370,13 +370,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input->p->title = NULL;
p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
p_input->p->i_state = INIT_S;
- double f_rate = var_InheritFloat( p_input, "rate" );
- if( f_rate <= 0. )
- {
- msg_Warn( p_input, "Negative or zero rate values are forbidden" );
- f_rate = 1.;
- }
- p_input->p->i_rate = INPUT_RATE_DEFAULT / f_rate;
+ p_input->p->i_rate = INPUT_RATE_DEFAULT;
p_input->p->b_recording = false;
memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) );
TAB_INIT( p_input->p->i_bookmark, p_input->p->pp_bookmark );
@@ -1290,6 +1284,13 @@ static int Init( input_thread_t * p_input )
LoadSubtitles( p_input );
LoadSlaves( p_input );
InitPrograms( p_input );
+
+ double f_rate = var_InheritFloat( p_input, "rate" );
+ if( f_rate != 0.0 && f_rate != 1.0 )
+ {
+ vlc_value_t val = { .i_int = INPUT_RATE_DEFAULT / f_rate };
+ input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &val );
+ }
}
if( !p_input->b_preparsing && p_input->p->p_sout )
diff --git a/src/input/var.c b/src/input/var.c
index 83510c8..f1fbc3c 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -137,8 +137,6 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* Rate */
var_Create( p_input, "rate", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
- val.f_float = (float)INPUT_RATE_DEFAULT / (float)p_input->p->i_rate;
- var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "frame-next", VLC_VAR_VOID );
More information about the vlc-commits
mailing list