Skip to content
Snippets Groups Projects
Commit cbc02ddd authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

video: Add color space getter

Refs #70057
parent 64496d22
Branches
Tags
No related merge requests found
...@@ -40,17 +40,13 @@ class DirectRendererPrivate : public QObject ...@@ -40,17 +40,13 @@ class DirectRendererPrivate : public QObject
Q_OBJECT Q_OBJECT
public: public:
DirectRendererPrivate(Video::DirectRenderer* parent); DirectRendererPrivate(Video::DirectRenderer* parent);
//Attributes
private: private:
Video::DirectRenderer* q_ptr; // Video::DirectRenderer* q_ptr;
}; };
} }
Video::DirectRendererPrivate::DirectRendererPrivate(Video::DirectRenderer* parent) : QObject(parent), q_ptr(parent) Video::DirectRendererPrivate::DirectRendererPrivate(Video::DirectRenderer* parent) : QObject(parent)/*, q_ptr(parent)*/
{ {
} }
...@@ -67,7 +63,6 @@ Video::DirectRenderer::~DirectRenderer() ...@@ -67,7 +63,6 @@ Video::DirectRenderer::~DirectRenderer()
void Video::DirectRenderer::startRendering() void Video::DirectRenderer::startRendering()
{ {
qWarning() << "STARTING RENDERING"; qWarning() << "STARTING RENDERING";
Video::Renderer::d_ptr->m_isRendering = true; Video::Renderer::d_ptr->m_isRendering = true;
emit started(); emit started();
...@@ -89,4 +84,9 @@ void Video::DirectRenderer::onNewFrame(const QByteArray& frame) ...@@ -89,4 +84,9 @@ void Video::DirectRenderer::onNewFrame(const QByteArray& frame)
emit frameUpdated(); emit frameUpdated();
} }
Video::Renderer::ColorSpace Video::DirectRenderer::colorSpace() const
{
return Video::Renderer::ColorSpace::RGBA;
}
#include <directrenderer.moc> #include <directrenderer.moc>
...@@ -48,6 +48,9 @@ class LIB_EXPORT DirectRenderer : public Renderer { ...@@ -48,6 +48,9 @@ class LIB_EXPORT DirectRenderer : public Renderer {
DirectRenderer (const QByteArray& id, const QSize& res); DirectRenderer (const QByteArray& id, const QSize& res);
virtual ~DirectRenderer(); virtual ~DirectRenderer();
//Getter
virtual ColorSpace colorSpace() const override;
void onNewFrame(const QByteArray& frame); void onNewFrame(const QByteArray& frame);
public Q_SLOTS: public Q_SLOTS:
......
...@@ -340,6 +340,11 @@ const QByteArray& ShmRenderer::currentFrame() const ...@@ -340,6 +340,11 @@ const QByteArray& ShmRenderer::currentFrame() const
return Renderer::currentFrame(); return Renderer::currentFrame();
} }
Video::Renderer::ColorSpace ShmRenderer::colorSpace() const
{
return Video::Renderer::ColorSpace::BGRA;
}
/***************************************************************************** /*****************************************************************************
* * * *
* Setters * * Setters *
......
...@@ -54,8 +54,9 @@ public: ...@@ -54,8 +54,9 @@ public:
bool startShm (); bool startShm ();
//Getters //Getters
virtual int fps() const; int fps() const;
virtual const QByteArray& currentFrame() const override; virtual const QByteArray& currentFrame() const override;
virtual ColorSpace colorSpace () const override;
//Setters //Setters
void setShmPath(const QString& path); void setShmPath(const QString& path);
......
...@@ -58,6 +58,16 @@ class LIB_EXPORT Renderer : public QObject ...@@ -58,6 +58,16 @@ class LIB_EXPORT Renderer : public QObject
friend class VideoRendererManagerPrivate ; friend class VideoRendererManagerPrivate ;
public: public:
/**
* Each platform may have its preferred color space. To be able to use a
* client on multiple platforms, they need to check the colorspace.
*/
enum class ColorSpace {
BGRA , /*!< 32bit BLUE GREEN RED ALPHA */
RGBA , /*!< 32bit ALPHA GREEN RED BLUE */
};
//Constructor //Constructor
Renderer (const QByteArray& id, const QSize& res); Renderer (const QByteArray& id, const QSize& res);
virtual ~Renderer(); virtual ~Renderer();
...@@ -67,6 +77,7 @@ public: ...@@ -67,6 +77,7 @@ public:
virtual const QByteArray& currentFrame () const; virtual const QByteArray& currentFrame () const;
virtual QSize size () const; virtual QSize size () const;
virtual QMutex* mutex () const; virtual QMutex* mutex () const;
virtual ColorSpace colorSpace () const = 0;
void setSize(const QSize& size) const; void setSize(const QSize& size) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment