Commit 5c1e2a1e authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

gst/: Post an error message when we get an EOS event and were not able to find...

gst/: Post an error message when we get an EOS event and were not able to find out the type of stream.

Original commit message from CVS:
* gst/apetag/gsttagdemux.c: (gst_tag_demux_init),
(gst_tag_demux_sink_event):
* gst/id3demux/gstid3demux.c: (gst_id3demux_init),
(gst_id3demux_sink_event):
Post an error message when we get an EOS event and were not
able to find out the type of stream.
* tests/check/elements/id3v2mux.c: (fill_mp3_buffer), (got_buffer),
(test_taglib_id3mux_with_tags):
Decrease num-buffers to 16 per iteration again, otherwise the
many memcpy()s and reallocations in the test will hammer slow
CPUs completely and make the test timeout.
parent 7df5ab1b
2006-05-02 Tim-Philipp Müller <tim at centricular dot net>
* gst/apetag/gsttagdemux.c: (gst_tag_demux_init),
(gst_tag_demux_sink_event):
* gst/id3demux/gstid3demux.c: (gst_id3demux_init),
(gst_id3demux_sink_event):
Post an error message when we get an EOS event and were not
able to find out the type of stream.
* tests/check/elements/id3v2mux.c: (fill_mp3_buffer), (got_buffer),
(test_taglib_id3mux_with_tags):
Decrease num-buffers to 16 per iteration again, otherwise the
many memcpy()s and reallocations in the test will hammer slow
CPUs completely and make the test timeout.
2006-05-02 Thomas Vander Stichele <thomas at apestaart dot org> 2006-05-02 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac: * configure.ac:
......
...@@ -129,6 +129,7 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", ...@@ -129,6 +129,7 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
static void gst_tag_demux_dispose (GObject * object); static void gst_tag_demux_dispose (GObject * object);
static GstFlowReturn gst_tag_demux_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_tag_demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_tag_demux_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active); static gboolean gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active);
static GstFlowReturn gst_tag_demux_read_range (GstTagDemux * tagdemux, static GstFlowReturn gst_tag_demux_read_range (GstTagDemux * tagdemux,
...@@ -260,6 +261,8 @@ gst_tag_demux_init (GstTagDemux * demux, GstTagDemuxClass * gclass) ...@@ -260,6 +261,8 @@ gst_tag_demux_init (GstTagDemux * demux, GstTagDemuxClass * gclass)
gst_pad_set_activate_function (demux->priv->sinkpad, gst_pad_set_activate_function (demux->priv->sinkpad,
GST_DEBUG_FUNCPTR (gst_tag_demux_sink_activate)); GST_DEBUG_FUNCPTR (gst_tag_demux_sink_activate));
gst_pad_set_event_function (demux->priv->sinkpad,
GST_DEBUG_FUNCPTR (gst_tag_demux_sink_event));
gst_pad_set_chain_function (demux->priv->sinkpad, gst_pad_set_chain_function (demux->priv->sinkpad,
GST_DEBUG_FUNCPTR (gst_tag_demux_chain)); GST_DEBUG_FUNCPTR (gst_tag_demux_chain));
gst_element_add_pad (GST_ELEMENT (demux), demux->priv->sinkpad); gst_element_add_pad (GST_ELEMENT (demux), demux->priv->sinkpad);
...@@ -634,6 +637,31 @@ error: ...@@ -634,6 +637,31 @@ error:
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
static gboolean
gst_tag_demux_sink_event (GstPad * pad, GstEvent * event)
{
GstTagDemux *demux;
gboolean ret;
demux = GST_TAG_DEMUX (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
if (demux->priv->srcpad == NULL) {
GST_WARNING_OBJECT (demux, "EOS before we found a type");
GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
}
ret = gst_pad_event_default (pad, event);
break;
default:
ret = gst_pad_event_default (pad, event);
break;
}
gst_object_unref (demux);
return ret;
}
static gboolean static gboolean
gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux) gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux)
{ {
......
...@@ -95,7 +95,7 @@ static void gst_id3demux_get_property (GObject * object, guint prop_id, ...@@ -95,7 +95,7 @@ static void gst_id3demux_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_id3demux_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_id3demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_id3demux_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_id3demux_src_activate_pull (GstPad * pad, gboolean active); static gboolean gst_id3demux_src_activate_pull (GstPad * pad, gboolean active);
static GstFlowReturn gst_id3demux_read_range (GstID3Demux * id3demux, static GstFlowReturn gst_id3demux_read_range (GstID3Demux * id3demux,
guint64 offset, guint length, GstBuffer ** buffer); guint64 offset, guint length, GstBuffer ** buffer);
...@@ -217,6 +217,8 @@ gst_id3demux_init (GstID3Demux * id3demux) ...@@ -217,6 +217,8 @@ gst_id3demux_init (GstID3Demux * id3demux)
"sink"), "sink"); "sink"), "sink");
gst_pad_set_activate_function (id3demux->sinkpad, gst_pad_set_activate_function (id3demux->sinkpad,
GST_DEBUG_FUNCPTR (gst_id3demux_sink_activate)); GST_DEBUG_FUNCPTR (gst_id3demux_sink_activate));
gst_pad_set_event_function (id3demux->sinkpad,
GST_DEBUG_FUNCPTR (gst_id3demux_sink_event));
gst_pad_set_chain_function (id3demux->sinkpad, gst_pad_set_chain_function (id3demux->sinkpad,
GST_DEBUG_FUNCPTR (gst_id3demux_chain)); GST_DEBUG_FUNCPTR (gst_id3demux_chain));
gst_element_add_pad (GST_ELEMENT (id3demux), id3demux->sinkpad); gst_element_add_pad (GST_ELEMENT (id3demux), id3demux->sinkpad);
...@@ -532,6 +534,32 @@ error: ...@@ -532,6 +534,32 @@ error:
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
static gboolean
gst_id3demux_sink_event (GstPad * pad, GstEvent * event)
{
GstID3Demux *demux;
gboolean ret;
demux = GST_ID3DEMUX (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
if (demux->srcpad == NULL) {
GST_WARNING_OBJECT (demux, "EOS before we found a type");
GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
}
ret = gst_pad_event_default (pad, event);
break;
default:
ret = gst_pad_event_default (pad, event);
break;
}
gst_object_unref (demux);
return ret;
}
static void static void
gst_id3demux_set_property (GObject * object, guint prop_id, gst_id3demux_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
......
...@@ -171,7 +171,7 @@ fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad, ...@@ -171,7 +171,7 @@ fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad,
{ {
GstCaps *caps; GstCaps *caps;
g_assert (GST_BUFFER_SIZE (buf) == MP3_FRAME_SIZE); fail_unless (GST_BUFFER_SIZE (buf) == MP3_FRAME_SIZE);
GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT, GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT,
*p_offset); *p_offset);
...@@ -294,7 +294,7 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask) ...@@ -294,7 +294,7 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask)
/* set up source */ /* set up source */
g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE, g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE,
"filltype", 2, "sizetype", 2, "sizemax", MP3_FRAME_SIZE, "filltype", 2, "sizetype", 2, "sizemax", MP3_FRAME_SIZE,
"num-buffers", 256, NULL); "num-buffers", 16, NULL);
offset = 0; offset = 0;
g_signal_connect (fakesrc, "handoff", G_CALLBACK (fill_mp3_buffer), &offset); g_signal_connect (fakesrc, "handoff", G_CALLBACK (fill_mp3_buffer), &offset);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment