msg_Dbg( p_this, "creating VLM" );
- p_vlm = vlc_custom_create( p_this, sizeof( *p_vlm ), VLC_OBJECT_GENERIC,
- vlm_object_name );
+ p_vlm = vlc_custom_create( p_this->p_libvlc, sizeof( *p_vlm ),
+ VLC_OBJECT_GENERIC, vlm_object_name );
if( !p_vlm )
{
vlc_mutex_unlock( &vlm_mutex );
TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );
p_vlm->p_vod = NULL;
var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS );
- vlc_object_attach( p_vlm, p_this->p_libvlc );
if( vlc_clone( &p_vlm->thread, Manage, p_vlm, VLC_THREAD_PRIORITY_LOW ) )
{
TAB_CLEAN( p_vlm->i_media, p_vlm->media );
vlm_ControlInternal( p_vlm, VLM_CLEAR_SCHEDULES );
- TAB_CLEAN( p_vlm->schedule, p_vlm->schedule );
+ TAB_CLEAN( p_vlm->i_schedule, p_vlm->schedule );
vlc_mutex_unlock( &p_vlm->lock );
libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
switch( i_query )
{
case VOD_MEDIA_PLAY:
+ {
psz = (const char *)va_arg( args, const char * );
+ int64_t *i_time = (int64_t *)va_arg( args, int64_t *);
+ bool b_retry = false;
+ if (*i_time < 0)
+ {
+ /* No start time requested: return the current NPT */
+ i_ret = vlm_ControlInternal( vlm, VLM_GET_MEDIA_INSTANCE_TIME, id, psz_id, i_time );
+ /* The instance is not running yet, it will start at 0 */
+ if (i_ret)
+ *i_time = 0;
+ }
+ else
+ {
+ /* We want to seek before unpausing, but it won't
+ * work if the instance is not running yet. */
+ b_retry = vlm_ControlInternal( vlm, VLM_SET_MEDIA_INSTANCE_TIME, id, psz_id, *i_time );
+ }
+
i_ret = vlm_ControlInternal( vlm, VLM_START_MEDIA_VOD_INSTANCE, id, psz_id, 0, psz );
+
+ if (!i_ret && b_retry)
+ i_ret = vlm_ControlInternal( vlm, VLM_SET_MEDIA_INSTANCE_TIME, id, psz_id, *i_time );
break;
+ }
case VOD_MEDIA_PAUSE:
+ {
+ int64_t *i_time = (int64_t *)va_arg( args, int64_t *);
i_ret = vlm_ControlInternal( vlm, VLM_PAUSE_MEDIA_INSTANCE, id, psz_id );
+ if (!i_ret)
+ i_ret = vlm_ControlInternal( vlm, VLM_GET_MEDIA_INSTANCE_TIME, id, psz_id, i_time );
break;
+ }
case VOD_MEDIA_STOP:
i_ret = vlm_ControlInternal( vlm, VLM_STOP_MEDIA_INSTANCE, id, psz_id );
{
mtime_t i_real_date = vlm->schedule[i]->i_date;
- if( vlm->schedule[i]->b_enabled == true )
+ if( vlm->schedule[i]->b_enabled )
{
if( vlm->schedule[i]->i_date == 0 ) // now !
{
}
}
}
- else
+ else if( i_nextschedule == 0 || i_real_date < i_nextschedule )
{
i_nextschedule = i_real_date;
}
&preparse );
input_Stop( p_input, true );
- vlc_thread_join( p_input );
- vlc_object_release( p_input );
+ input_Close( p_input );
vlc_sem_destroy( &sem_preparse );
}
free( psz_header );
{
p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ),
VLC_OBJECT_GENERIC, "vod server" );
- vlc_object_attach( p_vlm->p_vod, p_vlm->p_libvlc );
- p_vlm->p_vod->p_module = module_need( p_vlm->p_vod, "vod server", NULL, false );
+ p_vlm->p_vod->p_module = module_need( p_vlm->p_vod, "vod server", "$vod-server", false );
if( !p_vlm->p_vod->p_module )
{
msg_Err( p_vlm, "cannot find vod server" );
p_instance->i_index = 0;
p_instance->b_sout_keep = false;
p_instance->p_parent = vlc_object_create( p_vlm, sizeof (vlc_object_t) );
- vlc_object_attach( p_instance->p_parent, p_vlm->p_libvlc );
p_instance->p_input = NULL;
p_instance->p_input_resource = NULL;
if( p_input )
{
input_Stop( p_input, true );
- vlc_thread_join( p_input );
-
+ input_Join( p_input );
var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
- vlc_object_release( p_input );
+ input_Release( p_input );
vlm_SendEventMediaInstanceStopped( p_vlm, id, p_media->cfg.psz_name );
}
input_Stop( p_input, true );
- vlc_thread_join( p_input );
-
+ input_Join( p_input );
var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
- vlc_object_release( p_input );
+ input_Release( p_input );
if( !p_instance->b_sout_keep )
input_resource_TerminateSout( p_instance->p_input_resource );