Commit 428762fb authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix proccessing item-change at playlist level

it is needed to pass from input_item_t to playlist_item_t
 for this variable only (others directly provide playlist_item_t)
parent 61642608
...@@ -35,14 +35,24 @@ void CmdPlaytreeChanged::execute() ...@@ -35,14 +35,24 @@ void CmdPlaytreeChanged::execute()
void CmdPlaytreeUpdate::execute() void CmdPlaytreeUpdate::execute()
{ {
VlcProc::instance( getIntf() )->getPlaytreeVar().onUpdateItem( m_id ); if( !m_pItem )
return;
playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
playlist_Lock( pPlaylist );
playlist_item_t* p_plItem = playlist_ItemGetByInput( pPlaylist, m_pItem );
int id = p_plItem ? p_plItem->i_id : 0;
playlist_Unlock( pPlaylist );
if( id )
VlcProc::instance( getIntf() )->getPlaytreeVar().onUpdateItem( id );
} }
bool CmdPlaytreeUpdate::checkRemove( CmdGeneric *pQueuedCommand ) const bool CmdPlaytreeUpdate::checkRemove( CmdGeneric *pQueuedCommand ) const
{ {
// We don't use RTTI - Use C-style cast // We don't use RTTI - Use C-style cast
CmdPlaytreeUpdate *pUpdateCommand = (CmdPlaytreeUpdate *)(pQueuedCommand); CmdPlaytreeUpdate *pUpdateCommand = (CmdPlaytreeUpdate *)(pQueuedCommand);
return m_id == pUpdateCommand->m_id; return m_pItem == pUpdateCommand->m_pItem;
} }
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#ifndef CMD_VARS_HPP #ifndef CMD_VARS_HPP
#define CMD_VARS_HPP #define CMD_VARS_HPP
#include <vlc_common.h>
#include <vlc_playlist.h>
#include "cmd_generic.hpp" #include "cmd_generic.hpp"
#include "../utils/ustring.hpp" #include "../utils/ustring.hpp"
...@@ -41,9 +44,17 @@ DEFINE_COMMAND( PlaytreeChanged, "playtree changed" ) ...@@ -41,9 +44,17 @@ DEFINE_COMMAND( PlaytreeChanged, "playtree changed" )
class CmdPlaytreeUpdate: public CmdGeneric class CmdPlaytreeUpdate: public CmdGeneric
{ {
public: public:
CmdPlaytreeUpdate( intf_thread_t *pIntf, int id ): CmdPlaytreeUpdate( intf_thread_t *pIntf, input_item_t* pItem ):
CmdGeneric( pIntf ), m_id( id ) { } CmdGeneric( pIntf ), m_pItem( pItem )
virtual ~CmdPlaytreeUpdate() { } {
if( pItem )
vlc_gc_incref( pItem );
}
virtual ~CmdPlaytreeUpdate()
{
if( m_pItem )
vlc_gc_decref( m_pItem );
}
virtual void execute(); virtual void execute();
virtual string getType() const { return "playtree update"; } virtual string getType() const { return "playtree update"; }
...@@ -51,8 +62,8 @@ public: ...@@ -51,8 +62,8 @@ public:
virtual bool checkRemove( CmdGeneric * ) const; virtual bool checkRemove( CmdGeneric * ) const;
private: private:
/// Playlist item ID /// input item changed
int m_id; input_item_t* m_pItem;
}; };
/// Command to notify the playtree of an item append /// Command to notify the playtree of an item append
......
...@@ -267,24 +267,17 @@ int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable, ...@@ -267,24 +267,17 @@ int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldval, vlc_value_t newval, vlc_value_t oldval, vlc_value_t newval,
void *pParam ) void *pParam )
{ {
// TODO: FIXME
// Deactivated because it mixes up i_id from input_item_t
// and i_id from playlist_item_t
#if 0
VlcProc *pThis = (VlcProc*)pParam; VlcProc *pThis = (VlcProc*)pParam;
input_item_t *p_item = static_cast<input_item_t*>(newval.p_address); input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
// Create a playtree notify command // Create a playtree notify command
CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
p_item->i_id ); p_item );
// Push the command in the asynchronous command queue // Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() ); AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmdTree ), true ); pQueue->push( CmdGenericPtr( pCmdTree ), true );
#endif
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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