Commit 64aaa8ee authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

demux: remove demux_GetParentInput()

parent c34114a5
...@@ -243,12 +243,6 @@ VLC_API decoder_t * demux_PacketizerNew( demux_t *p_demux, es_format_t *p_fmt, c ...@@ -243,12 +243,6 @@ VLC_API decoder_t * demux_PacketizerNew( demux_t *p_demux, es_format_t *p_fmt, c
*/ */
VLC_API void demux_PacketizerDestroy( decoder_t *p_packetizer ); VLC_API void demux_PacketizerDestroy( decoder_t *p_packetizer );
/**
* This function will return the parent input of this demux.
* It is retained. Can return NULL.
*/
VLC_API input_thread_t * demux_GetParentInput( demux_t *p_demux ) VLC_USED;
/* */ /* */
#define DEMUX_INIT_COMMON() do { \ #define DEMUX_INIT_COMMON() do { \
p_demux->pf_control = Control; \ p_demux->pf_control = Control; \
......
...@@ -142,7 +142,6 @@ struct demux_sys_t ...@@ -142,7 +142,6 @@ struct demux_sys_t
mtime_t i_still_end_time; mtime_t i_still_end_time;
/* */ /* */
input_thread_t *p_input;
vout_thread_t *p_vout; vout_thread_t *p_vout;
/* TS stream */ /* TS stream */
...@@ -423,8 +422,7 @@ static int blurayOpen(vlc_object_t *object) ...@@ -423,8 +422,7 @@ static int blurayOpen(vlc_object_t *object)
/* Registering overlay event handler */ /* Registering overlay event handler */
bd_register_overlay_proc(p_sys->bluray, p_demux, blurayOverlayProc); bd_register_overlay_proc(p_sys->bluray, p_demux, blurayOverlayProc);
p_sys->p_input = demux_GetParentInput(p_demux); if (unlikely(!p_demux->p_input)) {
if (unlikely(!p_sys->p_input)) {
msg_Err(p_demux, "Could not get parent input"); msg_Err(p_demux, "Could not get parent input");
goto error; goto error;
} }
...@@ -495,8 +493,6 @@ static void blurayClose(vlc_object_t *object) ...@@ -495,8 +493,6 @@ static void blurayClose(vlc_object_t *object)
var_DelCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux); var_DelCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux);
vlc_object_release(p_sys->p_vout); vlc_object_release(p_sys->p_vout);
} }
if (p_sys->p_input != NULL)
vlc_object_release(p_sys->p_input);
if (p_sys->p_parser) if (p_sys->p_parser)
stream_Delete(p_sys->p_parser); stream_Delete(p_sys->p_parser);
if (p_sys->p_out != NULL) if (p_sys->p_out != NULL)
...@@ -1693,7 +1689,7 @@ static int blurayDemux(demux_t *p_demux) ...@@ -1693,7 +1689,7 @@ static int blurayDemux(demux_t *p_demux)
vlc_mutex_unlock(&ov->lock); vlc_mutex_unlock(&ov->lock);
if (display) { if (display) {
if (p_sys->p_vout == NULL) if (p_sys->p_vout == NULL)
p_sys->p_vout = input_GetVout(p_sys->p_input); p_sys->p_vout = input_GetVout(p_demux->p_input);
if (p_sys->p_vout != NULL) { if (p_sys->p_vout != NULL) {
var_AddCallback(p_sys->p_vout, "mouse-moved", onMouseEvent, p_demux); var_AddCallback(p_sys->p_vout, "mouse-moved", onMouseEvent, p_demux);
var_AddCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux); var_AddCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux);
......
...@@ -138,9 +138,6 @@ struct demux_sys_t ...@@ -138,9 +138,6 @@ struct demux_sys_t
ps_track_t tk[PS_TK_COUNT]; ps_track_t tk[PS_TK_COUNT];
int i_mux_rate; int i_mux_rate;
/* for spu variables */
input_thread_t *p_input;
/* event */ /* event */
vout_thread_t *p_vout; vout_thread_t *p_vout;
...@@ -316,17 +313,16 @@ static int CommonOpen( vlc_object_t *p_this, ...@@ -316,17 +313,16 @@ static int CommonOpen( vlc_object_t *p_this,
/* FIXME hack hack hack hack FIXME */ /* FIXME hack hack hack hack FIXME */
/* Get p_input and create variable */ /* Get p_input and create variable */
p_sys->p_input = demux_GetParentInput( p_demux ); var_Create( p_demux->p_input, "x-start", VLC_VAR_INTEGER );
var_Create( p_sys->p_input, "x-start", VLC_VAR_INTEGER ); var_Create( p_demux->p_input, "y-start", VLC_VAR_INTEGER );
var_Create( p_sys->p_input, "y-start", VLC_VAR_INTEGER ); var_Create( p_demux->p_input, "x-end", VLC_VAR_INTEGER );
var_Create( p_sys->p_input, "x-end", VLC_VAR_INTEGER ); var_Create( p_demux->p_input, "y-end", VLC_VAR_INTEGER );
var_Create( p_sys->p_input, "y-end", VLC_VAR_INTEGER ); var_Create( p_demux->p_input, "color", VLC_VAR_ADDRESS );
var_Create( p_sys->p_input, "color", VLC_VAR_ADDRESS ); var_Create( p_demux->p_input, "menu-palette", VLC_VAR_ADDRESS );
var_Create( p_sys->p_input, "menu-palette", VLC_VAR_ADDRESS ); var_Create( p_demux->p_input, "highlight", VLC_VAR_BOOL );
var_Create( p_sys->p_input, "highlight", VLC_VAR_BOOL );
/* catch vout creation event */ /* catch vout creation event */
var_AddCallback( p_sys->p_input, "intf-event", EventIntf, p_demux ); var_AddCallback( p_demux->p_input, "intf-event", EventIntf, p_demux );
p_sys->still.b_enabled = false; p_sys->still.b_enabled = false;
vlc_mutex_init( &p_sys->still.lock ); vlc_mutex_init( &p_sys->still.lock );
...@@ -501,7 +497,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -501,7 +497,7 @@ static void Close( vlc_object_t *p_this )
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
/* Stop vout event handler */ /* Stop vout event handler */
var_DelCallback( p_sys->p_input, "intf-event", EventIntf, p_demux ); var_DelCallback( p_demux->p_input, "intf-event", EventIntf, p_demux );
if( p_sys->p_vout != NULL ) if( p_sys->p_vout != NULL )
{ /* Should not happen, but better be safe than sorry. */ { /* Should not happen, but better be safe than sorry. */
msg_Warn( p_sys->p_vout, "removing dangling mouse DVD callbacks" ); msg_Warn( p_sys->p_vout, "removing dangling mouse DVD callbacks" );
...@@ -514,15 +510,13 @@ static void Close( vlc_object_t *p_this ) ...@@ -514,15 +510,13 @@ static void Close( vlc_object_t *p_this )
vlc_timer_destroy( p_sys->still.timer ); vlc_timer_destroy( p_sys->still.timer );
vlc_mutex_destroy( &p_sys->still.lock ); vlc_mutex_destroy( &p_sys->still.lock );
var_Destroy( p_sys->p_input, "highlight" ); var_Destroy( p_demux->p_input, "highlight" );
var_Destroy( p_sys->p_input, "x-start" ); var_Destroy( p_demux->p_input, "x-start" );
var_Destroy( p_sys->p_input, "x-end" ); var_Destroy( p_demux->p_input, "x-end" );
var_Destroy( p_sys->p_input, "y-start" ); var_Destroy( p_demux->p_input, "y-start" );
var_Destroy( p_sys->p_input, "y-end" ); var_Destroy( p_demux->p_input, "y-end" );
var_Destroy( p_sys->p_input, "color" ); var_Destroy( p_demux->p_input, "color" );
var_Destroy( p_sys->p_input, "menu-palette" ); var_Destroy( p_demux->p_input, "menu-palette" );
vlc_object_release( p_sys->p_input );
for( int i = 0; i < PS_TK_COUNT; i++ ) for( int i = 0; i < PS_TK_COUNT; i++ )
{ {
...@@ -1232,13 +1226,13 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode ) ...@@ -1232,13 +1226,13 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
} }
vlc_global_lock( VLC_HIGHLIGHT_MUTEX ); vlc_global_lock( VLC_HIGHLIGHT_MUTEX );
var_SetInteger( p_sys->p_input, "x-start", hl.sx ); var_SetInteger( p_demux->p_input, "x-start", hl.sx );
var_SetInteger( p_sys->p_input, "x-end", hl.ex ); var_SetInteger( p_demux->p_input, "x-end", hl.ex );
var_SetInteger( p_sys->p_input, "y-start", hl.sy ); var_SetInteger( p_demux->p_input, "y-start", hl.sy );
var_SetInteger( p_sys->p_input, "y-end", hl.ey ); var_SetInteger( p_demux->p_input, "y-end", hl.ey );
var_SetAddress( p_sys->p_input, "menu-palette", p_sys->palette ); var_SetAddress( p_demux->p_input, "menu-palette", p_sys->palette );
var_SetBool( p_sys->p_input, "highlight", true ); var_SetBool( p_demux->p_input, "highlight", true );
msg_Dbg( p_demux, "buttonUpdate %d", i_button ); msg_Dbg( p_demux, "buttonUpdate %d", i_button );
} }
...@@ -1249,7 +1243,7 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode ) ...@@ -1249,7 +1243,7 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
/* Show all */ /* Show all */
vlc_global_lock( VLC_HIGHLIGHT_MUTEX ); vlc_global_lock( VLC_HIGHLIGHT_MUTEX );
var_SetBool( p_sys->p_input, "highlight", false ); var_SetBool( p_demux->p_input, "highlight", false );
} }
vlc_global_unlock( VLC_HIGHLIGHT_MUTEX ); vlc_global_unlock( VLC_HIGHLIGHT_MUTEX );
} }
......
...@@ -148,7 +148,7 @@ void event_thread_t::EventThread() ...@@ -148,7 +148,7 @@ void event_thread_t::EventThread()
/* catch all key event */ /* catch all key event */
var_AddCallback( p_demux->p_libvlc, "key-action", EventKey, this ); var_AddCallback( p_demux->p_libvlc, "key-action", EventKey, this );
/* catch input event */ /* catch input event */
var_AddCallback( p_sys->p_input, "intf-event", EventInput, this ); var_AddCallback( p_demux->p_input, "intf-event", EventInput, this );
/* main loop */ /* main loop */
for( ;; ) for( ;; )
...@@ -368,17 +368,17 @@ void event_thread_t::EventThread() ...@@ -368,17 +368,17 @@ void event_thread_t::EventThread()
} }
vlc_global_lock( VLC_HIGHLIGHT_MUTEX ); vlc_global_lock( VLC_HIGHLIGHT_MUTEX );
var_SetInteger( p_sys->p_input, "x-start", var_SetInteger( p_demux->p_input, "x-start",
button_ptr.x_start ); button_ptr.x_start );
var_SetInteger( p_sys->p_input, "x-end", var_SetInteger( p_demux->p_input, "x-end",
button_ptr.x_end ); button_ptr.x_end );
var_SetInteger( p_sys->p_input, "y-start", var_SetInteger( p_demux->p_input, "y-start",
button_ptr.y_start ); button_ptr.y_start );
var_SetInteger( p_sys->p_input, "y-end", var_SetInteger( p_demux->p_input, "y-end",
button_ptr.y_end ); button_ptr.y_end );
var_SetAddress( p_sys->p_input, "menu-palette", var_SetAddress( p_demux->p_input, "menu-palette",
p_sys->palette ); p_sys->palette );
var_SetBool( p_sys->p_input, "highlight", true ); var_SetBool( p_demux->p_input, "highlight", true );
vlc_global_unlock( VLC_HIGHLIGHT_MUTEX ); vlc_global_unlock( VLC_HIGHLIGHT_MUTEX );
} }
vlc_mutex_unlock( &p_sys->lock_demuxer ); vlc_mutex_unlock( &p_sys->lock_demuxer );
...@@ -400,7 +400,7 @@ void event_thread_t::EventThread() ...@@ -400,7 +400,7 @@ void event_thread_t::EventThread()
/* Always check vout */ /* Always check vout */
if( p_vout == NULL ) if( p_vout == NULL )
{ {
p_vout = (vlc_object_t*) input_GetVout(p_sys->p_input); p_vout = (vlc_object_t*) input_GetVout(p_demux->p_input);
if( p_vout) if( p_vout)
{ {
var_AddCallback( p_vout, "mouse-moved", EventMouse, this ); var_AddCallback( p_vout, "mouse-moved", EventMouse, this );
...@@ -416,7 +416,7 @@ void event_thread_t::EventThread() ...@@ -416,7 +416,7 @@ void event_thread_t::EventThread()
var_DelCallback( p_vout, "mouse-clicked", EventMouse, this ); var_DelCallback( p_vout, "mouse-clicked", EventMouse, this );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
var_DelCallback( p_sys->p_input, "intf-event", EventInput, this ); var_DelCallback( p_demux->p_input, "intf-event", EventInput, this );
var_DelCallback( p_demux->p_libvlc, "key-action", EventKey, this ); var_DelCallback( p_demux->p_libvlc, "key-action", EventKey, this );
vlc_restorecancel (canc); vlc_restorecancel (canc);
...@@ -605,7 +605,7 @@ void demux_sys_t::InitUi() ...@@ -605,7 +605,7 @@ void demux_sys_t::InitUi()
/* FIXME hack hack hack hack FIXME */ /* FIXME hack hack hack hack FIXME */
/* Get p_input and create variable */ /* Get p_input and create variable */
p_input = demux_GetParentInput( &demuxer ); p_input = demuxer.p_input;
if( p_input ) if( p_input )
{ {
var_Create( p_input, "x-start", VLC_VAR_INTEGER ); var_Create( p_input, "x-start", VLC_VAR_INTEGER );
...@@ -635,8 +635,6 @@ void demux_sys_t::CleanUi() ...@@ -635,8 +635,6 @@ void demux_sys_t::CleanUi()
var_Destroy( p_input, "y-end" ); var_Destroy( p_input, "y-end" );
var_Destroy( p_input, "color" ); var_Destroy( p_input, "color" );
var_Destroy( p_input, "menu-palette" ); var_Destroy( p_input, "menu-palette" );
vlc_object_release( p_input );
} }
msg_Dbg( &demuxer, "Stopping the UI Hook" ); msg_Dbg( &demuxer, "Stopping the UI Hook" );
......
...@@ -738,7 +738,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -738,7 +738,7 @@ static int Open( vlc_object_t * p_this )
msg_Dbg( p_demux, "detected playlist mov file (%d ref)", i_count ); msg_Dbg( p_demux, "detected playlist mov file (%d ref)", i_count );
input_thread_t *p_input = demux_GetParentInput( p_demux ); input_thread_t *p_input = p_demux->p_input;
input_item_t *p_current = input_GetItem( p_input ); input_item_t *p_current = input_GetItem( p_input );
input_item_node_t *p_subitems = input_item_node_Create( p_current ); input_item_node_t *p_subitems = input_item_node_Create( p_current );
...@@ -784,7 +784,6 @@ static int Open( vlc_object_t * p_this ) ...@@ -784,7 +784,6 @@ static int Open( vlc_object_t * p_this )
free( psz_ref ); free( psz_ref );
free( psz_path ); free( psz_path );
input_item_node_Delete( p_subitems ); input_item_node_Delete( p_subitems );
vlc_object_release( p_input) ;
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -806,7 +805,6 @@ static int Open( vlc_object_t * p_this ) ...@@ -806,7 +805,6 @@ static int Open( vlc_object_t * p_this )
free( psz_ref ); free( psz_ref );
} }
input_item_node_PostAndDelete( p_subitems ); input_item_node_PostAndDelete( p_subitems );
vlc_object_release( p_input );
} }
if( !(p_mvhd = MP4_BoxGet( p_sys->p_root, "/moov/mvhd" ) ) ) if( !(p_mvhd = MP4_BoxGet( p_sys->p_root, "/moov/mvhd" ) ) )
......
...@@ -205,10 +205,8 @@ int Control(demux_t *demux, int query, va_list args) ...@@ -205,10 +205,8 @@ int Control(demux_t *demux, int query, va_list args)
input_item_t * GetCurrentItem(demux_t *p_demux) input_item_t * GetCurrentItem(demux_t *p_demux)
{ {
input_thread_t *p_input_thread = demux_GetParentInput( p_demux ); input_item_t *p_current_input = input_GetItem( p_demux->p_input );
input_item_t *p_current_input = input_GetItem( p_input_thread );
vlc_gc_incref(p_current_input); vlc_gc_incref(p_current_input);
vlc_object_release(p_input_thread);
return p_current_input; return p_current_input;
} }
......
...@@ -246,8 +246,7 @@ static int Demux( demux_t *p_demux ) ...@@ -246,8 +246,7 @@ static int Demux( demux_t *p_demux )
lua_State *L = p_demux->p_sys->L; lua_State *L = p_demux->p_sys->L;
char *psz_filename = p_demux->p_sys->psz_filename; char *psz_filename = p_demux->p_sys->psz_filename;
input_thread_t *p_input_thread = demux_GetParentInput( p_demux ); input_item_t *p_current_input = input_GetItem( p_demux->p_input );
input_item_t *p_current_input = input_GetItem( p_input_thread );
luaL_register( L, "vlc", p_reg_parse ); luaL_register( L, "vlc", p_reg_parse );
...@@ -257,7 +256,6 @@ static int Demux( demux_t *p_demux ) ...@@ -257,7 +256,6 @@ static int Demux( demux_t *p_demux )
{ {
msg_Warn( p_demux, "Error while running script %s, " msg_Warn( p_demux, "Error while running script %s, "
"function parse() not found", psz_filename ); "function parse() not found", psz_filename );
vlc_object_release( p_input_thread );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -266,7 +264,6 @@ static int Demux( demux_t *p_demux ) ...@@ -266,7 +264,6 @@ static int Demux( demux_t *p_demux )
msg_Warn( p_demux, "Error while running script %s, " msg_Warn( p_demux, "Error while running script %s, "
"function parse(): %s", psz_filename, "function parse(): %s", psz_filename,
lua_tostring( L, lua_gettop( L ) ) ); lua_tostring( L, lua_gettop( L ) ) );
vlc_object_release( p_input_thread );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -275,8 +272,6 @@ static int Demux( demux_t *p_demux ) ...@@ -275,8 +272,6 @@ static int Demux( demux_t *p_demux )
else else
msg_Err( p_demux, "Script went completely foobar" ); msg_Err( p_demux, "Script went completely foobar" );
vlc_object_release( p_input_thread );
return -1; /* Needed for correct operation of go back */ return -1; /* Needed for correct operation of go back */
} }
......
...@@ -613,10 +613,9 @@ static void *Run( void *data ) ...@@ -613,10 +613,9 @@ static void *Run( void *data )
static int Demux( demux_t *p_demux ) static int Demux( demux_t *p_demux )
{ {
sdp_t *p_sdp = p_demux->p_sys->p_sdp; sdp_t *p_sdp = p_demux->p_sys->p_sdp;
input_thread_t *p_input; input_thread_t *p_input = p_demux->p_input;
input_item_t *p_parent_input; input_item_t *p_parent_input;
p_input = demux_GetParentInput( p_demux );
assert( p_input ); assert( p_input );
if( !p_input ) if( !p_input )
{ {
...@@ -646,7 +645,6 @@ static int Demux( demux_t *p_demux ) ...@@ -646,7 +645,6 @@ static int Demux( demux_t *p_demux )
p_parent_input->b_net = true; p_parent_input->b_net = true;
vlc_mutex_unlock( &p_parent_input->lock ); vlc_mutex_unlock( &p_parent_input->lock );
vlc_object_release( p_input );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -220,15 +220,6 @@ void demux_Delete( demux_t *p_demux ) ...@@ -220,15 +220,6 @@ void demux_Delete( demux_t *p_demux )
stream_Delete( s ); stream_Delete( s );
} }
/*****************************************************************************
* demux_GetParentInput:
*****************************************************************************/
input_thread_t * demux_GetParentInput( demux_t *p_demux )
{
return p_demux->p_input ? vlc_object_hold((vlc_object_t*)p_demux->p_input) : NULL;
}
/***************************************************************************** /*****************************************************************************
* demux_vaControlHelper: * demux_vaControlHelper:
*****************************************************************************/ *****************************************************************************/
......
...@@ -89,7 +89,6 @@ decoder_SynchroReset ...@@ -89,7 +89,6 @@ decoder_SynchroReset
decoder_SynchroTrash decoder_SynchroTrash
decode_URI decode_URI
decode_URI_duplicate decode_URI_duplicate
demux_GetParentInput
demux_PacketizerDestroy demux_PacketizerDestroy
demux_PacketizerNew demux_PacketizerNew
demux_vaControlHelper demux_vaControlHelper
......
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