[vlc-devel] [PATCH 3/5] dvdnav: use DEMUX_VOUT_CHANGED control to get vouts
Thomas Guillem
thomas at gllm.fr
Fri Jul 13 11:34:39 CEST 2018
Remove one other dependency to "intf-event".
---
modules/access/dvdnav.c | 57 ++++++++++++++++-------------------------
1 file changed, 22 insertions(+), 35 deletions(-)
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index c48264e5d2..da6ca086a6 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -187,8 +187,6 @@ static void StillTimer( void * );
static int EventMouse( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
-static int EventIntf( vlc_object_t *, char const *,
- vlc_value_t, vlc_value_t, void * );
/*****************************************************************************
* CommonOpen:
@@ -326,9 +324,6 @@ static int CommonOpen( vlc_object_t *p_this,
var_Create( p_demux->p_input, "menu-palette", VLC_VAR_ADDRESS );
var_Create( p_demux->p_input, "highlight", VLC_VAR_BOOL );
- /* catch vout creation event */
- var_AddCallback( p_demux->p_input, "intf-event", EventIntf, p_demux );
-
p_sys->still.b_enabled = false;
vlc_mutex_init( &p_sys->still.lock );
if( !vlc_timer_create( &p_sys->still.timer, StillTimer, p_sys ) )
@@ -507,13 +502,11 @@ static void Close( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
- /* Stop vout event handler */
- var_DelCallback( p_demux->p_input, "intf-event", EventIntf, p_demux );
if( p_sys->p_vout != NULL )
- { /* Should not happen, but better be safe than sorry. */
- msg_Warn( p_sys->p_vout, "removing dangling mouse DVD callbacks" );
+ {
var_DelCallback( p_sys->p_vout, "mouse-moved", EventMouse, p_demux );
var_DelCallback( p_sys->p_vout, "mouse-clicked", EventMouse, p_demux );
+ vlc_object_release( p_sys->p_vout );
}
/* Stop still image handler */
@@ -781,6 +774,26 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
p_sys->cur_seekpoint = 2;
break;
}
+ case DEMUX_VOUT_CHANGED:
+ {
+ vout_thread_t **pp_vouts = va_arg( args, vout_thread_t** );
+ size_t i_vout_count = va_arg( args, size_t );
+ if( p_sys->p_vout != NULL )
+ {
+ var_DelCallback( p_sys->p_vout, "mouse-moved", EventMouse, p_demux );
+ var_DelCallback( p_sys->p_vout, "mouse-clicked", EventMouse, p_demux );
+ vlc_object_release( p_sys->p_vout );
+ }
+
+ /* DVDs should have only one VOUT (or zero) */
+ p_sys->p_vout = i_vout_count > 0 ? vlc_object_hold(pp_vouts[0]) : NULL;
+ if( p_sys->p_vout != NULL )
+ {
+ var_AddCallback( p_sys->p_vout, "mouse-moved", EventMouse, p_demux );
+ var_AddCallback( p_sys->p_vout, "mouse-clicked", EventMouse, p_demux );
+ }
+ break;
+ }
/* TODO implement others */
default:
@@ -1608,32 +1621,6 @@ static int EventMouse( vlc_object_t *p_vout, char const *psz_var,
return VLC_SUCCESS;
}
-static int EventIntf( vlc_object_t *p_input, char const *psz_var,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- demux_t *p_demux = p_data;
- demux_sys_t *p_sys = p_demux->p_sys;
-
- if (val.i_int == INPUT_EVENT_VOUT)
- {
- if( p_sys->p_vout != NULL )
- {
- var_DelCallback( p_sys->p_vout, "mouse-moved", EventMouse, p_demux );
- var_DelCallback( p_sys->p_vout, "mouse-clicked", EventMouse, p_demux );
- vlc_object_release( p_sys->p_vout );
- }
-
- p_sys->p_vout = input_GetVout( (input_thread_t *)p_input );
- if( p_sys->p_vout != NULL )
- {
- var_AddCallback( p_sys->p_vout, "mouse-moved", EventMouse, p_demux );
- var_AddCallback( p_sys->p_vout, "mouse-clicked", EventMouse, p_demux );
- }
- }
- (void) psz_var; (void) oldval;
- return VLC_SUCCESS;
-}
-
/*****************************************************************************
* ProbeDVD: very weak probing that avoids going too often into a dvdnav_open()
*****************************************************************************/
--
2.18.0
More information about the vlc-devel
mailing list