From: Clément Stenac Date: Thu, 25 May 2006 09:52:57 +0000 (+0000) Subject: * Remove unused playlist_ItemCopy X-Git-Tag: 0.9.0-test0~11163 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c21acbbcf5f0c6969fcd3a2daf6812925f334fa5;p=vlc * Remove unused playlist_ItemCopy * Fix some debug --- diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h index 94b669d633..fe53dd5848 100644 --- a/include/vlc_playlist.h +++ b/include/vlc_playlist.h @@ -250,9 +250,7 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const /* 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 ) ); @@ -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 diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 7b828ef5a6..ef754dcbf1 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -266,7 +266,7 @@ struct module_symbols_t 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; @@ -761,7 +761,6 @@ struct module_symbols_t # 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 @@ -1232,7 +1231,6 @@ struct module_symbols_t ((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; \ @@ -1453,6 +1451,7 @@ struct module_symbols_t ((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; \ diff --git a/src/playlist/control.c b/src/playlist/control.c index 5ac0ee60b3..aec26adae5 100644 --- a/src/playlist/control.c +++ b/src/playlist/control.c @@ -25,8 +25,6 @@ #include #include "vlc_playlist.h" -#define PLAYLIST_DEBUG 1 - /***************************************************************************** * Local prototypes *****************************************************************************/ @@ -335,9 +333,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) /* 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; @@ -359,10 +355,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) 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 ); @@ -379,10 +372,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) 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, @@ -397,9 +387,7 @@ playlist_item_t * playlist_NextItem( playlist_t *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 ) @@ -410,9 +398,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) 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 ); diff --git a/src/playlist/engine.c b/src/playlist/engine.c index 1443fad7f8..8be880dd37 100644 --- a/src/playlist/engine.c +++ b/src/playlist/engine.c @@ -28,8 +28,6 @@ #include "vlc_playlist.h" #include "vlc_interaction.h" -#undef PLAYLIST_DEBUG - /***************************************************************************** * Local prototypes *****************************************************************************/ @@ -192,9 +190,7 @@ void playlist_MainLoop( playlist_t *p_playlist ) /* 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 ) { diff --git a/src/playlist/item.c b/src/playlist/item.c index 1285fe074c..4514c6bb97 100644 --- a/src/playlist/item.c +++ b/src/playlist/item.c @@ -93,91 +93,6 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj, 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 ***************************************************************************/ diff --git a/src/playlist/search.c b/src/playlist/search.c index 10a8b706a3..41d2d26515 100644 --- a/src/playlist/search.c +++ b/src/playlist/search.c @@ -75,7 +75,6 @@ playlist_item_t * playlist_ItemGetByInput( playlist_t * p_playlist , 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]; @@ -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 && \ 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; diff --git a/src/playlist/tree.c b/src/playlist/tree.c index a205fba299..120ef09986 100644 --- a/src/playlist/tree.c +++ b/src/playlist/tree.c @@ -25,8 +25,6 @@ #include #include "vlc_playlist.h" -#define PLAYLIST_DEBUG 1 - /************************************************************************ * Local prototypes ************************************************************************/ @@ -486,17 +484,14 @@ playlist_item_t *GetNextItem( playlist_t *p_playlist, 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 ); } @@ -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] ) { -#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; } @@ -627,11 +619,9 @@ playlist_item_t *GetPrevItem( playlist_t *p_playlist, 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