} vlm_schedule_t
#endif
+/** VLM events
+ * You can catch vlm event by adding a callback on the variable "intf-event"
+ * of the VLM object.
+ * This variable is an address that will hold a vlm_event_t* value.
+ */
+enum vlm_event_type_e
+{
+ /* */
+ VLM_EVENT_MEDIA_ADDED = 0x100,
+ VLM_EVENT_MEDIA_REMOVED,
+ VLM_EVENT_MEDIA_CHANGED,
+
+ /* */
+ VLM_EVENT_MEDIA_INSTANCE_STARTED = 0x200,
+ VLM_EVENT_MEDIA_INSTANCE_STOPPED,
+};
+
+typedef struct
+{
+ int i_type; /* a vlm_event_type_e value */
+ int64_t id; /* Media ID */
+} vlm_event_t;
+
/** VLM control query */
enum vlm_query_e
{
#endif
#include <vlc_input.h>
-#include "input_internal.h"
#include <vlc_stream.h>
#include "vlm_internal.h"
+#include "vlm_event.h"
#include <vlc_vod.h>
#include <vlc_charset.h>
#include <vlc_sout.h>
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 );
if( vlc_clone( &p_vlm->thread, Manage, p_vlm, VLC_THREAD_PRIORITY_LOW ) )
/* TODO add support of var vlm_media_broadcast/vlm_media_vod */
+ vlm_SendEventMediaChanged( p_vlm, p_cfg->id );
return VLC_SUCCESS;
}
static int vlm_ControlMediaChange( vlm_t *p_vlm, vlm_media_t *p_cfg )
if( p_id )
*p_id = p_media->cfg.id;
+ /* */
+ vlm_SendEventMediaAdded( p_vlm, p_media->cfg.id );
return vlm_OnMediaUpdate( p_vlm, p_media );
}
vlc_object_release( p_vlm->p_vod );
p_vlm->p_vod = NULL;
}
+
+ /* */
+ vlm_SendEventMediaRemoved( p_vlm, id );
return VLC_SUCCESS;
}
return p_instance;
}
-static void vlm_MediaInstanceDelete( 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 )
{
input_thread_t *p_input = p_instance->p_input;
if( p_input )
input_resource_Delete( p_resource );
vlc_object_release( p_input );
+
+ vlm_SendEventMediaInstanceStopped( p_vlm, id );
}
if( p_instance->p_input_resource )
input_resource_Delete( p_instance->p_input_resource );
if( !p_instance->b_sout_keep )
input_resource_TerminateSout( p_instance->p_input_resource );
input_resource_TerminateVout( p_instance->p_input_resource );
+
+ vlm_SendEventMediaInstanceStopped( p_vlm, id );
}
/* Start new one */
if( !p_instance->p_input )
{
TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
- vlm_MediaInstanceDelete( p_instance );
+ vlm_MediaInstanceDelete( p_vlm, id, p_instance );
+ }
+ else
+ {
+ vlm_SendEventMediaInstanceStarted( p_vlm, id );
}
free( psz_log );
}
TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
- vlm_MediaInstanceDelete( p_instance );
+ vlm_MediaInstanceDelete( p_vlm, id, p_instance );
return VLC_SUCCESS;
}