Commit 10b1ba7f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: pass input items rather than ID through IMevent

parent 279777bf
...@@ -170,14 +170,14 @@ void InputManager::customEvent( QEvent *event ) ...@@ -170,14 +170,14 @@ void InputManager::customEvent( QEvent *event )
break; break;
case ItemChanged_Type: case ItemChanged_Type:
/* Ignore ItemChanged_Type event that does not apply to our input */ /* Ignore ItemChanged_Type event that does not apply to our input */
if( p_item->i_id == ple->i_id ) if( p_item == ple->p_item )
{ {
UpdateStatus(); UpdateStatus();
// UpdateName(); // UpdateName();
UpdateArt(); UpdateArt();
/* Update duration of file */ /* Update duration of file */
} }
UpdateMeta( ple->i_id ); UpdateMeta( ple->p_item->i_id );
break; break;
case ItemStateChanged_Type: case ItemStateChanged_Type:
// TODO: Fusion with above state // TODO: Fusion with above state
...@@ -257,7 +257,7 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -257,7 +257,7 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
InputManager *im = (InputManager*)param; InputManager *im = (InputManager*)param;
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);
IMEvent *event = new IMEvent( ItemChanged_Type, p_item->i_id ); IMEvent *event = new IMEvent( ItemChanged_Type, p_item );
QApplication::postEvent( im, event ); QApplication::postEvent( im, event );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -271,74 +271,74 @@ static int InputEvent( vlc_object_t *p_this, const char *, ...@@ -271,74 +271,74 @@ static int InputEvent( vlc_object_t *p_this, const char *,
switch( newval.i_int ) switch( newval.i_int )
{ {
case INPUT_EVENT_STATE: case INPUT_EVENT_STATE:
event = new IMEvent( ItemStateChanged_Type, 0 ); event = new IMEvent( ItemStateChanged_Type );
break; break;
case INPUT_EVENT_RATE: case INPUT_EVENT_RATE:
event = new IMEvent( ItemRateChanged_Type, 0 ); event = new IMEvent( ItemRateChanged_Type );
break; break;
case INPUT_EVENT_POSITION: case INPUT_EVENT_POSITION:
//case INPUT_EVENT_LENGTH: //case INPUT_EVENT_LENGTH:
event = new IMEvent( PositionUpdate_Type, 0 ); event = new IMEvent( PositionUpdate_Type );
break; break;
case INPUT_EVENT_TITLE: case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER: case INPUT_EVENT_CHAPTER:
event = new IMEvent( ItemTitleChanged_Type, 0 ); event = new IMEvent( ItemTitleChanged_Type );
break; break;
case INPUT_EVENT_ES: case INPUT_EVENT_ES:
event = new IMEvent( ItemEsChanged_Type, 0 ); event = new IMEvent( ItemEsChanged_Type );
break; break;
case INPUT_EVENT_TELETEXT: case INPUT_EVENT_TELETEXT:
event = new IMEvent( ItemTeletextChanged_Type, 0 ); event = new IMEvent( ItemTeletextChanged_Type );
break; break;
case INPUT_EVENT_STATISTICS: case INPUT_EVENT_STATISTICS:
event = new IMEvent( StatisticsUpdate_Type, 0 ); event = new IMEvent( StatisticsUpdate_Type );
break; break;
case INPUT_EVENT_VOUT: case INPUT_EVENT_VOUT:
event = new IMEvent( InterfaceVoutUpdate_Type, 0 ); event = new IMEvent( InterfaceVoutUpdate_Type );
break; break;
case INPUT_EVENT_AOUT: case INPUT_EVENT_AOUT:
event = new IMEvent( InterfaceAoutUpdate_Type, 0 ); event = new IMEvent( InterfaceAoutUpdate_Type );
break; break;
case INPUT_EVENT_ITEM_META: /* Codec MetaData + Art */ case INPUT_EVENT_ITEM_META: /* Codec MetaData + Art */
event = new IMEvent( MetaChanged_Type, 0 ); event = new IMEvent( MetaChanged_Type );
break; break;
case INPUT_EVENT_ITEM_INFO: /* Codec Info */ case INPUT_EVENT_ITEM_INFO: /* Codec Info */
event = new IMEvent( InfoChanged_Type, 0 ); event = new IMEvent( InfoChanged_Type );
break; break;
case INPUT_EVENT_ITEM_NAME: case INPUT_EVENT_ITEM_NAME:
event = new IMEvent( NameChanged_Type, 0 ); event = new IMEvent( NameChanged_Type );
break; break;
case INPUT_EVENT_AUDIO_DELAY: case INPUT_EVENT_AUDIO_DELAY:
case INPUT_EVENT_SUBTITLE_DELAY: case INPUT_EVENT_SUBTITLE_DELAY:
event = new IMEvent( SynchroChanged_Type, 0 ); event = new IMEvent( SynchroChanged_Type );
break; break;
case INPUT_EVENT_CACHE: case INPUT_EVENT_CACHE:
event = new IMEvent( CachingEvent_Type, 0 ); event = new IMEvent( CachingEvent_Type );
break; break;
case INPUT_EVENT_BOOKMARK: case INPUT_EVENT_BOOKMARK:
event = new IMEvent( BookmarksChanged_Type, 0 ); event = new IMEvent( BookmarksChanged_Type );
break; break;
case INPUT_EVENT_RECORD: case INPUT_EVENT_RECORD:
event = new IMEvent( RecordingEvent_Type, 0 ); event = new IMEvent( RecordingEvent_Type );
break; break;
case INPUT_EVENT_PROGRAM: case INPUT_EVENT_PROGRAM:
/* This is for PID changes */ /* This is for PID changes */
event = new IMEvent( ProgramChanged_Type, 0 ); event = new IMEvent( ProgramChanged_Type );
break; break;
case INPUT_EVENT_SIGNAL: case INPUT_EVENT_SIGNAL:
/* This is for capture-card signals */ /* This is for capture-card signals */
/* event = new IMEvent( SignalChanged_Type, 0 ); /* event = new IMEvent( SignalChanged_Type );
break; */ break; */
default: default:
event = NULL; event = NULL;
...@@ -354,7 +354,7 @@ static int VbiEvent( vlc_object_t *, const char *, ...@@ -354,7 +354,7 @@ static int VbiEvent( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void *param ) vlc_value_t, vlc_value_t, void *param )
{ {
InputManager *im = (InputManager*)param; InputManager *im = (InputManager*)param;
IMEvent *event = new IMEvent( ItemTeletextChanged_Type, 0 ); IMEvent *event = new IMEvent( ItemTeletextChanged_Type );
QApplication::postEvent( im, event ); QApplication::postEvent( im, event );
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -891,7 +891,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -891,7 +891,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
input_item_t *p_item = input_GetItem( p_input ); input_item_t *p_item = input_GetItem( p_input );
if( p_item ) if( p_item )
{ {
IMEvent *event = new IMEvent( ItemChanged_Type, p_item->i_id ); IMEvent *event = new IMEvent( ItemChanged_Type, p_item );
customEvent( event ); customEvent( event );
delete event; delete event;
} }
...@@ -1016,7 +1016,7 @@ static int PLItemChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -1016,7 +1016,7 @@ static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
{ {
MainInputManager *mim = (MainInputManager*)param; MainInputManager *mim = (MainInputManager*)param;
IMEvent *event = new IMEvent( ItemChanged_Type, 0 ); IMEvent *event = new IMEvent( ItemChanged_Type );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1026,7 +1026,7 @@ static int VolumeChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -1026,7 +1026,7 @@ static int VolumeChanged( vlc_object_t *p_this, const char *psz_var,
{ {
MainInputManager *mim = (MainInputManager*)param; MainInputManager *mim = (MainInputManager*)param;
IMEvent *event = new IMEvent( VolumeChanged_Type, newval.i_int ); IMEvent *event = new IMEvent( VolumeChanged_Type );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -71,12 +71,20 @@ class IMEvent : public QEvent ...@@ -71,12 +71,20 @@ class IMEvent : public QEvent
{ {
friend class InputManager; friend class InputManager;
public: public:
IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) ) IMEvent( int type, input_item_t *p_input = NULL )
{ i_id = id ; } : QEvent( (QEvent::Type)(type) )
virtual ~IMEvent() {} {
if( (p_item = p_input) != NULL )
vlc_gc_incref( p_item );
}
virtual ~IMEvent()
{
if( p_item )
vlc_gc_decref( p_item );
}
private: private:
int i_id; input_item_t *p_item;
}; };
class InputManager : public QObject class InputManager : public QObject
......
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