]> git.sesse.net Git - vlc/commitdiff
* Add a "media-library" option to enable/disable ML
authorClément Stenac <zorglub@videolan.org>
Wed, 14 Jun 2006 20:09:51 +0000 (20:09 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 14 Jun 2006 20:09:51 +0000 (20:09 +0000)
* Add a "playlist-tree" option to force onelevel/catgory mode

include/vlc_playlist.h
src/libvlc.h
src/playlist/engine.c

index a13a03eda0c55ad761b32416cf02c4bd38645025..faf1e0550b336295f00b3f85d5191e826b944a29 100644 (file)
@@ -65,12 +65,13 @@ struct playlist_item_t
     uint8_t                i_flags;     /**< Flags */
 };
 
-#define PLAYLIST_SAVE_FLAG      0x01    /**< Must it be saved */
-#define PLAYLIST_SKIP_FLAG      0x02    /**< Must playlist skip after it ? */
-#define PLAYLIST_DBL_FLAG       0x04    /**< Is it disabled ? */
-#define PLAYLIST_RO_FLAG        0x10    /**< Write-enabled ? */
-#define PLAYLIST_REMOVE_FLAG    0x20    /**< Remove this item at the end */
-#define PLAYLIST_EXPANDED_FLAG  0x40    /**< Expanded node */
+#define PLAYLIST_SAVE_FLAG      0x0001    /**< Must it be saved */
+#define PLAYLIST_SKIP_FLAG      0x0002    /**< Must playlist skip after it ? */
+#define PLAYLIST_DBL_FLAG       0x0004    /**< Is it disabled ? */
+#define PLAYLIST_RO_FLAG        0x0008    /**< Write-enabled ? */
+#define PLAYLIST_REMOVE_FLAG    0x0010    /**< Remove this item at the end */
+#define PLAYLIST_EXPANDED_FLAG  0x0020    /**< Expanded node */
+#define PLAYLIST_PREFCAT_FLAG   0x0040    /**< Prefer category */
 
 /**
  * Playlist status
@@ -99,9 +100,7 @@ struct playlist_preparse_t
 };
 
 
-/**
- * Structure containing information about the playlist
- */
+/** Structure containing information about the playlist */
 struct playlist_t
 {
     VLC_COMMON_MEMBERS
@@ -112,38 +111,40 @@ struct playlist_t
 /*@{*/
     int                   i_enabled; /**< How many items are enabled ? */
 
+    /* Arrays of items */
     int                   i_size;   /**< total size of the list */
     playlist_item_t **    pp_items; /**< array of pointers to the
                                      * playlist items */
     int                   i_all_size; /**< size of list of items and nodes */
     playlist_item_t **    pp_all_items; /**< array of pointers to the
                                          * playlist items and nodes */
-    int                   i_last_playlist_id; /**< Last id to an item */
-
     int                   i_input_items;
-    input_item_t **    pp_input_items;
-
-    int                  i_last_input_id ;
+    input_item_t **       pp_input_items;
 
-    input_thread_t *      p_input;  /**< the input thread associated
-                                     * with the current item */
+    int                   i_last_playlist_id; /**< Last id to an item */
+    int                   i_last_input_id ; /**< Last id on an input */
 
-    int                   i_sort; /**< Last sorting applied to the playlist */
-    int                   i_order; /**< Last ordering applied to the playlist */
+    services_discovery_t **pp_sds;
+    int                   i_sds;
 
+    /* Predefined items */
     playlist_item_t *     p_root_category;
     playlist_item_t *     p_root_onelevel;
-
     playlist_item_t *     p_local_category; /** < "Playlist" in CATEGORY view */
     playlist_item_t *     p_ml_category; /** < "Library" in CATEGORY view */
     playlist_item_t *     p_local_onelevel; /** < "Playlist" in ONELEVEL view */
     playlist_item_t *     p_ml_onelevel; /** < "Library" in ONELEVEL iew */
 
-    services_discovery_t **pp_sds;
-    int                   i_sds;
+    /* Runtime */
+    input_thread_t *      p_input;  /**< the input thread associated
+                                     * with the current item */
+    int                   i_sort; /**< Last sorting applied to the playlist */
+    int                   i_order; /**< Last ordering applied to the playlist */
+    mtime_t               i_vout_destroyed_date;
+    mtime_t               i_sout_destroyed_date;
+    playlist_preparse_t  *p_preparse; /**< Preparser object */
 
-    mtime_t    i_vout_destroyed_date;
-    mtime_t    i_sout_destroyed_date;
+    vlc_mutex_t gc_lock;         /**< Lock to protect the garbage collection */
 
     struct {
         /* Current status. These fields are readonly, only the playlist
@@ -167,14 +168,9 @@ struct playlist_t
         vlc_mutex_t         lock;     /**< Lock to protect request */
     } request;
 
-    playlist_preparse_t     *p_preparse; /**< Preparser object */
-
-    vlc_mutex_t gc_lock;         /**< Lock to protect the garbage collection */
-
     // Playlist-unrelated fields
-    interaction_t *p_interaction;       /**< Interaction manager */
-    global_stats_t *p_stats;            /**< Global statistics */
-
+    interaction_t       *p_interaction;       /**< Interaction manager */
+    global_stats_t      *p_stats;             /**< Global statistics */
     /*@}*/
 };
 
