mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 08:08:22 +00:00
multipartdemux: Post an error message on the bus if we got EOS without having added any pads
This commit is contained in:
parent
37f991f06e
commit
f48fef2f77
1 changed files with 28 additions and 0 deletions
|
@ -106,6 +106,8 @@ static const GstNamesMap gstnames[] = {
|
|||
|
||||
static GstFlowReturn gst_multipart_demux_chain (GstPad * pad,
|
||||
GstObject * parent, GstBuffer * buf);
|
||||
static gboolean gst_multipart_demux_event (GstPad * pad,
|
||||
GstObject * parent, GstEvent * event);
|
||||
|
||||
static GstStateChangeReturn gst_multipart_demux_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
|
@ -179,6 +181,8 @@ gst_multipart_demux_init (GstMultipartDemux * multipart)
|
|||
gst_element_add_pad (GST_ELEMENT_CAST (multipart), multipart->sinkpad);
|
||||
gst_pad_set_chain_function (multipart->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_multipart_demux_chain));
|
||||
gst_pad_set_event_function (multipart->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_multipart_demux_event));
|
||||
|
||||
multipart->adapter = gst_adapter_new ();
|
||||
multipart->boundary = DEFAULT_BOUNDARY;
|
||||
|
@ -571,6 +575,30 @@ multipart_find_boundary (GstMultipartDemux * multipart, gint * datalen)
|
|||
return MULTIPART_NEED_MORE_DATA;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_multipart_demux_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||
{
|
||||
GstMultipartDemux *multipart;
|
||||
|
||||
multipart = GST_MULTIPART_DEMUX (parent);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (!multipart->srcpads) {
|
||||
GST_ELEMENT_ERROR (multipart, STREAM, WRONG_TYPE,
|
||||
("This stream contains no valid streams."),
|
||||
("Got EOS before adding any pads"));
|
||||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
} else {
|
||||
return gst_pad_event_default (pad, parent, event);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return gst_pad_event_default (pad, parent, event);
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_multipart_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue