vlc_value_t oldval, vlc_value_t newval, void *param )
{
InputManager *im = (InputManager*)param;
+ input_item_t *p_item = static_cast<input_item_t *>(newval.p_address);
- IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
+ IMEvent *event = new IMEvent( ItemChanged_Type, p_item->i_id );
QApplication::postEvent( im, event );
return VLC_SUCCESS;
}
im, setInput( input_thread_t * ) );
/* emit check if playlist has already started playing */
- IMEvent *event = new IMEvent( ItemChanged_Type,
- var_GetInteger( THEPL, "item-current" ) );
- customEvent( event );
- delete event;
+ input_thread_t *p_input = playlist_CurrentInput( THEPL );
+ if( p_input )
+ {
+ input_item_t *p_item = input_GetItem( p_input );
+ if( p_item )
+ {
+ IMEvent *event = new IMEvent( ItemChanged_Type, p_item->i_id );
+ customEvent( event );
+ delete event;
+ }
+ vlc_object_release( p_input );
+ }
}
MainInputManager::~MainInputManager()
/* Static callbacks for MIM */
static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *param )
+ vlc_value_t oldval, vlc_value_t, void *param )
{
MainInputManager *mim = (MainInputManager*)param;
- IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
+ IMEvent *event = new IMEvent( ItemChanged_Type, 0 );
QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}
void *pParam )
{
VlcProc *pThis = (VlcProc*)pParam;
+ input_item_t *p_item = newval.p_address;
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pThis->updateStreamName();
// Create two playtree notify commands: one for old item, one for new
+#if 0 /* FIXME: Heck, no! You cannot do that.
+ There is no warranty that the old item is still valid. */
CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
oldVal.i_int );
pQueue->push( CmdGenericPtr( pCmdTree ) , true );
- pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
+#endif
+ pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), p_item->i_id );
pQueue->push( CmdGenericPtr( pCmdTree ) , true );
return VLC_SUCCESS;
static int vlclua_playlist_current( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- lua_pushinteger( L, var_GetInteger( p_playlist, "item-current" ) );
+ input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+ int id = -1;
+
+ if( p_input )
+ {
+ input_item_t *p_item = input_GetItem( p_input );
+ if( p_item )
+ id = p_item->i_id;
+ vlc_object_release( p_input );
+ }
+
+#warning Indexing input items by ID is unsafe,
+ lua_pushinteger( L, id );
vlclua_release_playlist_internal( p_playlist );
return 1;
}
playlist_t* p_playlist = (playlist_t*) p_this;
char *psz_buf = NULL;
input_thread_t *p_input;
+ input_item_t *p_item = newval.p_address;
bool b_is_item_current = !strcmp( "item-current", psz_var );
/* Don't update Telepathy presence each time an item has been preparsed */
if( b_is_item_current )
{ /* stores the current input item id */
- p_intf->p_sys->i_id = newval.i_int;
+ p_intf->p_sys->i_id = p_item->i_id;
p_intf->p_sys->i_item_changes = 0;
}
else
{
- input_item_t *p_item = newval.p_address;
if( p_item->i_id != p_intf->p_sys->i_id ) /* "item-change" */
return VLC_SUCCESS;
var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS );
- var_Create( p_playlist, "item-current", VLC_VAR_INTEGER );
- var_SetInteger( p_playlist, "item-current", -1 );
+ var_Create( p_playlist, "item-current", VLC_VAR_ADDRESS );
var_Create( p_playlist, "activity", VLC_VAR_INTEGER );
var_SetInteger( p_playlist, "activity", 0 );
}
PL_UNLOCK;
- var_SetInteger( p_playlist, "item-current", p_input->i_id );
+ var_SetAddress( p_playlist, "item-current", p_input );
PL_LOCK;
return VLC_SUCCESS;