[vlc-commits] lib: reset the audio output when selecting amem or custom plugin
Rémi Denis-Courmont
git at videolan.org
Mon Mar 10 18:19:13 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 10 19:18:43 2014 +0200| [ff42916045c79a24488bf69e9c2146b50011bc28] | committer: Rémi Denis-Courmont
lib: reset the audio output when selecting amem or custom plugin
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff42916045c79a24488bf69e9c2146b50011bc28
---
lib/audio.c | 9 +++++++++
lib/media_player.c | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/lib/audio.c b/lib/audio.c
index 1b834d7..51d3ff3 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -127,6 +127,15 @@ int libvlc_audio_output_set( libvlc_media_player_t *mp, const char *psz_name )
return -1;
var_SetString( mp, "aout", value );
free( value );
+
+ /* Forget the existing audio output */
+ input_resource_ResetAout(mp->input.p_resource);
+
+ /* Create a new audio output */
+ audio_output_t *aout = input_resource_GetAout(mp->input.p_resource);
+ if( aout != NULL )
+ input_resource_PutAout(mp->input.p_resource, aout);
+
return 0;
}
diff --git a/lib/media_player.c b/lib/media_player.c
index 868aefe..7df46f4 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -988,12 +988,16 @@ void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
var_SetAddress( mp, "amem-drain", drain_cb );
var_SetAddress( mp, "amem-data", opaque );
var_SetString( mp, "aout", "amem,none" );
+
+ input_resource_ResetAout(mp->input.p_resource);
}
void libvlc_audio_set_volume_callback( libvlc_media_player_t *mp,
libvlc_audio_set_volume_cb cb )
{
var_SetAddress( mp, "amem-set-volume", cb );
+
+ input_resource_ResetAout(mp->input.p_resource);
}
void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
@@ -1002,6 +1006,8 @@ void libvlc_audio_set_format_callbacks( libvlc_media_player_t *mp,
{
var_SetAddress( mp, "amem-setup", setup );
var_SetAddress( mp, "amem-cleanup", cleanup );
+
+ input_resource_ResetAout(mp->input.p_resource);
}
void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
@@ -1010,6 +1016,8 @@ void libvlc_audio_set_format( libvlc_media_player_t *mp, const char *format,
var_SetString( mp, "amem-format", format );
var_SetInteger( mp, "amem-rate", rate );
var_SetInteger( mp, "amem-channels", channels );
+
+ input_resource_ResetAout(mp->input.p_resource);
}
More information about the vlc-commits
mailing list