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




commit b6238235f4b8193bfc358a74ac18d3e0927bb922
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 62d93b6b5c..c0df124a1c 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_space (self->gdk_context,
+                                                     *(guint *) frame->data[0],
+                                                     frame->info.width,
+                                                     frame->info.height,
+                                                     0, /* Neither premultiplied nor flipped */
+                                                     gdk_color_space_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]