[vlc-devel] [PATCH] Added a new play-and-pause option.
Laurent Aimar
fenrir at via.ecp.fr
Tue Aug 4 21:58:07 CEST 2009
Hi,
Sorry for the delay,
> diff --git a/src/input/input.c b/src/input/input.c
> index 7afbd52..8d4b29a 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -630,7 +630,15 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_d
>
> if( i_ret == 0 ) /* EOF */
> {
> + bool b_pause_after_each = var_CreateGetBool( p_input, "play-and-pause" );
Could you create the variable in input_ConfigVarInit ? (inside
the "if( !p_input->b_preparsing )") ? That way you could simply use a
var_GetBool here.
> msg_Dbg( p_input, "EOF reached" );
> + if ( b_pause_after_each )
> + {
> + msg_Dbg( p_input, "pausing at EOF (pause after each)");
> + vlc_value_t pause_state;
> + pause_state.i_int = PAUSE_S;
> + Control( p_input, INPUT_CONTROL_SET_STATE, pause_state );
> + }
It is not done at the right place. You will pause before having finished
playing all buffered data (try with 30s buffering for example).
I think the right place would be after that MainLoopTryRepeat has been called
and have failed. ie something like (in MainLoop, untested)
if( !b_paused )
{
if( !p_input->p->input.b_eof )
{
[...]
}
else if( !p_input->b_eof && !es_out_GetEmpty( p_input->p->p_es_out ) )
{
[...]
}
else
{
if( MainLoopTryRepeat( p_input, &i_start_mdate ) )
{
if( !b_pause_after_play )
break;
Do the pause and set b_pause to true.
}
}
}
> p_input->p->input.b_eof = true;
> }
> else if( i_ret < 0 )
> diff --git a/src/libvlc-module.c b/src/libvlc-module.c
> index b489fae..5ef077a 100644
> --- a/src/libvlc-module.c
> +++ b/src/libvlc-module.c
> @@ -1190,7 +1190,11 @@ static const char *const ppsz_albumart_descriptions[] =
>
> #define PAE_TEXT N_("Play and exit")
> #define PAE_LONGTEXT N_( \
> - "Exit if there are no more items in the playlist." )
> + "Exit if there are no more items in the playlist." )
> +
Unrelated change.
Regards,
--
fenrir
More information about the vlc-devel
mailing list