GStreamer Core Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
The event classes are used to construct and query events.
Events are usually created with gst_event_new() which takes the event type as an argument. properties specific to the event can be set afterwards with the provided macros. The event should be unreferenced with gst_event_unref().
gst_event_new_seek() is a usually used to create a seek event and it takes the needed parameters for a seek event.
gst_event_new_flush() creates a new flush event.
typedef enum { GST_EVENT_UNKNOWN, GST_EVENT_EOS, GST_EVENT_FLUSH, GST_EVENT_EMPTY, GST_EVENT_DISCONTINUOUS, GST_EVENT_NEW_MEDIA, GST_EVENT_QOS, GST_EVENT_SEEK, GST_EVENT_SEEK_SEGMENT, GST_EVENT_SEGMENT_DONE, GST_EVENT_SIZE, GST_EVENT_RATE, GST_EVENT_FILLER } GstEventType; |
The different major types of events.
GST_EVENT_UNKNOWN | unknown event. |
GST_EVENT_EOS | an end-of-stream event. |
GST_EVENT_FLUSH | a flush event. |
GST_EVENT_EMPTY | an empty event. |
GST_EVENT_DISCONTINUOUS | a discontinuous event to indicate the stream has a discontinuity. |
GST_EVENT_NEW_MEDIA | a new media stream is started |
GST_EVENT_QOS | a quality of service event |
GST_EVENT_SEEK | a seek event. |
GST_EVENT_SEEK_SEGMENT | a segment seek with start and stop position |
GST_EVENT_SEGMENT_DONE | the event that will be emited when the segment seek has ended |
GST_EVENT_SIZE | a size suggestion for a peer element |
GST_EVENT_RATE | adjust the output rate of an element |
GST_EVENT_FILLER | a dummy element that should be ignored by plugins |
#define GST_EVENT_SRC(event) (GST_EVENT(event)->src) |
The source object that generated this event
#define GST_EVENT_TIMESTAMP(event) (GST_EVENT(event)->timestamp) |
Get the timestamp of the event.
typedef enum { /* | with some format */ /* | with one of these */ GST_SEEK_METHOD_CUR = (1 << (GST_SEEK_METHOD_SHIFT + 0)), GST_SEEK_METHOD_SET = (1 << (GST_SEEK_METHOD_SHIFT + 1)), GST_SEEK_METHOD_END = (1 << (GST_SEEK_METHOD_SHIFT + 2)), /* | with optional seek flags */ /* seek flags */ GST_SEEK_FLAG_FLUSH = (1 << (GST_SEEK_FLAGS_SHIFT + 0)), GST_SEEK_FLAG_ACCURATE = (1 << (GST_SEEK_FLAGS_SHIFT + 1)), GST_SEEK_FLAG_KEY_UNIT = (1 << (GST_SEEK_FLAGS_SHIFT + 2)), GST_SEEK_FLAG_SEGMENT_LOOP = (1 << (GST_SEEK_FLAGS_SHIFT + 3)) } GstSeekType; |
The different types of seek events.
GST_SEEK_METHOD_CUR | Seek to an relative position |
GST_SEEK_METHOD_SET | Seek to an absolute position |
GST_SEEK_METHOD_END | Seek relative to the end of the stream |
GST_SEEK_FLAG_FLUSH | Flush any pending data while seeking |
GST_SEEK_FLAG_ACCURATE | Seek as accuratly as possible |
GST_SEEK_FLAG_KEY_UNIT | Seek to a nearby key unit |
GST_SEEK_FLAG_SEGMENT_LOOP | Loop between start and stop in a segmented seek |
typedef enum { GST_SEEK_CERTAIN, GST_SEEK_FUZZY } GstSeekAccuracy; |
The seekaccuracy gives more information of how the seek was performed, if the seek was accurate or fuzzy.
#define GST_EVENT_SEEK_TYPE(event) (GST_EVENT(event)->event_data.seek.type) |
Get the seektype of the GST_EVENT_SEEK.
#define GST_EVENT_SEEK_FORMAT(event) (GST_EVENT_SEEK_TYPE(event) & GST_SEEK_FORMAT_MASK) |
The format of the seek value
#define GST_EVENT_SEEK_METHOD(event) (GST_EVENT_SEEK_TYPE(event) & GST_SEEK_METHOD_MASK) |
The seek method to use as one of GstSeekType
#define GST_EVENT_SEEK_FLAGS(event) (GST_EVENT_SEEK_TYPE(event) & GST_SEEK_FLAGS_MASK) |
The optional seek flags
#define GST_EVENT_SEEK_OFFSET(event) (GST_EVENT(event)->event_data.seek.offset) |
Get the offset of the seek event.
#define GST_EVENT_SEEK_ACCURACY(event) (GST_EVENT(event)->event_data.seek.accuracy) |
Indicates how accurate the event was performed.
#define GST_EVENT_DISCONT_NEW_MEDIA(event) (GST_EVENT(event)->event_data.discont.new_media) |
Flag that indicates the discont event was because of a new media type.
#define GST_EVENT_DISCONT_OFFSET(event,i) (GST_EVENT(event)->event_data.discont.offsets[i]) |
The offset of the discont event. A discont evetn can hold up to 8 different format/value pairs.
#define GST_EVENT_DISCONT_OFFSET_LEN(event) (GST_EVENT(event)->event_data.discont.noffsets) |
Get the number of offset/value pairs this event has.
#define GST_EVENT_RATE_VALUE(event) (GST_EVENT(event)->event_data.rate.value) |
Get access to the rate vale field
#define GST_EVENT_SEEK_ENDOFFSET(event) (GST_EVENT(event)->event_data.seek.endoffset) |
The event stop position for a segment seek
#define GST_EVENT_SIZE_FORMAT(event) (GST_EVENT(event)->event_data.size.format) |
The format of the size event.
#define GST_EVENT_SIZE_VALUE(event) (GST_EVENT(event)->event_data.size.value) |
The value of the size event
struct GstEvent { GstData data; GstEventType type; guint64 timestamp; GstObject *src; union { struct { GstSeekType type; gint64 offset; gint64 endoffset; GstSeekAccuracy accuracy; } seek; struct { GstFormatValue offsets[8]; gint noffsets; gboolean new_media; } discont; struct { GstFormat format; gint64 value; } size; struct { gdouble value; } rate; } event_data; }; |
The event data structure.
GstData data | The parent data type. |
GstEventType type | The event type. |
guint64 timestamp | The event timestamp. |
GstObject *src | The object that generated the event |
#define gst_event_copy(ev) GST_EVENT (gst_data_copy (GST_DATA (ev))) |
Copy the event using the event specific copy function
#define gst_event_ref(ev) gst_data_ref (GST_DATA (ev)) |
Increase the refcount of this event
#define gst_event_ref_by_count(ev,c) gst_data_ref_by_count (GST_DATA (ev), c) |
Increase the refcount of the event with the given value
#define gst_event_unref(ev) gst_data_unref (GST_DATA (ev)) |
Decrease the refcount of an event, freeing it if the refcount reaches 0
GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset); |
Allocate a new seek event with the given parameters.
GstEvent* gst_event_new_segment_seek (GstSeekType type, gint64 start, gint64 stop); |
Allocate a new segment seek event with the given parameters.
GstEvent* gst_event_new_size (GstFormat format, gint64 value); |
Create a new size event with the given values.
GstEvent* gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...); |
Allocate a new discontinuous event with the geven format/value pairs.
gboolean gst_event_discont_get_value (GstEvent *event, GstFormat format, gint64 *value); |
Get the value for the given format in the dicont event.
#define gst_event_new_filler() gst_event_new(GST_EVENT_FILLER) |
Create a new dummy event that should be ignored
#define gst_event_new_flush() gst_event_new(GST_EVENT_FLUSH) |
Create a new flush event.