Commit 9bd12356 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: pass playlist item as "playlist-item-append" value

parent 88ca3f38
......@@ -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
......
......@@ -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;
......
......@@ -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.
......
/*****************************************************************************
>>>>>>> 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];
......
......@@ -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;
}
......
......@@ -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() );
......
......@@ -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 ) );
}
......
......@@ -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 );
......
......@@ -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;
......
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