bool *pb_need_release )
{
intf_sys_t *p_sys = p_intf->p_sys;
- int i_object_type = 0;
vlc_object_t *p_object = NULL;
*pb_need_release = false;
if( !strcmp( psz_object, "VLC_OBJECT_LIBVLC" ) )
p_object = VLC_OBJECT(p_intf->p_libvlc);
- else if( !strcmp( psz_object, "VLC_OBJECT_INTF" ) )
- p_object = VLC_OBJECT(p_intf);
else if( !strcmp( psz_object, "VLC_OBJECT_PLAYLIST" ) )
p_object = VLC_OBJECT(p_sys->p_playlist);
else if( !strcmp( psz_object, "VLC_OBJECT_INPUT" ) )
p_object = VLC_OBJECT(p_sys->p_input);
- else if( !strcmp( psz_object, "VLC_OBJECT_VOUT" ) )
- i_object_type = VLC_OBJECT_VOUT;
- else if( !strcmp( psz_object, "VLC_OBJECT_AOUT" ) )
- i_object_type = VLC_OBJECT_AOUT;
- else
- msg_Warn( p_intf, "unknown object type (%s)", psz_object );
-
- if( p_object == NULL && i_object_type )
+ else if( p_sys->p_input )
{
- *pb_need_release = true;
- p_object = vlc_object_find( p_intf, i_object_type, FIND_ANYWHERE );
+ if( !strcmp( psz_object, "VLC_OBJECT_VOUT" ) )
+ p_object = VLC_OBJECT( input_GetVout( p_sys->p_input ) );
+ else if( !strcmp( psz_object, "VLC_OBJECT_AOUT" ) )
+ p_object = VLC_OBJECT( input_GetAout( p_sys->p_input ) );
+ if( p_object )
+ *pb_need_release = true;
}
+ else
+ msg_Warn( p_intf, "unknown object type (%s)", psz_object );
return p_object;
}
int i_id = SSPopN( st, vars );
int i_ret;
- vlc_object_lock( p_sys->p_playlist );
+ playlist_Lock( p_sys->p_playlist );
i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
pl_Locked, NULL,
playlist_ItemGetById( p_sys->p_playlist,
- i_id, pl_Locked ) );
- vlc_object_unlock( p_sys->p_playlist );
+ i_id ) );
+ playlist_Unlock( p_sys->p_playlist );
msg_Dbg( p_intf, "requested playlist item: %i", i_id );
SSPushN( st, i_ret );
}
{
playlist_item_t *p_item;
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
+ playlist_Lock( p_sys->p_playlist );
p_item = playlist_ItemGetByInput( p_sys->p_playlist,
- p_input,
- pl_Unlocked );
+ p_input );
if( p_item )
i_ret = p_item->i_id;
+ playlist_Unlock( p_sys->p_playlist );
}
else
msg_Warn( p_intf, "adding mrl %s failed", mrl );
else if( !strcmp( s, "playlist_delete" ) )
{
int i_id = SSPopN( st, vars );
+ playlist_Lock( p_sys->p_playlist );
playlist_item_t *p_item = playlist_ItemGetById( p_sys->p_playlist,
- i_id, pl_Unlocked );
+ i_id );
if( p_item )
{
playlist_DeleteFromInput( p_sys->p_playlist,
- p_item->p_input->i_id, pl_Unlocked );
+ p_item->p_input->i_id, pl_Locked );
msg_Dbg( p_intf, "requested playlist delete: %d", i_id );
}
else
msg_Dbg( p_intf, "couldn't find playlist item to delete (%d)",
i_id );
}
+ playlist_Unlock( p_sys->p_playlist );
}
else if( !strcmp( s, "playlist_move" ) )
{
while( strcmp( psz_elt = SSPop( st ), "" )
&& strcmp( psz_elt, ";" ) )
{
- char *psz_buf =
- (char *)malloc( strlen( psz_cmd ) + strlen( psz_elt ) + 2 );
- sprintf( psz_buf, "%s %s", psz_cmd, psz_elt );
+ char* psz_buf;
+ if( asprintf( &psz_buf, "%s %s", psz_cmd, psz_elt ) == -1 )
+ psz_buf = NULL;
free( psz_cmd );
free( psz_elt );
psz_cmd = psz_buf;
}
else
{
- psz_error = malloc( strlen(vlm_answer->psz_name) +
- strlen(vlm_answer->psz_value) +
- strlen( " : ") + 1 );
- sprintf( psz_error , "%s : %s" , vlm_answer->psz_name,
- vlm_answer->psz_value );
+ if( asprintf( &psz_error , "%s : %s" , vlm_answer->psz_name,
+ vlm_answer->psz_value ) == -1 )
+ psz_error = NULL;
}
mvar_AppendNewVar( vars, "vlm_error", psz_error );
{
if( p_sys->p_input )
{
- vout_thread_t *p_vout;
- p_vout = vlc_object_find( p_sys->p_input,
- VLC_OBJECT_VOUT, FIND_CHILD );
-
+ vout_thread_t *p_vout = input_GetVout( p_sys->p_input );
if( p_vout )
{
- vout_Control( p_vout, VOUT_SNAPSHOT );
+ var_TriggerCallback( p_vout, "video-snapshot" );
vlc_object_release( p_vout );
msg_Dbg( p_intf, "requested snapshot" );
}