Commit e46b1586 authored by Harald Sitter's avatar Harald Sitter
Browse files

clear pending adjusts on source change

Otherwise it could happen that a player tries to set the values so they end up in the pendings hash, then the user switches to another file before video is detected -> the settings are applied to the new video rather than the one they were targetting.
parent b1327fde
......@@ -70,7 +70,9 @@ void VideoWidget::connectToMediaObject(MediaObject *mediaObject)
connect(mediaObject, SIGNAL(videoWidgetSizeChanged(int, int)),
SLOT(videoWidgetSizeChanged(int, int)));
connect(mediaObject, SIGNAL(hasVideoChanged(bool)),
SLOT(clearPendingAdjusts(bool)));
SLOT(processPendingAdjusts(bool)));
connect(mediaObject, SIGNAL(currentSourceChanged(MediaSource)),
SLOT(clearPendingAdjusts()));
// mediaObject->setVideoWidgetId(p_video_widget->winId());
mediaObject->setVideoWidget(this);
......@@ -352,7 +354,7 @@ void VideoWidget::videoWidgetSizeChanged(int width, int height)
libvlc_video_set_format(m_player, "RV32", width, height, width * 4);
}
void VideoWidget::clearPendingAdjusts(bool videoAvailable)
void VideoWidget::processPendingAdjusts(bool videoAvailable)
{
if (!videoAvailable || !m_mediaObject || !m_mediaObject->hasVideo()) {
return;
......@@ -366,6 +368,12 @@ void VideoWidget::clearPendingAdjusts(bool videoAvailable)
m_pendingAdjusts.clear();
}
void VideoWidget::clearPendingAdjusts()
{
m_pendingAdjusts.clear();
}
void VideoWidget::paintEvent(QPaintEvent *event)
{
if (m_customRender) {
......
......@@ -216,8 +216,16 @@ private slots:
/**
* Sets all pending video adjusts (hue, brightness etc.) that the application
* wanted to set before the vidoe became available.
*
* \param videoAvailable whether or not video is available at the time of calling
*/
void clearPendingAdjusts(bool videoAvailable);
void processPendingAdjusts(bool videoAvailable);
/**
* Clears all pending video adjusts (hue, brightness etc.).
*/
void clearPendingAdjusts();
protected:
/* Overloading QWidget */
......
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