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




commit 8dcd5f488fc6652e52f1a807a34db783df485640
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 3c41af73f3..8d2e27c54e 100644
--- a/modules/media/gtkgstsink.c
+++ b/modules/media/gtkgstsink.c
@@ -290,17 +290,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]