| 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 is freed with gst_event_free().
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_FILLER,
GST_EVENT_SIZE
} 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_FILLER | a dummy element that should be ignored by plugins |
| GST_EVENT_SIZE |
#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 {
GST_SEEK_METHOD_CUR = (1 << GST_SEEK_METHOD_SHIFT),
GST_SEEK_METHOD_SET = (2 << GST_SEEK_METHOD_SHIFT),
GST_SEEK_METHOD_END = (3 << GST_SEEK_METHOD_SHIFT),
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))
} 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 |
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.
struct GstEvent {
GstData data;
GstEventType type;
guint64 timestamp;
GstObject *src;
union {
struct {
GstSeekType type;
gint64 offset;
GstSeekAccuracy accuracy;
} seek;
struct {
GstFormatValue offsets[8];
gint noffsets;
gboolean new_media;
} discont;
struct {
GstFormat format;
gint64 value;
} size;
} 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 |
GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset); |
Allocate a new seek event with the given parameters.
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