summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-22 03:28:38 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-03-22 03:28:38 (GMT)
commit0dff17f1e08f57040f3a156f9f3675024ec59978 (patch)
tree0b3c47a172b90acfd3582b7f6d04bb9b8d9ff780 /src/plugins/mediaservices
parent1ef014ebae2c28c38c25facd90ba8be71b195195 (diff)
parentdbd293e2579e80756ca7e711ea1f82b9e42c5b92 (diff)
downloadQt-0dff17f1e08f57040f3a156f9f3675024ec59978.zip
Qt-0dff17f1e08f57040f3a156f9f3675024ec59978.tar.gz
Qt-0dff17f1e08f57040f3a156f9f3675024ec59978.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7
Diffstat (limited to 'src/plugins/mediaservices')
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp61
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp12
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h4
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp10
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.mm14
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.mm8
12 files changed, 86 insertions, 55 deletions
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
index bb7bac3..67d07e1 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
@@ -87,7 +87,7 @@ DirectShowPlayerControl::DirectShowPlayerControl(DirectShowPlayerService *servic
, m_muteVolume(-1)
, m_position(0)
, m_duration(0)
- , m_playbackRate(0)
+ , m_playbackRate(1.0)
, m_seekable(false)
{
}
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index 317fa5c..d54d188 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -274,7 +274,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
}
if (SUCCEEDED(hr)) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -282,7 +282,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -319,7 +319,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
source->setDevice(m_stream);
if (SUCCEEDED(m_graph->AddFilter(source, L"Source"))) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -327,7 +327,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -346,7 +346,10 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
void DirectShowPlayerService::doRender(QMutexLocker *locker)
{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
+ if (m_executedTasks & Pause)
+ m_pendingTasks |= Pause;
+ else if (m_executedTasks & Play && m_rate != 0.0)
+ m_pendingTasks |= Play;
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
@@ -624,8 +627,13 @@ void DirectShowPlayerService::play()
{
QMutexLocker locker(&m_mutex);
- m_pendingTasks &= ~Pause;
- m_pendingTasks |= Play;
+ if (m_rate != 0.0) {
+ m_pendingTasks &= ~Pause;
+ m_pendingTasks |= Play;
+ } else {
+ m_pendingTasks |= Pause;
+ m_executedTasks |= Play;
+ }
if (m_executedTasks & Render) {
if (m_executedTasks & Stop) {
@@ -650,6 +658,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker)
if (SUCCEEDED(hr)) {
m_executedTasks |= Play;
+ m_executedTasks &= ~Pause;
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
@@ -704,6 +713,9 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
m_executedTasks |= Pause;
+ if (m_rate != 0.0)
+ m_executedTasks &= ~Play;
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
m_error = QMediaPlayer::ResourceError;
@@ -764,9 +776,27 @@ void DirectShowPlayerService::setRate(qreal rate)
{
QMutexLocker locker(&m_mutex);
- m_rate = rate;
+ if (m_rate == rate)
+ return;
+
+ if (rate == 0.0) {
+ if (m_pendingTasks & Play) {
+ m_executedTasks |= Play;
+ m_pendingTasks &= ~(Play | SetRate);
+
+ if (!((m_executingTask | m_executedTasks) & Pause))
+ m_pendingTasks |= Pause;
+ } else if ((m_executingTask | m_executedTasks) & Play) {
+ m_pendingTasks |= Pause;
+ }
+ } else {
+ m_pendingTasks |= SetRate;
+
+ if (m_rate == 0.0 && (m_executedTasks & Play) && !(m_executingTask & Play))
+ m_pendingTasks |= Play;
+ }
- m_pendingTasks |= SetRate;
+ m_rate = rate;
if (m_executedTasks & FinalizeLoad)
::SetEvent(m_taskHandle);
@@ -800,8 +830,9 @@ void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
seeking->Release();
} else if (m_rate != 1.0) {
- m_rate = 1.0;
+ m_rate = 1.0;
}
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(RateChange)));
}
@@ -1344,16 +1375,16 @@ void DirectShowPlayerService::run()
m_executingTask = Stop;
doStop(&locker);
- } else if (m_pendingTasks & SetRate) {
- m_pendingTasks ^= SetRate;
- m_executingTask = SetRate;
-
- doSetRate(&locker);
} else if (m_pendingTasks & Pause) {
m_pendingTasks ^= Pause;
m_executingTask = Pause;
doPause(&locker);
+ } else if (m_pendingTasks & SetRate) {
+ m_pendingTasks ^= SetRate;
+ m_executingTask = SetRate;
+
+ doSetRate(&locker);
} else if (m_pendingTasks & Seek) {
m_pendingTasks ^= Seek;
m_executingTask = Seek;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
index b1ddd98..4b9aeb8 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
@@ -162,30 +162,30 @@ QSize Vmr9VideoWindowControl::nativeSize() const
return size;
}
-QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
+Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
{
- QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio;
+ Qt::AspectRatioMode mode = Qt::KeepAspectRatio;
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
DWORD arMode;
if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None)
- mode = QVideoWidget::IgnoreAspectRatio;
+ mode = Qt::IgnoreAspectRatio;
control->Release();
}
return mode;
}
-void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
switch (mode) {
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_None);
break;
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_LetterBox);
break;
default:
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
index a0aca95..bf4fb42 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
@@ -75,8 +75,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
index 846a24a..427d514 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
@@ -52,7 +52,7 @@ QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent)
: QVideoWindowControl(parent)
, m_surface(new QX11VideoSurface)
, m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface)))
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_fullScreen(false)
{
if (m_videoSink) {
@@ -94,12 +94,12 @@ void QGstreamerVideoOverlay::setDisplayRect(const QRect &rect)
setScaledDisplayRect();
}
-QVideoWidget::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoOverlay::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
@@ -193,7 +193,7 @@ void QGstreamerVideoOverlay::surfaceFormatChanged()
void QGstreamerVideoOverlay::setScaledDisplayRect()
{
switch (m_aspectRatioMode) {
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
{
QSize size = m_surface->surfaceFormat().viewport().size();
@@ -205,7 +205,7 @@ void QGstreamerVideoOverlay::setScaledDisplayRect()
m_surface->setDisplayRect(rect);
}
break;
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
m_surface->setDisplayRect(m_displayRect);
break;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
index 9566949..1188074 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
@@ -73,8 +73,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
void repaint();
@@ -102,7 +102,7 @@ private:
QX11VideoSurface *m_surface;
GstElement *m_videoSink;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
index 8307aa5..763f7f1 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
@@ -233,17 +233,17 @@ QWidget *QGstreamerVideoWidgetControl::videoWidget()
return m_widget;
}
-QVideoWidget::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_videoSink) {
g_object_set(G_OBJECT(m_videoSink),
"force-aspect-ratio",
- (mode == QVideoWidget::KeepAspectRatio),
+ (mode == Qt::KeepAspectRatio),
(const char*)NULL);
}
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
index 6a4c0f3..28b48af 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
@@ -67,8 +67,8 @@ public:
QWidget *videoWidget();
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
@@ -99,7 +99,7 @@ private:
GstElement *m_videoSink;
QGstreamerVideoWidget *m_widget;
WId m_windowId;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
index 558c3d7..7908efd 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
@@ -83,8 +83,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -118,7 +118,7 @@ private:
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
index 00ceffc..197c26e 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
@@ -66,7 +66,7 @@ public:
: QGLWidget(format, parent),
m_texRef(0),
m_nativeSize(640,480),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ m_aspectRatioMode(Qt::KeepAspectRatio)
{
setAutoFillBackground(false);
}
@@ -145,7 +145,7 @@ public:
m_nativeSize = size;
}
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+ void setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_aspectRatioMode != mode) {
m_aspectRatioMode = mode;
@@ -158,7 +158,7 @@ private:
{
QRect displayRect = rect();
- if (m_aspectRatioMode == QVideoWidget::KeepAspectRatio) {
+ if (m_aspectRatioMode == Qt::KeepAspectRatio) {
QSize size = m_nativeSize;
size.scale(displayRect.size(), Qt::KeepAspectRatio);
@@ -170,7 +170,7 @@ private:
CVOpenGLTextureRef m_texRef;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
};
QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
@@ -178,7 +178,7 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
m_movie(0),
m_videoWidget(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -324,12 +324,12 @@ QSize QT7MovieVideoWidget::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
m_videoWidget->setAspectRatioMode(mode);
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
index 3ac409e..49049ad 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
@@ -80,8 +80,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -106,7 +106,7 @@ private:
QRect m_displayRect;
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
index d5f4f95..8e4dd9b 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
@@ -157,7 +157,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent)
m_layouted(false),
m_winId(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -254,7 +254,7 @@ void QT7MovieViewOutput::setDisplayRect(const QRect &rect)
if (m_movieView) {
AutoReleasePool pool;
- [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == QVideoWidget::KeepAspectRatio ? YES : NO)];
+ [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == Qt::KeepAspectRatio ? YES : NO)];
[(QTMovieView*)m_movieView setFrame:NSMakeRect(m_displayRect.x(),
m_displayRect.y(),
m_displayRect.width(),
@@ -283,12 +283,12 @@ QSize QT7MovieViewOutput::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieViewOutput::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieViewOutput::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
setDisplayRect(m_displayRect);