Commit 4678f5e8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LibVLC VoD: remove exceptions

parent 3bcf3fa0
...@@ -62,14 +62,13 @@ VLC_PUBLIC_API void libvlc_vlm_release( libvlc_instance_t * ); ...@@ -62,14 +62,13 @@ VLC_PUBLIC_API void libvlc_vlm_release( libvlc_instance_t * );
* \param ppsz_options additional options * \param ppsz_options additional options
* \param b_enabled boolean for enabling the new broadcast * \param b_enabled boolean for enabling the new broadcast
* \param b_loop Should this broadcast be played in loop ? * \param b_loop Should this broadcast be played in loop ?
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_add_broadcast( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_add_broadcast( libvlc_instance_t *,
const char *, const char *, const char *, const char *,
const char * , int, const char * , int,
const char * const*, const char * const*,
int, int, int, int );
libvlc_exception_t * );
/** /**
* Add a vod, with one input. * Add a vod, with one input.
...@@ -81,24 +80,21 @@ VLC_PUBLIC_API void libvlc_vlm_add_broadcast( libvlc_instance_t *, ...@@ -81,24 +80,21 @@ VLC_PUBLIC_API void libvlc_vlm_add_broadcast( libvlc_instance_t *,
* \param ppsz_options additional options * \param ppsz_options additional options
* \param b_enabled boolean for enabling the new vod * \param b_enabled boolean for enabling the new vod
* \param psz_mux the muxer of the vod media * \param psz_mux the muxer of the vod media
* \param p_e an initialized exception pointer * \param 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_add_vod( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_add_vod( libvlc_instance_t *,
const char *, const char *, const char *, const char *,
int, const char * const*, int, const char * const*,
int, const char *, int, const char * );
libvlc_exception_t * );
/** /**
* Delete a media (VOD or broadcast). * Delete a media (VOD or broadcast).
* *
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to delete * \param psz_name the media to delete
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_del_media( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_del_media( libvlc_instance_t *, const char * );
const char *,
libvlc_exception_t * );
/** /**
* Enable or disable a media (VOD or broadcast). * Enable or disable a media (VOD or broadcast).
...@@ -106,10 +102,10 @@ VLC_PUBLIC_API void libvlc_vlm_del_media( libvlc_instance_t *, ...@@ -106,10 +102,10 @@ VLC_PUBLIC_API void libvlc_vlm_del_media( libvlc_instance_t *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param b_enabled the new status * \param b_enabled the new status
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_set_enabled( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_set_enabled( libvlc_instance_t *, const char *,
int, libvlc_exception_t * ); int );
/** /**
* Set the output for a media. * Set the output for a media.
...@@ -117,11 +113,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_enabled( libvlc_instance_t *, const char *, ...@@ -117,11 +113,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_enabled( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param psz_output the output MRL (the parameter to the "sout" variable) * \param psz_output the output MRL (the parameter to the "sout" variable)
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_set_output( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_set_output( libvlc_instance_t *, const char *,
const char *, const char * );
libvlc_exception_t * );
/** /**
* Set a media's input MRL. This will delete all existing inputs and * Set a media's input MRL. This will delete all existing inputs and
...@@ -130,11 +125,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_output( libvlc_instance_t *, const char *, ...@@ -130,11 +125,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_output( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param psz_input the input MRL * \param psz_input the input MRL
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_set_input( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_set_input( libvlc_instance_t *, const char *,
const char *, const char * );
libvlc_exception_t * );
/** /**
* Add a media's input MRL. This will add the specified one. * Add a media's input MRL. This will add the specified one.
...@@ -142,21 +136,21 @@ VLC_PUBLIC_API void libvlc_vlm_set_input( libvlc_instance_t *, const char *, ...@@ -142,21 +136,21 @@ VLC_PUBLIC_API void libvlc_vlm_set_input( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param psz_input the input MRL * \param psz_input the input MRL
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_add_input( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_add_input( libvlc_instance_t *, const char *,
const char *, const char * );
libvlc_exception_t * );
/** /**
* Set a media's loop status. * Set a media's loop status.
* *
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param b_loop the new status * \param b_loop the new status
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_set_loop( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_set_loop( libvlc_instance_t *, const char *,
int, libvlc_exception_t * ); int );
/** /**
* Set a media's vod muxer. * Set a media's vod muxer.
...@@ -164,10 +158,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_loop( libvlc_instance_t *, const char *, ...@@ -164,10 +158,10 @@ VLC_PUBLIC_API void libvlc_vlm_set_loop( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the media to work on * \param psz_name the media to work on
* \param psz_mux the new muxer * \param psz_mux the new muxer
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_set_mux( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_set_mux( libvlc_instance_t *, const char *,
const char *, libvlc_exception_t * ); const char * );
/** /**
* Edit the parameters of a media. This will delete all existing inputs and * Edit the parameters of a media. This will delete all existing inputs and
...@@ -181,43 +175,39 @@ VLC_PUBLIC_API void libvlc_vlm_set_mux( libvlc_instance_t *, const char *, ...@@ -181,43 +175,39 @@ VLC_PUBLIC_API void libvlc_vlm_set_mux( libvlc_instance_t *, const char *,
* \param ppsz_options additional options * \param ppsz_options additional options
* \param b_enabled boolean for enabling the new broadcast * \param b_enabled boolean for enabling the new broadcast
* \param b_loop Should this broadcast be played in loop ? * \param b_loop Should this broadcast be played in loop ?
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_change_media( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_change_media( libvlc_instance_t *,
const char *, const char *, const char *, const char *,
const char* , int, const char* , int,
const char * const *, int, int, const char * const *, int, int );
libvlc_exception_t * );
/** /**
* Play the named broadcast. * Play the named broadcast.
* *
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the name of the broadcast * \param psz_name the name of the broadcast
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_play_media ( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_play_media ( libvlc_instance_t *, const char * );
libvlc_exception_t * );
/** /**
* Stop the named broadcast. * Stop the named broadcast.
* *
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the name of the broadcast * \param psz_name the name of the broadcast
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_stop_media ( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_stop_media ( libvlc_instance_t *, const char * );
libvlc_exception_t * );
/** /**
* Pause the named broadcast. * Pause the named broadcast.
* *
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the name of the broadcast * \param psz_name the name of the broadcast
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_pause_media( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_pause_media( libvlc_instance_t *, const char * );
libvlc_exception_t * );
/** /**
* Seek in the named broadcast. * Seek in the named broadcast.
...@@ -225,10 +215,10 @@ VLC_PUBLIC_API void libvlc_vlm_pause_media( libvlc_instance_t *, const char *, ...@@ -225,10 +215,10 @@ VLC_PUBLIC_API void libvlc_vlm_pause_media( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the name of the broadcast * \param psz_name the name of the broadcast
* \param f_percentage the percentage to seek to * \param f_percentage the percentage to seek to
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_vlm_seek_media( libvlc_instance_t *, const char *, VLC_PUBLIC_API int libvlc_vlm_seek_media( libvlc_instance_t *, const char *,
float, libvlc_exception_t * ); float );
/** /**
* Return information about the named media as a JSON * Return information about the named media as a JSON
...@@ -244,11 +234,10 @@ VLC_PUBLIC_API void libvlc_vlm_seek_media( libvlc_instance_t *, const char *, ...@@ -244,11 +234,10 @@ VLC_PUBLIC_API void libvlc_vlm_seek_media( libvlc_instance_t *, const char *,
* \param p_instance the instance * \param p_instance the instance
* \param psz_name the name of the media, * \param psz_name the name of the media,
* if the name is an empty string, all media is described * if the name is an empty string, all media is described
* \param p_e an initialized exception pointer * \return string with information about named media, or NULL on error
* \return string with information about named media
*/ */
VLC_PUBLIC_API const char* libvlc_vlm_show_media( libvlc_instance_t *, const char *, VLC_PUBLIC_API const char* libvlc_vlm_show_media( libvlc_instance_t *,
libvlc_exception_t * ); const char * );
/** /**
* Get vlm_media instance position by name or instance id * Get vlm_media instance position by name or instance id
......
...@@ -190,12 +190,6 @@ void libvlc_vlm_release( libvlc_instance_t *p_instance ) ...@@ -190,12 +190,6 @@ void libvlc_vlm_release( libvlc_instance_t *p_instance )
(p) = p_instance->libvlc_vlm.p_vlm; \ (p) = p_instance->libvlc_vlm.p_vlm; \
} while(0) } while(0)
#define VLM(p) do { \
if( libvlc_vlm_init( p_instance ) ) \
return; \
(p) = p_instance->libvlc_vlm.p_vlm; \
} while(0)
static vlm_media_instance_t * static vlm_media_instance_t *
libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance, libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
const char *psz_name, int i_minstance_idx ) const char *psz_name, int i_minstance_idx )
...@@ -344,8 +338,7 @@ static char* recurse_answer( vlm_message_t *p_answer, const char* psz_delim, ...@@ -344,8 +338,7 @@ static char* recurse_answer( vlm_message_t *p_answer, const char* psz_delim,
} }
const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name )
libvlc_exception_t *p_exception )
{ {
char *psz_message = NULL; char *psz_message = NULL;
vlm_message_t *answer = NULL; vlm_message_t *answer = NULL;
...@@ -360,16 +353,11 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, ...@@ -360,16 +353,11 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
assert( psz_name ); assert( psz_name );
if( asprintf( &psz_message, "show %s", psz_name ) == -1 ) if( asprintf( &psz_message, "show %s", psz_name ) == -1 )
{
libvlc_exception_raise( p_exception );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
}
vlm_ExecuteCommand( p_vlm, psz_message, &answer ); vlm_ExecuteCommand( p_vlm, psz_message, &answer );
if( answer->psz_value ) if( answer->psz_value )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to call show %s: %s", libvlc_printerr( "Unable to call show %s: %s",
psz_name, answer->psz_value ); psz_name, answer->psz_value );
} }
...@@ -390,8 +378,8 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, ...@@ -390,8 +378,8 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
if( asprintf( &psz_response, psz_fmt, if( asprintf( &psz_response, psz_fmt,
recurse_answer( answer, psz_delimiter, i_list ) ) == -1 ) recurse_answer( answer, psz_delimiter, i_list ) ) == -1 )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Out of memory" ); libvlc_printerr( "Out of memory" );
psz_response = NULL;
} }
} }
free( psz_message ); free( psz_message );
...@@ -399,19 +387,18 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, ...@@ -399,19 +387,18 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
} }
void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance, int libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name,
const char *psz_input, const char *psz_input,
const char *psz_output, int i_options, const char *psz_output, int i_options,
const char * const *ppsz_options, const char * const *ppsz_options,
int b_enabled, int b_loop, int b_enabled, int b_loop )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
vlm_media_t m; vlm_media_t m;
int n; int n;
VLM(p_vlm); VLM_RET(p_vlm, -1);
vlm_media_Init( &m ); vlm_media_Init( &m );
m.psz_name = strdup( psz_name ); m.psz_name = strdup( psz_name );
...@@ -429,21 +416,22 @@ void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance, ...@@ -429,21 +416,22 @@ void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance,
vlm_media_Clean( &m ); vlm_media_Clean( &m );
if( n ) if( n )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Media %s creation failed", psz_name ); libvlc_printerr( "Media %s creation failed", psz_name );
return -1;
} }
return 0;
} }
void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name, int libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name,
const char *psz_input, int i_options, const char *psz_input, int i_options,
const char * const *ppsz_options, int b_enabled, const char * const *ppsz_options, int b_enabled,
const char *psz_mux, libvlc_exception_t *p_exception ) const char *psz_mux )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
vlm_media_t m; vlm_media_t m;
int n; int n;
VLM(p_vlm); VLM_RET(p_vlm, -1);
vlm_media_Init( &m ); vlm_media_Init( &m );
m.psz_name = strdup( psz_name ); m.psz_name = strdup( psz_name );
...@@ -459,37 +447,37 @@ void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name, ...@@ -459,37 +447,37 @@ void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name,
vlm_media_Clean( &m ); vlm_media_Clean( &m );
if( n ) if( n )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Media %s creation failed", psz_name ); libvlc_printerr( "Media %s creation failed", psz_name );
return -1;
} }
return 0;
} }
void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name, int libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
int64_t id; int64_t id;
VLM(p_vlm); VLM_RET(p_vlm, -1);
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_DEL_MEDIA, id ) ) vlm_Control( p_vlm, VLM_DEL_MEDIA, id ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to delete %s", psz_name ); libvlc_printerr( "Unable to delete %s", psz_name );
return -1;
} }
return 0;
} }
#define VLM_CHANGE(psz_error, code ) do { \ #define VLM_CHANGE(psz_error, code ) do { \
vlm_media_t *p_media; \ vlm_media_t *p_media; \
vlm_t *p_vlm; \ vlm_t *p_vlm; \
int64_t id; \ int64_t id; \
VLM(p_vlm); \ VLM_RET(p_vlm, -1); \
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || \ if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || \
vlm_Control( p_vlm, VLM_GET_MEDIA, id, &p_media ) ) { \ vlm_Control( p_vlm, VLM_GET_MEDIA, id, &p_media ) ) { \
libvlc_exception_raise( p_exception ); \
libvlc_printerr( psz_error, psz_name ); \ libvlc_printerr( psz_error, psz_name ); \
return; \ return -1; \
} \ } \
if( !p_media ) goto error; \ if( !p_media ) goto error; \
\ \
...@@ -500,31 +488,30 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name, ...@@ -500,31 +488,30 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name,
goto error; \ goto error; \
} \ } \
vlm_media_Delete( p_media ); \ vlm_media_Delete( p_media ); \
return; \ return 0; \
error: \ error: \
libvlc_exception_raise( p_exception ); \
libvlc_printerr( psz_error, psz_name ); \ libvlc_printerr( psz_error, psz_name ); \
return -1; \
} while(0) } while(0)
void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, int libvlc_vlm_set_enabled( libvlc_instance_t *p_instance,
const char *psz_name, int b_enabled, const char *psz_name, int b_enabled )
libvlc_exception_t *p_exception )
{ {
#define VLM_CHANGE_CODE { p_media->b_enabled = b_enabled; } #define VLM_CHANGE_CODE { p_media->b_enabled = b_enabled; }
VLM_CHANGE( "Unable to delete %s", VLM_CHANGE_CODE ); VLM_CHANGE( "Unable to delete %s", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, const char *psz_name, int libvlc_vlm_set_loop( libvlc_instance_t *p_instance, const char *psz_name,
int b_loop, libvlc_exception_t *p_exception ) int b_loop )
{ {
#define VLM_CHANGE_CODE { p_media->broadcast.b_loop = b_loop; } #define VLM_CHANGE_CODE { p_media->broadcast.b_loop = b_loop; }
VLM_CHANGE( "Unable to change %s loop property", VLM_CHANGE_CODE ); VLM_CHANGE( "Unable to change %s loop property", VLM_CHANGE_CODE );
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_set_mux( libvlc_instance_t *p_instance, const char *psz_name, int libvlc_vlm_set_mux( libvlc_instance_t *p_instance, const char *psz_name,
const char *psz_mux, libvlc_exception_t *p_exception ) const char *psz_mux )
{ {
#define VLM_CHANGE_CODE { if( p_media->b_vod ) { \ #define VLM_CHANGE_CODE { if( p_media->b_vod ) { \
free( p_media->vod.psz_mux ); \ free( p_media->vod.psz_mux ); \
...@@ -535,9 +522,8 @@ void libvlc_vlm_set_mux( libvlc_instance_t *p_instance, const char *psz_name, ...@@ -535,9 +522,8 @@ void libvlc_vlm_set_mux( libvlc_instance_t *p_instance, const char *psz_name,
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_set_output( libvlc_instance_t *p_instance, int libvlc_vlm_set_output( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_output, const char *psz_name, const char *psz_output )
libvlc_exception_t *p_exception )
{ {
#define VLM_CHANGE_CODE { free( p_media->psz_output ); \ #define VLM_CHANGE_CODE { free( p_media->psz_output ); \
p_media->psz_output = strdup( psz_output ); } p_media->psz_output = strdup( psz_output ); }
...@@ -545,9 +531,8 @@ void libvlc_vlm_set_output( libvlc_instance_t *p_instance, ...@@ -545,9 +531,8 @@ void libvlc_vlm_set_output( libvlc_instance_t *p_instance,
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_set_input( libvlc_instance_t *p_instance, int libvlc_vlm_set_input( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_input, const char *psz_name, const char *psz_input )
libvlc_exception_t *p_exception )
{ {
#define VLM_CHANGE_CODE { while( p_media->i_input > 0 ) \ #define VLM_CHANGE_CODE { while( p_media->i_input > 0 ) \
free( p_media->ppsz_input[--p_media->i_input] );\ free( p_media->ppsz_input[--p_media->i_input] );\
...@@ -557,9 +542,8 @@ void libvlc_vlm_set_input( libvlc_instance_t *p_instance, ...@@ -557,9 +542,8 @@ void libvlc_vlm_set_input( libvlc_instance_t *p_instance,
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_add_input( libvlc_instance_t *p_instance, int libvlc_vlm_add_input( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_input, const char *psz_name, const char *psz_input )
libvlc_exception_t *p_exception )
{ {
#define VLM_CHANGE_CODE { TAB_APPEND( p_media->i_input, p_media->ppsz_input, \ #define VLM_CHANGE_CODE { TAB_APPEND( p_media->i_input, p_media->ppsz_input, \
strdup(psz_input) ); } strdup(psz_input) ); }
...@@ -567,11 +551,11 @@ void libvlc_vlm_add_input( libvlc_instance_t *p_instance, ...@@ -567,11 +551,11 @@ void libvlc_vlm_add_input( libvlc_instance_t *p_instance,
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_change_media( libvlc_instance_t *p_instance, int libvlc_vlm_change_media( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_input, const char *psz_name, const char *psz_input,
const char *psz_output, int i_options, const char *psz_output, int i_options,
const char * const *ppsz_options, int b_enabled, const char * const *ppsz_options, int b_enabled,
int b_loop, libvlc_exception_t *p_exception ) int b_loop )
{ {
#define VLM_CHANGE_CODE { int n; \ #define VLM_CHANGE_CODE { int n; \
p_media->b_enabled = b_enabled; \ p_media->b_enabled = b_enabled; \
...@@ -592,73 +576,73 @@ void libvlc_vlm_change_media( libvlc_instance_t *p_instance, ...@@ -592,73 +576,73 @@ void libvlc_vlm_change_media( libvlc_instance_t *p_instance,
#undef VLM_CHANGE_CODE #undef VLM_CHANGE_CODE
} }
void libvlc_vlm_play_media( libvlc_instance_t *p_instance, int libvlc_vlm_play_media( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
int64_t id; int64_t id;
VLM(p_vlm); VLM_RET(p_vlm, -1);
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_START_MEDIA_BROADCAST_INSTANCE, id, NULL, 0 ) ) vlm_Control( p_vlm, VLM_START_MEDIA_BROADCAST_INSTANCE, id, NULL, 0 ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to play %s", psz_name ); libvlc_printerr( "Unable to play %s", psz_name );
return -1;
} }
return 0;
} }
void libvlc_vlm_stop_media( libvlc_instance_t *p_instance, int libvlc_vlm_stop_media( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
int64_t id; int64_t id;
VLM(p_vlm); VLM_RET(p_vlm, -1);
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_STOP_MEDIA_INSTANCE, id, NULL ) ) vlm_Control( p_vlm, VLM_STOP_MEDIA_INSTANCE, id, NULL ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to stop %s", psz_name ); libvlc_printerr( "Unable to stop %s", psz_name );
return -1;
} }
return 0;
} }
void libvlc_vlm_pause_media( libvlc_instance_t *p_instance, int libvlc_vlm_pause_media( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
int64_t id; int64_t id;
VLM(p_vlm); VLM_RET(p_vlm, -1);
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) ) vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to pause %s", psz_name ); libvlc_printerr( "Unable to pause %s", psz_name );
return -1;
} }
return 0;
} }
void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, int libvlc_vlm_seek_media( libvlc_instance_t *p_instance,
const char *psz_name, float f_percentage, const char *psz_name, float f_percentage )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
int64_t id; int64_t id;
VLM(p_vlm); VLM_RET(p_vlm, -1);
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_SET_MEDIA_INSTANCE_POSITION, id, NULL, vlm_Control( p_vlm, VLM_SET_MEDIA_INSTANCE_POSITION, id, NULL,
f_percentage ) ) f_percentage ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to seek %s to %f%%", psz_name, f_percentage ); libvlc_printerr( "Unable to seek %s to %f%%", psz_name, f_percentage );
return -1;
} }
return 0;
} }
float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance, float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment