[gtk/matthiasc/gl-media-stream: 24/27] video: Realize the media stream before setting a file




commit afced57b1ca6b2be1e0c65e18e8867e5e97f78ef
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 29 15:55:28 2020 -0500

    video: Realize the media stream before setting a file
    
    This makes it so that we obtain a GL context before
    creating the GstSink, so we at least advertise our
    ability to handle GL buffer.
    
    Gstreamer still won't send us any.

 gtk/gtkvideo.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c
index 7eee5fd5ba..e9fb80f652 100644
--- a/gtk/gtkvideo.c
+++ b/gtk/gtkvideo.c
@@ -679,7 +679,13 @@ gtk_video_set_file (GtkVideo *self,
       stream = gtk_media_file_new ();
 
       if (gtk_widget_get_realized (GTK_WIDGET (self)))
-        gtk_media_file_set_file (GTK_MEDIA_FILE (stream), file);
+        {
+          GdkSurface *surface;
+
+          surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
+          gtk_media_stream_realize (stream, surface);
+          gtk_media_file_set_file (GTK_MEDIA_FILE (stream), file);
+        }
       gtk_video_set_media_stream (self, stream);
 
       g_object_unref (stream);


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