Commit 47fd5024 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Fix playlist_CurrentInput usage.

parent f5292e55
...@@ -167,7 +167,6 @@ DBUS_METHOD( PositionGet ) ...@@ -167,7 +167,6 @@ DBUS_METHOD( PositionGet )
dbus_int32_t i_pos; dbus_int32_t i_pos;
playlist_t *p_playlist = pl_Hold( ((vlc_object_t*) p_this) ); playlist_t *p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist ); input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( !p_input ) if( !p_input )
...@@ -176,8 +175,8 @@ DBUS_METHOD( PositionGet ) ...@@ -176,8 +175,8 @@ DBUS_METHOD( PositionGet )
{ {
var_Get( p_input, "time", &position ); var_Get( p_input, "time", &position );
i_pos = position.i_time / 1000; i_pos = position.i_time / 1000;
vlc_object_release( p_input );
} }
PL_UNLOCK;
pl_Release( ((vlc_object_t*) p_this) ); pl_Release( ((vlc_object_t*) p_this) );
ADD_INT32( &i_pos ); ADD_INT32( &i_pos );
REPLY_SEND; REPLY_SEND;
...@@ -206,15 +205,14 @@ DBUS_METHOD( PositionSet ) ...@@ -206,15 +205,14 @@ DBUS_METHOD( PositionSet )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
p_playlist = pl_Hold( ((vlc_object_t*) p_this) ); p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist ); input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input ) if( p_input )
{ {
position.i_time = i_pos * 1000; position.i_time = i_pos * 1000;
var_Set( p_input, "time", position ); var_Set( p_input, "time", position );
vlc_object_release( p_input );
} }
PL_UNLOCK;
pl_Release( ((vlc_object_t*) p_this) ); pl_Release( ((vlc_object_t*) p_this) );
REPLY_SEND; REPLY_SEND;
} }
...@@ -319,11 +317,7 @@ DBUS_METHOD( Play ) ...@@ -319,11 +317,7 @@ DBUS_METHOD( Play )
REPLY_INIT; REPLY_INIT;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this ); playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist ); input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
vlc_object_hold( p_input );
PL_UNLOCK;
if( p_input ) if( p_input )
{ {
...@@ -796,7 +790,6 @@ static void Close ( vlc_object_t *p_this ) ...@@ -796,7 +790,6 @@ static void Close ( vlc_object_t *p_this )
playlist_t *p_playlist = pl_Hold( p_intf );; playlist_t *p_playlist = pl_Hold( p_intf );;
input_thread_t *p_input; input_thread_t *p_input;
PL_LOCK;
var_DelCallback( p_playlist, "playlist-current", TrackChange, p_intf ); var_DelCallback( p_playlist, "playlist-current", TrackChange, p_intf );
var_DelCallback( p_playlist, "intf-change", TrackListChangeEmit, p_intf ); var_DelCallback( p_playlist, "intf-change", TrackListChangeEmit, p_intf );
var_DelCallback( p_playlist, "item-append", TrackListChangeEmit, p_intf ); var_DelCallback( p_playlist, "item-append", TrackListChangeEmit, p_intf );
...@@ -808,12 +801,10 @@ static void Close ( vlc_object_t *p_this ) ...@@ -808,12 +801,10 @@ static void Close ( vlc_object_t *p_this )
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
if ( p_input ) if ( p_input )
{ {
vlc_object_hold( p_input );
var_DelCallback( p_input, "state", StateChange, p_intf ); var_DelCallback( p_input, "state", StateChange, p_intf );
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
PL_UNLOCK;
pl_Release( p_intf ); pl_Release( p_intf );
dbus_connection_unref( p_intf->p_sys->p_conn ); dbus_connection_unref( p_intf->p_sys->p_conn );
...@@ -999,15 +990,12 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var, ...@@ -999,15 +990,12 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var,
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
if( !p_input ) if( !p_input )
{ {
PL_UNLOCK;
pl_Release( p_intf ); pl_Release( p_intf );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
vlc_object_hold( p_input );
pl_Release( p_intf ); pl_Release( p_intf );
p_item = input_GetItem( p_input ); p_item = input_GetItem( p_input );
...@@ -1041,6 +1029,7 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked ) ...@@ -1041,6 +1029,7 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked )
if( p_playlist->current.i_size > 0 ) if( p_playlist->current.i_size > 0 )
i_caps |= CAPS_CAN_PLAY | CAPS_CAN_GO_PREV | CAPS_CAN_GO_NEXT; i_caps |= CAPS_CAN_PLAY | CAPS_CAN_GO_PREV | CAPS_CAN_GO_NEXT;
if( !b_playlist_locked ) PL_UNLOCK;
input_thread_t* p_input = playlist_CurrentInput( p_playlist ); input_thread_t* p_input = playlist_CurrentInput( p_playlist );
if( p_input ) if( p_input )
...@@ -1051,9 +1040,9 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked ) ...@@ -1051,9 +1040,9 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked )
i_caps |= CAPS_CAN_PAUSE; i_caps |= CAPS_CAN_PAUSE;
if( var_GetBool( p_input, "seekable" ) ) if( var_GetBool( p_input, "seekable" ) )
i_caps |= CAPS_CAN_SEEK; i_caps |= CAPS_CAN_SEEK;
vlc_object_release( p_input );
} }
if( !b_playlist_locked ) PL_UNLOCK;
pl_Release( p_intf ); pl_Release( p_intf );
if( p_sys->b_meta_read ) if( p_sys->b_meta_read )
...@@ -1163,8 +1152,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args, ...@@ -1163,8 +1152,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
input_thread_t* p_input = NULL; input_thread_t* p_input = NULL;
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
if( lock )
PL_LOCK;
i_state = 2; i_state = 2;
...@@ -1178,6 +1165,7 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args, ...@@ -1178,6 +1165,7 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
i_state = 1; i_state = 1;
else if( val.i_int <= PLAYING_S ) else if( val.i_int <= PLAYING_S )
i_state = 0; i_state = 0;
vlc_object_release( p_input );
} }
i_random = var_CreateGetBool( p_playlist, "random" ); i_random = var_CreateGetBool( p_playlist, "random" );
...@@ -1186,8 +1174,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args, ...@@ -1186,8 +1174,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
i_loop = var_CreateGetBool( p_playlist, "loop" ); i_loop = var_CreateGetBool( p_playlist, "loop" );
if( lock )
PL_UNLOCK;
pl_Release( p_intf ); pl_Release( p_intf );
dbus_message_iter_open_container( args, DBUS_TYPE_STRUCT, NULL, &status ); dbus_message_iter_open_container( args, DBUS_TYPE_STRUCT, NULL, &status );
......
...@@ -330,8 +330,6 @@ void VlcProc::refreshInput() ...@@ -330,8 +330,6 @@ void VlcProc::refreshInput()
{ {
getIntf()->p_sys->p_input = getIntf()->p_sys->p_input =
playlist_CurrentInput( getIntf()->p_sys->p_playlist ); playlist_CurrentInput( getIntf()->p_sys->p_playlist );
if( getIntf()->p_sys->p_input )
vlc_object_hold( getIntf()->p_sys->p_input );
} }
else if( getIntf()->p_sys->p_input->b_dead ) else if( getIntf()->p_sys->p_input->b_dead )
{ {
...@@ -561,10 +559,11 @@ int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable, ...@@ -561,10 +559,11 @@ int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
void VlcProc::updateStreamName( playlist_t *p_playlist ) void VlcProc::updateStreamName( playlist_t *p_playlist )
{ {
if( p_playlist && playlist_CurrentInput( p_playlist )) if( p_playlist )
{ {
input_thread_t * p_input = playlist_CurrentInput( p_playlist )
// Get playlist item information // Get playlist item information
input_item_t *pItem = input_GetItem(playlist_CurrentInput( p_playlist)); input_item_t *pItem = input_GetItem( p_input );
VarText &rStreamName = getStreamNameVar(); VarText &rStreamName = getStreamNameVar();
VarText &rStreamURI = getStreamURIVar(); VarText &rStreamURI = getStreamURIVar();
...@@ -589,6 +588,7 @@ void VlcProc::updateStreamName( playlist_t *p_playlist ) ...@@ -589,6 +588,7 @@ void VlcProc::updateStreamName( playlist_t *p_playlist )
AsyncQueue *pQueue = AsyncQueue::instance( getIntf() ); AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
pQueue->push( CmdGenericPtr( pCmd1 ), false ); pQueue->push( CmdGenericPtr( pCmd1 ), false );
pQueue->push( CmdGenericPtr( pCmd2 ), false ); pQueue->push( CmdGenericPtr( pCmd2 ), false );
vlc_object_release( p_input );
} }
} }
......
...@@ -150,7 +150,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var, ...@@ -150,7 +150,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
if( !p_input ) return VLC_SUCCESS; if( !p_input ) return VLC_SUCCESS;
vlc_object_hold( p_input );
if( p_input->b_dead ) if( p_input->b_dead )
{ {
......
...@@ -139,12 +139,13 @@ static void Close( vlc_object_t *p_this ) ...@@ -139,12 +139,13 @@ static void Close( vlc_object_t *p_this )
playlist_t *p_playlist = pl_Hold( p_this ); playlist_t *p_playlist = pl_Hold( p_this );
input_thread_t *p_input = NULL; input_thread_t *p_input = NULL;
PL_LOCK;
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf ); var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_playlist, "playlist-current", ItemChange, p_intf ); var_DelCallback( p_playlist, "playlist-current", ItemChange, p_intf );
if( (p_input = playlist_CurrentInput( p_playlist )) ) if( (p_input = playlist_CurrentInput( p_playlist )) )
{
var_DelCallback( p_input, "state", StateChange, p_intf ); var_DelCallback( p_input, "state", StateChange, p_intf );
PL_UNLOCK; vlc_object_release( p_input );
}
pl_Release( p_this ); pl_Release( p_this );
/* Clears the Presence message ... else it looks like we're still playing /* Clears the Presence message ... else it looks like we're still playing
...@@ -194,7 +195,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var, ...@@ -194,7 +195,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
if( !p_input ) return VLC_SUCCESS; if( !p_input ) return VLC_SUCCESS;
vlc_object_hold( p_input );
if( p_input->b_dead || !input_GetItem(p_input)->psz_name ) if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
{ {
......
...@@ -1934,8 +1934,9 @@ static void AddStateVariableCallback(filter_t *p_filter) ...@@ -1934,8 +1934,9 @@ static void AddStateVariableCallback(filter_t *p_filter)
if(p_input) if(p_input)
{ {
var_AddCallback( p_input, "state", StateCallback, p_filter ); var_AddCallback( p_input, "state", StateCallback, p_filter );
vlc_object_release( p_input );
} }
vlc_object_release( p_playlist ); pl_Release( p_filter );
} }
/***************************************************************************** /*****************************************************************************
...@@ -1952,8 +1953,9 @@ static void DelStateVariableCallback( filter_t *p_filter ) ...@@ -1952,8 +1953,9 @@ static void DelStateVariableCallback( filter_t *p_filter )
if(p_input) if(p_input)
{ {
var_DelCallback( p_input, "state", StateCallback, p_filter ); var_DelCallback( p_input, "state", StateCallback, p_filter );
vlc_object_release( p_input );
} }
vlc_object_release( p_playlist ); pl_Release( p_filter );
} }
......
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