[vlc-commits] commit: Unload vod-VLM only at the end ( Sébastien Escudier )
git at videolan.org
git at videolan.org
Sun May 2 19:23:38 CEST 2010
vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Wed Mar 17 08:30:22 2010 +0100| [6d4a41a6e779e606c8ffd212948535f9e46691c1] | committer: Rémi Denis-Courmont
Unload vod-VLM only at the end
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d4a41a6e779e606c8ffd212948535f9e46691c1
---
src/input/vlm.c | 26 +++++++++++---------------
src/input/vlm_internal.h | 1 -
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 7956249..facc49c 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -153,7 +153,6 @@ vlm_t *vlm_New ( vlc_object_t *p_this )
p_vlm->i_id = 1;
TAB_INIT( p_vlm->i_media, p_vlm->media );
TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );
- p_vlm->i_vod = 0;
p_vlm->p_vod = NULL;
var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS );
vlc_object_attach( p_vlm, p_this->p_libvlc );
@@ -225,6 +224,13 @@ static void vlm_Destructor( vlm_t *p_vlm )
libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
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 );
p_vlm->input_state_changed = true;
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 )
{
vlm_media_t *p_cfg = &p_media->cfg;
/* 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 )
{
@@ -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
{
/* 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
return VLC_EGENERIC;
}
/* 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 ),
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
if( !p_media )
return VLC_ENOMEM;
- if( p_cfg->b_vod )
- p_vlm->i_vod++;
-
vlm_media_Copy( &p_media->cfg, p_cfg );
p_media->cfg.id = p_vlm->i_id++;
/* 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 )
{
p_media->cfg.b_enabled = false;
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 )
TAB_REMOVE( p_vlm->i_media, p_vlm->media, 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;
}
diff --git a/src/input/vlm_internal.h b/src/input/vlm_internal.h
index e7ef823..03e5828 100644
--- a/src/input/vlm_internal.h
+++ b/src/input/vlm_internal.h
@@ -98,7 +98,6 @@ struct vlm_t
int64_t i_id;
/* Vod server (used by media) */
- int i_vod;
vod_t *p_vod;
/* Media list */
More information about the vlc-commits
mailing list