mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
gst/gstevent.*: add string representations for event types
Original commit message from CVS: * gst/gstevent.c: (gst_event_type_get_name), (gst_event_type_to_quark), (gst_event_finalize), (gst_event_new): * gst/gstevent.h: add string representations for event types
This commit is contained in:
parent
c6f9c38da2
commit
37c3c87edb
3 changed files with 60 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-10-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gstevent.c: (gst_event_type_get_name),
|
||||
(gst_event_type_to_quark), (gst_event_finalize), (gst_event_new):
|
||||
* gst/gstevent.h:
|
||||
add string representations for event types
|
||||
|
||||
2005-10-06 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/elements/gstfilesink.c: (gst_file_sink_close_file):
|
||||
|
|
|
@ -57,6 +57,51 @@ _gst_event_initialize (void)
|
|||
gst_event_get_type ();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint type;
|
||||
gchar *name;
|
||||
GQuark quark;
|
||||
} GstEventQuarks;
|
||||
|
||||
static GstEventQuarks event_quarks[] = {
|
||||
{GST_EVENT_UNKNOWN, "unknown", 0},
|
||||
{GST_EVENT_FLUSH_START, "flush-start", 0},
|
||||
{GST_EVENT_FLUSH_STOP, "flush-stop", 0},
|
||||
{GST_EVENT_EOS, "eos", 0},
|
||||
{GST_EVENT_NEWSEGMENT, "newsegment", 0},
|
||||
{GST_EVENT_TAG, "tag", 0},
|
||||
{GST_EVENT_FILLER, "filler", 0},
|
||||
{GST_EVENT_QOS, "qos", 0},
|
||||
{GST_EVENT_SEEK, "seek", 0},
|
||||
{GST_EVENT_NAVIGATION, "navigation", 0},
|
||||
{0, NULL, 0}
|
||||
};
|
||||
|
||||
const gchar *
|
||||
gst_event_type_get_name (GstEventType type)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; event_quarks[i].name; i++) {
|
||||
if (type == event_quarks[i].type)
|
||||
return event_quarks[i].name;
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
GQuark
|
||||
gst_event_type_to_quark (GstEventType type)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; event_quarks[i].name; i++) {
|
||||
if (type == event_quarks[i].type)
|
||||
return event_quarks[i].quark;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_event_get_type (void)
|
||||
{
|
||||
|
@ -110,7 +155,8 @@ gst_event_finalize (GstEvent * event)
|
|||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (GST_IS_EVENT (event));
|
||||
|
||||
GST_CAT_INFO (GST_CAT_EVENT, "freeing event %p", event);
|
||||
GST_CAT_INFO (GST_CAT_EVENT, "freeing event %p type %s", event,
|
||||
gst_event_type_get_name (GST_EVENT_TYPE (event)));
|
||||
|
||||
if (GST_EVENT_SRC (event)) {
|
||||
gst_object_unref (GST_EVENT_SRC (event));
|
||||
|
@ -150,7 +196,8 @@ gst_event_new (GstEventType type)
|
|||
|
||||
event = (GstEvent *) gst_mini_object_new (GST_TYPE_EVENT);
|
||||
|
||||
GST_CAT_INFO (GST_CAT_EVENT, "creating new event %p %d", event, type);
|
||||
GST_CAT_INFO (GST_CAT_EVENT, "creating new event %p %s", event,
|
||||
gst_event_type_get_name (type));
|
||||
|
||||
event->type = type;
|
||||
event->src = NULL;
|
||||
|
|
|
@ -211,6 +211,10 @@ struct _GstEventClass {
|
|||
|
||||
void _gst_event_initialize (void);
|
||||
|
||||
const gchar* gst_event_type_get_name (GstEventType type);
|
||||
GQuark gst_event_type_to_quark (GstEventType type);
|
||||
|
||||
|
||||
GType gst_event_get_type (void);
|
||||
|
||||
/* refcounting */
|
||||
|
|
Loading…
Reference in a new issue