[farsight2/master] Make the enum types be generated by glib-mkenums

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:20:27 PST 2008


---
 .gitignore                         |    4 ++--
 gst-libs/gst/farsight/Makefile.am  |   34 +++++++++++++++++++++++++++++++---
 gst-libs/gst/farsight/fs-codec.c   |   18 ------------------
 gst-libs/gst/farsight/fs-codec.h   |    4 ----
 gst-libs/gst/farsight/fs-session.c |    1 +
 gst-libs/gst/farsight/fs-stream.c  |   20 +-------------------
 gst-libs/gst/farsight/fs-stream.h  |    4 ----
 7 files changed, 35 insertions(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore
index 26ed868..f9d37d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,8 +11,8 @@ Makefile.in
 .#*
 *.stamp
 
-gst-libs/gst/farsight/fs-marshal.c
-gst-libs/gst/farsight/fs-marshal.h
+gst-libs/gst/farsight/fs-marshal.[ch]
+gst-libs/gst/farsight/fs-enum-types.[ch]
 
 docs/libs/farsight-libs-decl-list.txt
 docs/libs/farsight-libs-decl-list.txt.bak
diff --git a/gst-libs/gst/farsight/Makefile.am b/gst-libs/gst/farsight/Makefile.am
index bbbed0f..0773b90 100644
--- a/gst-libs/gst/farsight/Makefile.am
+++ b/gst-libs/gst/farsight/Makefile.am
@@ -11,13 +11,16 @@ libgstfarsightinclude_HEADERS = \
 		fs-transmitter.h \
 		fs-stream-transmitter.h \
 		fs-plugin.h \
-		fs-marshal.h
+		fs-marshal.h \
+		fs-enum-types.h
 
 lib_LTLIBRARIES = libgstfarsight- at GST_MAJORMINOR@.la
 
 BUILT_SOURCES = \
 		fs-marshal.c \
-		fs-marshal.h
+		fs-marshal.h \
+		fs-enum-types.c \
+		fs-enum-types.h
 
 libgstfarsight_ at GST_MAJORMINOR@_la_SOURCES = \
 		fs-base-conference.c \
@@ -30,7 +33,8 @@ libgstfarsight_ at GST_MAJORMINOR@_la_SOURCES = \
 		fs-transmitter.c \
 		fs-stream-transmitter.c \
 		fs-plugin.c \
-		fs-marshal.c
+		fs-marshal.c \
+		fs-enum-types.c
 
 EXTRA_libgstfarsight_ at GST_MAJORMINOR@_la_SOURCES = fs-marshal.list
 
@@ -49,3 +53,27 @@ libgstfarsight_ at GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
 libgstfarsight_ at GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
 
 noinst_HEADERS = fs-marshal.h
+
+public_headers = fs-candidate.h \
+		fs-codec.h \
+		fs-participant.h \
+		fs-session.h \
+		fs-stream.h \
+		fs-conference-iface.h
+
+fs-enum-types-h: $(fs_headers) Makefile
+	( cd $(srcdir) && glib-mkenums \
+			--fhead "#ifndef __FS_ENUM_TYPES_H__\n#define __FS_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+			--fprod "/* enumerations from \"@filename@\" */\n" \
+			--vhead "GType @enum_name at _get_type (void);\n#define FS_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" 	\
+			--ftail "G_END_DECLS\n\n#endif /* __FS_ENUM_TYPES_H__ */" \
+		$(public_headers) ) > fs-enum-types.h
+
+fs-enum-types-c: $(fs_headers) Makefile
+	( cd $(srcdir) && glib-mkenums \
+			--fhead "#include <fs-conference-iface.h>" \
+			--fprod "\n/* enumerations from \"@filename@\" */" \
+			--vhead "GType\n at enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G at Type@Value values[] = {" 	\
+			--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ at type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
+		$(public_headers) ) > fs-enum-types.c
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 5d78be6..356b7be 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -71,24 +71,6 @@ fs_codec_list_get_type (void)
   return codec_list_type;
 }
 
-GType
-fs_media_type_get_type (void)
-{
-  static GType gtype = 0;
-
-  if (gtype == 0) {
-    static const GEnumValue values[] = {
-      { FS_MEDIA_TYPE_AUDIO, "Audio (default)", "audio"},
-      { FS_MEDIA_TYPE_VIDEO, "Video", "video"},
-      { FS_MEDIA_TYPE_APPLICATION, "Applicaton", "application" },
-      {0, NULL, NULL}
-    };
-
-    gtype = g_enum_register_static ("FsMediaType", values);
-  }
-  return gtype;
-}
-
 /**
  * fs_codec_new:
  * @id: codec identifier, if RTP this should be based on IETF RTP payload types
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index ba0e5b1..d115fd4 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -42,9 +42,6 @@ typedef struct _FsCodecPreference FsCodecPreference;
 #define FS_TYPE_CODEC_LIST \
   (fs_codec_list_get_type())
 
-#define FS_TYPE_MEDIA_TYPE \
-  (fs_media_type_get_type())
-
 /**
  * FsMediaType:
  * @FS_MEDIA_TYPE_AUDIO: A media type that encodes audio.
@@ -130,7 +127,6 @@ struct _FsCodecPreference {
 
 GType fs_codec_get_type (void);
 GType fs_codec_list_get_type (void);
-GType fs_media_type_get_type (void);
 
 
 FsCodec *fs_codec_new (int id, const char *encoding_name,
diff --git a/gst-libs/gst/farsight/fs-session.c b/gst-libs/gst/farsight/fs-session.c
index 14e5ac6..d656a2f 100644
--- a/gst-libs/gst/farsight/fs-session.c
+++ b/gst-libs/gst/farsight/fs-session.c
@@ -46,6 +46,7 @@
 #include "fs-session.h"
 #include "fs-codec.h"
 #include "fs-marshal.h"
+#include "fs-enum-types.h"
 #include <gst/gst.h>
 
 /* Signals */
diff --git a/gst-libs/gst/farsight/fs-stream.c b/gst-libs/gst/farsight/fs-stream.c
index 6be4d16..07e89f2 100644
--- a/gst-libs/gst/farsight/fs-stream.c
+++ b/gst-libs/gst/farsight/fs-stream.c
@@ -46,6 +46,7 @@
 #include "fs-candidate.h"
 #include "fs-stream-transmitter.h"
 #include "fs-conference-iface.h"
+#include "fs-enum-types.h"
 
 #include <gst/gst.h>
 
@@ -102,25 +103,6 @@ static void fs_stream_set_property (GObject *object,
 static GObjectClass *parent_class = NULL;
 static guint signals[LAST_SIGNAL] = { 0 };
 
-GType
-fs_stream_direction_get_type (void)
-{
-  static GType gtype = 0;
-
-  if (gtype == 0) {
-    static const GEnumValue values[] = {
-      { FS_DIRECTION_NONE, "No data transfer (default)", "none"},
-      { FS_DIRECTION_BOTH, "Both (send and receive)", "both"},
-      { FS_DIRECTION_SEND, "Send only", "send" },
-      { FS_DIRECTION_RECV, "Receive only", "recv" },
-      {0, NULL, NULL}
-    };
-
-    gtype = g_enum_register_static ("FsStreamDirection", values);
-  }
-  return gtype;
-}
-
 static void
 fs_stream_class_init (FsStreamClass *klass)
 {
diff --git a/gst-libs/gst/farsight/fs-stream.h b/gst-libs/gst/farsight/fs-stream.h
index b7c0f4c..439fcb1 100644
--- a/gst-libs/gst/farsight/fs-stream.h
+++ b/gst-libs/gst/farsight/fs-stream.h
@@ -33,8 +33,6 @@
 
 G_BEGIN_DECLS
 
-#define FS_TYPE_STREAM_DIRECTION (fs_stream_direction_get_type ())
-
 /**
  * FsStreamDirection:
  * @FS_DIRECTION_NONE: No direction specified
@@ -53,8 +51,6 @@ typedef enum
   FS_DIRECTION_BOTH = FS_DIRECTION_SEND | FS_DIRECTION_RECV
 } FsStreamDirection;
 
-GType fs_stream_direction_get_type (void);
-
 /* TYPE MACROS */
 #define FS_TYPE_STREAM \
   (fs_stream_get_type())
-- 
1.5.6.5




More information about the farsight-commits mailing list