+#if 0
+/* local function to be used in libvlc_vlm_show_media only */
+static char* recurse_answer( char* psz_prefix, vlm_message_t *p_answer ) {
+ char* psz_childprefix;
+ char* psz_response="";
+ char* response_tmp;
+ int i;
+ vlm_message_t *aw_child, **paw_child;
+
+ asprintf( &psz_childprefix, "%s%s.", psz_prefix, p_answer->psz_name );
+
+ if ( p_answer->i_child )
+ {
+ paw_child = p_answer->child;
+ aw_child = *( paw_child );
+ for( i = 0; i < p_answer->i_child; i++ )
+ {
+ asprintf( &response_tmp, "%s%s%s:%s\n",
+ psz_response, psz_prefix, aw_child->psz_name,
+ aw_child->psz_value );
+ free( psz_response );
+ psz_response = response_tmp;
+ if ( aw_child->i_child )
+ {
+ asprintf(&response_tmp, "%s%s", psz_response,
+ recurse_answer(psz_childprefix, aw_child));
+ free( psz_response );
+ psz_response = response_tmp;
+ }
+ paw_child++;
+ aw_child = *( paw_child );
+ }
+ }
+ free( psz_childprefix );
+ return psz_response;
+}
+
+char* libvlc_vlm_show_media( libvlc_instance_t *p_instance, char *psz_name,
+ libvlc_exception_t *p_exception )
+{
+ char *psz_message;
+ vlm_message_t *answer;
+ char *psz_response;
+
+ CHECK_VLM;
+#ifdef ENABLE_VLM
+ asprintf( &psz_message, "show %s", psz_name );
+ asprintf( &psz_response, "", psz_name );
+ vlm_ExecuteCommand( p_instance->p_vlm, psz_message, &answer );
+ if( answer->psz_value )
+ {
+ libvlc_exception_raise( p_exception, "Unable to call show %s: %s",
+ psz_name, answer->psz_value );
+ }
+ else
+ {
+ if ( answer->child )
+ {
+ psz_response = recurse_answer( "", answer );
+ }
+ }
+ free( psz_message );
+ return(psz_response );
+#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." );
+ return VLC_EGENERIC;
+ }
+ return VLC_SUCCESS;
+}
+#define VLM_RET(p,ret) do { \
+ if( libvlc_vlm_init( p_instance, p_exception ) ) return ret;\
+ (p) = p_instance->p_vlm; \
+ } 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 )