Commit 6baf8eb3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LibVLC VLM: remove exceptions

parent cebf0bcd
...@@ -48,9 +48,8 @@ extern "C" { ...@@ -48,9 +48,8 @@ extern "C" {
* Release the vlm instance related to the given libvlc_instance_t * Release the vlm instance related to the given libvlc_instance_t
* *
* \param p_instance the instance * \param p_instance the instance
* \param p_e an initialized exception pointer
*/ */
VLC_PUBLIC_API void libvlc_vlm_release( libvlc_instance_t *, libvlc_exception_t * ); VLC_PUBLIC_API void libvlc_vlm_release( libvlc_instance_t * );
/** /**
* Add a broadcast, with one input. * Add a broadcast, with one input.
...@@ -257,12 +256,10 @@ VLC_PUBLIC_API const char* libvlc_vlm_show_media( libvlc_instance_t *, const cha ...@@ -257,12 +256,10 @@ VLC_PUBLIC_API const char* libvlc_vlm_show_media( libvlc_instance_t *, const cha
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return position as float or -1. on error
* \return position as float
*/ */
VLC_PUBLIC_API float libvlc_vlm_get_media_instance_position( libvlc_instance_t *, VLC_PUBLIC_API float libvlc_vlm_get_media_instance_position( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Get vlm_media instance time by name or instance id * Get vlm_media instance time by name or instance id
...@@ -270,12 +267,10 @@ VLC_PUBLIC_API float libvlc_vlm_get_media_instance_position( libvlc_instance_t * ...@@ -270,12 +267,10 @@ VLC_PUBLIC_API float libvlc_vlm_get_media_instance_position( libvlc_instance_t *
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return time as integer or -1 on error
* \return time as integer
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_time( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_time( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Get vlm_media instance length by name or instance id * Get vlm_media instance length by name or instance id
...@@ -283,12 +278,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_time( libvlc_instance_t *, ...@@ -283,12 +278,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_time( libvlc_instance_t *,
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return length of media item or -1 on error
* \return length of media item
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_length( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_length( libvlc_instance_t *,
const char *, int , const char *, int );
libvlc_exception_t * );
/** /**
* Get vlm_media instance playback rate by name or instance id * Get vlm_media instance playback rate by name or instance id
...@@ -296,12 +289,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_length( libvlc_instance_t *, ...@@ -296,12 +289,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_length( libvlc_instance_t *,
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return playback rate or -1 on error
* \return playback rate
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Get vlm_media instance title number by name or instance id * Get vlm_media instance title number by name or instance id
...@@ -309,12 +300,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *, ...@@ -309,12 +300,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *,
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return title as number or -1 on error
* \return title as number
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_title( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_title( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Get vlm_media instance chapter number by name or instance id * Get vlm_media instance chapter number by name or instance id
...@@ -322,12 +311,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_title( libvlc_instance_t *, ...@@ -322,12 +311,10 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_title( libvlc_instance_t *,
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return chapter as number or -1 on error
* \return chapter as number
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Is libvlc instance seekable ? * Is libvlc instance seekable ?
...@@ -335,24 +322,20 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *, ...@@ -335,24 +322,20 @@ VLC_PUBLIC_API int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *,
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param psz_name name of vlm media instance * \param psz_name name of vlm media instance
* \param i_instance instance id * \param i_instance instance id
* \param p_e an initialized exception pointer * \return 1 if seekable, 0 if not, -1 if media does not exist
* \return 1 if seekable, 0 if not
*/ */
VLC_PUBLIC_API int libvlc_vlm_get_media_instance_seekable( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_vlm_get_media_instance_seekable( libvlc_instance_t *,
const char *, int, const char *, int );
libvlc_exception_t * );
/** /**
* Get libvlc_event_manager from a vlm media. * Get libvlc_event_manager from a vlm media.
* The p_event_manager is immutable, so you don't have to hold the lock * The p_event_manager is immutable, so you don't have to hold the lock
* *
* \param p_instance a libvlc instance * \param p_instance a libvlc instance
* \param p_exception an initialized exception pointer
* \return libvlc_event_manager * \return libvlc_event_manager
*/ */
VLC_PUBLIC_API libvlc_event_manager_t * VLC_PUBLIC_API libvlc_event_manager_t *
libvlc_vlm_get_event_manager( libvlc_instance_t *, libvlc_vlm_get_event_manager( libvlc_instance_t * );
libvlc_exception_t * );
/** @} */ /** @} */
......
...@@ -119,8 +119,7 @@ static void libvlc_vlm_release_internal( libvlc_instance_t *p_instance ) ...@@ -119,8 +119,7 @@ static void libvlc_vlm_release_internal( libvlc_instance_t *p_instance )
p_instance->libvlc_vlm.p_vlm = NULL; p_instance->libvlc_vlm.p_vlm = NULL;
} }
static int libvlc_vlm_init( libvlc_instance_t *p_instance, static int libvlc_vlm_init( libvlc_instance_t *p_instance )
libvlc_exception_t *p_exception )
{ {
if( !p_instance->libvlc_vlm.p_event_manager ) if( !p_instance->libvlc_vlm.p_event_manager )
{ {
...@@ -168,7 +167,6 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance, ...@@ -168,7 +167,6 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance,
p_instance->libvlc_vlm.p_vlm = vlm_New( p_instance->p_libvlc_int ); p_instance->libvlc_vlm.p_vlm = vlm_New( p_instance->p_libvlc_int );
if( !p_instance->libvlc_vlm.p_vlm ) if( !p_instance->libvlc_vlm.p_vlm )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "VLM not supported or out of memory" ); libvlc_printerr( "VLM not supported or out of memory" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -181,23 +179,26 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance, ...@@ -181,23 +179,26 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
void libvlc_vlm_release( libvlc_instance_t *p_instance, void libvlc_vlm_release( libvlc_instance_t *p_instance )
libvlc_exception_t *p_exception)
{ {
VLC_UNUSED(p_exception);
libvlc_vlm_release_internal( p_instance ); libvlc_vlm_release_internal( p_instance );
} }
#define VLM_RET(p,ret) do { \ #define VLM_RET(p,ret) do { \
if( libvlc_vlm_init( p_instance, p_exception ) ) return ret;\ if( libvlc_vlm_init( p_instance ) ) \
return (ret); \
(p) = p_instance->libvlc_vlm.p_vlm; \
} while(0)
#define VLM(p) do { \
if( libvlc_vlm_init( p_instance ) ) \
return; \
(p) = p_instance->libvlc_vlm.p_vlm; \ (p) = p_instance->libvlc_vlm.p_vlm; \
} while(0) } while(0)
#define VLM(p) VLM_RET(p,)
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 )
libvlc_exception_t *p_exception )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
vlm_media_instance_t **pp_minstance; vlm_media_instance_t **pp_minstance;
...@@ -211,7 +212,6 @@ libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance, ...@@ -211,7 +212,6 @@ libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance,
&i_minstance ) ) &i_minstance ) )
{ {
libvlc_exception_raise( p_exception );
libvlc_printerr( "%s: media instances not found", psz_name ); libvlc_printerr( "%s: media instances not found", psz_name );
return NULL; return NULL;
} }
...@@ -663,14 +663,12 @@ void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, ...@@ -663,14 +663,12 @@ void libvlc_vlm_seek_media( libvlc_instance_t *p_instance,
float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance, float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name,
int i_instance, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
float result = -1.; float result = -1.;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
{ {
result = p_mi->d_position; result = p_mi->d_position;
...@@ -680,14 +678,12 @@ float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance, ...@@ -680,14 +678,12 @@ float libvlc_vlm_get_media_instance_position( libvlc_instance_t *p_instance,
} }
int libvlc_vlm_get_media_instance_time( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_time( libvlc_instance_t *p_instance,
const char *psz_name, int i_instance, const char *psz_name, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
int result = -1; int result = -1;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
{ {
result = p_mi->i_time; result = p_mi->i_time;
...@@ -698,14 +694,12 @@ int libvlc_vlm_get_media_instance_time( libvlc_instance_t *p_instance, ...@@ -698,14 +694,12 @@ int libvlc_vlm_get_media_instance_time( libvlc_instance_t *p_instance,
int libvlc_vlm_get_media_instance_length( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_length( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name,
int i_instance, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
int result = -1; int result = -1;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
{ {
result = p_mi->i_length; result = p_mi->i_length;
...@@ -715,14 +709,12 @@ int libvlc_vlm_get_media_instance_length( libvlc_instance_t *p_instance, ...@@ -715,14 +709,12 @@ int libvlc_vlm_get_media_instance_length( libvlc_instance_t *p_instance,
} }
int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *p_instance,
const char *psz_name, int i_instance, const char *psz_name, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
int result = -1; int result = -1;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
{ {
result = p_mi->i_rate; result = p_mi->i_rate;
...@@ -732,13 +724,11 @@ int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *p_instance, ...@@ -732,13 +724,11 @@ int libvlc_vlm_get_media_instance_rate( libvlc_instance_t *p_instance,
} }
int libvlc_vlm_get_media_instance_title( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_title( libvlc_instance_t *p_instance,
const char *psz_name, int i_instance, const char *psz_name, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
vlm_media_instance_Delete( p_mi ); vlm_media_instance_Delete( p_mi );
return p_mi ? 0 : -1; return p_mi ? 0 : -1;
...@@ -746,13 +736,12 @@ int libvlc_vlm_get_media_instance_title( libvlc_instance_t *p_instance, ...@@ -746,13 +736,12 @@ int libvlc_vlm_get_media_instance_title( libvlc_instance_t *p_instance,
int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name,
int i_instance, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name,
i_instance, p_exception ); i_instance );
if( p_mi ) if( p_mi )
vlm_media_instance_Delete( p_mi ); vlm_media_instance_Delete( p_mi );
return p_mi ? 0 : -1; return p_mi ? 0 : -1;
...@@ -760,20 +749,18 @@ int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *p_instance, ...@@ -760,20 +749,18 @@ int libvlc_vlm_get_media_instance_chapter( libvlc_instance_t *p_instance,
int libvlc_vlm_get_media_instance_seekable( libvlc_instance_t *p_instance, int libvlc_vlm_get_media_instance_seekable( libvlc_instance_t *p_instance,
const char *psz_name, const char *psz_name,
int i_instance, int i_instance )
libvlc_exception_t *p_exception )
{ {
vlm_media_instance_t *p_mi; vlm_media_instance_t *p_mi;
p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, p_mi = libvlc_vlm_get_media_instance( p_instance, psz_name, i_instance );
i_instance, p_exception );
if( p_mi ) if( p_mi )
vlm_media_instance_Delete( p_mi ); vlm_media_instance_Delete( p_mi );
return p_mi ? 0 : -1; return p_mi ? 0 : -1;
} }
libvlc_event_manager_t * libvlc_vlm_get_event_manager( libvlc_instance_t *p_instance, libvlc_event_manager_t *
libvlc_exception_t *p_exception ) libvlc_vlm_get_event_manager( libvlc_instance_t *p_instance )
{ {
vlm_t *p_vlm; vlm_t *p_vlm;
VLM_RET( p_vlm, NULL); VLM_RET( p_vlm, NULL);
......
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