From a78d3beebfe59309b80c826e43978e71153f7ec9 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 20 Apr 2004 09:43:34 +0000 Subject: [PATCH] gst/gstpad.c (_invent_event): Clean up Original commit message from CVS: * gst/gstpad.c (_invent_event): Clean up --- ChangeLog | 4 ++++ gst/gstpad.c | 27 ++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed27e51a2a..61f3a2dfe7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-04-20 Johan Dahlin + + * gst/gstpad.c (_invent_event): Clean up + 2004-04-20 Benjamin Otte * testsuite/caps/filtercaps.c: (main): diff --git a/gst/gstpad.c b/gst/gstpad.c index b691257150..480a70486d 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3026,26 +3026,35 @@ gst_ghost_pad_save_thyself (GstPad * pad, xmlNodePtr parent) static GstData * _invent_event (GstPad * pad, GstBuffer * buffer) { - GstData *data; + GstEvent *event; + GstEventType event_type; + guint64 offset; + + if (GST_BUFFER_OFFSET_IS_VALID (buffer)) + event_type = GST_FORMAT_DEFAULT; + else + event_type = GST_FORMAT_UNDEFINED; + + offset = GST_BUFFER_OFFSET (buffer); if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) { - data = GST_DATA (gst_event_new_discontinuous (TRUE, GST_FORMAT_TIME, - GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_OFFSET_IS_VALID (buffer) ? - GST_FORMAT_DEFAULT : 0, GST_BUFFER_OFFSET (buffer), 0)); + GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer); + + event = gst_event_new_discontinuous (TRUE, + GST_FORMAT_TIME, timestamp, event_type, offset, GST_FORMAT_UNDEFINED); GST_CAT_WARNING (GST_CAT_DATAFLOW, "needed to invent a DISCONT (time %" G_GUINT64_FORMAT - ") for %s:%s => %s:%s", GST_BUFFER_TIMESTAMP (buffer), + ") for %s:%s => %s:%s", timestamp, GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad)); } else { - data = GST_DATA (gst_event_new_discontinuous (TRUE, - GST_BUFFER_OFFSET_IS_VALID (buffer) ? GST_FORMAT_DEFAULT : 0, - GST_BUFFER_OFFSET (buffer), 0)); + event = gst_event_new_discontinuous (TRUE, + event_type, offset, GST_FORMAT_UNDEFINED); GST_CAT_WARNING (GST_CAT_DATAFLOW, "needed to invent a DISCONT (no time) for %s:%s => %s:%s", GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad)); } - return data; + return GST_DATA (event); } /** -- 2.34.1