diff options
author | Andy Nichols <andy.nichols@digia.com> | 2013-08-15 15:08:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-27 14:16:10 +0200 |
commit | 51d0f852b9be9c5753e28e2bb4a7f2f6c35dc533 (patch) | |
tree | 92fdcdc94ca120d33363d7b827b5c2f4e3fbf4f5 /src/plugins/avfoundation/mediaplayer/avfvideowidget.h | |
parent | 17a700292ad9289e8de199dc50b3e222ede42e1d (diff) |
AVFoundation: Use CoreAnimation to render video to QVideoWidget
Previously a QGLWidget was used as a target for the
AVFVideoFrameRenderer. This was uncessary as it is possible to render
directly on top of the QWidget using the CoreAnimation Framework.
Change-Id: I08923c85fd56c8874c1d8c187ae5145e220fab92
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/avfoundation/mediaplayer/avfvideowidget.h')
-rw-r--r-- | src/plugins/avfoundation/mediaplayer/avfvideowidget.h | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideowidget.h b/src/plugins/avfoundation/mediaplayer/avfvideowidget.h index 460d5305e..12b8c26b1 100644 --- a/src/plugins/avfoundation/mediaplayer/avfvideowidget.h +++ b/src/plugins/avfoundation/mediaplayer/avfvideowidget.h @@ -42,43 +42,44 @@ #ifndef AVFVIDEOWIDGET_H #define AVFVIDEOWIDGET_H -#include <QtOpenGL/QGLWidget> -#include <QtGui/QMatrix4x4> +#include <QtWidgets/QWidget> -QT_BEGIN_NAMESPACE +@class AVPlayerLayer; +#if defined(Q_OS_OSX) +@class NSView; +#else +@class UIView; +#endif -class QOpenGLShaderProgram; +QT_BEGIN_NAMESPACE -class AVFVideoWidget : public QGLWidget +class AVFVideoWidget : public QWidget { public: - AVFVideoWidget(QWidget *parent, const QGLFormat &format); + AVFVideoWidget(QWidget *parent); virtual ~AVFVideoWidget(); - void initializeGL(); - void resizeGL(int w, int h); - void paintGL(); - - void setTexture(GLuint texture); - QSize sizeHint() const; - void setNativeSize(const QSize &size); - + Qt::AspectRatioMode aspectRatioMode() const; void setAspectRatioMode(Qt::AspectRatioMode mode); + void setPlayerLayer(AVPlayerLayer *layer); + +protected: + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *); private: - QRect displayRect() const; + void updateAspectRatio(); + void updatePlayerLayerBounds(const QSize &size); - GLuint m_textureId; QSize m_nativeSize; Qt::AspectRatioMode m_aspectRatioMode; - - QOpenGLShaderProgram *m_shaderProgram; - QMatrix4x4 m_transformMatrix; - - int m_matrixLocation; - int m_vertexCoordEntry; - int m_textureCoordEntry; + AVPlayerLayer *m_playerLayer; +#if defined(Q_OS_OSX) + NSView *m_nativeView; +#else + UIView *m_nativeView; +#endif }; QT_END_NAMESPACE |