Commit 7e30f80e authored by Rémi Denis-Courmont's avatar 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.
parent 663e69a6
...@@ -42,7 +42,13 @@ ...@@ -42,7 +42,13 @@
static aout_instance_t *findAout (vlc_object_t *obj) 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) if (p_input == NULL)
return NULL; return NULL;
......
...@@ -450,6 +450,19 @@ mouse_object( vlc_object_t *p_this, char const *psz_cmd, ...@@ -450,6 +450,19 @@ mouse_object( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS; 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 * ); static void libvlc_media_player_destroy( libvlc_media_player_t * );
...@@ -530,6 +543,8 @@ libvlc_media_player_new( libvlc_instance_t *instance ) ...@@ -530,6 +543,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
/* Audio */ /* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT); 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->p_md = NULL;
mp->state = libvlc_NothingSpecial; mp->state = libvlc_NothingSpecial;
......
...@@ -282,6 +282,12 @@ void set_current_status_node( playlist_t * p_playlist, ...@@ -282,6 +282,12 @@ void set_current_status_node( playlist_t * p_playlist,
pl_priv(p_playlist)->status.p_node = p_node; 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 ) static void VariablesInit( playlist_t *p_playlist )
{ {
/* These variables control updates */ /* These variables control updates */
...@@ -316,6 +322,10 @@ static void VariablesInit( playlist_t *p_playlist ) ...@@ -316,6 +322,10 @@ static void VariablesInit( playlist_t *p_playlist )
/* Variables to preserve video output parameters */ /* Variables to preserve video output parameters */
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 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 ) playlist_item_t * playlist_CurrentPlayingItem( playlist_t * p_playlist )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment