Commit 7060dbb9 authored by Antoine Cellerier's avatar Antoine Cellerier

s/vlc_object_yield/vlc_object_release/

As discussed on IRC. Yield was quite confusing.
parent e6103805
......@@ -84,7 +84,7 @@ __attribute__((deprecated))
#endif
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( vlc_object_t *, vlc_object_find_name, ( vlc_object_t *, const char *, int ) );
VLC_EXPORT( void *, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void *, __vlc_object_hold, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_children, ( vlc_object_t * ) );
......@@ -110,8 +110,8 @@ VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
#define vlc_object_find_name(a,b,c) \
vlc_object_find_name( VLC_OBJECT(a),b,c)
#define vlc_object_yield(a) \
(typeof(a))__vlc_object_yield( VLC_OBJECT(a) )
#define vlc_object_hold(a) \
(typeof(a))__vlc_object_hold( VLC_OBJECT(a) )
#define vlc_object_release(a) \
__vlc_object_release( VLC_OBJECT(a) )
......
......@@ -322,7 +322,7 @@ DBUS_METHOD( Play )
PL_LOCK;
input_thread_t *p_input = p_playlist->p_input;
if( p_input )
vlc_object_yield( p_input );
vlc_object_hold( p_input );
PL_UNLOCK;
if( p_input )
......@@ -807,7 +807,7 @@ static void Close ( vlc_object_t *p_this )
p_input = p_playlist->p_input;
if ( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
var_DelCallback( p_input, "state", StateChange, p_intf );
vlc_object_release( p_input );
}
......@@ -1006,7 +1006,7 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS;
}
vlc_object_yield( p_input );
vlc_object_hold( p_input );
pl_Release( p_intf );
p_item = input_GetItem( p_input );
......
......@@ -144,7 +144,7 @@ static input_thread_t * input_from_playlist ( playlist_t *p_playlist )
PL_LOCK;
p_input = p_playlist->p_input;
if( p_input )
vlc_object_yield( p_input );
vlc_object_hold( p_input );
PL_UNLOCK;
return p_input;
......
......@@ -177,7 +177,7 @@ static void Run( intf_thread_t *p_intf )
PL_LOCK;
p_input = p_playlist->p_input;
if( p_input )
vlc_object_yield( p_input );
vlc_object_hold( p_input );
PL_UNLOCK;
/* Update the vout */
......
......@@ -387,7 +387,7 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer,
p_sys->p_input = p_sys->p_playlist->p_input;
if( p_sys->p_input )
{
vlc_object_yield( p_sys->p_input );
vlc_object_hold( p_sys->p_input );
var_Get( p_sys->p_input, "position", &val);
sprintf( position, "%d" , (int)((val.f_float) * 100.0));
var_Get( p_sys->p_input, "time", &val);
......
......@@ -1084,7 +1084,7 @@
if( self != nil )
{
psz_name = strdup( name );
_vlc_object = vlc_object_yield( object );
_vlc_object = vlc_object_hold( object );
value = val;
i_type = type;
}
......@@ -1111,7 +1111,7 @@
- (vlc_object_t *)vlcObject
{
return vlc_object_yield( _vlc_object );
return vlc_object_hold( _vlc_object );
}
......
......@@ -271,7 +271,7 @@ static VLCTreeItem *o_root_item = nil;
o_name = [o_item_name copy];
o_title= [o_item_title copy];
o_help= [o_item_help copy];
_vlc_object = object ? vlc_object_yield( object ) : NULL;
_vlc_object = object ? vlc_object_hold( object ) : NULL;
o_parent = o_parent_item;
o_children = o_children_array;
i_object_category = i_category;
......@@ -482,7 +482,7 @@ static VLCTreeItem *o_root_item = nil;
- (vlc_object_t *)vlcObject
{
return vlc_object_yield(_vlc_object);
return vlc_object_hold(_vlc_object);
}
- (NSString *)name
......
......@@ -417,7 +417,7 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_sys->p_input->b_dead )
{
vlc_object_yield( p_sys->p_input );
vlc_object_hold( p_sys->p_input );
}
}
}
......
......@@ -153,7 +153,7 @@ void MediaInfoDialog::update( input_thread_t *p_input )
}
/* Launch the update in all the panels */
vlc_object_yield( p_input );
vlc_object_hold( p_input );
update( input_GetItem(p_input), true, true);
......@@ -171,7 +171,7 @@ void MediaInfoDialog::updateOnTimeOut()
if( p_input && !p_input->b_dead )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
update( input_GetItem(p_input), false, false);
vlc_object_release( p_input );
}
......
......@@ -87,7 +87,7 @@ void InputManager::setInput( input_thread_t *_p_input )
p_input = _p_input;
if( p_input && !( p_input->b_dead || !vlc_object_alive (p_input) ) )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
emit statusChanged( PLAYING_S );
UpdateMeta();
UpdateArt();
......@@ -650,7 +650,7 @@ void MainInputManager::customEvent( QEvent *event )
p_input = THEPL->p_input;
if( p_input && !( !vlc_object_alive (p_input) || p_input->b_dead) )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
var_AddCallback( p_input, "state", PLItemChanged, this );
emit inputChanged( p_input );
}
......
......@@ -464,7 +464,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
p_input = THEMIM->getInput();
if( p_input )
vlc_object_yield( p_input );
vlc_object_hold( p_input );
p_aout = ( vlc_object_t * ) vlc_object_find( p_intf,
VLC_OBJECT_AOUT,
FIND_ANYWHERE );
......@@ -519,7 +519,7 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
p_input = THEMIM->getInput();
if( p_input )
vlc_object_yield( p_input );
vlc_object_hold( p_input );
p_vout = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
......@@ -713,7 +713,7 @@ void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
......@@ -733,7 +733,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
......@@ -753,7 +753,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
varnames.push_back( "audio-es" );
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
PUSH_SEPARATOR;
......@@ -814,7 +814,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
menu->addSeparator();
vlc_object_yield( p_input );
vlc_object_hold( p_input );
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
vlc_object_release( p_input );
......
......@@ -330,7 +330,7 @@ void VlcProc::refreshInput()
{
getIntf()->p_sys->p_input = getIntf()->p_sys->p_playlist->p_input;
if( getIntf()->p_sys->p_input )
vlc_object_yield( getIntf()->p_sys->p_input );
vlc_object_hold( getIntf()->p_sys->p_input );
}
else if( getIntf()->p_sys->p_input->b_dead )
{
......
......@@ -129,7 +129,7 @@ void FileInfo::Update()
}
pl_Release( p_intf );
vlc_object_yield( p_input );
vlc_object_hold( p_input );
vlc_mutex_lock( &input_GetItem(p_input)->lock );
if( b_need_update == true )
{
......
......@@ -143,7 +143,7 @@ void VLMBroadcastStreamPanel::OnPlay( wxCommandEvent &event )
p_stream->p_media->instance[0]->p_input )
{
vlc_value_t val;
vlc_object_yield( p_stream->p_media->instance[0]->p_input );
vlc_object_hold( p_stream->p_media->instance[0]->p_input );
var_Get( p_stream->p_media->instance[0]->p_input, "state", &val );
if( val.i_int != PAUSE_S )
{
......
......@@ -200,7 +200,7 @@ void InputManager::UpdateInput()
LockPlaylist( p_intf->p_sys, p_playlist );
p_input = p_intf->p_sys->p_input = p_playlist->p_input;
if( p_intf->p_sys->p_input )
vlc_object_yield( p_intf->p_sys->p_input );
vlc_object_hold( p_intf->p_sys->p_input );
UnlockPlaylist( p_intf->p_sys, p_playlist );
pl_Release( p_intf );
}
......
......@@ -282,7 +282,7 @@ void VideoPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
as_varnames.Add( "video-es" );
ai_objects.Add( p_input->i_object_id );
as_varnames.Add( "spu-es" );
......@@ -306,7 +306,7 @@ void AudioPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
as_varnames.Add( "audio-es" );
ai_objects.Add( p_input->i_object_id );
vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
......@@ -330,7 +330,7 @@ void MiscPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
as_varnames.Add( "audio-es" );
InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
PUSH_SEPARATOR;
......@@ -357,7 +357,7 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
/* Video menu */
......
......@@ -215,7 +215,7 @@ static void Close( vlc_object_t *p_this )
p_input = p_playlist->p_input;
if ( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
if( p_sys->b_state_cb )
var_DelCallback( p_input, "state", PlayingChange, p_intf );
......@@ -516,7 +516,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS;
}
vlc_object_yield( p_input );
vlc_object_hold( p_input );
PL_UNLOCK;
pl_Release( p_intf );
......@@ -930,7 +930,7 @@ static int ReadMetaData( intf_thread_t *p_this )
return( VLC_SUCCESS );
}
vlc_object_yield( p_input );
vlc_object_hold( p_input );
PL_UNLOCK;
pl_Release( p_this );
......
......@@ -51,7 +51,7 @@ input_thread_t * vlclua_get_input_internal( lua_State *L )
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
PL_LOCK;
input_thread_t *p_input = p_playlist->p_input;
if( p_input ) vlc_object_yield( p_input );
if( p_input ) vlc_object_hold( p_input );
PL_UNLOCK;
vlclua_release_playlist_internal( p_playlist );
return p_input;
......
......@@ -165,7 +165,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
pl_Release( p_this );
if( !p_input ) return VLC_SUCCESS;
vlc_object_yield( p_input );
vlc_object_hold( p_input );
char *psz_name = input_item_GetName( input_GetItem( p_input ) );
if( p_input->b_dead || !psz_name )
......
......@@ -127,7 +127,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
pl_Release( p_this );
if( !p_input ) return VLC_SUCCESS;
vlc_object_yield( p_input );
vlc_object_hold( p_input );
char *psz_name = input_item_GetName( input_GetItem( p_input ) );
if( p_input->b_dead || !psz_name )
......
......@@ -148,7 +148,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
pl_Release( p_this );
if( !p_input ) return VLC_SUCCESS;
vlc_object_yield( p_input );
vlc_object_hold( p_input );
if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
{
......
......@@ -149,7 +149,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
intf_sys_t *p_sys = p_intf->p_sys;
if( !p_input ) return VLC_SUCCESS;
vlc_object_yield( p_input );
vlc_object_hold( p_input );
if( p_input->b_dead )
{
......
......@@ -193,7 +193,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
p_input = p_playlist->p_input;
if( !p_input ) return VLC_SUCCESS;
vlc_object_yield( p_input );
vlc_object_hold( p_input );
if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -129,7 +129,7 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
}
p_input_thread = p_mi->p_input_thread;
vlc_object_yield( p_input_thread );
vlc_object_hold( p_input_thread );
vlc_mutex_unlock( &p_mi->object_lock );
......@@ -430,7 +430,7 @@ libvlc_media_player_t * libvlc_media_player_new_from_input_thread(
}
/* will be released in media_player_release() */
vlc_object_yield( p_input );
vlc_object_hold( p_input );
p_mi->p_input_thread = p_input;
p_mi->b_own_its_input_thread = false;
......
......@@ -85,7 +85,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
p_vlm = *pp_vlm;
if( p_vlm )
{ /* VLM already exists */
vlc_object_yield( p_vlm );
vlc_object_hold( p_vlm );
vlc_mutex_unlock( lockval.p_address );
return p_vlm;
}
......
......@@ -410,7 +410,7 @@ static interaction_t * InteractionGet( vlc_object_t *p_this )
{
interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
if( obj )
vlc_object_yield( obj );
vlc_object_hold( obj );
return obj;
}
......@@ -612,7 +612,7 @@ static void InteractionManage( interaction_t *p_interaction )
}
}
else
vlc_object_yield( p_interaction->p_intf );
vlc_object_hold( p_interaction->p_intf );
for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
{
......
......@@ -481,7 +481,7 @@ __vlc_object_signal_unlocked
__vlc_object_unlock
__vlc_object_wait
__vlc_object_waitpipe
__vlc_object_yield
__vlc_object_hold
vlc_poll
vlc_rand_bytes
vlc_recvmsg
......
......@@ -525,7 +525,7 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
/* If we are of the requested type ourselves, don't look further */
if( !(i_mode & FIND_STRICT) && p_this->i_object_type == i_type )
{
vlc_object_yield( p_this );
vlc_object_hold( p_this );
return p_this;
}
......@@ -574,7 +574,7 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
&& p_this->psz_object_name
&& !strcmp( p_this->psz_object_name, psz_name ) )
{
vlc_object_yield( p_this );
vlc_object_hold( p_this );
return p_this;
}
......@@ -613,7 +613,7 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
/**
* Increment an object reference counter.
*/
void * __vlc_object_yield( vlc_object_t *p_this )
void * __vlc_object_hold( vlc_object_t *p_this )
{
vlc_object_internals_t *internals = vlc_internals( p_this );
......@@ -721,7 +721,7 @@ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
{
if( !p_this ) return;
vlc_object_yield (p_parent);
vlc_object_hold (p_parent);
vlc_mutex_lock( &structure_lock );
/* Attach the parent to its child */
......@@ -867,7 +867,7 @@ vlc_list_t *__vlc_list_children( vlc_object_t *obj )
l = NewList( priv->i_children );
for (int i = 0; i < l->i_count; i++)
{
vlc_object_yield( priv->pp_children[i] );
vlc_object_hold( priv->pp_children[i] );
l->p_values[i].p_object = priv->pp_children[i];
}
vlc_mutex_unlock( &structure_lock );
......@@ -1067,7 +1067,7 @@ static vlc_object_t * FindObject( vlc_object_t *p_this, int i_type, int i_mode )
{
if( p_tmp->i_object_type == i_type )
{
vlc_object_yield( p_tmp );
vlc_object_hold( p_tmp );
return p_tmp;
}
else
......@@ -1083,7 +1083,7 @@ static vlc_object_t * FindObject( vlc_object_t *p_this, int i_type, int i_mode )
p_tmp = vlc_internals( p_this )->pp_children[i];
if( p_tmp->i_object_type == i_type )
{
vlc_object_yield( p_tmp );
vlc_object_hold( p_tmp );
return p_tmp;
}
else if( vlc_internals( p_tmp )->i_children )
......@@ -1121,7 +1121,7 @@ static vlc_object_t * FindObjectName( vlc_object_t *p_this,
if( p_tmp->psz_object_name
&& !strcmp( p_tmp->psz_object_name, psz_name ) )
{
vlc_object_yield( p_tmp );
vlc_object_hold( p_tmp );
return p_tmp;
}
else
......@@ -1138,7 +1138,7 @@ static vlc_object_t * FindObjectName( vlc_object_t *p_this,
if( p_tmp->psz_object_name
&& !strcmp( p_tmp->psz_object_name, psz_name ) )
{
vlc_object_yield( p_tmp );
vlc_object_hold( p_tmp );
return p_tmp;
}
else if( vlc_internals( p_tmp )->i_children )
......@@ -1289,7 +1289,7 @@ static void ListReplace( vlc_list_t *p_list, vlc_object_t *p_object,
return;
}
vlc_object_yield( p_object );
vlc_object_hold( p_object );
p_list->p_values[i_index].p_object = p_object;
......@@ -1311,7 +1311,7 @@ static void ListReplace( vlc_list_t *p_list, vlc_object_t *p_object,
return;
}
vlc_object_yield( p_object );
vlc_object_hold( p_object );
p_list->p_values[p_list->i_count].p_object = p_object;
p_list->i_count++;
......
......@@ -536,7 +536,7 @@ found_shortcut:
p_tmp = p_first;
while( p_tmp != NULL )
{
vlc_object_yield( p_tmp->p_module );
vlc_object_hold( p_tmp->p_module );
p_tmp = p_tmp->p_next;
}
......@@ -690,7 +690,7 @@ module_t *__module_Find( vlc_object_t *p_this, const char * psz_name )
if( psz_module_name && !strcmp( psz_module_name, psz_name ) )
{
/* We can release the list, and return yes */
vlc_object_yield( p_module );
vlc_object_hold( p_module );
vlc_list_release( p_list );
return p_module;
}
......
......@@ -218,7 +218,7 @@ vlc_acl_t *__ACL_Create( vlc_object_t *p_this, bool b_allow )
if( p_acl == NULL )
return NULL;
vlc_object_yield( p_this );
vlc_object_hold( p_this );
p_acl->p_owner = p_this;
p_acl->i_size = 0;
p_acl->p_entries = NULL;
......@@ -264,7 +264,7 @@ vlc_acl_t *__ACL_Duplicate( vlc_object_t *p_this, const vlc_acl_t *p_acl )
else
p_dupacl->p_entries = NULL;
vlc_object_yield( p_this );
vlc_object_hold( p_this );
p_dupacl->p_owner = p_this;
p_dupacl->i_size = p_acl->i_size;
p_dupacl->b_allow_default = p_acl->b_allow_default;
......
......@@ -1015,7 +1015,7 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
ptrval.p_address = httpd;
libvlc_priv (p_this->p_libvlc)->p_httpd = httpd;
vlc_object_yield( httpd );
vlc_object_hold( httpd );
vlc_object_attach( httpd, p_this->p_libvlc );
}
......
......@@ -49,10 +49,10 @@ playlist_t *__pl_Yield( vlc_object_t *p_this )
pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
assert( VLC_OBJECT(pl) != p_this /* This does not make sense to yield the playlist
using pl_Yield. use vlc_object_yield in this case */ );
using pl_Yield. use vlc_object_hold in this case */ );
if (pl)
vlc_object_yield (pl);
vlc_object_hold (pl);
return pl;
}
......
......@@ -279,7 +279,7 @@ void playlist_set_current_input(
if( p_input )
{
vlc_object_yield( p_input );
vlc_object_hold( p_input );
p_playlist->p_input = p_input;
vlc_event_manager_t * p_em = input_get_event_manager( p_input );
vlc_event_attach( p_em, vlc_InputStateChanged,
......@@ -296,7 +296,7 @@ input_thread_t * playlist_CurrentInput( playlist_t * p_playlist )
input_thread_t * p_input;
PL_LOCK;
p_input = p_playlist->p_input;
if( p_input ) vlc_object_yield( p_input );
if( p_input ) vlc_object_hold( p_input );
PL_UNLOCK;
return p_input;
}
......
......@@ -96,7 +96,7 @@ sout_AnnounceRegisterSDP( sout_instance_t *p_sout, const char *psz_sdp,
vlc_object_set_destructor ((vlc_object_t *)p_sap, sap_destroy);
}
else
vlc_object_yield ((vlc_object_t *)p_sap);
vlc_object_hold ((vlc_object_t *)p_sap);
vlc_mutex_unlock (lockval.p_address);
if (p_sap == NULL)
......
......@@ -144,7 +144,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
/* If a video output was provided, lock it, otherwise look for one. */
if( p_vout )
{
vlc_object_yield( p_vout );
vlc_object_hold( p_vout );
}
/* TODO: find a suitable unused video output */
......
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