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 ) { #ifdef ENABLE_VLM 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; #else libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." ); return VLC_EGENERIC; #endif }
static vlm_media_instance_t * libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance, const char *psz_name, int i_minstance_idx ) { 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_printerr( "%s: media instances not found", 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; }
int libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name ) { vlm_t *p_vlm; int64_t id; VLM_RET(p_vlm, -1); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_DEL_MEDIA, id ) ) { libvlc_printerr( "Unable to delete %s", psz_name ); return -1; } return 0; }
void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name, libvlc_exception_t *p_exception ) { vlm_t *p_vlm; int64_t id; VLM(p_vlm); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_DEL_MEDIA, id ) ) { libvlc_exception_raise( p_exception ); libvlc_printerr( "Unable to delete %s", psz_name ); } }
void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, char *psz_name, char *psz_input, int i_options, char **ppsz_options, int b_enabled, char *psz_mux, libvlc_exception_t *p_exception ) { #ifdef ENABLE_VLM vlm_t *p_vlm; vlm_media_t m; int n; VLM(p_vlm); vlm_media_Init( &m ); m.psz_name = strdup( psz_name ); m.b_enabled = b_enabled; m.b_vod = true; m.vod.psz_mux = psz_mux ? strdup( psz_mux ) : NULL; if( psz_input ) TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) ); for( n = 0; n < i_options; n++ ) TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) ); n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL ); vlm_media_Clean( &m ); if( n ) libvlc_exception_raise( p_exception, "Media %s creation failed", psz_name ); #else libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." ); return VLC_EGENERIC; #endif }
int libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name, const char *psz_input, int i_options, const char * const *ppsz_options, int b_enabled, const char *psz_mux ) { vlm_t *p_vlm; vlm_media_t m; int n; VLM_RET(p_vlm, -1); vlm_media_Init( &m ); m.psz_name = strdup( psz_name ); m.b_enabled = b_enabled; m.b_vod = true; m.vod.psz_mux = psz_mux ? strdup( psz_mux ) : NULL; if( psz_input ) TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) ); for( n = 0; n < i_options; n++ ) TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) ); n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL ); vlm_media_Clean( &m ); if( n ) { libvlc_printerr( "Media %s creation failed", psz_name ); return -1; } return 0; }
void libvlc_vlm_pause_media( libvlc_instance_t *p_instance, const char *psz_name, libvlc_exception_t *p_exception ) { vlm_t *p_vlm; int64_t id; VLM(p_vlm); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) ) { libvlc_exception_raise( p_exception ); libvlc_printerr( "Unable to pause %s", psz_name ); } }
void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance, const char *psz_name, const char *psz_input, const char *psz_output, int i_options, const char * const *ppsz_options, int b_enabled, int b_loop, libvlc_exception_t *p_exception ) { vlm_t *p_vlm; vlm_media_t m; int n; VLM(p_vlm); vlm_media_Init( &m ); m.psz_name = strdup( psz_name ); m.b_enabled = b_enabled; m.b_vod = false; m.broadcast.b_loop = b_loop; if( psz_input ) TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) ); if( psz_output ) m.psz_output = strdup( psz_output ); for( n = 0; n < i_options; n++ ) TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) ); n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL ); vlm_media_Clean( &m ); if( n ) { libvlc_exception_raise( p_exception ); libvlc_printerr( "Media %s creation failed", psz_name ); } }
static void libvlc_vlm_release_internal( libvlc_instance_t *p_instance ) { vlm_t *p_vlm = p_instance->libvlc_vlm.p_vlm; if( !p_instance->libvlc_vlm.p_vlm ) return; /* We need to remove medias in order to receive events */ vlm_Control( p_vlm, VLM_CLEAR_MEDIAS ); vlm_Control( p_vlm, VLM_CLEAR_SCHEDULES ); var_DelCallback( (vlc_object_t *)p_vlm, "intf-event", VlmEvent, p_instance->libvlc_vlm.p_event_manager ); p_instance->libvlc_vlm.pf_release = NULL; libvlc_event_manager_release( p_instance->libvlc_vlm.p_event_manager ); p_instance->libvlc_vlm.p_event_manager = NULL; vlm_Delete( p_vlm ); p_instance->libvlc_vlm.p_vlm = NULL; }
void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, const char *psz_name, float f_percentage, libvlc_exception_t *p_exception ) { vlm_t *p_vlm; int64_t id; VLM(p_vlm); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_SET_MEDIA_INSTANCE_POSITION, id, NULL, f_percentage ) ) { libvlc_exception_raise( p_exception ); libvlc_printerr( "Unable to seek %s to %f%%", psz_name, f_percentage ); } }
void libvlc_vlm_release( libvlc_instance_t *p_instance ) { vlm_t *p_vlm = p_instance->vlm->p_vlm; if( !p_vlm ) return; /* We need to remove medias in order to receive events */ vlm_Control( p_vlm, VLM_CLEAR_MEDIAS ); vlm_Control( p_vlm, VLM_CLEAR_SCHEDULES ); var_DelCallback( (vlc_object_t *)p_vlm, "intf-event", VlmEvent, &p_instance->vlm->event_manager ); libvlc_event_manager_destroy( &p_instance->vlm->event_manager ); vlm_Delete( p_vlm ); free( p_instance->vlm ); p_instance->vlm = NULL; libvlc_release( p_instance ); }
void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, char *psz_name, float f_percentage, libvlc_exception_t *p_exception ) { #ifdef ENABLE_VLM vlm_t *p_vlm; int64_t id; VLM(p_vlm); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_SET_MEDIA_INSTANCE_POSITION, id, NULL, f_percentage ) ) { libvlc_exception_raise( p_exception, "Unable to seek %s to %f", psz_name, f_percentage ); } #else libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." ); return VLC_EGENERIC; #endif }
void libvlc_vlm_pause_media( libvlc_instance_t *p_instance, char *psz_name, libvlc_exception_t *p_exception ) { #ifdef ENABLE_VLM vlm_t *p_vlm; int64_t id; VLM(p_vlm); if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) ) { libvlc_exception_raise( p_exception, "Unable to pause %s", psz_name ); } #else libvlc_exception_raise( p_exception, "VLM has been disabled in this libvlc." ); return VLC_EGENERIC; #endif }
void VLMDialog::mediasPopulator() { if( p_vlm ) { int i_nMedias; QString typeShortName; int vlmItemCount; vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) ); /* Get medias information and numbers */ vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias ); /* Loop on all of them */ for( int i = 0; i < i_nMedias; i++ ) { VLMAWidget * vlmAwidget; vlmItemCount = vlmItems.count(); QString mediaName = qfu( (*ppp_dsc)[i]->psz_name ); /* It may have several inputs, we take the first one by default - an evolution will be to manage these inputs in the gui */ QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] ); QString outputText = qfu( (*ppp_dsc)[i]->psz_output ); /* Schedule media is a quite especial, maybe there is another way to grab information */ if( (*ppp_dsc)[i]->b_vod ) { typeShortName = "VOD"; QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux ); vlmAwidget = new VLMVod( mediaName, inputText, inputOptions, outputText, (*ppp_dsc)[i]->b_enabled, mux, this ); } else { typeShortName = "Bcast"; vlmAwidget = new VLMBroadcast( mediaName, inputText, inputOptions, outputText, (*ppp_dsc)[i]->b_enabled, (*ppp_dsc)[i]->broadcast.b_loop, this ); } /* Add an Item of the Side List */ ui.vlmListItem->addItem( typeShortName + " : " + mediaName ); ui.vlmListItem->setCurrentRow( vlmItemCount - 1 ); /* Add a new VLMAWidget on the main List */ vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget ); vlmItems.append( vlmAwidget ); clearWidgets(); } free( ppp_dsc ); } }