summaryrefslogtreecommitdiff
path: root/gst/multipart/multipartdemux.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/multipart/multipartdemux.c')
-rw-r--r--gst/multipart/multipartdemux.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/gst/multipart/multipartdemux.c b/gst/multipart/multipartdemux.c
index a5a51a2..525143c 100644
--- a/gst/multipart/multipartdemux.c
+++ b/gst/multipart/multipartdemux.c
@@ -62,14 +62,16 @@ enum
LAST_SIGNAL
};
-#define DEFAULT_AUTOSCAN FALSE
-#define DEFAULT_BOUNDARY NULL
+#define DEFAULT_AUTOSCAN FALSE
+#define DEFAULT_BOUNDARY NULL
+#define DEFAULT_SINGLE_STREAM FALSE
enum
{
PROP_0,
PROP_AUTOSCAN,
- PROP_BOUNDARY
+ PROP_BOUNDARY,
+ PROP_SINGLE_STREAM
};
static GstStaticPadTemplate multipart_demux_src_template_factory =
@@ -132,10 +134,10 @@ gst_multipart_demux_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&multipart_demux_sink_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&multipart_demux_src_template_factory));
+ gst_element_class_add_static_pad_template (element_class,
+ &multipart_demux_sink_template_factory);
+ gst_element_class_add_static_pad_template (element_class,
+ &multipart_demux_src_template_factory);
gst_element_class_set_details_simple (element_class, "Multipart demuxer",
"Codec/Demuxer",
"demux multipart streams",
@@ -165,6 +167,20 @@ gst_multipart_demux_class_init (GstMultipartDemuxClass * klass)
"Try to autofind the prefix (deprecated unused, see boundary)",
DEFAULT_AUTOSCAN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstMultipartDemux::single-stream:
+ *
+ * Assume that there is only one stream whose content-type will
+ * not change and emit no-more-pads as soon as the first boundary
+ * content is parsed, decoded, and pads are linked.
+ *
+ * Since: 0.10.31
+ */
+ g_object_class_install_property (gobject_class, PROP_SINGLE_STREAM,
+ g_param_spec_boolean ("single-stream", "Single Stream",
+ "Assume that there is only one stream whose content-type will not change and emit no-more-pads as soon as the first boundary content is parsed, decoded, and pads are linked",
+ DEFAULT_SINGLE_STREAM, G_PARAM_READWRITE));
+
/* populate gst names and mime types pairs */
klass->gstnames = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; gstnames[i].key; i++) {
@@ -194,6 +210,7 @@ gst_multipart_demux_init (GstMultipartDemux * multipart,
multipart->header_completed = FALSE;
multipart->scanpos = 0;
multipart->autoscan = DEFAULT_AUTOSCAN;
+ multipart->singleStream = DEFAULT_SINGLE_STREAM;
}
static void
@@ -324,6 +341,10 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime,
*created = TRUE;
}
+ if (demux->singleStream) {
+ gst_element_no_more_pads (GST_ELEMENT_CAST (demux));
+ }
+
return mppad;
}
}
@@ -664,6 +685,9 @@ gst_multipart_set_property (GObject * object, guint prop_id,
case PROP_AUTOSCAN:
filter->autoscan = g_value_get_boolean (value);
break;
+ case PROP_SINGLE_STREAM:
+ filter->singleStream = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -686,6 +710,9 @@ gst_multipart_get_property (GObject * object, guint prop_id,
case PROP_AUTOSCAN:
g_value_set_boolean (value, filter->autoscan);
break;
+ case PROP_SINGLE_STREAM:
+ g_value_set_boolean (value, filter->singleStream);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;