summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2012-01-15 20:39:10 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2012-01-15 22:26:45 +0200
commitaf9ac27bdf77af0bbb1c08b62a1a64fa48d53f92 (patch)
tree20e6d81159cea357e08118f8caa32e56e52dd7a0
parentd8e18d9add1ad664c6c2eddeb5a37e87b9676d29 (diff)
QtVideoSinkDelegate: Replace ShaderType enum with PainterType
-rw-r--r--elements/gstqtvideosink/qtvideosinkdelegate.cpp31
-rw-r--r--elements/gstqtvideosink/qtvideosinkdelegate.h25
2 files changed, 22 insertions, 34 deletions
diff --git a/elements/gstqtvideosink/qtvideosinkdelegate.cpp b/elements/gstqtvideosink/qtvideosinkdelegate.cpp
index 0dc6011..b4e0ac5 100644
--- a/elements/gstqtvideosink/qtvideosinkdelegate.cpp
+++ b/elements/gstqtvideosink/qtvideosinkdelegate.cpp
@@ -34,9 +34,9 @@
QtVideoSinkDelegate::QtVideoSinkDelegate(GstQtVideoSinkBase *sink, QObject *parent)
: QObject(parent)
, m_painter(0)
+ , m_supportedPainters(Generic)
#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
, m_glContext(0)
- , m_supportedShaderTypes(NoShaders)
#endif
, m_colorsDirty(true)
, m_brightness(0)
@@ -64,7 +64,7 @@ QSet<GstVideoFormat> QtVideoSinkDelegate::supportedPixelFormats() const
{
QSet<GstVideoFormat> result;
#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
- if (m_glContext)
+ if (m_supportedPainters & Glsl || m_supportedPainters & ArbFp)
result = OpenGLSurfacePainter::supportedPixelFormats();
else
#endif
@@ -313,8 +313,7 @@ void QtVideoSinkDelegate::setGLContext(QGLContext *context)
return;
m_glContext = context;
-
- m_supportedShaderTypes = NoShaders;
+ m_supportedPainters = Generic;
if (m_glContext) {
m_glContext->makeCurrent();
@@ -324,24 +323,22 @@ void QtVideoSinkDelegate::setGLContext(QGLContext *context)
#ifndef QT_OPENGL_ES
if (extensions.contains("ARB_fragment_program"))
- m_supportedShaderTypes |= FragmentProgramShader;
+ m_supportedPainters |= ArbFp;
#endif
#ifndef QT_OPENGL_ES_2
if (QGLShaderProgram::hasOpenGLShaderPrograms(m_glContext)
&& extensions.contains("ARB_shader_objects"))
#endif
- m_supportedShaderTypes |= GlslShader;
+ m_supportedPainters |= Glsl;
}
- GST_LOG_OBJECT(m_sink, "Done setting GL context. m_shaderTypes=%x", (int) m_supportedShaderTypes);
+ GST_LOG_OBJECT(m_sink, "Done setting GL context. m_supportedPainters=%x", (int) m_supportedPainters);
}
#endif
-enum PainterType { Glsl, ArbFp, Generic };
-
void QtVideoSinkDelegate::changePainter(const BufferFormat & format)
{
if (m_painter) {
@@ -358,16 +355,14 @@ void QtVideoSinkDelegate::changePainter(const BufferFormat & format)
}
#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
-# ifndef QT_OPENGL_ES
- if (m_supportedShaderTypes & QtVideoSinkDelegate::FragmentProgramShader
- && ArbFpSurfacePainter::supportedPixelFormats().contains(format.videoFormat())) {
- possiblePainters.push(ArbFp);
- }
-# endif
+ if (OpenGLSurfacePainter::supportedPixelFormats().contains(format.videoFormat())) {
+ if (m_supportedPainters & ArbFp) {
+ possiblePainters.push(ArbFp);
+ }
- if (m_supportedShaderTypes & QtVideoSinkDelegate::GlslShader
- && GlslSurfacePainter::supportedPixelFormats().contains(format.videoFormat())) {
- possiblePainters.push(Glsl);
+ if (m_supportedPainters & Glsl) {
+ possiblePainters.push(Glsl);
+ }
}
#endif
diff --git a/elements/gstqtvideosink/qtvideosinkdelegate.h b/elements/gstqtvideosink/qtvideosinkdelegate.h
index 9bb361a..8e71185 100644
--- a/elements/gstqtvideosink/qtvideosinkdelegate.h
+++ b/elements/gstqtvideosink/qtvideosinkdelegate.h
@@ -97,20 +97,10 @@ public:
bool forceAspectRatio() const;
void setForceAspectRatio(bool force);
- // glcontext property
-
#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
+ // glcontext property
QGLContext *glContext() const;
void setGLContext(QGLContext *context);
-
- enum ShaderType
- {
- NoShaders = 0x00,
- FragmentProgramShader = 0x01,
- GlslShader = 0x02
- };
-
- Q_DECLARE_FLAGS(ShaderTypes, ShaderType)
#endif
// paint action signal
@@ -124,13 +114,18 @@ private:
void changePainter(const BufferFormat & format);
void destroyPainter();
+ enum PainterType {
+ Generic = 0x00,
+ ArbFp = 0x01,
+ Glsl = 0x02
+ };
+ Q_DECLARE_FLAGS(PainterTypes, PainterType);
AbstractSurfacePainter *m_painter;
+ PainterTypes m_supportedPainters;
#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
QGLContext *m_glContext;
- ShaderTypes m_supportedShaderTypes;
- ShaderType m_shaderType;
#endif
// colorbalance interface properties
@@ -162,8 +157,6 @@ private:
GstQtVideoSinkBase *m_sink;
};
-#ifndef GST_QT_VIDEO_SINK_NO_OPENGL
-Q_DECLARE_OPERATORS_FOR_FLAGS(QtVideoSinkDelegate::ShaderTypes)
-#endif
+Q_DECLARE_OPERATORS_FOR_FLAGS(QtVideoSinkDelegate::PainterTypes)
#endif // QT_VIDEO_SINK_DELEGATE_H