Commit 93eeed79 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Don't flood the GUI with timeChanged events

parent 5962391b
......@@ -64,7 +64,7 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
// case libvlc_MediaPlayerEndReached:
// case libvlc_MediaPlayerEncounteredError:
case libvlc_MediaPlayerTimeChanged:
self->emit timeChanged();
self->timeChangedFilter();
break;
// case libvlc_MediaPlayerPositionChanged:
// case libvlc_MediaPlayerSeekableChanged:
......@@ -158,3 +158,14 @@ void MediaPlayer::setDrawable( uint32_t drawable
{
libvlc_media_player_set_xwindow( m_internalPtr, drawable, m_ex );
}
void MediaPlayer::timeChangedFilter()
{
// Don't flood the gui with too many signals
qint64 currentTime = getTime() / 100;
static qint64 lastTime = 0;
if ( currentTime != lastTime )
emit timeChanged();
lastTime = currentTime;
}
......@@ -53,6 +53,7 @@ namespace LibVLCpp
private:
static void callbacks( const libvlc_event_t* event, void* self );
void timeChangedFilter();
Exception m_ex;
libvlc_event_manager_t* p_em;
......
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