mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
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.
This commit is contained in:
parent
3004cc5f45
commit
d445027ec1
4 changed files with 63 additions and 0 deletions
|
@ -1055,6 +1055,9 @@ gst_event_has_name
|
|||
gst_event_get_seqnum
|
||||
gst_event_set_seqnum
|
||||
|
||||
gst_event_get_running_time_offset
|
||||
gst_event_set_running_time_offset
|
||||
|
||||
gst_event_new_flush_start
|
||||
gst_event_new_flush_stop
|
||||
gst_event_parse_flush_stop
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -442,6 +448,54 @@ gst_event_set_seqnum (GstEvent * event, guint32 seqnum)
|
|||
GST_EVENT_SEQNUM (event) = 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:
|
||||
*
|
||||
|
|
|
@ -482,6 +482,10 @@ gboolean gst_event_has_name (GstEvent *event, const gchar *n
|
|||
guint32 gst_event_get_seqnum (GstEvent *event);
|
||||
void gst_event_set_seqnum (GstEvent *event, guint32 seqnum);
|
||||
|
||||
/* accumulated pad offsets for the event */
|
||||
gint64 gst_event_get_running_time_offset (GstEvent *event);
|
||||
void gst_event_set_running_time_offset (GstEvent *event, gint64 offset);
|
||||
|
||||
/* Stream start event */
|
||||
GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
|
||||
void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
|
||||
|
|
|
@ -510,6 +510,7 @@ EXPORTS
|
|||
gst_element_unlink_pads
|
||||
gst_error_get_message
|
||||
gst_event_copy_segment
|
||||
gst_event_get_running_time_offset
|
||||
gst_event_get_seqnum
|
||||
gst_event_get_structure
|
||||
gst_event_get_type
|
||||
|
@ -552,6 +553,7 @@ EXPORTS
|
|||
gst_event_parse_toc
|
||||
gst_event_parse_toc_select
|
||||
gst_event_set_group_id
|
||||
gst_event_set_running_time_offset
|
||||
gst_event_set_seqnum
|
||||
gst_event_set_stream_flags
|
||||
gst_event_type_flags_get_type
|
||||
|
|
Loading…
Reference in a new issue