@@ -183,7 +179,6 @@ struct playlist_add_t
 {
     int i_node;
     int i_item;
-    int i_view;
     int i_position;
 };
 
index f1561408dfafdfa0aaafa5e671b618091ac0847a..40b6666bea4e3ab43f7e777a1ab7048834617b4e 100644 (file)
@@ -928,6 +928,21 @@ static char *ppsz_clock_descriptions[] =
 #define PAS_LONGTEXT N_( \
     "Stop the playlist after each played playlist item." )
 
+#define ML_TEXT N_("Use media library")
+#define ML_LONGTEXT N_( \
+    "The media library is automatically saved and reloaded each time you " \
+    "start VLC." )
+
+#define PLTREE_TEXT N_("Use playlist tree")
+#define PLTREE_LONGTEXT N_( \
+    "The playlist can use a tree to categorize some items, like the " \
+    "contents of a directory. \"Default\" means that the tree will only " \
+    "be used when really needed." )
+static int pi_pltree_values[] = { 0, 1, 2 };
+static char *ppsz_pltree_descriptions[] = { N_("Default"), N_("Always"), N_("Never") };
+
+
+
 /*****************************************************************************
  * Hotkeys
  ****************************************************************************/
@@ -1549,10 +1564,15 @@ vlc_module_begin();
     add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_FALSE );
         change_short('R');
     add_bool( "play-and-stop", 0, NULL, PAS_TEXT, PAS_LONGTEXT, VLC_FALSE );
+    add_bool( "media-library", 1, NULL, ML_TEXT, ML_LONGTEXT, VLC_FALSE );
+    add_integer( "playlist-tree", 0, NULL, PLTREE_TEXT, PLTREE_LONGTEXT,
+                 VLC_TRUE );
+        change_integer_list( pi_pltree_values, ppsz_pltree_descriptions, 0 );
 
     add_string( "open", "", NULL, OPEN_TEXT, OPEN_LONGTEXT, VLC_FALSE );
 
-    add_bool( "auto-preparse", VLC_TRUE, NULL, PREPARSE_TEXT, PREPARSE_LONGTEXT, VLC_FALSE );
+    add_bool( "auto-preparse", VLC_TRUE, NULL, PREPARSE_TEXT,
+              PREPARSE_LONGTEXT, VLC_FALSE );
 
     set_subcategory( SUBCAT_PLAYLIST_SD );
     add_module_list_cat( "services-discovery", SUBCAT_PLAYLIST_SD, NULL,
index ddcd6a54b5f93465858ec3cf175172ad04944a31..19bd9fd22295c2540467c75c6cf78dbd4bdbf31b 100644 (file)
@@ -77,24 +77,30 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     /* Create playlist and media library */
     p_playlist->p_local_category = playlist_NodeCreate( p_playlist,
                                  _( "Playlist" ),p_playlist->p_root_category );
-    p_playlist->p_ml_category =   playlist_NodeCreate( p_playlist,
-                           _( "Media Library" ), p_playlist->p_root_category );
     p_playlist->p_local_onelevel =  playlist_NodeCreate( p_playlist,
                                 _( "Playlist" ), p_playlist->p_root_onelevel );
-    p_playlist->p_ml_onelevel =  playlist_NodeCreate( p_playlist,
-                           _( "Media Library" ), p_playlist->p_root_onelevel );
-
     p_playlist->p_local_category->i_flags |= PLAYLIST_RO_FLAG;
-    p_playlist->p_ml_category->i_flags |= PLAYLIST_RO_FLAG;
     p_playlist->p_local_onelevel->i_flags |= PLAYLIST_RO_FLAG;
-    p_playlist->p_ml_onelevel->i_flags |= PLAYLIST_RO_FLAG;
 
-    /* This is a hack to find it later. Quite ugly, but I haven't found a
-     * better way */
+    /* Link the nodes together. Todo: actually create them from the same input*/
     p_playlist->p_local_onelevel->p_input->i_id =
         p_playlist->p_local_category->p_input->i_id;
-    p_playlist->p_ml_onelevel->p_input->i_id =
-        p_playlist->p_ml_category->p_input->i_id;
+
+    if( config_GetInt( p_playlist, "media-library") )
+    {
+        p_playlist->p_ml_category =   playlist_NodeCreate( p_playlist,
+                           _( "Media Library" ), p_playlist->p_root_category );
+        p_playlist->p_ml_onelevel =  playlist_NodeCreate( p_playlist,
+                           _( "Media Library" ), p_playlist->p_root_onelevel );
+        p_playlist->p_ml_category->i_flags |= PLAYLIST_RO_FLAG;
+        p_playlist->p_ml_onelevel->i_flags |= PLAYLIST_RO_FLAG;
+        p_playlist->p_ml_onelevel->p_input->i_id =
+             p_playlist->p_ml_category->p_input->i_id;
+    }
+    else
+    {
+        p_playlist->p_ml_category = p_playlist->p_ml_onelevel = NULL;
+    }
 
     /* Initial status */
     p_playlist->status.p_item = NULL;