summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-08-04 10:19:33 +0300
committerSebastian Dröge <sebastian@centricular.com>2021-08-04 10:19:33 +0300
commit5abdbf850596d0782f3d7d471e5584305bd227f3 (patch)
treef5d3323807d792d3fa879ffba2c1bf121c575bf3
parentc5265dfa63be0adb8d6ede13837624b557565c44 (diff)
downloadgtk+-wip/gstmediafile-input.tar.gz
Add a pad template for the source padwip/gstmediafile-input
-rw-r--r--modules/media/gtkgstbin.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/media/gtkgstbin.c b/modules/media/gtkgstbin.c
index ee4456c7da..b7bc31ef3d 100644
--- a/modules/media/gtkgstbin.c
+++ b/modules/media/gtkgstbin.c
@@ -21,6 +21,11 @@
#include "gtkgstbinprivate.h"
+static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
struct _GtkGstBin {
GstBin parent;
@@ -82,13 +87,17 @@ G_DEFINE_TYPE_WITH_CODE (GtkGstBin, gtk_gst_bin, GST_TYPE_BIN,
static void
gtk_gst_bin_init (GtkGstBin *self)
{
+ GstPadTemplate *templ;
+ GstPad *pad;
+
self->src = gst_element_factory_make ("giostreamsrc", "src");
- g_object_ref_sink (self->src);
gst_bin_add (GST_BIN (self), self->src);
+ templ = gst_element_get_pad_template (GST_ELEMENT (self), "src");
+ pad = gst_element_get_static_pad (self->src, "src");
gst_element_add_pad (GST_ELEMENT (self),
- gst_ghost_pad_new ("src", gst_element_get_static_pad (self->src, "src")));
-
+ gst_ghost_pad_new_from_template ("src", pad, templ));
+ gst_object_unref (pad);
}
static void
@@ -98,6 +107,8 @@ gtk_gst_bin_class_init (GtkGstBinClass *class)
"GtkGstBin",
"Source", "Handles GtkMediaFile sources",
"Matthias Clasen");
+
+ gst_element_class_add_static_pad_template (GST_ELEMENT_CLASS (class), &src_templ);
}
void