From 864faa34cd1f87ed3383b34cc694b184330a4d88 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 26 Jul 2024 08:18:21 +0200 Subject: [PATCH] qt6: Rename symbols to avoid conflict in static builds Part-of: --- .../ext/qt6/gstqsg6material.cc | 56 +++++++++---------- .../ext/qt6/gstqsg6material.h | 12 ++-- .../ext/qt6/gstqt6glutility.cc | 2 +- .../ext/qt6/gstqt6glutility.h | 2 +- .../gst-plugins-good/ext/qt6/qt6glitem.cc | 6 +- .../gst-plugins-good/ext/qt6/qt6glrenderer.cc | 26 ++++----- .../gst-plugins-good/ext/qt6/qt6glrenderer.h | 6 +- 7 files changed, 55 insertions(+), 55 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc b/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc index 722ee1412a..3848f1cab8 100644 --- a/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc +++ b/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc @@ -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(newMaterial); + auto *mat = static_cast(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(new GstQSGMaterial_RGBA_SWIZZLE()); + return static_cast(new GstQSG6Material_RGBA_SWIZZLE()); } switch (format) { case GST_VIDEO_FORMAT_YV12: - return static_cast(new GstQSGMaterial_YUV_TRIPLANAR()); + return static_cast(new GstQSG6Material_YUV_TRIPLANAR()); case GST_VIDEO_FORMAT_NV12: - return static_cast(new GstQSGMaterial_YUV_BIPLANAR()); + return static_cast(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; diff --git a/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.h b/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.h index a2c703ef78..3bf9fb8ecf 100644 --- a/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.h +++ b/subprojects/gst-plugins-good/ext/qt6/gstqsg6material.h @@ -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; diff --git a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc index 6802cf16d2..e40fcb75f5 100644 --- a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc +++ b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.cc @@ -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; diff --git a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.h b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.h index a3a5561306..c407056a4f 100644 --- a/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.h +++ b/subprojects/gst-plugins-good/ext/qt6/gstqt6glutility.h @@ -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__ */ diff --git a/subprojects/gst-plugins-good/ext/qt6/qt6glitem.cc b/subprojects/gst-plugins-good/ext/qt6/qt6glitem.cc index 5314b01acd..971a027de9 100644 --- a/subprojects/gst-plugins-good/ext/qt6/qt6glitem.cc +++ b/subprojects/gst-plugins-good/ext/qt6/qt6glitem.cc @@ -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(texNode->material()); + tex = static_cast(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); diff --git a/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.cc b/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.cc index 20b803cdb7..cbf6b2911d 100644 --- a/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.cc +++ b/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.cc @@ -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; } diff --git a/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.h b/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.h index 0d36a66117..c0636e455d 100644 --- a/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.h +++ b/subprojects/gst-plugins-good/ext/qt6/qt6glrenderer.h @@ -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;