Commit 2eb3e28b authored by Clément Stenac's avatar Clément Stenac

Fix some bugs

parent 0178bdfc
...@@ -90,9 +90,7 @@ void libvlc_exception_clear( libvlc_exception_t * ); ...@@ -90,9 +90,7 @@ void libvlc_exception_clear( libvlc_exception_t * );
*/ */
char* libvlc_exception_get_message( libvlc_exception_t *p_exception ); char* libvlc_exception_get_message( libvlc_exception_t *p_exception );
/**@} */
/** @} */
/***************************************************************************** /*****************************************************************************
* Core handling * Core handling
...@@ -168,10 +166,6 @@ int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * ); ...@@ -168,10 +166,6 @@ int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
*/ */
int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * ); int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
/** /**
* Stop playing * Stop playing
* \param p_instance the instance to stop * \param p_instance the instance to stop
...@@ -305,7 +299,9 @@ void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * ); ...@@ -305,7 +299,9 @@ void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
*/ */
int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * ); int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
/** @} /** @} */
/**
* defgroup libvlc_vlm VLM * defgroup libvlc_vlm VLM
* \ingroup libvlc * \ingroup libvlc
* LibVLC VLM handling * LibVLC VLM handling
...@@ -399,6 +395,7 @@ void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* , ...@@ -399,6 +395,7 @@ void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
int, char **, int, int, libvlc_exception_t * ); int, char **, int, int, libvlc_exception_t * );
/** @} */
/** @} */ /** @} */
# ifdef __cplusplus # ifdef __cplusplus
......
...@@ -30,14 +30,18 @@ ...@@ -30,14 +30,18 @@
void InitVLM( libvlc_instance_t *p_instance ) void InitVLM( libvlc_instance_t *p_instance )
{ {
#ifdef ENABLE_VLM
if( p_instance->p_vlm ) return; if( p_instance->p_vlm ) return;
p_instance->p_vlm = vlm_New( p_instance->p_vlc ); p_instance->p_vlm = vlm_New( p_instance->p_vlc );
#else
p_instance->p_vlm = NULL;
#endif
} }
#define CHECK_VLM { if( !p_instance->p_vlm ) InitVLM( p_instance ); \ #define CHECK_VLM { if( !p_instance->p_vlm ) InitVLM( p_instance ); \
if( !p_instance->p_vlm ) {\ if( !p_instance->p_vlm ) {\
libvlc_exception_raise( p_exception, \ libvlc_exception_raise( p_exception, \
"Unable to create VLM" ); return; } } "Unable to create VLM. It might be disabled." ); return; } }
#define GET_MEDIA { p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name );\ #define GET_MEDIA { p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name );\
if( !p_media ) \ if( !p_media ) \
...@@ -74,6 +78,7 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, char *psz_name, ...@@ -74,6 +78,7 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, char *psz_name,
char *psz_message; char *psz_message;
vlm_message_t *answer; vlm_message_t *answer;
CHECK_VLM; CHECK_VLM;
#ifdef ENABLE_VLM
asprintf( &psz_message, "del %s", psz_name ); asprintf( &psz_message, "del %s", psz_name );
vlm_ExecuteCommand( p_instance->p_vlm, psz_message, &answer ); vlm_ExecuteCommand( p_instance->p_vlm, psz_message, &answer );
if( answer->psz_value ) if( answer->psz_value )
...@@ -82,6 +87,7 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, char *psz_name, ...@@ -82,6 +87,7 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, char *psz_name,
psz_name ); psz_name );
} }
free( psz_message); free( psz_message);
#endif
} }
void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name,
...@@ -89,9 +95,11 @@ void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name, ...@@ -89,9 +95,11 @@ void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance, char *psz_name,
{ {
vlm_media_t *p_media; vlm_media_t *p_media;
CHECK_VLM; CHECK_VLM;
#ifdef ENABLE_VLM
GET_MEDIA; GET_MEDIA;
if( b_enabled != 0 ) b_enabled = 1; if( b_enabled != 0 ) b_enabled = 1;
p_media->b_enabled = b_enabled; p_media->b_enabled = b_enabled;
#endif
} }
void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name,
...@@ -99,9 +107,11 @@ void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name, ...@@ -99,9 +107,11 @@ void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name,
{ {
vlm_media_t *p_media; vlm_media_t *p_media;
CHECK_VLM; CHECK_VLM;
#ifdef ENABLE_VLM
GET_MEDIA; GET_MEDIA;
if( b_loop != 0 ) b_loop = 1; if( b_loop != 0 ) b_loop = 1;
p_media->b_loop = b_loop; p_media->b_loop = b_loop;
#endif
} }
void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name,
...@@ -110,13 +120,18 @@ void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name, ...@@ -110,13 +120,18 @@ void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name,
vlm_media_t *p_media; vlm_media_t *p_media;
int i_ret; int i_ret;
CHECK_VLM; CHECK_VLM;
#ifdef ENABLE_VLM
GET_MEDIA; GET_MEDIA;
vlc_mutex_lock( &p_instance->p_vlm->lock ); vlc_mutex_lock( &p_instance->p_vlm->lock );
i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to set output" ); return;} {
libvlc_exception_raise( p_exception, "Unable to set output" );
vlc_mutex_unlock( &p_instance->p_vlm->lock );return;
}
vlc_mutex_unlock( &p_instance->p_vlm->lock ); vlc_mutex_unlock( &p_instance->p_vlm->lock );
#endif
} }
void libvlc_vlm_set_input( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_set_input( libvlc_instance_t *p_instance, char *psz_name,
...@@ -125,18 +140,24 @@ void libvlc_vlm_set_input( libvlc_instance_t *p_instance, char *psz_name, ...@@ -125,18 +140,24 @@ void libvlc_vlm_set_input( libvlc_instance_t *p_instance, char *psz_name,
vlm_media_t *p_media; vlm_media_t *p_media;
int i_ret; int i_ret;
CHECK_VLM; CHECK_VLM;
GET_MEDIA; #ifdef ENABLE_VLM
vlc_mutex_lock( &p_instance->p_vlm->lock ); vlc_mutex_lock( &p_instance->p_vlm->lock );
GET_MEDIA;
vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" ); vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to change input" ); return;} {
libvlc_exception_raise( p_exception, "Unable to change input" );
vlc_mutex_unlock( &p_instance->p_vlm->lock );return;
}
vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to change input" ); return;} {
libvlc_exception_raise( p_exception, "Unable to change input" );
vlc_mutex_unlock( &p_instance->p_vlm->lock );return;
}
vlc_mutex_unlock( &p_instance->p_vlm->lock ); vlc_mutex_unlock( &p_instance->p_vlm->lock );
#endif
} }
void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name,
...@@ -145,20 +166,22 @@ void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name, ...@@ -145,20 +166,22 @@ void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name,
vlm_media_t *p_media; vlm_media_t *p_media;
int i_ret; int i_ret;
CHECK_VLM; CHECK_VLM;
GET_MEDIA; #ifdef ENABLE_VLM
vlc_mutex_lock( &p_instance->p_vlm->lock ); vlc_mutex_lock( &p_instance->p_vlm->lock );
GET_MEDIA;
vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to change input" ); return;} {
libvlc_exception_raise( p_exception, "Unable to change input" );
vlc_mutex_unlock( &p_instance->p_vlm->lock ); return;
}
vlc_mutex_unlock( &p_instance->p_vlm->lock ); vlc_mutex_unlock( &p_instance->p_vlm->lock );
#endif
} }
void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name, void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name,
char *psz_input, char *psz_output, int i_options, char *psz_input, char *psz_output, int i_options,
char **ppsz_options, int b_enabled, int b_loop, char **ppsz_options, int b_enabled, int b_loop,
...@@ -167,25 +190,41 @@ void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name, ...@@ -167,25 +190,41 @@ void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name,
vlm_media_t *p_media; vlm_media_t *p_media;
int i_ret; int i_ret;
CHECK_VLM; CHECK_VLM;
#ifdef ENABLE_VLM
vlc_mutex_lock( &p_instance->p_vlm->lock );
GET_MEDIA; GET_MEDIA;
if( b_enabled != 0 ) b_enabled = 1; if( b_enabled != 0 ) b_enabled = 1;
if( b_loop != 0 ) b_loop = 1; if( b_loop != 0 ) b_loop = 1;
vlc_mutex_lock( &p_instance->p_vlm->lock );
i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output );
if( i_ret ) libvlc_exception_raise( p_exception, "Unable to set output" ); if( i_ret )
{
libvlc_exception_raise( p_exception, "Unable to set output" );
vlc_mutex_unlock( &p_instance->p_vlm->lock );
return;
}
p_media->b_enabled = b_enabled; p_media->b_enabled = b_enabled;
p_media->b_loop = b_loop; p_media->b_loop = b_loop;
i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to set output" ); return;} {
libvlc_exception_raise( p_exception, "Unable to set output" );
vlc_mutex_unlock( &p_instance->p_vlm->lock ); return;
}
vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" ); vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to change input" ); return;} {
libvlc_exception_raise( p_exception, "Unable to change input" );
vlc_mutex_unlock( &p_instance->p_vlm->lock ); return;
}
vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input );
if( i_ret ) if( i_ret )
{ libvlc_exception_raise( p_exception, "Unable to change input" ); return;} {
libvlc_exception_raise( p_exception, "Unable to change input" );
vlc_mutex_unlock( &p_instance->p_vlm->lock );return;
}
vlc_mutex_unlock( &p_instance->p_vlm->lock ); vlc_mutex_unlock( &p_instance->p_vlm->lock );
#endif
} }
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