[vlc-devel] commit: Add indirection to find input from wanabee input manager object ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Feb 14 10:58:26 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 14 11:53:53 2010 +0200| [7e30f80eed086fafd1583b4e852a550ecc118d32] | committer: Rémi Denis-Courmont
Add indirection to find input from wanabee input manager object
PARENTAL ADVISORY: explicit hack
This should allow volume control to (somewhat) work in LibVLC.
Unfortunately, it will still be buggy when there are multiple players.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e30f80eed086fafd1583b4e852a550ecc118d32
---
src/audio_output/intf.c | 8 +++++++-
src/control/media_player.c | 15 +++++++++++++++
src/playlist/engine.c | 10 ++++++++++
3 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/src/audio_output/intf.c b/src/audio_output/intf.c
index 4a589a4..57eefe3 100644
--- a/src/audio_output/intf.c
+++ b/src/audio_output/intf.c
@@ -42,7 +42,13 @@
static aout_instance_t *findAout (vlc_object_t *obj)
{
- input_thread_t *p_input = playlist_CurrentInput (pl_Get (obj));
+ input_thread_t *(*pf_find_input) (vlc_object_t *);
+
+ pf_find_input = var_GetAddress (obj, "find-input-callback");
+ if (unlikely(pf_find_input == NULL))
+ return NULL;
+
+ input_thread_t *p_input = pf_find_input (obj);
if (p_input == NULL)
return NULL;
diff --git a/src/control/media_player.c b/src/control/media_player.c
index 6bc0a6e..4901319 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -450,6 +450,19 @@ mouse_object( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
+static input_thread_t *find_input (vlc_object_t *obj)
+{
+ libvlc_media_player_t *mp = (libvlc_media_player_t *)obj;
+ input_thread_t *p_input;
+
+ lock (mp);
+ p_input = mp->p_input_thread;
+ if (p_input)
+ vlc_object_hold (p_input);
+ unlock (mp);
+ return p_input;
+}
+
/* */
static void libvlc_media_player_destroy( libvlc_media_player_t * );
@@ -530,6 +543,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
/* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+ var_Create (mp, "find-input-callback", VLC_VAR_ADDRESS);
+ var_SetAddress (mp, "find-input-callback", find_input);
mp->p_md = NULL;
mp->state = libvlc_NothingSpecial;
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 8976ac4..b0a05ce 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -282,6 +282,12 @@ void set_current_status_node( playlist_t * p_playlist,
pl_priv(p_playlist)->status.p_node = p_node;
}
+static input_thread_t *playlist_FindInput( vlc_object_t *object )
+{
+ assert( object == VLC_OBJECT(pl_Get(object)) );
+ return playlist_CurrentInput( (playlist_t *)object );
+}
+
static void VariablesInit( playlist_t *p_playlist )
{
/* These variables control updates */
@@ -316,6 +322,10 @@ static void VariablesInit( playlist_t *p_playlist )
/* Variables to preserve video output parameters */
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+
+ /* FIXME: horrible hack for audio output interface code */
+ var_Create( p_playlist, "find-input-callback", VLC_VAR_ADDRESS );
+ var_SetAddress( p_playlist, "find-input-callback", playlist_FindInput );
}
playlist_item_t * playlist_CurrentPlayingItem( playlist_t * p_playlist )
More information about the vlc-devel
mailing list