/* Item management functions (act on items) */
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
-#define playlist_ItemCopy( a, b ) __playlist_ItemCopy(VLC_OBJECT(a), b )
VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
-VLC_EXPORT( playlist_item_t* , __playlist_ItemCopy, ( vlc_object_t *,playlist_item_t* ) );
VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int , const char **, int, int) );
#define playlist_ItemNewFromInput(a,b) __playlist_ItemNewFromInput(VLC_OBJECT(a),b)
VLC_EXPORT( playlist_item_t *, __playlist_ItemNewFromInput, ( vlc_object_t *p_obj,input_item_t *p_input ) );
* @}
*/
+#define PLAYLIST_DEBUG 1
+
+#ifdef PLAYLIST_DEBUG
+#define PL_DEBUG( msg, args... ) msg_Dbg( p_playlist, msg, ## args )
+#else
+#define PL_DEBUG( msg, args ... ) {}
+#endif
+
#endif
int (*playlist_AddSDModules_inner) (playlist_t *, char *);
vlc_bool_t (*playlist_IsServicesDiscoveryLoaded_inner) (playlist_t *,const char *);
playlist_item_t* (*__playlist_ItemNew_inner) (vlc_object_t *,const char *,const char *);
- playlist_item_t* (*__playlist_ItemCopy_inner) (vlc_object_t *,playlist_item_t*);
+ void *__playlist_ItemCopy_deprecated;
playlist_item_t* (*playlist_ItemNewWithType_inner) (vlc_object_t *,const char *,const char *, int , const char **, int, int);
int (*playlist_ItemDelete_inner) (playlist_item_t *);
void *playlist_ItemAddParent_deprecated;
# define playlist_AddSDModules (p_symbols)->playlist_AddSDModules_inner
# define playlist_IsServicesDiscoveryLoaded (p_symbols)->playlist_IsServicesDiscoveryLoaded_inner
# define __playlist_ItemNew (p_symbols)->__playlist_ItemNew_inner
-# define __playlist_ItemCopy (p_symbols)->__playlist_ItemCopy_inner
# define playlist_ItemNewWithType (p_symbols)->playlist_ItemNewWithType_inner
# define playlist_ItemDelete (p_symbols)->playlist_ItemDelete_inner
# define playlist_ItemSetName (p_symbols)->playlist_ItemSetName_inner
((p_symbols)->playlist_AddSDModules_inner) = playlist_AddSDModules; \
((p_symbols)->playlist_IsServicesDiscoveryLoaded_inner) = playlist_IsServicesDiscoveryLoaded; \
((p_symbols)->__playlist_ItemNew_inner) = __playlist_ItemNew; \
- ((p_symbols)->__playlist_ItemCopy_inner) = __playlist_ItemCopy; \
((p_symbols)->playlist_ItemNewWithType_inner) = playlist_ItemNewWithType; \
((p_symbols)->playlist_ItemDelete_inner) = playlist_ItemDelete; \
((p_symbols)->playlist_ItemSetName_inner) = playlist_ItemSetName; \
((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
+ (p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
(p_symbols)->playlist_CopyParents_deprecated = NULL; \
(p_symbols)->playlist_ViewInsert_deprecated = NULL; \
#include <vlc/input.h>
#include "vlc_playlist.h"
-#define PLAYLIST_DEBUG 1
-
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* Start the real work */
if( p_playlist->request.b_request )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist,"processing request" );
-#endif
+ PL_DEBUG( "processing request" );
p_new = p_playlist->request.p_item;
i_skip = p_playlist->request.i_skip;
p_new );
if( p_new == NULL )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "looping - restarting at beginning "
- "of node" );
-#endif
+ PL_DEBUG( "looping - restarting at beginning of node" );
p_new = playlist_GetNextLeaf( p_playlist,
p_playlist->request.p_node,
NULL );
p_new );
if( p_new == NULL )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "looping - restarting at end "
- "of node" );
-#endif
+ PL_DEBUG( "looping - restarting at end of node" );
/** \bug This is needed because GetPrevLeaf does not loop
* by itself */
p_new = playlist_GetLastLeaf( p_playlist,
/* "Automatic" item change ( next ) */
else
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist,"changing item without a request" );
-#endif
+ PL_DEBUG( "changing item without a request" );
/* Cant go to next from current item */
if( p_playlist->status.p_item &&
p_playlist->status.p_item->i_flags & PLAYLIST_SKIP_FLAG )
p_playlist->status.p_item );
if( p_new == NULL && b_loop )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "looping" );
-#endif
+ PL_DEBUG( "looping" );
p_new = playlist_GetNextLeaf( p_playlist,
p_playlist->status.p_node,
NULL );
#include "vlc_playlist.h"
#include "vlc_interaction.h"
-#undef PLAYLIST_DEBUG
-
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* FIXME : this can be called several times */
if( p_playlist->request.b_request )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg(p_playlist, "incoming request - stopping current input" );
-#endif
+ PL_DEBUG( "incoming request - stopping current input" );
/* Stop the existing input */
if( p_playlist->p_input )
{
return p_item;
}
-/**
- * Copy a playlist item - FIXME: Rewrite FIXME
- *
- * Creates a new item with name, mrl and meta infor like the
- * source. Does not copy children for node type items.
- * \param p_obj any vlc object, needed for mutex init
- * \param p_item the item to copy
- * \return pointer to the new item, or NULL on error
- * \note function takes the lock on p_item
- */
-playlist_item_t *__playlist_ItemCopy( vlc_object_t *p_obj,
- playlist_item_t *p_item )
-{
- playlist_item_t *p_res;
- int i;
- vlc_mutex_lock( &p_item->p_input->lock );
-
- p_res = malloc( sizeof( playlist_item_t ) );
- if( p_res == NULL )
- {
- vlc_mutex_unlock( &p_item->p_input->lock );
- return NULL;
- }
-
- *p_res = *p_item;
- vlc_mutex_init( p_obj, &p_res->p_input->lock );
-
- if( p_item->p_input->i_options )
- p_res->p_input->ppsz_options =
- malloc( p_item->p_input->i_options * sizeof(char*) );
- for( i = 0; i < p_item->p_input->i_options; i++ )
- {
- p_res->p_input->ppsz_options[i] = strdup( p_item->p_input->ppsz_options[i] );
- }
-
- if( p_item->i_children != -1 )
- {
- msg_Warn( p_obj, "not copying playlist-item's children" );
- p_res->i_children = -1;
- p_res->pp_children = NULL;
- }
- p_res->p_parent = NULL;
-
- if( p_item->p_input->psz_name )
- p_res->p_input->psz_name = strdup( p_item->p_input->psz_name );
- if( p_item->p_input->psz_uri )
- p_res->p_input->psz_uri = strdup( p_item->p_input->psz_uri );
-
- if( p_item->p_input->i_es )
- {
- p_res->p_input->es =
- (es_format_t**)malloc( p_item->p_input->i_es * sizeof(es_format_t*));
- for( i = 0; i < p_item->p_input->i_es; i++ )
- {
- p_res->p_input->es[ i ] = (es_format_t*)malloc(sizeof(es_format_t*));
- es_format_Copy( p_res->p_input->es[ i ],
- p_item->p_input->es[ i ] );
- }
- }
- if( p_item->p_input->i_categories )
- {
- p_res->p_input->pp_categories = NULL;
- p_res->p_input->i_categories = 0;
- for( i = 0; i < p_item->p_input->i_categories; i++ )
- {
- info_category_t *p_incat;
- p_incat = p_item->p_input->pp_categories[i];
- if( p_incat->i_infos )
- {
- int j;
- for( j = 0; j < p_incat->i_infos; j++ )
- {
- vlc_input_item_AddInfo( p_res->p_input, p_incat->psz_name,
- p_incat->pp_infos[j]->psz_name,
- "%s",
- p_incat->pp_infos[j]->psz_value );
- }
- }
- }
- }
-
- vlc_mutex_unlock( &p_item->p_input->lock );
- return p_res;
-}
-
/***************************************************************************
* Playlist item destruction
***************************************************************************/
for( i = 0 ; i < p_playlist->i_all_size; i++ )
{
-msg_Err( p_playlist, "%p, %p", p_item, p_playlist->pp_all_items[i]->p_input );
if( p_playlist->pp_all_items[i]->p_input == p_item )
{
return p_playlist->pp_all_items[i];
#define META_MATCHES( field ) ( p_item->p_input->p_meta && \
p_item->p_input->p_meta->psz_##field && \
strcasestr( p_item->p_input->p_meta->psz_##field, psz_string ) )
- /* Todo: Filter on all fields */
if( strcasestr( p_item->p_input->psz_name, psz_string ) ||
META_MATCHES( artist ) || META_MATCHES( album ) )
p_item->i_flags &= ~PLAYLIST_DBL_FLAG;
#include <vlc/input.h>
#include "vlc_playlist.h"
-#define PLAYLIST_DEBUG 1
-
/************************************************************************
* Local prototypes
************************************************************************/
if( i+1 >= p_parent->i_children )
{
/* Was already the last sibling. Look for uncles */
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "Current item is the last of the node,"
- "looking for uncle from %s",
- p_parent->p_input->psz_name );
-#endif
+ PL_DEBUG( "Current item is the last of the node,"
+ "looking for uncle from %s",
+ p_parent->p_input->psz_name );
+
if( p_parent == p_root )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "Already at root" );
+ PL_DEBUG( "already at root" );
return NULL;
-#endif
}
return GetNextUncle( p_playlist, p_item, p_root );
}
{
if( p_parent == p_grandparent->pp_children[i] )
{
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "parent %s found as child %i of "
- "grandparent %s",
- p_parent->p_input->psz_name, i,
- p_grandparent->p_input->psz_name );
-#endif
+ PL_DEBUG( "parent %s found as child %i of grandparent %s",
+ p_parent->p_input->psz_name, i,
+ p_grandparent->p_input->psz_name );
b_found = VLC_TRUE;
break;
}
if( i-1 < 0 )
{
/* Was already the first sibling. Look for uncles */
-#ifdef PLAYLIST_DEBUG
- msg_Dbg( p_playlist, "Current item is the first of the node,"
- "looking for uncle from %s",
- p_parent->p_input->psz_name );
-#endif
+ PL_DEBUG( "Current item is the first of the node,"
+ "looking for uncle from %s",
+ p_parent->p_input->psz_name );
return GetPrevUncle( p_playlist, p_item, p_root );
}
else