From: Edward Hervey Date: Sun, 16 Jan 2011 13:55:26 +0000 (+0100) Subject: gstmodule: Use a macro to register tags X-Git-Tag: 1.19.3~485^2~290 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dfb6a5b0999d73726073bd3cfeb45bd2089f1287;p=platform%2Fupstream%2Fgstreamer.git gstmodule: Use a macro to register tags Avoids human error when registering them (like USER_RATING previously being TRACK_PEAK). --- diff --git a/gst/gstmodule.c b/gst/gstmodule.c index 9ed3360..3f29c52 100644 --- a/gst/gstmodule.c +++ b/gst/gstmodule.c @@ -255,116 +255,89 @@ init_gst (void) PyModule_AddObject (m, "TYPE_TYPE_FIND_FACTORY", pyg_type_wrapper_new (GST_TYPE_TYPE_FIND_FACTORY)); +#define ADD_GST_TAG(a) PyModule_AddStringConstant(m, "TAG_" #a, GST_TAG_##a) /* GStreamer core tags */ - PyModule_AddStringConstant (m, "TAG_TITLE", GST_TAG_TITLE); - PyModule_AddStringConstant (m, "TAG_ARTIST", GST_TAG_ARTIST); - PyModule_AddStringConstant (m, "TAG_ALBUM", GST_TAG_ALBUM); - PyModule_AddStringConstant (m, "TAG_DATE", GST_TAG_DATE); - PyModule_AddStringConstant (m, "TAG_GENRE", GST_TAG_GENRE); - PyModule_AddStringConstant (m, "TAG_COMMENT", GST_TAG_COMMENT); - PyModule_AddStringConstant (m, "TAG_TRACK_NUMBER", GST_TAG_TRACK_NUMBER); - PyModule_AddStringConstant (m, "TAG_TRACK_COUNT", GST_TAG_TRACK_COUNT); - PyModule_AddStringConstant (m, "TAG_ALBUM_VOLUME_NUMBER", - GST_TAG_ALBUM_VOLUME_NUMBER); - PyModule_AddStringConstant (m, "TAG_ALBUM_VOLUME_COUNT", - GST_TAG_ALBUM_VOLUME_COUNT); - PyModule_AddStringConstant (m, "TAG_LOCATION", GST_TAG_LOCATION); - PyModule_AddStringConstant (m, "TAG_DESCRIPTION", GST_TAG_DESCRIPTION); - PyModule_AddStringConstant (m, "TAG_VERSION", GST_TAG_VERSION); - PyModule_AddStringConstant (m, "TAG_ISRC", GST_TAG_ISRC); - PyModule_AddStringConstant (m, "TAG_ORGANIZATION", GST_TAG_ORGANIZATION); - PyModule_AddStringConstant (m, "TAG_COPYRIGHT", GST_TAG_COPYRIGHT); - PyModule_AddStringConstant (m, "TAG_CONTACT", GST_TAG_CONTACT); - PyModule_AddStringConstant (m, "TAG_LICENSE", GST_TAG_LICENSE); - PyModule_AddStringConstant (m, "TAG_PERFORMER", GST_TAG_PERFORMER); - PyModule_AddStringConstant (m, "TAG_DURATION", GST_TAG_DURATION); - PyModule_AddStringConstant (m, "TAG_CODEC", GST_TAG_CODEC); - PyModule_AddStringConstant (m, "TAG_VIDEO_CODEC", GST_TAG_VIDEO_CODEC); - PyModule_AddStringConstant (m, "TAG_AUDIO_CODEC", GST_TAG_AUDIO_CODEC); - PyModule_AddStringConstant (m, "TAG_BITRATE", GST_TAG_BITRATE); - PyModule_AddStringConstant (m, "TAG_NOMINAL_BITRATE", - GST_TAG_NOMINAL_BITRATE); - PyModule_AddStringConstant (m, "TAG_MINIMUM_BITRATE", - GST_TAG_MINIMUM_BITRATE); - PyModule_AddStringConstant (m, "TAG_MAXIMUM_BITRATE", - GST_TAG_MAXIMUM_BITRATE); - PyModule_AddStringConstant (m, "TAG_SERIAL", GST_TAG_SERIAL); - PyModule_AddStringConstant (m, "TAG_ENCODER", GST_TAG_ENCODER); - PyModule_AddStringConstant (m, "TAG_ENCODER_VERSION", - GST_TAG_ENCODER_VERSION); - PyModule_AddStringConstant (m, "TAG_TRACK_GAIN", GST_TAG_TRACK_GAIN); - PyModule_AddStringConstant (m, "TAG_TRACK_PEAK", GST_TAG_TRACK_PEAK); - PyModule_AddStringConstant (m, "TAG_ALBUM_GAIN", GST_TAG_ALBUM_GAIN); - PyModule_AddStringConstant (m, "TAG_ALBUM_PEAK", GST_TAG_ALBUM_PEAK); - PyModule_AddStringConstant (m, "TAG_LANGUAGE_CODE", GST_TAG_LANGUAGE_CODE); - PyModule_AddStringConstant (m, "TAG_IMAGE", GST_TAG_IMAGE); - PyModule_AddStringConstant (m, "TAG_PREVIEW_IMAGE", GST_TAG_PREVIEW_IMAGE); - PyModule_AddStringConstant (m, "TAG_EXTENDED_COMMENT", - GST_TAG_EXTENDED_COMMENT); - PyModule_AddStringConstant (m, "TAG_REFERENCE_LEVEL", - GST_TAG_REFERENCE_LEVEL); - PyModule_AddStringConstant (m, "TAG_BEATS_PER_MINUTE", - GST_TAG_BEATS_PER_MINUTE); - PyModule_AddStringConstant (m, "TAG_LICENSE_URI", GST_TAG_LICENSE_URI); - PyModule_AddStringConstant (m, "TAG_COPYRIGHT_URI", GST_TAG_COPYRIGHT_URI); - PyModule_AddStringConstant (m, "TAG_COMPOSER", GST_TAG_COMPOSER); - PyModule_AddStringConstant (m, "TAG_ARTIST_SORTNAME", - GST_TAG_ARTIST_SORTNAME); - PyModule_AddStringConstant (m, "TAG_ALBUM_SORTNAME", GST_TAG_ALBUM_SORTNAME); - PyModule_AddStringConstant (m, "TAG_TITLE_SORTNAME", GST_TAG_TITLE_SORTNAME); + ADD_GST_TAG (TITLE); + ADD_GST_TAG (ARTIST); + ADD_GST_TAG (ALBUM); + ADD_GST_TAG (DATE); + ADD_GST_TAG (GENRE); + ADD_GST_TAG (COMMENT); + ADD_GST_TAG (TRACK_NUMBER); + ADD_GST_TAG (TRACK_COUNT); + ADD_GST_TAG (ALBUM_VOLUME_NUMBER); + ADD_GST_TAG (ALBUM_VOLUME_COUNT); + ADD_GST_TAG (LOCATION); + ADD_GST_TAG (DESCRIPTION); + ADD_GST_TAG (VERSION); + ADD_GST_TAG (ISRC); + ADD_GST_TAG (ORGANIZATION); + ADD_GST_TAG (COPYRIGHT); + ADD_GST_TAG (CONTACT); + ADD_GST_TAG (LICENSE); + ADD_GST_TAG (PERFORMER); + ADD_GST_TAG (DURATION); + ADD_GST_TAG (CODEC); + ADD_GST_TAG (VIDEO_CODEC); + ADD_GST_TAG (AUDIO_CODEC); + ADD_GST_TAG (BITRATE); + ADD_GST_TAG (NOMINAL_BITRATE); + ADD_GST_TAG (MINIMUM_BITRATE); + ADD_GST_TAG (MAXIMUM_BITRATE); + ADD_GST_TAG (SERIAL); + ADD_GST_TAG (ENCODER); + ADD_GST_TAG (ENCODER_VERSION); + ADD_GST_TAG (TRACK_GAIN); + ADD_GST_TAG (TRACK_PEAK); + ADD_GST_TAG (ALBUM_GAIN); + ADD_GST_TAG (ALBUM_PEAK); + ADD_GST_TAG (LANGUAGE_CODE); + ADD_GST_TAG (IMAGE); + ADD_GST_TAG (PREVIEW_IMAGE); + ADD_GST_TAG (EXTENDED_COMMENT); + ADD_GST_TAG (REFERENCE_LEVEL); + ADD_GST_TAG (BEATS_PER_MINUTE); + ADD_GST_TAG (LICENSE_URI); + ADD_GST_TAG (COPYRIGHT_URI); + ADD_GST_TAG (COMPOSER); + ADD_GST_TAG (ARTIST_SORTNAME); + ADD_GST_TAG (ALBUM_SORTNAME); + ADD_GST_TAG (TITLE_SORTNAME); #if ((GST_VERSION_MICRO >= 21) || (GST_VERSION_MICRO == 20 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_ATTACHMENT", GST_TAG_ATTACHMENT); - PyModule_AddStringConstant (m, "TAG_KEYWORDS", GST_TAG_KEYWORDS); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_NAME", - GST_TAG_GEO_LOCATION_NAME); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_LATITUDE", - GST_TAG_GEO_LOCATION_LATITUDE); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_LONGITUDE", - GST_TAG_GEO_LOCATION_LONGITUDE); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_ELEVATION", - GST_TAG_GEO_LOCATION_ELEVATION); + ADD_GST_TAG (ATTACHMENT); + ADD_GST_TAG (KEYWORDS); + ADD_GST_TAG (GEO_LOCATION_NAME); + ADD_GST_TAG (GEO_LOCATION_LATITUDE); + ADD_GST_TAG (GEO_LOCATION_LONGITUDE); + ADD_GST_TAG (GEO_LOCATION_ELEVATION); #if ((GST_VERSION_MICRO >= 23) || (GST_VERSION_MICRO == 22 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_SUBTITLE_CODEC", GST_TAG_SUBTITLE_CODEC); - PyModule_AddStringConstant (m, "TAG_HOMEPAGE", GST_TAG_HOMEPAGE); + ADD_GST_TAG (SUBTITLE_CODEC); + ADD_GST_TAG (HOMEPAGE); #if ((GST_VERSION_MICRO >= 24) || (GST_VERSION_MICRO == 23 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_CONTAINER_FORMAT", - GST_TAG_CONTAINER_FORMAT); + ADD_GST_TAG (CONTAINER_FORMAT); #if ((GST_VERSION_MICRO >= 25) || (GST_VERSION_MICRO == 24 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_ALBUM_ARTIST", GST_TAG_ALBUM_ARTIST); - PyModule_AddStringConstant (m, "TAG_ALBUM_ARTIST_SORTNAME", - GST_TAG_ALBUM_ARTIST_SORTNAME); + ADD_GST_TAG (ALBUM_ARTIST); + ADD_GST_TAG (ALBUM_ARTIST_SORTNAME); #if ((GST_VERSION_MICRO >= 26) || (GST_VERSION_MICRO == 25 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_SHOW_NAME", GST_TAG_SHOW_NAME); - PyModule_AddStringConstant (m, "TAG_SHOW_SORTNAME", GST_TAG_SHOW_SORTNAME); - PyModule_AddStringConstant (m, "TAG_SHOW_EPISODE_NUMBER", - GST_TAG_SHOW_EPISODE_NUMBER); - PyModule_AddStringConstant (m, "TAG_SHOW_SEASON_NUMBER", - GST_TAG_SHOW_SEASON_NUMBER); - PyModule_AddStringConstant (m, "TAG_LYRICS", GST_TAG_LYRICS); - PyModule_AddStringConstant (m, "TAG_COMPOSER_SORTNAME", - GST_TAG_COMPOSER_SORTNAME); - PyModule_AddStringConstant (m, "TAG_GROUPING", GST_TAG_GROUPING); + ADD_GST_TAG (SHOW_NAME); + ADD_GST_TAG (SHOW_SORTNAME); + ADD_GST_TAG (SHOW_EPISODE_NUMBER); + ADD_GST_TAG (SHOW_SEASON_NUMBER); + ADD_GST_TAG (LYRICS); + ADD_GST_TAG (COMPOSER_SORTNAME); + ADD_GST_TAG (GROUPING); #if ((GST_VERSION_MICRO >= 29) || (GST_VERSION_MICRO == 28 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_COUNTRY", - GST_TAG_GEO_LOCATION_COUNTRY); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_CITY", - GST_TAG_GEO_LOCATION_CITY); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_SUBLOCATION", - GST_TAG_GEO_LOCATION_SUBLOCATION); - PyModule_AddStringConstant (m, "TAG_USER_RATING", - GST_TAG_GEO_LOCATION_SUBLOCATION); + ADD_GST_TAG (GEO_LOCATION_COUNTRY); + ADD_GST_TAG (GEO_LOCATION_CITY); + ADD_GST_TAG (GEO_LOCATION_SUBLOCATION); + ADD_GST_TAG (USER_RATING); #if ((GST_VERSION_MICRO >= 30) || (GST_VERSION_MICRO == 29 && GST_VERSION_NANO > 0)) - PyModule_AddStringConstant (m, "TAG_DEVICE_MANUFACTURER", - GST_TAG_DEVICE_MANUFACTURER); - PyModule_AddStringConstant (m, "TAG_IMAGE_ORIENTATION", - GST_TAG_IMAGE_ORIENTATION); - PyModule_AddStringConstant (m, "TAG_DEVICE_MODEL", GST_TAG_DEVICE_MODEL); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_MOVEMENT_SPEED", - GST_TAG_GEO_LOCATION_MOVEMENT_SPEED); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_MOVEMENT_DIRECTION", - GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION); - PyModule_AddStringConstant (m, "TAG_GEO_LOCATION_CAPTURE_DIRECTION", - GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION); + ADD_GST_TAG (DEVICE_MANUFACTURER); + ADD_GST_TAG (IMAGE_ORIENTATION); + ADD_GST_TAG (DEVICE_MODEL); + ADD_GST_TAG (GEO_LOCATION_MOVEMENT_SPEED); + ADD_GST_TAG (GEO_LOCATION_MOVEMENT_DIRECTION); + ADD_GST_TAG (GEO_LOCATION_CAPTURE_DIRECTION); #if ((GST_VERSION_MICRO >= 31) || (GST_VERSION_MICRO == 30 && GST_VERSION_NANO > 0)) #define ADD_FACTORY_TYPE(a) PyModule_AddObject(m, "ELEMENT_FACTORY_TYPE_" #a,\ PyLong_FromUnsignedLongLong(GST_ELEMENT_FACTORY_TYPE_##a))