[vlc-commits] playlist: pass playlist item as "playlist-item-append" value
Rémi Denis-Courmont
git at videolan.org
Tue Nov 15 23:09:58 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 15 23:59:53 2016 +0200| [9bd12356d588d49801b94be1d211399758d0764a] | committer: Rémi Denis-Courmont
playlist: pass playlist item as "playlist-item-append" value
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bd12356d588d49801b94be1d211399758d0764a
---
extras/analyser/vlc.vim | 1 -
include/vlc_common.h | 1 -
include/vlc_playlist.h | 9 +--------
modules/gui/macosx/VLCPLModel.m | 6 ++++--
modules/gui/qt/input_manager.cpp | 8 +++++---
modules/gui/skins2/src/vlcproc.cpp | 4 ++--
src/playlist/item.c | 12 ++++--------
src/playlist/playlist_internal.h | 4 ++--
src/playlist/tree.c | 3 +--
9 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/extras/analyser/vlc.vim b/extras/analyser/vlc.vim
index 6e78a50..63be712 100644
--- a/extras/analyser/vlc.vim
+++ b/extras/analyser/vlc.vim
@@ -35,7 +35,6 @@ function VlcSyntax()
" Playlist
syn keyword cType playlist_t playlist_item_t
syn keyword cType services_discovery_t services_discovery_sys_t
- syn keyword cType playlist_add_t playlist_preparse_t
syn keyword cType item_info_t item_info_category_t
syn keyword cType sout_format_t playlist_export_t playlist_import_t
" Intf
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 0b1db73..8b4f5a4 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -207,7 +207,6 @@ typedef struct playlist_t playlist_t;
typedef struct playlist_item_t playlist_item_t;
typedef struct services_discovery_t services_discovery_t;
typedef struct services_discovery_sys_t services_discovery_sys_t;
-typedef struct playlist_add_t playlist_add_t;
typedef struct vlc_renderer_discovery_t vlc_renderer_discovery_t;
typedef struct vlc_renderer_item_t vlc_renderer_item_t;
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index ed88bb3..9903e69 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -105,7 +105,7 @@ struct intf_thread_t;
* item monitored by the playlist.
* item being played.
*
- * - "playlist-item-append": It will contain a pointer to a playlist_add_t.
+ * - "playlist-item-append": It will contain a pointer to a playlist_item_t.
* - "playlist-item-deleted": It will contain the playlist_item_t->i_id of a
* deleted playlist_item_t.
*
@@ -173,13 +173,6 @@ struct playlist_t
playlist_item_t * p_media_library;
};
-/** Helper to add an item */
-struct playlist_add_t
-{
- int i_node; /**< Playist id of the parent node */
- int i_item; /**< Playist id of the playlist_item_t */
-};
-
/* A bit of macro magic to generate an enum out of the following list,
* and later, to generate a list of static functions out of the same list.
* There is also SORT_RANDOM, which is always last and handled specially.
diff --git a/modules/gui/macosx/VLCPLModel.m b/modules/gui/macosx/VLCPLModel.m
index 7ccf308..7ba6bfd 100644
--- a/modules/gui/macosx/VLCPLModel.m
+++ b/modules/gui/macosx/VLCPLModel.m
@@ -1,4 +1,5 @@
/*****************************************************************************
+>>>>>>> Stashed changes
* VLCPLItem.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2014 VLC authors and VideoLAN
@@ -56,8 +57,9 @@ static int VLCPLItemAppended(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param)
{
@autoreleasepool {
- playlist_add_t *p_add = new_val.p_address;
- NSArray *o_val = [NSArray arrayWithObjects:[NSNumber numberWithInt:p_add->i_node], [NSNumber numberWithInt:p_add->i_item], nil];
+ playlist_item_t *p_item = new_val.p_address;
+ int i_node = p_item->p_parent ? p_item->p_parent->i_id : -1;
+ NSArray *o_val = [NSArray arrayWithObjects:[NSNumber numberWithInt:i_node], [NSNumber numberWithInt:p_item->i_id], nil];
VLCPLModel *model = (__bridge VLCPLModel*)param;
[model performSelectorOnMainThread:@selector(VLCPLItemAppended:) withObject:o_val waitUntilDone:NO];
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 82082c1..b4dffbb 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -1232,11 +1232,13 @@ int MainInputManager::PLItemAppended( vlc_object_t *, const char *,
void *data )
{
MainInputManager *mim = static_cast<MainInputManager*>(data);
- playlist_add_t *p_add = static_cast<playlist_add_t*>( cur.p_address );
+ playlist_item_t *item = static_cast<playlist_item_t *>( cur.p_address );
- PLEvent *event = new PLEvent( PLEvent::PLItemAppended, p_add->i_item, p_add->i_node );
+ PLEvent *event = new PLEvent( PLEvent::PLItemAppended, item->i_id,
+ (item->p_parent != NULL) ? item->p_parent->i_id : -1 );
QApplication::postEvent( mim, event );
- event = new PLEvent( PLEvent::PLEmpty, p_add->i_item, 0 );
+
+ event = new PLEvent( PLEvent::PLEmpty, item->i_id, 0 );
QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 21b37f2..167c1aa 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -264,9 +264,9 @@ int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
(void)pObj; (void)pVariable; (void)oldVal;
VlcProc *pThis = (VlcProc*)pParam;
- playlist_add_t *p_add = static_cast<playlist_add_t*>(newVal.p_address);
+ playlist_item_t *item = static_cast<playlist_item_t *>(newVal.p_address);
CmdPlaytreeAppend *pCmdTree =
- new CmdPlaytreeAppend( pThis->getIntf(), p_add->i_item );
+ new CmdPlaytreeAppend( pThis->getIntf(), item->i_id );
// Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
diff --git a/src/playlist/item.c b/src/playlist/item.c
index cef6d86..cb02815 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -739,8 +739,8 @@ int playlist_TreeMoveMany( playlist_t *p_playlist,
* \param b_signal TRUE if the function must send a signal
* \return nothing
*/
-void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
- int i_node_id, bool b_signal )
+void playlist_SendAddNotify( playlist_t *p_playlist, playlist_item_t *item,
+ bool b_signal )
{
playlist_private_t *p_sys = pl_priv(p_playlist);
PL_ASSERT_LOCKED;
@@ -749,11 +749,7 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
if( b_signal )
vlc_cond_signal( &p_sys->signal );
- playlist_add_t add;
- add.i_item = i_item_id;
- add.i_node = i_node_id;
-
- var_SetAddress( p_playlist, "playlist-item-append", &add );
+ var_SetAddress( p_playlist, "playlist-item-append", item );
}
/**
@@ -823,7 +819,7 @@ static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );
- playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id,
+ playlist_SendAddNotify( p_playlist, p_item,
!( i_mode & PLAYLIST_NO_REBUILD ) );
}
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 0861330..837915f 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -117,8 +117,8 @@ int playlist_MLDump( playlist_t *p_playlist );
* Item management
**********************************************************************/
-void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
- int i_node_id, bool b_signal );
+void playlist_SendAddNotify( playlist_t *p_playlist, playlist_item_t *item,
+ bool b_signal );
playlist_item_t * playlist_NodeAddInput( playlist_t *, input_item_t *,
playlist_item_t *,int , int, bool );
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 45c45b7..74a8eb8 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -81,8 +81,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
if( p_parent != NULL )
playlist_NodeInsert( p_playlist, p_item, p_parent, i_pos );
- playlist_SendAddNotify( p_playlist, p_item->i_id,
- p_parent ? p_parent->i_id : -1,
+ playlist_SendAddNotify( p_playlist, p_item,
!( i_flags & PLAYLIST_NO_REBUILD ));
p_item->i_flags |= i_flags;
More information about the vlc-commits
mailing list