mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
multipartdemux: Add property to assume a single stream and emit no-more-pads
Fixes bug #616686.
This commit is contained in:
parent
c39b7a5359
commit
86f9fa785a
2 changed files with 32 additions and 3 deletions
|
@ -62,14 +62,16 @@ enum
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_AUTOSCAN FALSE
|
#define DEFAULT_AUTOSCAN FALSE
|
||||||
#define DEFAULT_BOUNDARY NULL
|
#define DEFAULT_BOUNDARY NULL
|
||||||
|
#define DEFAULT_SINGLE_STREAM FALSE
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_AUTOSCAN,
|
PROP_AUTOSCAN,
|
||||||
PROP_BOUNDARY
|
PROP_BOUNDARY,
|
||||||
|
PROP_SINGLE_STREAM
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstStaticPadTemplate multipart_demux_src_template_factory =
|
static GstStaticPadTemplate multipart_demux_src_template_factory =
|
||||||
|
@ -165,6 +167,20 @@ gst_multipart_demux_class_init (GstMultipartDemuxClass * klass)
|
||||||
"Try to autofind the prefix (deprecated unused, see boundary)",
|
"Try to autofind the prefix (deprecated unused, see boundary)",
|
||||||
DEFAULT_AUTOSCAN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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.30
|
||||||
|
*/
|
||||||
|
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 */
|
/* populate gst names and mime types pairs */
|
||||||
klass->gstnames = g_hash_table_new (g_str_hash, g_str_equal);
|
klass->gstnames = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
for (i = 0; gstnames[i].key; i++) {
|
for (i = 0; gstnames[i].key; i++) {
|
||||||
|
@ -194,6 +210,7 @@ gst_multipart_demux_init (GstMultipartDemux * multipart,
|
||||||
multipart->header_completed = FALSE;
|
multipart->header_completed = FALSE;
|
||||||
multipart->scanpos = 0;
|
multipart->scanpos = 0;
|
||||||
multipart->autoscan = DEFAULT_AUTOSCAN;
|
multipart->autoscan = DEFAULT_AUTOSCAN;
|
||||||
|
multipart->singleStream = DEFAULT_SINGLE_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -324,6 +341,10 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime,
|
||||||
*created = TRUE;
|
*created = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (demux->singleStream) {
|
||||||
|
gst_element_no_more_pads (GST_ELEMENT_CAST (demux));
|
||||||
|
}
|
||||||
|
|
||||||
return mppad;
|
return mppad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,6 +685,9 @@ gst_multipart_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_AUTOSCAN:
|
case PROP_AUTOSCAN:
|
||||||
filter->autoscan = g_value_get_boolean (value);
|
filter->autoscan = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SINGLE_STREAM:
|
||||||
|
filter->singleStream = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -686,6 +710,9 @@ gst_multipart_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_AUTOSCAN:
|
case PROP_AUTOSCAN:
|
||||||
g_value_set_boolean (value, filter->autoscan);
|
g_value_set_boolean (value, filter->autoscan);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SINGLE_STREAM:
|
||||||
|
g_value_set_boolean (value, filter->singleStream);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -84,6 +84,8 @@ struct _GstMultipartDemux
|
||||||
|
|
||||||
/* Index inside the current data when manually looking for the boundary */
|
/* Index inside the current data when manually looking for the boundary */
|
||||||
gint scanpos;
|
gint scanpos;
|
||||||
|
|
||||||
|
gboolean singleStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMultipartDemuxClass
|
struct _GstMultipartDemuxClass
|
||||||
|
|
Loading…
Reference in a new issue