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

Mark Lee mark.lee at capricasoftware.co.uk
Wed Feb 26 17:49:15 CET 2014


This is based on similar initialisation as is already done in the
playlist_Create() function.
---
 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
-- 
1.8.1.2




More information about the vlc-devel mailing list