summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-08-07 16:11:14 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-08-07 16:11:14 +0000
commitb0e3d44956b2ed01c027dab311441c99bf6fb318 (patch)
treedd8e200d0418c99259a89818f06da76c6c4a896c
parent89be24615416e27a9b1137bfa1812d628d639bd9 (diff)
ext/ogg/gstoggmux.*: Don't pretend to support NEWSEGMENT events, instead override the
Original commit message from CVS: * ext/ogg/gstoggmux.c: (gst_ogg_mux_sink_event), (gst_ogg_mux_request_new_pad): * ext/ogg/gstoggmux.h: Don't pretend to support NEWSEGMENT events, instead override the GstCollectPads event function to return FALSE on NEWSEGMENT events and do the normal work for other events. This prevents elements like flacenc to seek to the start and rewrite some data which then results in a broken Ogg packet.
-rw-r--r--ChangeLog12
-rw-r--r--ext/ogg/gstoggmux.c34
-rw-r--r--ext/ogg/gstoggmux.h2
3 files changed, 48 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a4dc02cfd..303a7d4fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-08-07 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/ogg/gstoggmux.c: (gst_ogg_mux_sink_event),
+ (gst_ogg_mux_request_new_pad):
+ * ext/ogg/gstoggmux.h:
+ Don't pretend to support NEWSEGMENT events, instead override the
+ GstCollectPads event function to return FALSE on NEWSEGMENT events
+ and do the normal work for other events.
+
+ This prevents elements like flacenc to seek to the start and rewrite
+ some data which then results in a broken Ogg packet.
+
2008-08-07 Tim-Philipp Müller <tim.muller at collabora co uk>
Patch by: Frederic Crozat <fcrozat@mandriva.org>
diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c
index 7ab13cf62..1cacfc9c9 100644
--- a/ext/ogg/gstoggmux.c
+++ b/ext/ogg/gstoggmux.c
@@ -300,6 +300,35 @@ gst_ogg_mux_sinkconnect (GstPad * pad, GstPad * peer)
return GST_PAD_LINK_OK;
}
+static gboolean
+gst_ogg_mux_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstOggMux *ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
+ GstOggPad *ogg_pad = (GstOggPad *) gst_pad_get_element_private (pad);
+ gboolean ret;
+
+ GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
+ GST_DEBUG_PAD_NAME (pad));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NEWSEGMENT:
+ /* We don't support NEWSEGMENT events */
+ gst_event_unref (event);
+ ret = FALSE;
+ break;
+ default:
+ ret = TRUE;
+ break;
+ }
+
+ /* now GstCollectPads can take care of the rest, e.g. EOS */
+ if (ret)
+ ret = ogg_pad->collect_event (pad, event);
+
+ gst_object_unref (ogg_mux);
+ return ret;
+}
+
static GstPad *
gst_ogg_mux_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * req_name)
@@ -359,11 +388,16 @@ gst_ogg_mux_request_new_pad (GstElement * element,
oggpad->first_delta = FALSE;
oggpad->prev_delta = FALSE;
oggpad->pagebuffers = g_queue_new ();
+
+ oggpad->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
+ gst_pad_set_event_function (newpad,
+ GST_DEBUG_FUNCPTR (gst_ogg_mux_sink_event));
}
}
/* setup some pad functions */
gst_pad_set_link_function (newpad, gst_ogg_mux_sinkconnect);
+
/* dd the pad to the element */
gst_element_add_pad (element, newpad);
diff --git a/ext/ogg/gstoggmux.h b/ext/ogg/gstoggmux.h
index dc7965f95..4d1d233c9 100644
--- a/ext/ogg/gstoggmux.h
+++ b/ext/ogg/gstoggmux.h
@@ -77,6 +77,8 @@ typedef struct
gboolean new_page; /* starting a new page */
gboolean first_delta; /* was the first packet in the page a delta */
gboolean prev_delta; /* was the previous buffer a delta frame */
+
+ GstPadEventFunction collect_event;
}
GstOggPad;