This will make variable inheritance to child inputs much simpler
- mp = malloc(sizeof(libvlc_media_player_t));
- if (!mp)
+ mp = vlc_object_create (instance->p_libvlc_int, sizeof(*mp));
+ if (unlikely(mp == NULL))
- libvlc_exception_raise(e);
libvlc_printerr("Not enough memory");
return NULL;
}
libvlc_printerr("Not enough memory");
return NULL;
}
+ vlc_object_attach (mp, mp->p_libvlc);
mp->p_md = NULL;
mp->drawable.agl = 0;
mp->drawable.xid = 0;
mp->p_md = NULL;
mp->drawable.agl = 0;
mp->drawable.xid = 0;
mp->p_event_manager = libvlc_event_manager_new(mp, instance);
if (unlikely(mp->p_event_manager == NULL))
{
mp->p_event_manager = libvlc_event_manager_new(mp, instance);
if (unlikely(mp->p_event_manager == NULL))
{
+ vlc_object_release(mp);
return NULL;
}
vlc_mutex_init(&mp->object_lock);
return NULL;
}
vlc_mutex_init(&mp->object_lock);
* FIXME: It's unclear why we want to put this in public API, and why we
* want to expose it in such a limiting and ugly way.
*/
* FIXME: It's unclear why we want to put this in public API, and why we
* want to expose it in such a limiting and ugly way.
*/
- var_AddCallback(instance->p_libvlc_int, "snapshot-file", snapshot_was_taken, mp);
+ var_AddCallback(mp->p_libvlc, "snapshot-file", snapshot_was_taken, mp);
assert( p_mi );
/* Detach Callback from the main libvlc object */
assert( p_mi );
/* Detach Callback from the main libvlc object */
- var_DelCallback( p_mi->p_libvlc_instance->p_libvlc_int,
+ var_DelCallback( p_mi->p_libvlc,
"snapshot-file", snapshot_was_taken, p_mi );
/* If the input thread hasn't been already deleted it means
"snapshot-file", snapshot_was_taken, p_mi );
/* If the input thread hasn't been already deleted it means
libvlc_event_manager_release( p_mi->p_event_manager );
libvlc_media_release( p_mi->p_md );
vlc_mutex_destroy( &p_mi->object_lock );
libvlc_event_manager_release( p_mi->p_event_manager );
libvlc_media_release( p_mi->p_md );
vlc_mutex_destroy( &p_mi->object_lock );
+ vlc_object_release( p_mi );
}
/**************************************************************************
}
/**************************************************************************
- p_mi->p_input_thread = input_Create( p_mi->p_libvlc_instance->p_libvlc_int,
- p_mi->p_md->p_input_item, NULL, p_mi->p_input_resource );
-
+ p_mi->p_input_thread = input_Create( p_mi,
+ p_mi->p_md->p_input_item, NULL,
+ p_mi->p_input_resource );
if( !p_mi->p_input_thread )
{
unlock(p_mi);
if( !p_mi->p_input_thread )
{
unlock(p_mi);
struct libvlc_media_player_t
{
struct libvlc_media_player_t
{
int i_refcount;
vlc_mutex_t object_lock;
input_thread_t * p_input_thread;
int i_refcount;
vlc_mutex_t object_lock;
input_thread_t * p_input_thread;