- p_input = input_ItemNewExt( p_playlist, psz_uri,
- _("Media Library"), 0, NULL, -1 );
+ if( asprintf( &psz_uri, "%s" DIR_SEP "ml.xspf", psz_datadir ) != -1 )
+ { /* loosy check for media library file */
+ struct stat st;
+ int ret = utf8_stat( psz_uri , &st );
+ free( psz_uri );
+ if( ret )
+ {
+ free( psz_datadir );
+ return VLC_EGENERIC;
+ }
+ }
+
+ psz_uri = make_URI( psz_datadir );
+ free( psz_datadir );
+ psz_datadir = psz_uri;
+ if( psz_datadir == NULL )
+ return VLC_EGENERIC;
+
+ /* Force XSPF demux (psz_datadir was a path, now it is a file URI) */
+ if( asprintf( &psz_uri, "file/xspf-open%s/ml.xspf", psz_datadir+4 ) == -1 )
+ psz_uri = NULL;
+ free( psz_datadir );
+ psz_datadir = NULL;
+ if( psz_uri == NULL )
+ return VLC_ENOMEM;
+
+ const char *const options[1] = { "meta-file", };
+ /* that option has to be cleaned in input_item_subitem_added() */
+ /* vlc_gc_decref() in the same function */
+ p_input = input_item_NewExt( p_playlist, psz_uri, _("Media Library"),
+ 1, options, VLC_INPUT_OPTION_TRUSTED, -1 );
+ free( psz_uri );
+ if( p_input == NULL )
+ return VLC_EGENERIC;
+
+ PL_LOCK;
+ if( p_playlist->p_ml_onelevel->p_input )
+ vlc_gc_decref( p_playlist->p_ml_onelevel->p_input );
+ if( p_playlist->p_ml_category->p_input )
+ vlc_gc_decref( p_playlist->p_ml_category->p_input );
+
+ p_playlist->p_ml_onelevel->p_input =