]> git.sesse.net Git - vlc/blobdiff - src/control/media_library.c
Extensions/Qt: buildsystem + menu entries
[vlc] / src / control / media_library.c
index 0a177f66be645f0744a1016a8ec1311d53cec4c6..041a2412d141fa33ab688571da80bfd1fd8a0d79 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * tree.c: libvlc tags tree functions
- * Create a tree of the 'tags' of a media_list's media_descriptors.
+ * Create a tree of the 'tags' of a media_list's medias.
  *****************************************************************************
  * Copyright (C) 2007 the VideoLAN team
  * $Id$
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#include "libvlc_internal.h"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/libvlc.h>
-#include "vlc_arrays.h"
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_media_list.h>
+#include <vlc/libvlc_media_library.h>
+#include <vlc/libvlc_events.h>
+
+#include <vlc_common.h>
+
+#include "libvlc_internal.h"
+
+struct libvlc_media_library_t
+{
+    libvlc_event_manager_t * p_event_manager;
+    libvlc_instance_t *      p_libvlc_instance;
+    int                      i_refcount;
+    libvlc_media_list_t *    p_mlist;
+};
+
 
 /*
  * Private functions
@@ -40,7 +60,6 @@ libvlc_media_library_t *
 libvlc_media_library_new( libvlc_instance_t * p_inst,
                           libvlc_exception_t * p_e )
 {
-    (void)p_e;
     libvlc_media_library_t * p_mlib;
 
     p_mlib = malloc(sizeof(libvlc_media_library_t));
@@ -88,21 +107,22 @@ void
 libvlc_media_library_load( libvlc_media_library_t * p_mlib,
                            libvlc_exception_t * p_e )
 {
-    const char *psz_datadir = p_mlib->p_libvlc_instance->p_libvlc_int->psz_datadir;
+    char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
     char * psz_uri;
 
-    if( !psz_datadir ) /* XXX: i doubt that this can ever happen */
-    {
-        libvlc_exception_raise( p_e, "Can't get data directory" );
-        return;
-    }
-
-    if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
+    if( psz_datadir == NULL
+     || asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
                   psz_datadir ) == -1 )
+        psz_uri = NULL;
+    free( psz_datadir );
+
+    if( psz_uri == NULL )
     {
-        libvlc_exception_raise( p_e, "Can't get create the path" );
+        libvlc_exception_raise( p_e );
+        libvlc_printerr( "Not enough memory" );
         return;
     }
+
     if( p_mlib->p_mlist )
         libvlc_media_list_release( p_mlib->p_mlist );
 
@@ -115,16 +135,6 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
     return;
 }
 
-/**************************************************************************
- *       save (Public)
- **************************************************************************/
-void
-libvlc_media_library_save( libvlc_media_library_t * p_mlib,
-                           libvlc_exception_t * p_e )
-{
-    libvlc_exception_raise( p_e, "Not supported" );
-}
-
 /**************************************************************************
  *        media_list (Public)
  **************************************************************************/