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




commit 8f585f7a53a2152801843357c7f9e6b8fb9bdea3
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 15a5e25a36..f5b6f303e0 100644
--- a/gtk/gtkvideo.c
+++ b/gtk/gtkvideo.c
@@ -688,7 +688,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]