[vlc-commits] playlist: pass playlist item as "playlist-item-deleted" 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> | Wed Nov 16 00:06:02 2016 +0200| [705dc653f5690e4b7c3420abf08b8c98405cd2cd] | committer: Rémi Denis-Courmont
playlist: pass playlist item as "playlist-item-deleted" value
This makes deletion and appending somewhat more consistent.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=705dc653f5690e4b7c3420abf08b8c98405cd2cd
---
include/vlc_playlist.h | 4 ++--
modules/gui/macosx/VLCPLModel.m | 3 ++-
modules/gui/qt/input_manager.cpp | 3 ++-
modules/gui/skins2/src/vlcproc.cpp | 4 ++--
src/playlist/engine.c | 4 +---
src/playlist/tree.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 9903e69..0c583ff 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -106,8 +106,8 @@ struct intf_thread_t;
* item being played.
*
* - "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.
+ * - "playlist-item-deleted": It will contain a pointer to the playlist_item_t
+ * about to be deleted.
*
* - "leaf-to-parent": It will contain the playlist_item_t->i_id of an item that is transformed
* into a node.
diff --git a/modules/gui/macosx/VLCPLModel.m b/modules/gui/macosx/VLCPLModel.m
index 7ba6bfd..f6d64ee 100644
--- a/modules/gui/macosx/VLCPLModel.m
+++ b/modules/gui/macosx/VLCPLModel.m
@@ -71,7 +71,8 @@ static int VLCPLItemRemoved(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param)
{
@autoreleasepool {
- NSNumber *o_val = [NSNumber numberWithInt:new_val.i_int];
+ playlist_item_t *p_item = new_val.p_address;
+ NSNumber *o_val = [NSNumber numberWithInt:p_item->i_id];
VLCPLModel *model = (__bridge VLCPLModel*)param;
[model performSelectorOnMainThread:@selector(VLCPLItemRemoved:) withObject:o_val waitUntilDone:NO];
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index b4dffbb..0f01f95 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -1248,8 +1248,9 @@ int MainInputManager::PLItemRemoved( vlc_object_t *obj, const char *,
{
playlist_t *pl = (playlist_t *) obj;
MainInputManager *mim = static_cast<MainInputManager*>(data);
+ playlist_item_t *item = static_cast<playlist_item_t *>( cur.p_address );
- PLEvent *event = new PLEvent( PLEvent::PLItemRemoved, cur.i_int, 0 );
+ PLEvent *event = new PLEvent( PLEvent::PLItemRemoved, item->i_id, 0 );
QApplication::postEvent( mim, event );
// can't use playlist_IsEmpty( ) as it isn't true yet
if ( pl->items.i_size == 1 ) // lock is held
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 167c1aa..6ead14c 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -282,9 +282,9 @@ int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
(void)pObj; (void)pVariable; (void)oldVal;
VlcProc *pThis = (VlcProc*)pParam;
- int i_id = newVal.i_int;
+ playlist_item_t *item = static_cast<playlist_item_t *>(newVal.p_address);
CmdPlaytreeDelete *pCmdTree =
- new CmdPlaytreeDelete( pThis->getIntf(), i_id);
+ new CmdPlaytreeDelete( pThis->getIntf(), item->i_id);
// Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 80b6521..cb49472 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -420,10 +420,8 @@ static void VariablesInit( playlist_t *p_playlist )
var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS );
var_Create( p_playlist, "leaf-to-parent", VLC_VAR_INTEGER );
- var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER );
- var_SetInteger( p_playlist, "playlist-item-deleted", -1 );
-
var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS );
+ var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_ADDRESS );
var_Create( p_playlist, "input-current", VLC_VAR_ADDRESS );
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 74a8eb8..8f9d167 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -148,7 +148,7 @@ void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
pl_priv(p_playlist)->b_reset_currently_playing = true;
int i;
- var_SetInteger( p_playlist, "playlist-item-deleted", p_root->i_id );
+ var_SetAddress( p_playlist, "playlist-item-deleted", p_root );
ARRAY_BSEARCH( pl_priv(p_playlist)->all_items, ->i_id, int, p_root->i_id, i );
if( i != -1 )
ARRAY_REMOVE( pl_priv(p_playlist)->all_items, i );
More information about the vlc-commits
mailing list