[vlc-commits] lib: allow media player volume to be set before playing media

Mark Lee git at videolan.org
Wed Feb 26 18:02:43 CET 2014


vlc | branch: master | Mark Lee <mark.lee at capricasoftware.co.uk> | Wed Feb 26 16:49:15 2014 +0000| [5c0a6cabc3dbf9ec248c0df48b907619c061c02c] | committer: Rémi Denis-Courmont

lib: allow media player volume to be set before playing media

This is based on similar initialisation as is already done in the
playlist_Create() function.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c0a6cabc3dbf9ec248c0df48b907619c061c02c
---

 include/vlc_input.h  |   10 ++++++++++
 lib/media_player.c   |    4 ++++
 src/input/resource.h |   10 ----------
 src/libvlccore.sym   |    2 ++
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 4098e6b..176bf51 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -653,4 +653,14 @@ VLC_API void input_resource_Terminate( input_resource_t * );
  */
 VLC_API audio_output_t *input_resource_HoldAout( input_resource_t * );
 
+/**
+ * This function creates or recycles an audio output.
+ */
+VLC_API audio_output_t *input_resource_GetAout( input_resource_t * );
+
+/**
+ * This function retains or destroys an audio output.
+ */
+VLC_API void input_resource_PutAout( input_resource_t *, audio_output_t * );
+
 #endif
diff --git a/lib/media_player.c b/lib/media_player.c
index daa9def..868aefe 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -501,6 +501,10 @@ libvlc_media_player_new( libvlc_instance_t *instance )
         vlc_object_release(mp);
         return NULL;
     }
+    audio_output_t *aout = input_resource_GetAout(mp->input.p_resource);
+    if( aout != NULL )
+        input_resource_PutAout(mp->input.p_resource, aout);
+
     vlc_mutex_init (&mp->input.lock);
     mp->i_refcount = 1;
     mp->p_event_manager = libvlc_event_manager_new(mp, instance);
diff --git a/src/input/resource.h b/src/input/resource.h
index f1ae4ef..4c24c74 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -37,16 +37,6 @@ void input_resource_SetInput( input_resource_t *, input_thread_t * );
 sout_instance_t *input_resource_RequestSout( input_resource_t *, sout_instance_t *, const char *psz_sout );
 
 /**
- * This function creates or recycles an audio output.
- */
-audio_output_t *input_resource_GetAout( input_resource_t * );
-
-/**
- * This function retains or destroys an audio output.
- */
-void input_resource_PutAout( input_resource_t *, audio_output_t * );
-
-/**
  * This function handles vout request.
  */
 vout_thread_t *input_resource_RequestVout( input_resource_t *, vout_thread_t *, video_format_t *, unsigned dpb_size, bool b_recycle );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index f6f8300..3858e43 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -217,7 +217,9 @@ input_resource_New
 input_resource_Release
 input_resource_TerminateVout
 input_resource_Terminate
+input_resource_GetAout
 input_resource_HoldAout
+input_resource_PutAout
 input_Start
 input_Stop
 input_vaControl



More information about the vlc-commits mailing list