}
free( psz_message );
return(psz_response );
-#endif
+#else
+ libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
return NULL;
-}
#endif
+}
+#endif /* 0 */
static int libvlc_vlm_init( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
#ifdef ENABLE_VLM
if( !p_instance->p_vlm )
p_instance->p_vlm = vlm_New( p_instance->p_libvlc_int );
+#else
+ libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." );
+ return VLC_EGENERIC;
#endif
if( !p_instance->p_vlm )
{
libvlc_exception_raise( p_exception,
- "Unable to create VLM. It might be disabled." );
+ "Unable to create VLM." );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
} while(0)
#define VLM(p) VLM_RET(p,)
+static vlm_media_instance_t *libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
+ char *psz_name, int i_minstance_idx,
+ libvlc_exception_t *p_exception )
+{
+ vlm_t *p_vlm;
+ vlm_media_instance_t **pp_minstance;
+ vlm_media_instance_t *p_minstance;
+ int i_minstance;
+ int64_t id;
+
+ VLM_RET(p_vlm, NULL);
+
+ if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
+ vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, &i_minstance ) )
+ {
+ libvlc_exception_raise( p_exception, "Unable to get %s instances", psz_name );
+ return NULL;
+ }
+ p_minstance = NULL;
+ if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
+ {
+ p_minstance = pp_minstance[i_minstance_idx];
+ TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
+ }
+ while( i_minstance > 0 )
+ vlm_media_instance_Delete( pp_minstance[--i_minstance] );
+ TAB_CLEAN( i_minstance, pp_minstance );
+ return p_minstance;
+}
+
+
+void libvlc_vlm_release( libvlc_instance_t *p_instance, libvlc_exception_t *p_exception)
+{
+ vlm_t *p_vlm;
+
+ VLM(p_vlm);
+
+ vlm_Delete( p_vlm );
+}
+
+
void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance, char *psz_name,
char *psz_input, char *psz_output,
int i_options, char **ppsz_options,
vlm_media_Init( &m );
m.psz_name = strdup( psz_name );
m.b_enabled = b_enabled;
- m.b_vod = VLC_FALSE;
+ m.b_vod = false;
m.broadcast.b_loop = b_loop;
if( psz_input )
TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) );
void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name,
char *psz_output, libvlc_exception_t *p_exception )
{
-#define VLM_CHANGE_CODE { if( p_media->psz_output ) free( p_media->psz_output ); \
+#define VLM_CHANGE_CODE { free( p_media->psz_output ); \
p_media->psz_output = strdup( psz_output ); }
VLM_CHANGE( "Unable to change %s output property", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE
free( p_media->ppsz_input[--p_media->i_input] ); \
if( psz_input ) \
TAB_APPEND( p_media->i_input, p_media->ppsz_input, strdup(psz_input) ); \
- if( p_media->psz_output ) \
- free( p_media->psz_output ); \
+ free( p_media->psz_output ); \
p_media->psz_output = psz_output ? strdup( psz_output ) : NULL; \
while( p_media->i_option > 0 ) \
free( p_media->ppsz_option[--p_media->i_option] ); \
}
}
-static vlm_media_instance_t *libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
- char *psz_name, int i_minstance_idx,
- libvlc_exception_t *p_exception )
-{
- vlm_t *p_vlm;
- vlm_media_instance_t **pp_minstance;
- vlm_media_instance_t *p_minstance;
- int i_minstance;
- int64_t id;
-
- VLM_RET(p_vlm, NULL);
-
- if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
- vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, &i_minstance ) )
- {
- libvlc_exception_raise( p_exception, "Unable to get %s instances", psz_name );
- return NULL;
- }
- p_minstance = NULL;
- if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
- {
- p_minstance = pp_minstance[i_minstance_idx];
- TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
- }
- while( i_minstance > 0 )
- vlm_media_instance_Delete( pp_minstance[--i_minstance] );
- TAB_CLEAN( i_minstance, pp_minstance );
- return p_minstance;
-}
-
#define LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( attr, returnType, getType, ret, code )\
-returnType libvlc_vlm_get_media_## attr( libvlc_instance_t *p_instance, \
+returnType libvlc_vlm_get_media_instance_## attr( libvlc_instance_t *p_instance, \
char *psz_name, int i_instance, libvlc_exception_t *p_exception ) \
{ \
vlm_media_instance_t *p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance, \
/* FIXME extend vlm_media_instance_t to be able to implement them */
LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( title, int, Integer, 0, ret_value = 0 );
LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( chapter, int, Integer, 0, ret_value = 0 );
-LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( seekable, int, Bool, 0, ret_value = VLC_FALSE );
+LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( seekable, int, Bool, 0, ret_value = false );
#undef LIBVLC_VLM_GET_MEDIA_ATTRIBUTE
char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, char *psz_name,
libvlc_exception_t *p_exception )
{
+ (void)p_instance;
/* FIXME is it needed ? */
libvlc_exception_raise( p_exception, "Unable to call show %s", psz_name );
return NULL;