move track type enum to ges-enums.{h,c}

This commit is contained in:
Brandon Lewis 2010-07-01 17:24:49 +02:00 committed by Edward Hervey
parent b25befe29a
commit babd78dbcd
4 changed files with 56 additions and 55 deletions

View file

@ -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;
}

View file

@ -21,10 +21,38 @@
#ifndef __GES_ENUMS_H__
#define __GES_ENUMS_H__
#include <glib.h>
#include <glib-object.h>
#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__ */

View file

@ -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)

View file

@ -24,6 +24,7 @@
#include <glib-object.h>
#include <gst/gst.h>
#include <ges/ges-types.h>
#include <ges/ges-enums.h>
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.