gst/gstpad.c (_invent_event): Clean up

Original commit message from CVS:
* gst/gstpad.c (_invent_event): Clean up
This commit is contained in:
Johan Dahlin 2004-04-20 09:43:34 +00:00
parent 5f524cd068
commit a78d3beebf
2 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,7 @@
2004-04-20 Johan Dahlin <johan@gnome.org>
* gst/gstpad.c (_invent_event): Clean up
2004-04-20 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-04-20 Benjamin Otte <in7y118@public.uni-hamburg.de>
* testsuite/caps/filtercaps.c: (main): * testsuite/caps/filtercaps.c: (main):

View file

@ -3026,26 +3026,35 @@ gst_ghost_pad_save_thyself (GstPad * pad, xmlNodePtr parent)
static GstData * static GstData *
_invent_event (GstPad * pad, GstBuffer * buffer) _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)) { if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
data = GST_DATA (gst_event_new_discontinuous (TRUE, GST_FORMAT_TIME, GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_OFFSET_IS_VALID (buffer) ?
GST_FORMAT_DEFAULT : 0, GST_BUFFER_OFFSET (buffer), 0)); event = gst_event_new_discontinuous (TRUE,
GST_FORMAT_TIME, timestamp, event_type, offset, GST_FORMAT_UNDEFINED);
GST_CAT_WARNING (GST_CAT_DATAFLOW, GST_CAT_WARNING (GST_CAT_DATAFLOW,
"needed to invent a DISCONT (time %" G_GUINT64_FORMAT "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)); GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
} else { } else {
data = GST_DATA (gst_event_new_discontinuous (TRUE, event = gst_event_new_discontinuous (TRUE,
GST_BUFFER_OFFSET_IS_VALID (buffer) ? GST_FORMAT_DEFAULT : 0, event_type, offset, GST_FORMAT_UNDEFINED);
GST_BUFFER_OFFSET (buffer), 0));
GST_CAT_WARNING (GST_CAT_DATAFLOW, GST_CAT_WARNING (GST_CAT_DATAFLOW,
"needed to invent a DISCONT (no time) for %s:%s => %s:%s", "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)); GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
} }
return data; return GST_DATA (event);
} }
/** /**