From babd78dbcd0933d8ba87b8d5f1df7c8c3ac209ab Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Thu, 1 Jul 2010 17:24:49 +0200 Subject: [PATCH] move track type enum to ges-enums.{h,c} --- ges/ges-enums.c | 26 ++++++++++++++++++++++++++ ges/ges-enums.h | 30 +++++++++++++++++++++++++++++- ges/ges-track.c | 26 -------------------------- ges/ges-track.h | 29 +---------------------------- 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/ges/ges-enums.c b/ges/ges-enums.c index b5baf163b6..c247714b9f 100644 --- a/ges/ges-enums.c +++ b/ges/ges-enums.c @@ -19,3 +19,29 @@ */ #include "ges-enums.h" + +#define C_ENUM(v) ((guint) v) +static void +register_ges_track_type_select_result (GType * id) +{ + static const GFlagsValue values[] = { + {C_ENUM (GES_TRACK_TYPE_UNKNOWN), "GES_TRACK_TYPE_UNKNOWN", "unknown"}, + {C_ENUM (GES_TRACK_TYPE_AUDIO), "GES_TRACK_TYPE_AUDIO", "audio"}, + {C_ENUM (GES_TRACK_TYPE_VIDEO), "GES_TRACK_TYPE_VIDEO", "video"}, + {C_ENUM (GES_TRACK_TYPE_TEXT), "GES_TRACK_TYPE_TEXT", "text"}, + {C_ENUM (GES_TRACK_TYPE_CUSTOM), "GES_TRACK_TYPE_CUSTOM", "custom"}, + {0, NULL, NULL} + }; + + *id = g_flags_register_static ("GESTrackType", values); +} + +GType +ges_track_type_get_type (void) +{ + static GType id; + static GOnce once = G_ONCE_INIT; + + g_once (&once, (GThreadFunc) register_ges_track_type_select_result, &id); + return id; +} diff --git a/ges/ges-enums.h b/ges/ges-enums.h index d9ab56d90e..c409009215 100644 --- a/ges/ges-enums.h +++ b/ges/ges-enums.h @@ -21,10 +21,38 @@ #ifndef __GES_ENUMS_H__ #define __GES_ENUMS_H__ -#include +#include + +#define GES_TYPE_TRACK_TYPE (ges_track_type_get_type ()) + +/** + * GESTrackType: + * @GES_TRACK_TYPE_UNKNOWN: A track of unknown type (i.e. invalid) + * @GES_TRACK_TYPE_AUDIO: An audio track + * @GES_TRACK_TYPE_VIDEO: A video track + * @GES_TRACK_TYPE_TEXT: A text (subtitle) track + * @GES_TRACK_TYPE_CUSTOM: A custom-content track + * + * Types of content handled by a track. If the content is not one of + * @GES_TRACK_TYPE_AUDIO, @GES_TRACK_TYPE_VIDEO or @GES_TRACK_TYPE_TEXT, + * the user of the #GESTrack must set the type to @GES_TRACK_TYPE_CUSTOM. + * + * @GES_TRACK_TYPE_UNKNOWN is for internal purposes and should not be used + * by users + */ + +typedef enum { + GES_TRACK_TYPE_UNKNOWN = 1 << 0, + GES_TRACK_TYPE_AUDIO = 1 << 1, + GES_TRACK_TYPE_VIDEO = 1 << 2, + GES_TRACK_TYPE_TEXT = 1 << 3, + GES_TRACK_TYPE_CUSTOM = 1 << 4, +} GESTrackType; G_BEGIN_DECLS +GType ges_track_type_get_type (void); + G_END_DECLS #endif /* __GES_ENUMS_H__ */ diff --git a/ges/ges-track.c b/ges/ges-track.c index 273ee3c35f..4dc4e70e22 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -47,32 +47,6 @@ static void pad_added_cb (GstElement * element, GstPad * pad, GESTrack * track); static void pad_removed_cb (GstElement * element, GstPad * pad, GESTrack * track); -#define C_ENUM(v) ((guint) v) -static void -register_ges_track_type_select_result (GType * id) -{ - static const GFlagsValue values[] = { - {C_ENUM (GES_TRACK_TYPE_UNKNOWN), "GES_TRACK_TYPE_UNKNOWN", "unknown"}, - {C_ENUM (GES_TRACK_TYPE_AUDIO), "GES_TRACK_TYPE_AUDIO", "audio"}, - {C_ENUM (GES_TRACK_TYPE_VIDEO), "GES_TRACK_TYPE_VIDEO", "video"}, - {C_ENUM (GES_TRACK_TYPE_TEXT), "GES_TRACK_TYPE_TEXT", "text"}, - {C_ENUM (GES_TRACK_TYPE_CUSTOM), "GES_TRACK_TYPE_CUSTOM", "custom"}, - {0, NULL, NULL} - }; - - *id = g_flags_register_static ("GESTrackType", values); -} - -GType -ges_track_type_get_type (void) -{ - static GType id; - static GOnce once = G_ONCE_INIT; - - g_once (&once, (GThreadFunc) register_ges_track_type_select_result, &id); - return id; -} - static void ges_track_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) diff --git a/ges/ges-track.h b/ges/ges-track.h index e2662d1bdd..0213bfc110 100644 --- a/ges/ges-track.h +++ b/ges/ges-track.h @@ -24,6 +24,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -44,34 +45,6 @@ G_BEGIN_DECLS #define GES_TRACK_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK, GESTrackClass)) - -#define GES_TYPE_TRACK_TYPE (ges_track_type_get_type ()) -GType ges_track_type_get_type (void); - -/** - * GESTrackType: - * @GES_TRACK_TYPE_UNKNOWN: A track of unknown type (i.e. invalid) - * @GES_TRACK_TYPE_AUDIO: An audio track - * @GES_TRACK_TYPE_VIDEO: A video track - * @GES_TRACK_TYPE_TEXT: A text (subtitle) track - * @GES_TRACK_TYPE_CUSTOM: A custom-content track - * - * Types of content handled by a track. If the content is not one of - * @GES_TRACK_TYPE_AUDIO, @GES_TRACK_TYPE_VIDEO or @GES_TRACK_TYPE_TEXT, - * the user of the #GESTrack must set the type to @GES_TRACK_TYPE_CUSTOM. - * - * @GES_TRACK_TYPE_UNKNOWN is for internal purposes and should not be used - * by users - */ - -typedef enum { - GES_TRACK_TYPE_UNKNOWN = 1 << 0, - GES_TRACK_TYPE_AUDIO = 1 << 1, - GES_TRACK_TYPE_VIDEO = 1 << 2, - GES_TRACK_TYPE_TEXT = 1 << 3, - GES_TRACK_TYPE_CUSTOM = 1 << 4, -} GESTrackType; - /** * GESTrack: * @type: a #GESTrackType indicting the basic type of the track.