[gtk/wip/gstmediafile-input] Force widget-factory to use an input stream



commit c5265dfa63be0adb8d6ede13837624b557565c44
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 3 14:59:21 2021 -0400

    Force widget-factory to use an input stream
    
    This is just to test the input stream support in
    GtkGstMediaFile.

 demos/widget-factory/widget-factory.c  | 14 ++++++++++++++
 demos/widget-factory/widget-factory.ui |  5 +++--
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 5b10ecdd74..997dfad7d5 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -2310,6 +2310,20 @@ activate (GApplication *app)
   model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
   set_up_context_popover (widget, model);
 
+  widget = (GtkWidget *)gtk_builder_get_object (builder, "video");
+
+  GFile *file;
+  GInputStream *input_stream;
+  GtkMediaStream *media_stream;
+
+  file = g_file_new_for_uri ("resource:///org/gtk/WidgetFactory4/gtk-logo.webm");
+  input_stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
+  media_stream = gtk_media_file_new_for_input_stream (input_stream);
+  gtk_video_set_media_stream (GTK_VIDEO (widget), media_stream);
+  g_object_unref (media_stream);
+  g_object_unref (input_stream);
+  g_object_unref (file);
+
   gtk_widget_show (GTK_WIDGET (window));
 
   g_object_unref (builder);
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index c37ade2945..195bd77d01 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -1060,16 +1060,17 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkVideo">
+                                  <object class="GtkVideo" id="video">
                                     <property name="halign">center</property>
                                     <property name="valign">center</property>
                                     <property name="margin-start">6</property>
                                     <property name="margin-end">6</property>
                                     <property name="margin-top">6</property>
                                     <property name="margin-bottom">6</property>
+                                  <!--
                                     <property name="autoplay">1</property>
                                     <property name="loop">1</property>
-                                    <property 
name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
+                                  -->
                                   </object>
                                 </child>
                               </object>


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