diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-04-04 17:06:18 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-04-10 08:25:50 +0200 |
commit | d445027ec17954820c60379b5aadd16274ad683f (patch) | |
tree | baaee7315c5cb3bbff07d40c2543a35e56c6efed /gst/gstevent.c | |
parent | 3004cc5f45427c44e425c9130faef53aa62438f0 (diff) | |
download | gstreamer-d445027ec17954820c60379b5aadd16274ad683f.tar.gz |
event: Add running-time-offset field to all events
Events passing through #GstPads that have a running time
offset set via gst_pad_set_offset() will get their offset
adjusted according to the pad's offset.
If the event contains any information that related to the
running time, this information will need to be updated
before usage with this offset.
Diffstat (limited to 'gst/gstevent.c')
-rw-r--r-- | gst/gstevent.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gst/gstevent.c b/gst/gstevent.c index 6be7d6291e..f31d3ed9df 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -90,6 +90,7 @@ typedef struct GstEvent event; GstStructure *structure; + gint64 running_time_offset; } GstEventImpl; #define GST_EVENT_STRUCTURE(e) (((GstEventImpl *)(e))->structure) @@ -251,6 +252,10 @@ _gst_event_copy (GstEvent * event) } else { GST_EVENT_STRUCTURE (copy) = NULL; } + + ((GstEventImpl *) copy)->running_time_offset = + ((GstEventImpl *) event)->running_time_offset; + return GST_EVENT_CAST (copy); } @@ -264,6 +269,7 @@ gst_event_init (GstEventImpl * event, GstEventType type) GST_EVENT_TYPE (event) = type; GST_EVENT_TIMESTAMP (event) = GST_CLOCK_TIME_NONE; GST_EVENT_SEQNUM (event) = gst_util_seqnum_next (); + event->running_time_offset = 0; } @@ -443,6 +449,54 @@ gst_event_set_seqnum (GstEvent * event, guint32 seqnum) } /** + * gst_event_get_running_time_offset: + * @event: A #GstEvent. + * + * Retrieve the accumulated running time offset of the event. + * + * Events passing through #GstPads that have a running time + * offset set via gst_pad_set_offset() will get their offset + * adjusted according to the pad's offset. + * + * If the event contains any information that related to the + * running time, this information will need to be updated + * before usage with this offset. + * + * Returns: The event's running time offset + * + * MT safe. + * + * Since: 1.4 + */ +gint64 +gst_event_get_running_time_offset (GstEvent * event) +{ + g_return_val_if_fail (GST_IS_EVENT (event), 0); + + return ((GstEventImpl *) event)->running_time_offset; +} + +/** + * gst_event_set_running_time_offset: + * @event: A #GstEvent. + * @offset: A the new running time offset + * + * Set the running time offset of a event. See + * gst_event_get_running_time_offset() for more information. + * + * MT safe. + * + * Since: 1.4 + */ +void +gst_event_set_running_time_offset (GstEvent * event, gint64 offset) +{ + g_return_if_fail (GST_IS_EVENT (event)); + + ((GstEventImpl *) event)->running_time_offset = offset; +} + +/** * gst_event_new_flush_start: * * Allocate a new flush start event. The flush start event can be sent |