[gtk/matthiasc/color-profile-rebased: 39/46] media: Use the new GL texture constructor




commit 587771171709a50fb87063e3668f770098535f3e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 8 14:58:20 2022 -0400

    media: Use the new GL texture constructor
    
    Use GdkGLTextureFlags in the gstreamer backend
    to tell gsk that the buffers are unpremultiplied,
    non-linear sRGB.

 modules/media/gtkgstsink.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/modules/media/gtkgstsink.c b/modules/media/gtkgstsink.c
index 529952fffc..139df579cc 100644
--- a/modules/media/gtkgstsink.c
+++ b/modules/media/gtkgstsink.c
@@ -291,17 +291,20 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
       GstGLSyncMeta *sync_meta;
 
       sync_meta = gst_buffer_get_gl_sync_meta (buffer);
-      if (sync_meta) {
-        gst_gl_sync_meta_set_sync_point (sync_meta, self->gst_context);
-        gst_gl_sync_meta_wait (sync_meta, self->gst_context);
-      }
-
-      texture = gdk_gl_texture_new (self->gdk_context,
-                                    *(guint *) frame->data[0],
-                                    frame->info.width,
-                                    frame->info.height,
-                                    (GDestroyNotify) video_frame_free,
-                                    frame);
+      if (sync_meta)
+        {
+          gst_gl_sync_meta_set_sync_point (sync_meta, self->gst_context);
+          gst_gl_sync_meta_wait (sync_meta, self->gst_context);
+        }
+
+      texture = gdk_gl_texture_new_with_color_profile (self->gdk_context,
+                                                       *(guint *) frame->data[0],
+                                                       frame->info.width,
+                                                       frame->info.height,
+                                                       0, /* Neither premultiplied nor flipped */
+                                                       gdk_color_profile_get_srgb (),
+                                                       (GDestroyNotify) video_frame_free,
+                                                       frame);
 
       *pixel_aspect_ratio = ((double) frame->info.par_n) / ((double) frame->info.par_d);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]