Commit 108803d9 authored by Sébastien Escudier's avatar Sébastien Escudier Committed by Rémi Denis-Courmont

Unload vod-VLM only at the end

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit 6d4a41a6)
parent c3eb8675
...@@ -153,7 +153,6 @@ vlm_t *vlm_New ( vlc_object_t *p_this ) ...@@ -153,7 +153,6 @@ vlm_t *vlm_New ( vlc_object_t *p_this )
p_vlm->i_id = 1; p_vlm->i_id = 1;
TAB_INIT( p_vlm->i_media, p_vlm->media ); TAB_INIT( p_vlm->i_media, p_vlm->media );
TAB_INIT( p_vlm->i_schedule, p_vlm->schedule ); TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );
p_vlm->i_vod = 0;
p_vlm->p_vod = NULL; p_vlm->p_vod = NULL;
var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS ); var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS );
vlc_object_attach( p_vlm, p_this->p_libvlc ); vlc_object_attach( p_vlm, p_this->p_libvlc );
...@@ -225,6 +224,13 @@ static void vlm_Destructor( vlm_t *p_vlm ) ...@@ -225,6 +224,13 @@ static void vlm_Destructor( vlm_t *p_vlm )
libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL; libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
vlc_object_kill( p_vlm ); vlc_object_kill( p_vlm );
if( p_vlm->p_vod )
{
module_unneed( p_vlm->p_vod, p_vlm->p_vod->p_module );
vlc_object_detach( p_vlm->p_vod );
vlc_object_release( p_vlm->p_vod );
}
vlc_mutex_lock( &p_vlm->lock_manage ); vlc_mutex_lock( &p_vlm->lock_manage );
p_vlm->input_state_changed = true; p_vlm->input_state_changed = true;
vlc_cond_signal( &p_vlm->wait_manage ); vlc_cond_signal( &p_vlm->wait_manage );
...@@ -563,7 +569,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media ) ...@@ -563,7 +569,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
{ {
vlm_media_t *p_cfg = &p_media->cfg; vlm_media_t *p_cfg = &p_media->cfg;
/* Check if we need to create/delete a vod media */ /* Check if we need to create/delete a vod media */
if( p_cfg->b_vod ) if( p_cfg->b_vod && p_vlm->p_vod )
{ {
if( !p_cfg->b_enabled && p_media->vod.p_media ) if( !p_cfg->b_enabled && p_media->vod.p_media )
{ {
...@@ -655,6 +661,8 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media ) ...@@ -655,6 +661,8 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
} }
} }
} }
else if ( p_cfg->b_vod )
msg_Err( p_vlm, "vod server is not loaded" );
else else
{ {
/* TODO start media if needed */ /* TODO start media if needed */
...@@ -696,7 +704,7 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id ...@@ -696,7 +704,7 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Check if we need to load the VOD server */ /* Check if we need to load the VOD server */
if( p_cfg->b_vod && !p_vlm->i_vod ) if( p_cfg->b_vod && !p_vlm->p_vod )
{ {
p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ), p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ),
VLC_OBJECT_GENERIC, "vod server" ); VLC_OBJECT_GENERIC, "vod server" );
...@@ -718,9 +726,6 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id ...@@ -718,9 +726,6 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
if( !p_media ) if( !p_media )
return VLC_ENOMEM; return VLC_ENOMEM;
if( p_cfg->b_vod )
p_vlm->i_vod++;
vlm_media_Copy( &p_media->cfg, p_cfg ); vlm_media_Copy( &p_media->cfg, p_cfg );
p_media->cfg.id = p_vlm->i_id++; p_media->cfg.id = p_vlm->i_id++;
/* FIXME do we do something here if enabled is true ? */ /* FIXME do we do something here if enabled is true ? */
...@@ -755,7 +760,6 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id ) ...@@ -755,7 +760,6 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
{ {
p_media->cfg.b_enabled = false; p_media->cfg.b_enabled = false;
vlm_OnMediaUpdate( p_vlm, p_media ); vlm_OnMediaUpdate( p_vlm, p_media );
p_vlm->i_vod--;
} }
/* */ /* */
...@@ -771,14 +775,6 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id ) ...@@ -771,14 +775,6 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
TAB_REMOVE( p_vlm->i_media, p_vlm->media, p_media ); TAB_REMOVE( p_vlm->i_media, p_vlm->media, p_media );
free( p_media ); free( p_media );
/* Check if we need to unload the VOD server */
if( p_vlm->p_vod && p_vlm->i_vod <= 0 )
{
module_unneed( p_vlm->p_vod, p_vlm->p_vod->p_module );
vlc_object_release( p_vlm->p_vod );
p_vlm->p_vod = NULL;
}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -98,7 +98,6 @@ struct vlm_t ...@@ -98,7 +98,6 @@ struct vlm_t
int64_t i_id; int64_t i_id;
/* Vod server (used by media) */ /* Vod server (used by media) */
int i_vod;
vod_t *p_vod; vod_t *p_vod;
/* Media list */ /* Media list */
......
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