qt6: Rename symbols to avoid conflict in static builds

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7414>
This commit is contained in:
Edward Hervey 2024-07-26 08:18:21 +02:00
parent e4fbf9d180
commit 864faa34cd
7 changed files with 55 additions and 55 deletions

View file

@ -256,10 +256,10 @@ GstQSGTexture::rhiTexture() const
return m_texture;
}
class GstQSGMaterialShader : public QSGMaterialShader {
class GstQSG6MaterialShader : public QSGMaterialShader {
public:
GstQSGMaterialShader(GstVideoFormat v_format, GstGLTextureTarget target);
~GstQSGMaterialShader();
GstQSG6MaterialShader(GstVideoFormat v_format, GstGLTextureTarget target);
~GstQSG6MaterialShader();
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *) override;
@ -269,7 +269,7 @@ private:
QSGTexture *m_textures[GST_VIDEO_MAX_PLANES];
};
GstQSGMaterialShader::GstQSGMaterialShader(GstVideoFormat v_format,
GstQSG6MaterialShader::GstQSG6MaterialShader(GstVideoFormat v_format,
GstGLTextureTarget target)
: v_format(v_format)
{
@ -305,7 +305,7 @@ GstQSGMaterialShader::GstQSGMaterialShader(GstVideoFormat v_format,
m_textures[3] = nullptr;
}
GstQSGMaterialShader::~GstQSGMaterialShader()
GstQSG6MaterialShader::~GstQSG6MaterialShader()
{
for (int i = 0; i < 4; i++) {
if (m_textures[i]) {
@ -316,7 +316,7 @@ GstQSGMaterialShader::~GstQSGMaterialShader()
}
bool
GstQSGMaterialShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
GstQSG6MaterialShader::updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
{
const GstVideoFormatInfo *finfo = gst_video_format_get_info (v_format);
bool changed = false;
@ -337,7 +337,7 @@ GstQSGMaterialShader::updateUniformData(RenderState &state, QSGMaterial *newMate
changed = true;
}
auto *mat = static_cast<GstQSGMaterial *>(newMaterial);
auto *mat = static_cast<GstQSG6Material *>(newMaterial);
if (oldMaterial != newMaterial || mat->uniforms.dirty) {
memcpy(buf->data() + 64, &mat->uniforms.input_swizzle, 4 * sizeof (int));
memcpy(buf->data() + 80, mat->uniforms.color_matrix.constData(), 64);
@ -358,7 +358,7 @@ GstQSGMaterialShader::updateUniformData(RenderState &state, QSGMaterial *newMate
}
void
GstQSGMaterialShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
GstQSG6MaterialShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *)
{
*texture = this->m_textures[binding - 1];
@ -366,39 +366,39 @@ GstQSGMaterialShader::updateSampledImage(RenderState &state, int binding, QSGTex
}
#define DEFINE_MATERIAL(format) \
class G_PASTE(GstQSGMaterial_,format) : public GstQSGMaterial { \
class G_PASTE(GstQSG6Material_,format) : public GstQSG6Material { \
public: \
G_PASTE(GstQSGMaterial_,format)(); \
~G_PASTE(GstQSGMaterial_,format)(); \
G_PASTE(GstQSG6Material_,format)(); \
~G_PASTE(GstQSG6Material_,format)(); \
QSGMaterialType *type() const override { static QSGMaterialType type; return &type; }; \
}; \
G_PASTE(GstQSGMaterial_,format)::G_PASTE(GstQSGMaterial_,format)() {} \
G_PASTE(GstQSGMaterial_,format)::~G_PASTE(GstQSGMaterial_,format)() {}
G_PASTE(GstQSG6Material_,format)::G_PASTE(GstQSG6Material_,format)() {} \
G_PASTE(GstQSG6Material_,format)::~G_PASTE(GstQSG6Material_,format)() {}
DEFINE_MATERIAL(RGBA_SWIZZLE);
DEFINE_MATERIAL(YUV_TRIPLANAR);
DEFINE_MATERIAL(YUV_BIPLANAR);
GstQSGMaterial *
GstQSGMaterial::new_for_format(GstVideoFormat format)
GstQSG6Material *
GstQSG6Material::new_for_format(GstVideoFormat format)
{
const GstVideoFormatInfo *finfo = gst_video_format_get_info (format);
if (GST_VIDEO_FORMAT_INFO_IS_RGB (finfo) && finfo->n_planes == 1) {
return static_cast<GstQSGMaterial *>(new GstQSGMaterial_RGBA_SWIZZLE());
return static_cast<GstQSG6Material *>(new GstQSG6Material_RGBA_SWIZZLE());
}
switch (format) {
case GST_VIDEO_FORMAT_YV12:
return static_cast<GstQSGMaterial *>(new GstQSGMaterial_YUV_TRIPLANAR());
return static_cast<GstQSG6Material *>(new GstQSG6Material_YUV_TRIPLANAR());
case GST_VIDEO_FORMAT_NV12:
return static_cast<GstQSGMaterial *>(new GstQSGMaterial_YUV_BIPLANAR());
return static_cast<GstQSG6Material *>(new GstQSG6Material_YUV_BIPLANAR());
default:
g_assert_not_reached ();
}
}
GstQSGMaterial::GstQSGMaterial ()
GstQSG6Material::GstQSG6Material ()
{
static gsize _debug;
@ -419,7 +419,7 @@ GstQSGMaterial::GstQSGMaterial ()
this->uniforms.dirty = true;
}
GstQSGMaterial::~GstQSGMaterial ()
GstQSG6Material::~GstQSG6Material ()
{
g_weak_ref_clear (&this->qt_context_ref_);
gst_buffer_replace (&this->buffer_, NULL);
@ -433,7 +433,7 @@ GstQSGMaterial::~GstQSGMaterial ()
}
bool
GstQSGMaterial::compatibleWith(GstVideoInfo * v_info)
GstQSG6Material::compatibleWith(GstVideoInfo * v_info)
{
if (GST_VIDEO_INFO_FORMAT (&this->v_info) != GST_VIDEO_INFO_FORMAT (v_info))
return false;
@ -442,17 +442,17 @@ GstQSGMaterial::compatibleWith(GstVideoInfo * v_info)
}
QSGMaterialShader *
GstQSGMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
GstQSG6Material::createShader(QSGRendererInterface::RenderMode renderMode) const
{
GstVideoFormat v_format = GST_VIDEO_INFO_FORMAT (&this->v_info);
GstGLTextureTarget target = this->tex_target;
return new GstQSGMaterialShader(v_format, target);
return new GstQSG6MaterialShader(v_format, target);
}
/* only called from the streaming thread with scene graph thread blocked */
void
GstQSGMaterial::setCaps (GstCaps * caps)
GstQSG6Material::setCaps (GstCaps * caps)
{
GstStructure *s;
const gchar *target_str;
@ -471,7 +471,7 @@ GstQSGMaterial::setCaps (GstCaps * caps)
/* only called from the streaming thread with scene graph thread blocked */
gboolean
GstQSGMaterial::setBuffer (GstBuffer * buffer)
GstQSG6Material::setBuffer (GstBuffer * buffer)
{
GST_LOG ("%p setBuffer %" GST_PTR_FORMAT, this, buffer);
/* FIXME: update more state here */
@ -512,7 +512,7 @@ GstQSGMaterial::setBuffer (GstBuffer * buffer)
/* only called from the streaming thread with scene graph thread blocked */
GstBuffer *
GstQSGMaterial::getBuffer (bool * was_bound)
GstQSG6Material::getBuffer (bool * was_bound)
{
GstBuffer *buffer = NULL;
@ -525,7 +525,7 @@ GstQSGMaterial::getBuffer (bool * was_bound)
}
void
GstQSGMaterial::setFiltering(QSGTexture::Filtering filtering)
GstQSG6Material::setFiltering(QSGTexture::Filtering filtering)
{
m_filtering = filtering;
}
@ -565,7 +565,7 @@ video_format_to_texel_size (GstVideoFormat format, guint plane)
}
QSGTexture *
GstQSGMaterial::bind(GstQSGMaterialShader *shader, QRhi * rhi, QRhiResourceUpdateBatch *res_updates, guint plane, GstVideoFormat v_format)
GstQSG6Material::bind(GstQSG6MaterialShader *shader, QRhi * rhi, QRhiResourceUpdateBatch *res_updates, guint plane, GstVideoFormat v_format)
{
GstGLContext *qt_context, *context;
GstMemory *mem;

View file

@ -33,15 +33,15 @@
class QRhi;
class QRhiResourceUpdateBatch;
class GstQSGMaterialShader;
class GstQSG6MaterialShader;
class GstQSGMaterial : public QSGMaterial
class GstQSG6Material : public QSGMaterial
{
protected:
GstQSGMaterial();
~GstQSGMaterial();
GstQSG6Material();
~GstQSG6Material();
public:
static GstQSGMaterial *new_for_format (GstVideoFormat format);
static GstQSG6Material *new_for_format (GstVideoFormat format);
void setCaps (GstCaps * caps);
gboolean setBuffer (GstBuffer * buffer);
@ -50,7 +50,7 @@ public:
void setFiltering(QSGTexture::Filtering);
QSGTexture * bind(GstQSGMaterialShader *, QRhi *, QRhiResourceUpdateBatch *, guint binding, GstVideoFormat);
QSGTexture * bind(GstQSG6MaterialShader *, QRhi *, QRhiResourceUpdateBatch *, guint binding, GstVideoFormat);
/* QSGMaterial */
QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;

View file

@ -292,7 +292,7 @@ gst_qml6_get_gl_wrapcontext (GstGLDisplay * display,
}
QOpenGLContext *
qt_opengl_native_context_from_gst_gl_context (GstGLContext * context)
qt6_opengl_native_context_from_gst_gl_context (GstGLContext * context)
{
guintptr handle;
GstGLPlatform platform;

View file

@ -47,6 +47,6 @@ gboolean gst_qml6_get_gl_wrapcontext (GstGLDisplay * display,
G_END_DECLS
QOpenGLContext * qt_opengl_native_context_from_gst_gl_context (GstGLContext * context);
QOpenGLContext * qt6_opengl_native_context_from_gst_gl_context (GstGLContext * context);
#endif /* __QML6_GL_UTILS_H__ */

View file

@ -274,7 +274,7 @@ Qt6GLVideoItem::updatePaintNode(QSGNode * oldNode,
UpdatePaintNodeData * updatePaintNodeData)
{
GstBuffer *old_buffer;
GstQSGMaterial *tex = nullptr;
GstQSG6Material *tex = nullptr;
QSGGeometry *geometry = nullptr;
bool was_bound = false;
@ -298,7 +298,7 @@ Qt6GLVideoItem::updatePaintNode(QSGNode * oldNode,
gst_gl_context_activate (this->priv->other_context, TRUE);
if (texNode) {
tex = static_cast<GstQSGMaterial *>(texNode->material());
tex = static_cast<GstQSG6Material *>(texNode->material());
if (tex && !tex->compatibleWith(&this->priv->v_info)) {
delete texNode;
texNode = nullptr;
@ -311,7 +311,7 @@ Qt6GLVideoItem::updatePaintNode(QSGNode * oldNode,
geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
texNode->setGeometry(geometry);
texNode->setFlag(QSGGeometryNode::OwnsGeometry);
tex = GstQSGMaterial::new_for_format(GST_VIDEO_INFO_FORMAT (&this->priv->v_info));
tex = GstQSG6Material::new_for_format(GST_VIDEO_INFO_FORMAT (&this->priv->v_info));
tex->setFiltering(is_smooth ? QSGTexture::Filtering::Linear :
QSGTexture::Filtering::Nearest);
texNode->setMaterial(tex);

View file

@ -220,16 +220,16 @@ dup_shared_render_data (gpointer data, gpointer user_data)
return NULL;
}
class CreateSurfaceEvent : public QEvent
class Qt6CreateSurfaceEvent : public QEvent
{
public:
CreateSurfaceEvent (CreateSurfaceWorker * worker)
: QEvent(CreateSurfaceEvent::type())
Qt6CreateSurfaceEvent (Qt6CreateSurfaceWorker * worker)
: QEvent(Qt6CreateSurfaceEvent::type())
{
m_worker = worker;
}
~CreateSurfaceEvent()
~Qt6CreateSurfaceEvent()
{
GST_TRACE ("%p destroying create surface event", this);
delete m_worker;
@ -246,25 +246,25 @@ public:
private:
static QEvent::Type customEventType;
CreateSurfaceWorker *m_worker;
Qt6CreateSurfaceWorker *m_worker;
};
QEvent::Type CreateSurfaceEvent::customEventType = QEvent::None;
QEvent::Type Qt6CreateSurfaceEvent::customEventType = QEvent::None;
CreateSurfaceWorker::CreateSurfaceWorker (struct SharedRenderData * rdata)
Qt6CreateSurfaceWorker::Qt6CreateSurfaceWorker (struct SharedRenderData * rdata)
{
m_sharedRenderData = shared_render_data_ref (rdata);
}
CreateSurfaceWorker::~CreateSurfaceWorker ()
Qt6CreateSurfaceWorker::~Qt6CreateSurfaceWorker ()
{
shared_render_data_unref (m_sharedRenderData);
}
bool CreateSurfaceWorker::event(QEvent * ev)
bool Qt6CreateSurfaceWorker::event(QEvent * ev)
{
if (ev->type() == CreateSurfaceEvent::type()) {
if (ev->type() == Qt6CreateSurfaceEvent::type()) {
GST_TRACE ("%p creating surface", m_sharedRenderData);
/* create the window surface in the main thread */
g_mutex_lock (&m_sharedRenderData->lock);
@ -284,7 +284,7 @@ bool GstQt6QuickRenderer::init (GstGLContext * context, GError ** error)
g_return_val_if_fail (GST_IS_GL_CONTEXT (context), false);
g_return_val_if_fail (gst_gl_context_get_current () == context, false);
QOpenGLContext *qt_native_context = qt_opengl_native_context_from_gst_gl_context (context);
QOpenGLContext *qt_native_context = qt6_opengl_native_context_from_gst_gl_context (context);
if (!qt_native_context) {
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_FOUND,
@ -340,11 +340,11 @@ bool GstQt6QuickRenderer::init (GstGLContext * context, GError ** error)
m_sharedRenderData->m_context = qt_native_context;
GST_TRACE ("%p new QOpenGLContext %p", this, m_sharedRenderData->m_context);
CreateSurfaceWorker *w = new CreateSurfaceWorker (m_sharedRenderData);
Qt6CreateSurfaceWorker *w = new Qt6CreateSurfaceWorker (m_sharedRenderData);
GST_TRACE ("%p posting create surface event to main thread with "
"worker %p", this, w);
w->moveToThread (app->thread());
app->postEvent (w, new CreateSurfaceEvent (w));
app->postEvent (w, new Qt6CreateSurfaceEvent (w));
m_sharedRenderData->state = STATE_WAITING_FOR_WINDOW;
}

View file

@ -107,13 +107,13 @@ private:
struct SharedRenderData *m_sharedRenderData;
};
class CreateSurfaceWorker : public QObject
class Qt6CreateSurfaceWorker : public QObject
{
Q_OBJECT
public:
CreateSurfaceWorker (struct SharedRenderData * rdata);
~CreateSurfaceWorker ();
Qt6CreateSurfaceWorker (struct SharedRenderData * rdata);
~Qt6CreateSurfaceWorker ();
bool event(QEvent *ev) override;