Hey,
I have an interface GESMetadataContainer which should provide getter and setter functions for different data types. As this are quite a few I tried to create macros to do this. The one for getter functions work fine (based on the one in gsttaglist.c) but I'm having a hard time with the setter macro. I uploaded the full source files at [1]. A types set function should look like [2] and compiles fine. I used that to create a macro [3]. This compiles if I call it with CREATE_SETTER (boolean, gboolean, G_TYPE_BOOLEAN); However if I call CREATE_GETTER (int, gint, G_TYPE_INT); I get compiler errors like in [4]. I don't have any idea how to solve this and hope you can give me some hints! Thanks in advance. regards, Paul [1] http://palango.fedorapeople.org/ges/ [2] void ges_metadata_container_set_int (GESMetadataContainer * container, const gchar * metadata_item, gboolean value) { GESMetadata *data; g_return_if_fail (GES_IS_METADATA_CONTAINER (container)); g_return_if_fail (metadata_item != NULL); data = ges_metadata_container_get_data (container); GES_METADATA_LOCK (data); ges_metadata_register (metadata_item, G_TYPE_INT); gst_tag_list_add (data->list, data->mode, metadata_item, value, NULL); GES_METADATA_UNLOCK (data); } --------------------------------------------------------------- [3] #define CREATE_SETTER(name,type,gtype) \ void \ ges_metadata_container_set_ ## name (GESMetadataContainer *container, \ const gchar *metadata_item, type value) \ { \ GESMetadata *data; \ \ g_return_if_fail (GES_IS_METADATA_CONTAINER (container)); \ g_return_if_fail (metadata_item != NULL); \ \ data = ges_metadata_container_get_data (container); \ \ GES_METADATA_LOCK (data); \ ges_metadata_register (metadata_item, gtype); \ gst_tag_list_add (data->list, data->mode, metadata_item, value, NULL); \ GES_METADATA_UNLOCK (data); \ } ------------------------------------------- [4] CC libges_1.0_la-ges-metadata-container.lo ges-metadata-container.c:105:27: error: expected ')' CREATE_GETTER (int, gint, G_TYPE_INT); ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:47: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:47: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ^ ges-metadata-container.c:105:27: note: to match this '(' CREATE_GETTER (int, gint, G_TYPE_INT); ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:22: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:46: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ^ ges-metadata-container.c:105:27: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] CREATE_GETTER (int, gint, G_TYPE_INT); ^~~~~~~~~~ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:47: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:47: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ~^ ges-metadata-container.c:105:27: error: expected ')' CREATE_GETTER (int, gint, G_TYPE_INT); ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:22: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:50: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ^ ges-metadata-container.c:105:27: note: to match this '(' CREATE_GETTER (int, gint, G_TYPE_INT); ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:22: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:45: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ^ ges-metadata-container.c:105:27: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] CREATE_GETTER (int, gint, G_TYPE_INT); ^~~~~~~~~~ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:22: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:38: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ~ ^ ges-metadata-container.c:105:27: error: function cannot return function type 'int ((int))' CREATE_GETTER (int, gint, G_TYPE_INT); ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:97:22: note: expanded from: #define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) ^ /home/paul/code/testptv//prefix/include/glib-2.0/gobject/gtype.h:222:37: note: expanded from: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) ^ ges-metadata-container.c:105:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] CREATE_GETTER (int, gint, G_TYPE_INT); ^~~~~~~~~~~~~ 6 errors generated. _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |