[vlc-devel] commit: VLM : Add media name in callbacks ( Sébastien Escudier )
git version control
git at videolan.org
Sun Apr 5 22:39:26 CEST 2009
vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Tue Mar 31 16:20:09 2009 +0200| [484758875dde16e1ada2d1ea4edf1d8d73cabc75] | committer: Rémi Denis-Courmont
VLM : Add media name in callbacks
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=484758875dde16e1ada2d1ea4edf1d8d73cabc75
---
include/vlc_vlm.h | 5 +++--
src/input/vlm.c | 21 +++++++++++----------
src/input/vlm_event.c | 25 +++++++++++++------------
src/input/vlm_event.h | 10 +++++-----
4 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/include/vlc_vlm.h b/include/vlc_vlm.h
index 4be26ed..3bc7d27 100644
--- a/include/vlc_vlm.h
+++ b/include/vlc_vlm.h
@@ -106,8 +106,9 @@ enum vlm_event_type_e
typedef struct
{
- int i_type; /* a vlm_event_type_e value */
- int64_t id; /* Media ID */
+ int i_type; /* a vlm_event_type_e value */
+ int64_t id; /* Media ID */
+ const char *psz_name; /* Media name */
} vlm_event_t;
/** VLM control query */
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 97a9aad..cb3cdc7 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -575,7 +575,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
/* TODO add support of var vlm_media_broadcast/vlm_media_vod */
- vlm_SendEventMediaChanged( p_vlm, p_cfg->id );
+ vlm_SendEventMediaChanged( p_vlm, p_cfg->id, p_cfg->psz_name );
return VLC_SUCCESS;
}
static int vlm_ControlMediaChange( vlm_t *p_vlm, vlm_media_t *p_cfg )
@@ -651,7 +651,7 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
*p_id = p_media->cfg.id;
/* */
- vlm_SendEventMediaAdded( p_vlm, p_media->cfg.id );
+ vlm_SendEventMediaAdded( p_vlm, p_media->cfg.id, p_media->cfg.psz_name );
return vlm_OnMediaUpdate( p_vlm, p_media );
}
@@ -672,6 +672,9 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
p_vlm->i_vod--;
}
+ /* */
+ vlm_SendEventMediaRemoved( p_vlm, id, p_media->cfg.psz_name );
+
vlm_media_Clean( &p_media->cfg );
vlc_gc_decref( p_media->vod.p_item );
@@ -689,8 +692,6 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
p_vlm->p_vod = NULL;
}
- /* */
- vlm_SendEventMediaRemoved( p_vlm, id );
return VLC_SUCCESS;
}
@@ -770,7 +771,7 @@ static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char
return p_instance;
}
-static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instance_sys_t *p_instance )
+static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instance_sys_t *p_instance, const char *psz_name )
{
input_thread_t *p_input = p_instance->p_input;
if( p_input )
@@ -785,7 +786,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
vlc_object_release( p_input );
- vlm_SendEventMediaInstanceStopped( p_vlm, id );
+ vlm_SendEventMediaInstanceStopped( p_vlm, id, psz_name );
}
if( p_instance->p_input_resource )
input_resource_Delete( p_instance->p_input_resource );
@@ -871,7 +872,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
input_resource_TerminateSout( p_instance->p_input_resource );
input_resource_TerminateVout( p_instance->p_input_resource );
- vlm_SendEventMediaInstanceStopped( p_vlm, id );
+ vlm_SendEventMediaInstanceStopped( p_vlm, id, p_media->cfg.psz_name );
}
/* Start new one */
@@ -887,11 +888,11 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
if( !p_instance->p_input )
{
TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
- vlm_MediaInstanceDelete( p_vlm, id, p_instance );
+ vlm_MediaInstanceDelete( p_vlm, id, p_instance, p_media->cfg.psz_name );
}
else
{
- vlm_SendEventMediaInstanceStarted( p_vlm, id );
+ vlm_SendEventMediaInstanceStarted( p_vlm, id, p_media->cfg.psz_name );
}
free( psz_log );
}
@@ -913,7 +914,7 @@ static int vlm_ControlMediaInstanceStop( vlm_t *p_vlm, int64_t id, const char *p
TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
- vlm_MediaInstanceDelete( p_vlm, id, p_instance );
+ vlm_MediaInstanceDelete( p_vlm, id, p_instance, p_media->cfg.psz_name );
return VLC_SUCCESS;
}
diff --git a/src/input/vlm_event.c b/src/input/vlm_event.c
index 31f1ddd..6898dcb 100644
--- a/src/input/vlm_event.c
+++ b/src/input/vlm_event.c
@@ -35,42 +35,43 @@
#include <assert.h>
/* */
-static void Trigger( vlm_t *, int i_type, int64_t id );
+static void Trigger( vlm_t *, int i_type, int64_t id, const char *psz_name );
/*****************************************************************************
*
*****************************************************************************/
-void vlm_SendEventMediaAdded( vlm_t *p_vlm, int64_t id )
+void vlm_SendEventMediaAdded( vlm_t *p_vlm, int64_t id, const char *psz_name )
{
- Trigger( p_vlm, VLM_EVENT_MEDIA_ADDED, id );
+ Trigger( p_vlm, VLM_EVENT_MEDIA_ADDED, id, psz_name );
}
-void vlm_SendEventMediaRemoved( vlm_t *p_vlm, int64_t id )
+void vlm_SendEventMediaRemoved( vlm_t *p_vlm, int64_t id, const char *psz_name )
{
- Trigger( p_vlm, VLM_EVENT_MEDIA_REMOVED, id );
+ Trigger( p_vlm, VLM_EVENT_MEDIA_REMOVED, id, psz_name );
}
-void vlm_SendEventMediaChanged( vlm_t *p_vlm, int64_t id )
+void vlm_SendEventMediaChanged( vlm_t *p_vlm, int64_t id, const char *psz_name )
{
- Trigger( p_vlm, VLM_EVENT_MEDIA_CHANGED, id );
+ Trigger( p_vlm, VLM_EVENT_MEDIA_CHANGED, id, psz_name );
}
-void vlm_SendEventMediaInstanceStarted( vlm_t *p_vlm, int64_t id )
+void vlm_SendEventMediaInstanceStarted( vlm_t *p_vlm, int64_t id, const char *psz_name )
{
- Trigger( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STARTED, id );
+ Trigger( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STARTED, id, psz_name );
}
-void vlm_SendEventMediaInstanceStopped( vlm_t *p_vlm, int64_t id )
+void vlm_SendEventMediaInstanceStopped( vlm_t *p_vlm, int64_t id, const char *psz_name )
{
- Trigger( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STOPPED, id );
+ Trigger( p_vlm, VLM_EVENT_MEDIA_INSTANCE_STOPPED, id, psz_name );
}
/*****************************************************************************
*
*****************************************************************************/
-static void Trigger( vlm_t *p_vlm, int i_type, int64_t id )
+static void Trigger( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name )
{
vlm_event_t event;
event.i_type = i_type;
event.id = id;
+ event.psz_name = psz_name;
var_SetAddress( p_vlm, "intf-event", &event );
}
diff --git a/src/input/vlm_event.h b/src/input/vlm_event.h
index eeedd22..41e1311 100644
--- a/src/input/vlm_event.h
+++ b/src/input/vlm_event.h
@@ -33,12 +33,12 @@
/*****************************************************************************
*
*****************************************************************************/
-void vlm_SendEventMediaAdded( vlm_t *, int64_t id );
-void vlm_SendEventMediaRemoved( vlm_t *, int64_t id );
-void vlm_SendEventMediaChanged( vlm_t *, int64_t id );
+void vlm_SendEventMediaAdded( vlm_t *, int64_t id, const char *psz_name );
+void vlm_SendEventMediaRemoved( vlm_t *, int64_t id, const char *psz_name );
+void vlm_SendEventMediaChanged( vlm_t *, int64_t id, const char *psz_name );
-void vlm_SendEventMediaInstanceStarted( vlm_t *, int64_t id );
-void vlm_SendEventMediaInstanceStopped( vlm_t *, int64_t id );
+void vlm_SendEventMediaInstanceStarted( vlm_t *, int64_t id, const char *psz_name );
+void vlm_SendEventMediaInstanceStopped( vlm_t *, int64_t id, const char *psz_name );
#endif
More information about the vlc-devel
mailing list