Commit c21acbbc authored by Clément Stenac's avatar Clément Stenac

* Remove unused playlist_ItemCopy

* Fix some debug
parent 105598d5
...@@ -250,9 +250,7 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const ...@@ -250,9 +250,7 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const
/* Item management functions (act on items) */ /* Item management functions (act on items) */
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c ) #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_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) ); 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) #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 ) ); VLC_EXPORT( playlist_item_t *, __playlist_ItemNewFromInput, ( vlc_object_t *p_obj,input_item_t *p_input ) );
...@@ -387,4 +385,12 @@ static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist ) ...@@ -387,4 +385,12 @@ static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
* @} * @}
*/ */
#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 #endif
...@@ -266,7 +266,7 @@ struct module_symbols_t ...@@ -266,7 +266,7 @@ struct module_symbols_t
int (*playlist_AddSDModules_inner) (playlist_t *, char *); int (*playlist_AddSDModules_inner) (playlist_t *, char *);
vlc_bool_t (*playlist_IsServicesDiscoveryLoaded_inner) (playlist_t *,const 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_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); 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 *); int (*playlist_ItemDelete_inner) (playlist_item_t *);
void *playlist_ItemAddParent_deprecated; void *playlist_ItemAddParent_deprecated;
...@@ -761,7 +761,6 @@ struct module_symbols_t ...@@ -761,7 +761,6 @@ struct module_symbols_t
# define playlist_AddSDModules (p_symbols)->playlist_AddSDModules_inner # define playlist_AddSDModules (p_symbols)->playlist_AddSDModules_inner
# define playlist_IsServicesDiscoveryLoaded (p_symbols)->playlist_IsServicesDiscoveryLoaded_inner # define playlist_IsServicesDiscoveryLoaded (p_symbols)->playlist_IsServicesDiscoveryLoaded_inner
# define __playlist_ItemNew (p_symbols)->__playlist_ItemNew_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_ItemNewWithType (p_symbols)->playlist_ItemNewWithType_inner
# define playlist_ItemDelete (p_symbols)->playlist_ItemDelete_inner # define playlist_ItemDelete (p_symbols)->playlist_ItemDelete_inner
# define playlist_ItemSetName (p_symbols)->playlist_ItemSetName_inner # define playlist_ItemSetName (p_symbols)->playlist_ItemSetName_inner
...@@ -1232,7 +1231,6 @@ struct module_symbols_t ...@@ -1232,7 +1231,6 @@ struct module_symbols_t
((p_symbols)->playlist_AddSDModules_inner) = playlist_AddSDModules; \ ((p_symbols)->playlist_AddSDModules_inner) = playlist_AddSDModules; \
((p_symbols)->playlist_IsServicesDiscoveryLoaded_inner) = playlist_IsServicesDiscoveryLoaded; \ ((p_symbols)->playlist_IsServicesDiscoveryLoaded_inner) = playlist_IsServicesDiscoveryLoaded; \
((p_symbols)->__playlist_ItemNew_inner) = __playlist_ItemNew; \ ((p_symbols)->__playlist_ItemNew_inner) = __playlist_ItemNew; \
((p_symbols)->__playlist_ItemCopy_inner) = __playlist_ItemCopy; \
((p_symbols)->playlist_ItemNewWithType_inner) = playlist_ItemNewWithType; \ ((p_symbols)->playlist_ItemNewWithType_inner) = playlist_ItemNewWithType; \
((p_symbols)->playlist_ItemDelete_inner) = playlist_ItemDelete; \ ((p_symbols)->playlist_ItemDelete_inner) = playlist_ItemDelete; \
((p_symbols)->playlist_ItemSetName_inner) = playlist_ItemSetName; \ ((p_symbols)->playlist_ItemSetName_inner) = playlist_ItemSetName; \
...@@ -1453,6 +1451,7 @@ struct module_symbols_t ...@@ -1453,6 +1451,7 @@ struct module_symbols_t
((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \ ((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \ ((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \ (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \ (p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
(p_symbols)->playlist_CopyParents_deprecated = NULL; \ (p_symbols)->playlist_CopyParents_deprecated = NULL; \
(p_symbols)->playlist_ViewInsert_deprecated = NULL; \ (p_symbols)->playlist_ViewInsert_deprecated = NULL; \
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <vlc/input.h> #include <vlc/input.h>
#include "vlc_playlist.h" #include "vlc_playlist.h"
#define PLAYLIST_DEBUG 1
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -335,9 +333,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -335,9 +333,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
/* Start the real work */ /* Start the real work */
if( p_playlist->request.b_request ) if( p_playlist->request.b_request )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "processing request" );
msg_Dbg( p_playlist,"processing request" );
#endif
p_new = p_playlist->request.p_item; p_new = p_playlist->request.p_item;
i_skip = p_playlist->request.i_skip; i_skip = p_playlist->request.i_skip;
...@@ -359,10 +355,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -359,10 +355,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
p_new ); p_new );
if( p_new == NULL ) if( p_new == NULL )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "looping - restarting at beginning of node" );
msg_Dbg( p_playlist, "looping - restarting at beginning "
"of node" );
#endif
p_new = playlist_GetNextLeaf( p_playlist, p_new = playlist_GetNextLeaf( p_playlist,
p_playlist->request.p_node, p_playlist->request.p_node,
NULL ); NULL );
...@@ -379,10 +372,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -379,10 +372,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
p_new ); p_new );
if( p_new == NULL ) if( p_new == NULL )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "looping - restarting at end of node" );
msg_Dbg( p_playlist, "looping - restarting at end "
"of node" );
#endif
/** \bug This is needed because GetPrevLeaf does not loop /** \bug This is needed because GetPrevLeaf does not loop
* by itself */ * by itself */
p_new = playlist_GetLastLeaf( p_playlist, p_new = playlist_GetLastLeaf( p_playlist,
...@@ -397,9 +387,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -397,9 +387,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
/* "Automatic" item change ( next ) */ /* "Automatic" item change ( next ) */
else else
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "changing item without a request" );
msg_Dbg( p_playlist,"changing item without a request" );
#endif
/* Cant go to next from current item */ /* Cant go to next from current item */
if( p_playlist->status.p_item && if( p_playlist->status.p_item &&
p_playlist->status.p_item->i_flags & PLAYLIST_SKIP_FLAG ) p_playlist->status.p_item->i_flags & PLAYLIST_SKIP_FLAG )
...@@ -410,9 +398,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -410,9 +398,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
p_playlist->status.p_item ); p_playlist->status.p_item );
if( p_new == NULL && b_loop ) if( p_new == NULL && b_loop )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "looping" );
msg_Dbg( p_playlist, "looping" );
#endif
p_new = playlist_GetNextLeaf( p_playlist, p_new = playlist_GetNextLeaf( p_playlist,
p_playlist->status.p_node, p_playlist->status.p_node,
NULL ); NULL );
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include "vlc_playlist.h" #include "vlc_playlist.h"
#include "vlc_interaction.h" #include "vlc_interaction.h"
#undef PLAYLIST_DEBUG
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -192,9 +190,7 @@ void playlist_MainLoop( playlist_t *p_playlist ) ...@@ -192,9 +190,7 @@ void playlist_MainLoop( playlist_t *p_playlist )
/* FIXME : this can be called several times */ /* FIXME : this can be called several times */
if( p_playlist->request.b_request ) if( p_playlist->request.b_request )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "incoming request - stopping current input" );
msg_Dbg(p_playlist, "incoming request - stopping current input" );
#endif
/* Stop the existing input */ /* Stop the existing input */
if( p_playlist->p_input ) if( p_playlist->p_input )
{ {
......
...@@ -93,91 +93,6 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj, ...@@ -93,91 +93,6 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
return p_item; 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 * Playlist item destruction
***************************************************************************/ ***************************************************************************/
......
...@@ -75,7 +75,6 @@ playlist_item_t * playlist_ItemGetByInput( playlist_t * p_playlist , ...@@ -75,7 +75,6 @@ playlist_item_t * playlist_ItemGetByInput( playlist_t * p_playlist ,
for( i = 0 ; i < p_playlist->i_all_size; i++ ) 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 ) if( p_playlist->pp_all_items[i]->p_input == p_item )
{ {
return p_playlist->pp_all_items[i]; return p_playlist->pp_all_items[i];
...@@ -102,7 +101,6 @@ int playlist_LiveSearchUpdate( playlist_t *p_playlist, playlist_item_t *p_root, ...@@ -102,7 +101,6 @@ int playlist_LiveSearchUpdate( playlist_t *p_playlist, playlist_item_t *p_root,
#define META_MATCHES( field ) ( p_item->p_input->p_meta && \ #define META_MATCHES( field ) ( p_item->p_input->p_meta && \
p_item->p_input->p_meta->psz_##field && \ p_item->p_input->p_meta->psz_##field && \
strcasestr( p_item->p_input->p_meta->psz_##field, psz_string ) ) 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 ) || if( strcasestr( p_item->p_input->psz_name, psz_string ) ||
META_MATCHES( artist ) || META_MATCHES( album ) ) META_MATCHES( artist ) || META_MATCHES( album ) )
p_item->i_flags &= ~PLAYLIST_DBL_FLAG; p_item->i_flags &= ~PLAYLIST_DBL_FLAG;
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <vlc/input.h> #include <vlc/input.h>
#include "vlc_playlist.h" #include "vlc_playlist.h"
#define PLAYLIST_DEBUG 1
/************************************************************************ /************************************************************************
* Local prototypes * Local prototypes
************************************************************************/ ************************************************************************/
...@@ -486,17 +484,14 @@ playlist_item_t *GetNextItem( playlist_t *p_playlist, ...@@ -486,17 +484,14 @@ playlist_item_t *GetNextItem( playlist_t *p_playlist,
if( i+1 >= p_parent->i_children ) if( i+1 >= p_parent->i_children )
{ {
/* Was already the last sibling. Look for uncles */ /* Was already the last sibling. Look for uncles */
#ifdef PLAYLIST_DEBUG PL_DEBUG( "Current item is the last of the node,"
msg_Dbg( p_playlist, "Current item is the last of the node,"
"looking for uncle from %s", "looking for uncle from %s",
p_parent->p_input->psz_name ); p_parent->p_input->psz_name );
#endif
if( p_parent == p_root ) if( p_parent == p_root )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "already at root" );
msg_Dbg( p_playlist, "Already at root" );
return NULL; return NULL;
#endif
} }
return GetNextUncle( p_playlist, p_item, p_root ); return GetNextUncle( p_playlist, p_item, p_root );
} }
...@@ -527,12 +522,9 @@ playlist_item_t *GetNextUncle( playlist_t *p_playlist, playlist_item_t *p_item, ...@@ -527,12 +522,9 @@ playlist_item_t *GetNextUncle( playlist_t *p_playlist, playlist_item_t *p_item,
{ {
if( p_parent == p_grandparent->pp_children[i] ) if( p_parent == p_grandparent->pp_children[i] )
{ {
#ifdef PLAYLIST_DEBUG PL_DEBUG( "parent %s found as child %i of grandparent %s",
msg_Dbg( p_playlist, "parent %s found as child %i of "
"grandparent %s",
p_parent->p_input->psz_name, i, p_parent->p_input->psz_name, i,
p_grandparent->p_input->psz_name ); p_grandparent->p_input->psz_name );
#endif
b_found = VLC_TRUE; b_found = VLC_TRUE;
break; break;
} }
...@@ -627,11 +619,9 @@ playlist_item_t *GetPrevItem( playlist_t *p_playlist, ...@@ -627,11 +619,9 @@ playlist_item_t *GetPrevItem( playlist_t *p_playlist,
if( i-1 < 0 ) if( i-1 < 0 )
{ {
/* Was already the first sibling. Look for uncles */ /* Was already the first sibling. Look for uncles */
#ifdef PLAYLIST_DEBUG PL_DEBUG( "Current item is the first of the node,"
msg_Dbg( p_playlist, "Current item is the first of the node,"
"looking for uncle from %s", "looking for uncle from %s",
p_parent->p_input->psz_name ); p_parent->p_input->psz_name );
#endif
return GetPrevUncle( p_playlist, p_item, p_root ); return GetPrevUncle( p_playlist, p_item, p_root );
} }
else else
......
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