[vlc-devel] [RFC PATCH] lib/media_player: don't terminate resources from stop
Thomas Guillem
thomas at gllm.fr
Wed Mar 8 09:48:30 CET 2017
On Wed, Mar 8, 2017, at 09:45, Thomas Guillem wrote:
> Terminate the resources only when the media_player is released (like the
> playlist terminates the resources when it's deactivated). This allows to
> keep
> the same aout module during one mediaplayer lifetime.
>
> Prior to this change, libvlc users had to re-set the prefered audio
> device
> after each call of stop because the aout module was destroyed.
> ---
> lib/media_player.c | 1 -
> modules/audio_output/audiotrack.c | 8 +++++++-
> modules/audio_output/pulse.c | 1 +
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 1ed1d84c15..901d82292e 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1054,7 +1054,6 @@ void libvlc_media_player_stop(
> libvlc_media_player_t *p_mi )
> libvlc_event_send( p_mi->p_event_manager, &event );
> }
>
> - input_resource_Terminate( p_mi->input.p_resource );
> unlock_input(p_mi);
> }
>
Tired this morning...
The next diff is WIP/debug code and doesn't belong to this patch.
> diff --git a/modules/audio_output/audiotrack.c
> b/modules/audio_output/audiotrack.c
> index 24cb527e43..a0d3443209 100644
> --- a/modules/audio_output/audiotrack.c
> +++ b/modules/audio_output/audiotrack.c
> @@ -952,9 +952,13 @@ StartPassthrough( JNIEnv *env, audio_output_t
> *p_aout )
> switch( p_sys->fmt.i_format )
> {
> case VLC_CODEC_DTS:
> - if( b_dtshd )
> + if( b_dtshd && p_sys->fmt.i_rate >= 48000 )
> {
> + p_sys->fmt.i_rate = 192000;
> + p_sys->fmt.i_bytes_per_frame = 16;
> }
> + else
> + p_sys->fmt.i_bytes_per_frame = 4;
> break;
> case VLC_CODEC_EAC3:
> p_sys->fmt.i_rate = 192000;
> @@ -1002,6 +1006,7 @@ StartPassthrough( JNIEnv *env, audio_output_t
> *p_aout )
> else
> p_sys->b_passthrough = true;
>
> + p_sys->fmt.i_rate = 768000;
> return i_ret;
> }
>
> @@ -1943,6 +1948,7 @@ Open( vlc_object_t *obj )
> static void
> Close( vlc_object_t *obj )
> {
> +fprintf(stderr, "Close ? whyme?\n");
> audio_output_t *p_aout = (audio_output_t *) obj;
> aout_sys_t *p_sys = p_aout->sys;
>
> diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
> index 38a0d6624e..83e9834f39 100644
> --- a/modules/audio_output/pulse.c
> +++ b/modules/audio_output/pulse.c
> @@ -1038,6 +1038,7 @@ static int Open(vlc_object_t *obj)
>
> static void Close(vlc_object_t *obj)
> {
> +fprintf(stderr, "Close ? whyme?\n");
> audio_output_t *aout = (audio_output_t *)obj;
> aout_sys_t *sys = aout->sys;
> pa_context *ctx = sys->context;
> --
> 2.11.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list