Commit 8689e8be authored by Ilkka Ollakka's avatar Ilkka Ollakka

stats-change variable for statistics/removing stats timer from qt4 interface

- Add stats-change variable for input to inform when statistics are computed
- Use that variable in qt4 interface to update statistics so no need to loop
  with timer ( ticket #1365)
parent 77a5fef9
...@@ -546,6 +546,8 @@ InputStatsPanel::InputStatsPanel( QWidget *parent, ...@@ -546,6 +546,8 @@ InputStatsPanel::InputStatsPanel( QWidget *parent,
StatsTree->setColumnWidth( 1 , 200 ); StatsTree->setColumnWidth( 1 , 200 );
layout->addWidget(StatsTree, 1, 0 ); layout->addWidget(StatsTree, 1, 0 );
CONNECT( THEMIM->getIM() , statisticsUpdated( input_item_t* ),
this, update( input_item_t* ) );
} }
InputStatsPanel::~InputStatsPanel() InputStatsPanel::~InputStatsPanel()
......
...@@ -162,9 +162,9 @@ void MediaInfoDialog::update( input_thread_t *p_input ) ...@@ -162,9 +162,9 @@ void MediaInfoDialog::update( input_thread_t *p_input )
void MediaInfoDialog::updateOnTimeOut() void MediaInfoDialog::updateOnTimeOut()
{ {
/* Timer runs at 150 ms, dont' update more than 2 times per second */ /* Timer runs at 150 ms, dont' update more than 2 times per second
i_runs++; i_runs++;
if( i_runs % 4 != 0 ) return; if( i_runs % 4 != 0 ) return;*/
/* Get Input and clear if non-existant */ /* Get Input and clear if non-existant */
input_thread_t *p_input = THEMIM->getInput(); input_thread_t *p_input = THEMIM->getInput();
......
...@@ -42,6 +42,8 @@ static int PLItemChanged( vlc_object_t *, const char *, ...@@ -42,6 +42,8 @@ static int PLItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int InterfaceChanged( vlc_object_t *, const char *, static int InterfaceChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int StatisticsUpdated( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int InterfaceVoutChanged( vlc_object_t *, const char *, static int InterfaceVoutChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int ItemStateChanged( vlc_object_t *, const char *, static int ItemStateChanged( vlc_object_t *, const char *,
...@@ -158,6 +160,8 @@ void InputManager::addCallbacks() ...@@ -158,6 +160,8 @@ void InputManager::addCallbacks()
var_AddCallback( p_input, "title", ItemTitleChanged, this ); var_AddCallback( p_input, "title", ItemTitleChanged, this );
/* src/input/input.c:734 for timers update*/ /* src/input/input.c:734 for timers update*/
var_AddCallback( p_input, "intf-change", InterfaceChanged, this ); var_AddCallback( p_input, "intf-change", InterfaceChanged, this );
/* src/input/input.c:710 for statistics update*/
var_AddCallback( p_input, "stats-change", StatisticsUpdated, this );
/* src/input/input.c for vout creation/destruction */ /* src/input/input.c for vout creation/destruction */
var_AddCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this ); var_AddCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this );
} }
...@@ -172,6 +176,7 @@ void InputManager::delCallbacks() ...@@ -172,6 +176,7 @@ void InputManager::delCallbacks()
var_DelCallback( p_input, "rate-change", ItemRateChanged, this ); var_DelCallback( p_input, "rate-change", ItemRateChanged, this );
var_DelCallback( p_input, "title", ItemTitleChanged, this ); var_DelCallback( p_input, "title", ItemTitleChanged, this );
var_DelCallback( p_input, "intf-change", InterfaceChanged, this ); var_DelCallback( p_input, "intf-change", InterfaceChanged, this );
var_DelCallback( p_input, "stats-change", StatisticsUpdated, this );
var_DelCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this ); var_DelCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this );
} }
...@@ -188,6 +193,7 @@ void InputManager::customEvent( QEvent *event ) ...@@ -188,6 +193,7 @@ void InputManager::customEvent( QEvent *event )
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type && type != ItemStateChanged_Type &&
type != StatisticsUpdate_Type &&
type != InterfaceVoutUpdate_Type ) type != InterfaceVoutUpdate_Type )
return; return;
...@@ -204,12 +210,14 @@ void InputManager::customEvent( QEvent *event ) ...@@ -204,12 +210,14 @@ void InputManager::customEvent( QEvent *event )
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type && type != ItemStateChanged_Type &&
type != StatisticsUpdate_Type &&
type != InterfaceVoutUpdate_Type type != InterfaceVoutUpdate_Type
) )
&& ( i_input_id != ple->i_id ) ) && ( i_input_id != ple->i_id ) )
return; return;
if( type != PositionUpdate_Type ) if( type != PositionUpdate_Type &&
type != StatisticsUpdate_Type )
msg_Dbg( p_intf, "New Event: type %i", type ); msg_Dbg( p_intf, "New Event: type %i", type );
/* Actions */ /* Actions */
...@@ -218,6 +226,9 @@ void InputManager::customEvent( QEvent *event ) ...@@ -218,6 +226,9 @@ void InputManager::customEvent( QEvent *event )
case PositionUpdate_Type: case PositionUpdate_Type:
UpdatePosition(); UpdatePosition();
break; break;
case StatisticsUpdate_Type:
UpdateStats();
break;
case ItemChanged_Type: case ItemChanged_Type:
UpdateMeta(); UpdateMeta();
UpdateStatus(); UpdateStatus();
...@@ -247,6 +258,11 @@ void InputManager::customEvent( QEvent *event ) ...@@ -247,6 +258,11 @@ void InputManager::customEvent( QEvent *event )
} }
} }
void InputManager::UpdateStats()
{
emit statisticsUpdated( input_GetItem( p_input ) );
}
void InputManager::UpdatePosition() void InputManager::UpdatePosition()
{ {
/* Update position */ /* Update position */
...@@ -726,6 +742,16 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -726,6 +742,16 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int StatisticsUpdated( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
InputManager *im = (InputManager*)param;
IMEvent *event = new IMEvent( StatisticsUpdate_Type, 0 );
QApplication::postEvent( im, static_cast<QEvent*>(event) );
return VLC_SUCCESS;
}
static int InterfaceVoutChanged( vlc_object_t *p_this, const char *psz_var, static int InterfaceVoutChanged( 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 newval, void *param )
{ {
......
...@@ -45,11 +45,12 @@ static int const VolumeChanged_Type = QEvent::User + IMEventType + 6; ...@@ -45,11 +45,12 @@ static int const VolumeChanged_Type = QEvent::User + IMEventType + 6;
static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7; static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7;
static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8; static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8;
static int const InterfaceVoutUpdate_Type= QEvent::User + IMEventType + 9; static int const InterfaceVoutUpdate_Type= QEvent::User + IMEventType + 9;
static int const StatisticsUpdate_Type = QEvent::User + IMEventType + 10;
static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 10; static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 11;
static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 11; static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 12;
static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 12; static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 13;
static int const FullscreenControlPlanHide_Type = QEvent::User + IMEventType + 13; static int const FullscreenControlPlanHide_Type = QEvent::User + IMEventType + 14;
class IMEvent : public QEvent class IMEvent : public QEvent
{ {
...@@ -98,6 +99,7 @@ private: ...@@ -98,6 +99,7 @@ private:
void UpdateTeletext(); void UpdateTeletext();
void UpdateArt(); void UpdateArt();
void UpdateVout(); void UpdateVout();
void UpdateStats();
public slots: public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed void setInput( input_thread_t * ); ///< Our controlled input changed
...@@ -122,6 +124,8 @@ signals: ...@@ -122,6 +124,8 @@ signals:
void nameChanged( QString ); void nameChanged( QString );
/// Used to signal whether we should show navigation buttons /// Used to signal whether we should show navigation buttons
void navigationChanged( int ); void navigationChanged( int );
/// Statistics are updated
void statisticsUpdated( input_item_t* );
/// Play/pause status /// Play/pause status
void statusChanged( int ); void statusChanged( int );
void artChanged( input_item_t* ); void artChanged( input_item_t* );
......
...@@ -2261,6 +2261,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -2261,6 +2261,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
EnablePixelDoubling( p_vout ); EnablePixelDoubling( p_vout );
#endif #endif
#if 0
/* Activate the window (give it the focus) */ /* Activate the window (give it the focus) */
XClientMessageEvent event; XClientMessageEvent event;
...@@ -2282,6 +2283,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -2282,6 +2283,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
DefaultRootWindow( p_vout->p_sys->p_display ), DefaultRootWindow( p_vout->p_sys->p_display ),
False, SubstructureRedirectMask, False, SubstructureRedirectMask,
(XEvent*)&event ); (XEvent*)&event );
#endif
} }
else else
{ {
...@@ -2307,6 +2309,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -2307,6 +2309,7 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
* window has already been mapped because the XMapWindow() request * window has already been mapped because the XMapWindow() request
* has not necessarily been sent directly to our window (remember, * has not necessarily been sent directly to our window (remember,
* the call is first redirected to the window manager) */ * the call is first redirected to the window manager) */
#if 0
do do
{ {
XWindowEvent( p_vout->p_sys->p_display, XWindowEvent( p_vout->p_sys->p_display,
...@@ -2320,6 +2323,9 @@ static void ToggleFullScreen ( vout_thread_t *p_vout ) ...@@ -2320,6 +2323,9 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
p_vout->p_sys->p_win->base_window, p_vout->p_sys->p_win->base_window,
RevertToParent, RevertToParent,
CurrentTime); CurrentTime);
#else
XSync( p_vout->p_sys->p_display, False );
#endif
/* signal that the size needs to be updated */ /* signal that the size needs to be updated */
p_vout->i_changes |= VOUT_SIZE_CHANGE; p_vout->i_changes |= VOUT_SIZE_CHANGE;
......
...@@ -123,6 +123,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for ...@@ -123,6 +123,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
* - intf-change * - intf-change
* - intf-change-vout for when a vout is created or destroyed * - intf-change-vout for when a vout is created or destroyed
* - rate-change for when playback rate changes * - rate-change for when playback rate changes
* - stats-change for when statistics are updated
* TODO explain when Callback is called * TODO explain when Callback is called
* TODO complete this list (?) * TODO complete this list (?)
*****************************************************************************/ *****************************************************************************/
...@@ -706,6 +707,7 @@ static void MainLoopStatistic( input_thread_t *p_input ) ...@@ -706,6 +707,7 @@ static void MainLoopStatistic( input_thread_t *p_input )
stats_ComputeGlobalStats( p_input->p_libvlc, stats_ComputeGlobalStats( p_input->p_libvlc,
p_input->p_libvlc->p_stats ); p_input->p_libvlc->p_stats );
} }
var_SetBool( p_input, "stats-change", true );
} }
/** /**
......
...@@ -223,11 +223,15 @@ void input_ControlVarInit ( input_thread_t *p_input ) ...@@ -223,11 +223,15 @@ void input_ControlVarInit ( input_thread_t *p_input )
* *
* Add rate-change to inform about rate changin * Add rate-change to inform about rate changin
* *
* stats-change to inform when statistics are computed
*
* TODO list all changes warn by this callbacks */ * TODO list all changes warn by this callbacks */
var_Create( p_input, "intf-change", VLC_VAR_BOOL ); var_Create( p_input, "intf-change", VLC_VAR_BOOL );
var_SetBool( p_input, "intf-change", true ); var_SetBool( p_input, "intf-change", true );
var_Create( p_input, "rate-change", VLC_VAR_BOOL ); var_Create( p_input, "rate-change", VLC_VAR_BOOL );
var_SetBool( p_input, "rate-change", true ); var_SetBool( p_input, "rate-change", true );
var_Create( p_input, "stats-change", VLC_VAR_BOOL );
var_SetBool( p_input, "stats-change", true );
var_Create( p_input, "intf-change-vout", VLC_VAR_BOOL ); var_Create( p_input, "intf-change-vout", VLC_VAR_BOOL );
var_SetBool( p_input, "intf-change-vout", true ); var_SetBool( p_input, "intf-change-vout", true );
......
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