Commit 06b57a51 authored by Clément Stenac's avatar Clément Stenac

* Add a "media-library" option to enable/disable ML

* Add a "playlist-tree" option to force onelevel/catgory mode
parent efae654e
......@@ -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_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 */
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 */
/*@}*/
};
......@@ -183,7 +179,6 @@ struct playlist_add_t
{
int i_node;
int i_item;
int i_view;
int i_position;
};
......
......@@ -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,
......
......@@ -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;
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;
......
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