diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 0e3078f7e7..6aa40583b3 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2519,6 +2519,7 @@ GST_TAG_APPLICATION_DATA GST_TAG_IMAGE_ORIENTATION gst_tag_register +gst_tag_register_static gst_tag_merge_use_first gst_tag_merge_strings_with_comma gst_tag_exists diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index 5cdc345b34..158c53c347 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -72,8 +72,8 @@ typedef struct { GType type; /* type the data is in */ - gchar *nick; /* translated name */ - gchar *blurb; /* translated description of type */ + const gchar *nick; /* translated short description */ + const gchar *blurb; /* translated long description */ GstTagMergeFunc merge_func; /* functions to merge the values */ GstTagFlag flag; /* type of tag */ @@ -99,291 +99,298 @@ static GstTagList *__gst_tag_list_copy (const GstTagList * list); * g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING, * _gst_structure_transform_to_string); */ - void _priv_gst_tag_initialize (void) { g_mutex_init (&__tag_mutex); __tags = g_hash_table_new (g_str_hash, g_str_equal); - gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TITLE, GST_TAG_FLAG_META, G_TYPE_STRING, _("title"), _("commonly used title"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_TITLE_SORTNAME, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TITLE_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, _("title sortname"), _("commonly used title for sorting purposes"), NULL); - gst_tag_register (GST_TAG_ARTIST, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ARTIST, GST_TAG_FLAG_META, G_TYPE_STRING, _("artist"), _("person(s) responsible for the recording"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_ARTIST_SORTNAME, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ARTIST_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, _("artist sortname"), _("person(s) responsible for the recording for sorting purposes"), NULL); - gst_tag_register (GST_TAG_ALBUM, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM, GST_TAG_FLAG_META, G_TYPE_STRING, _("album"), _("album containing this data"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_ALBUM_SORTNAME, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, _("album sortname"), _("album containing this data for sorting purposes"), NULL); - gst_tag_register (GST_TAG_ALBUM_ARTIST, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_ARTIST, GST_TAG_FLAG_META, G_TYPE_STRING, _("album artist"), _("The artist of the entire album, as it should be displayed"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_ALBUM_ARTIST_SORTNAME, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_ARTIST_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, _("album artist sortname"), _("The artist of the entire album, as it should be sorted"), NULL); - gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_DATE, + gst_tag_register_static (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_DATE, _("date"), _("date the data was created (as a GDate structure)"), NULL); - gst_tag_register (GST_TAG_DATE_TIME, GST_TAG_FLAG_META, GST_TYPE_DATE_TIME, - _("datetime"), + gst_tag_register_static (GST_TAG_DATE_TIME, GST_TAG_FLAG_META, + GST_TYPE_DATE_TIME, _("datetime"), _("date and time the data was created (as a GstDateTime structure)"), NULL); - gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GENRE, GST_TAG_FLAG_META, G_TYPE_STRING, _("genre"), _("genre this data belongs to"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COMMENT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_COMMENT, GST_TAG_FLAG_META, G_TYPE_STRING, _("comment"), _("free text commenting the data"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_EXTENDED_COMMENT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_EXTENDED_COMMENT, GST_TAG_FLAG_META, G_TYPE_STRING, _("extended comment"), _("free text commenting the data in key=value or key[en]=comment form"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_TRACK_NUMBER, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TRACK_NUMBER, GST_TAG_FLAG_META, G_TYPE_UINT, _("track number"), _("track number inside a collection"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_TRACK_COUNT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TRACK_COUNT, GST_TAG_FLAG_META, G_TYPE_UINT, _("track count"), _("count of tracks inside collection this track belongs to"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_ALBUM_VOLUME_NUMBER, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_VOLUME_NUMBER, GST_TAG_FLAG_META, G_TYPE_UINT, _("disc number"), _("disc number inside a collection"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_ALBUM_VOLUME_COUNT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_VOLUME_COUNT, GST_TAG_FLAG_META, G_TYPE_UINT, _("disc count"), _("count of discs inside collection this disc belongs to"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_LOCATION, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_LOCATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("location"), _("Origin of media as a URI (location, where the " "original of the file or stream is hosted)"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_HOMEPAGE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_HOMEPAGE, GST_TAG_FLAG_META, G_TYPE_STRING, _("homepage"), _("Homepage for this media (i.e. artist or movie homepage)"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_DESCRIPTION, GST_TAG_FLAG_META, G_TYPE_STRING, - _("description"), _("short text describing the content of the data"), + gst_tag_register_static (GST_TAG_DESCRIPTION, GST_TAG_FLAG_META, + G_TYPE_STRING, _("description"), + _("short text describing the content of the data"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_VERSION, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_VERSION, GST_TAG_FLAG_META, G_TYPE_STRING, _("version"), _("version of this data"), NULL); - gst_tag_register (GST_TAG_ISRC, GST_TAG_FLAG_META, G_TYPE_STRING, _("ISRC"), + gst_tag_register_static (GST_TAG_ISRC, GST_TAG_FLAG_META, G_TYPE_STRING, + _("ISRC"), _ ("International Standard Recording Code - see http://www.ifpi.org/isrc/"), NULL); /* FIXME: organization (fix what? tpm) */ - gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, - _("organization"), _("organization"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, + G_TYPE_STRING, _("organization"), _("organization"), + gst_tag_merge_strings_with_comma); + gst_tag_register_static (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META, G_TYPE_STRING, _("copyright"), _("copyright notice of the data"), NULL); - gst_tag_register (GST_TAG_COPYRIGHT_URI, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_COPYRIGHT_URI, GST_TAG_FLAG_META, G_TYPE_STRING, _("copyright uri"), _("URI to the copyright notice of the data"), NULL); - gst_tag_register (GST_TAG_ENCODED_BY, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_ENCODED_BY, GST_TAG_FLAG_META, G_TYPE_STRING, _("encoded by"), _("name of the encoding person or organization"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_CONTACT, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_CONTACT, GST_TAG_FLAG_META, G_TYPE_STRING, _("contact"), _("contact information"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_LICENSE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_LICENSE, GST_TAG_FLAG_META, G_TYPE_STRING, _("license"), _("license of data"), NULL); - gst_tag_register (GST_TAG_LICENSE_URI, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_LICENSE_URI, GST_TAG_FLAG_META, G_TYPE_STRING, _("license uri"), _("URI to the license of the data"), NULL); - gst_tag_register (GST_TAG_PERFORMER, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_PERFORMER, GST_TAG_FLAG_META, G_TYPE_STRING, _("performer"), _("person(s) performing"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COMPOSER, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_COMPOSER, GST_TAG_FLAG_META, G_TYPE_STRING, _("composer"), _("person(s) who composed the recording"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_DURATION, GST_TAG_FLAG_DECODED, + gst_tag_register_static (GST_TAG_DURATION, GST_TAG_FLAG_DECODED, G_TYPE_UINT64, _("duration"), _("length in GStreamer time units (nanoseconds)"), NULL); - gst_tag_register (GST_TAG_CODEC, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_CODEC, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("codec"), _("codec the data is stored in"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_VIDEO_CODEC, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_VIDEO_CODEC, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("video codec"), _("codec the video data is stored in"), NULL); - gst_tag_register (GST_TAG_AUDIO_CODEC, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_AUDIO_CODEC, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("audio codec"), _("codec the audio data is stored in"), NULL); - gst_tag_register (GST_TAG_SUBTITLE_CODEC, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_SUBTITLE_CODEC, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("subtitle codec"), _("codec the subtitle data is stored in"), NULL); - gst_tag_register (GST_TAG_CONTAINER_FORMAT, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_CONTAINER_FORMAT, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("container format"), _("container format the data is stored in"), NULL); - gst_tag_register (GST_TAG_BITRATE, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_BITRATE, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("bitrate"), _("exact or average bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_NOMINAL_BITRATE, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_NOMINAL_BITRATE, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("nominal bitrate"), _("nominal bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_MINIMUM_BITRATE, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_MINIMUM_BITRATE, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("minimum bitrate"), _("minimum bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_MAXIMUM_BITRATE, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_MAXIMUM_BITRATE, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("maximum bitrate"), _("maximum bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_ENCODER, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_ENCODER, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, _("encoder"), _("encoder used to encode this stream"), NULL); - gst_tag_register (GST_TAG_ENCODER_VERSION, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_ENCODER_VERSION, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("encoder version"), _("version of the encoder used to encode this stream"), NULL); - gst_tag_register (GST_TAG_SERIAL, GST_TAG_FLAG_ENCODED, + gst_tag_register_static (GST_TAG_SERIAL, GST_TAG_FLAG_ENCODED, G_TYPE_UINT, _("serial"), _("serial number of track"), NULL); - gst_tag_register (GST_TAG_TRACK_GAIN, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TRACK_GAIN, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain track gain"), _("track gain in db"), NULL); - gst_tag_register (GST_TAG_TRACK_PEAK, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_TRACK_PEAK, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain track peak"), _("peak of the track"), NULL); - gst_tag_register (GST_TAG_ALBUM_GAIN, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_GAIN, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain album gain"), _("album gain in db"), NULL); - gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain album peak"), _("peak of the album"), NULL); - gst_tag_register (GST_TAG_REFERENCE_LEVEL, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_REFERENCE_LEVEL, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain reference level"), _("reference level of track and album gain values"), NULL); - gst_tag_register (GST_TAG_LANGUAGE_CODE, GST_TAG_FLAG_META, G_TYPE_STRING, - _("language code"), + gst_tag_register_static (GST_TAG_LANGUAGE_CODE, GST_TAG_FLAG_META, + G_TYPE_STRING, _("language code"), _("language code for this stream, conforming to ISO-639-1 or ISO-639-2"), NULL); - gst_tag_register (GST_TAG_LANGUAGE_NAME, GST_TAG_FLAG_META, G_TYPE_STRING, - _("language name"), + gst_tag_register_static (GST_TAG_LANGUAGE_NAME, GST_TAG_FLAG_META, + G_TYPE_STRING, _("language name"), _("freeform name of the language this stream is in"), NULL); - gst_tag_register (GST_TAG_IMAGE, GST_TAG_FLAG_META, GST_TYPE_SAMPLE, + gst_tag_register_static (GST_TAG_IMAGE, GST_TAG_FLAG_META, GST_TYPE_SAMPLE, _("image"), _("image related to this stream"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_PREVIEW_IMAGE, GST_TAG_FLAG_META, GST_TYPE_SAMPLE, + gst_tag_register_static (GST_TAG_PREVIEW_IMAGE, GST_TAG_FLAG_META, + GST_TYPE_SAMPLE, /* TRANSLATORS: 'preview image' = image that shows a preview of the full image */ _("preview image"), _("preview image related to this stream"), NULL); - gst_tag_register (GST_TAG_ATTACHMENT, GST_TAG_FLAG_META, GST_TYPE_SAMPLE, - _("attachment"), _("file attached to this stream"), + gst_tag_register_static (GST_TAG_ATTACHMENT, GST_TAG_FLAG_META, + GST_TYPE_SAMPLE, _("attachment"), _("file attached to this stream"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_BEATS_PER_MINUTE, GST_TAG_FLAG_META, G_TYPE_DOUBLE, - _("beats per minute"), _("number of beats per minute in audio"), NULL); - gst_tag_register (GST_TAG_KEYWORDS, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_BEATS_PER_MINUTE, GST_TAG_FLAG_META, + G_TYPE_DOUBLE, _("beats per minute"), + _("number of beats per minute in audio"), NULL); + gst_tag_register_static (GST_TAG_KEYWORDS, GST_TAG_FLAG_META, G_TYPE_STRING, _("keywords"), _("comma separated keywords describing the content"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_GEO_LOCATION_NAME, GST_TAG_FLAG_META, G_TYPE_STRING, - _("geo location name"), _("human readable descriptive location of where " + gst_tag_register_static (GST_TAG_GEO_LOCATION_NAME, GST_TAG_FLAG_META, + G_TYPE_STRING, _("geo location name"), + _("human readable descriptive location of where " "the media has been recorded or produced"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_LATITUDE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_LATITUDE, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location latitude"), _("geo latitude location of where the media has been recorded or " "produced in degrees according to WGS84 (zero at the equator, " "negative values for southern latitudes)"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_LONGITUDE, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_LONGITUDE, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location longitude"), _("geo longitude location of where the media has been recorded or " "produced in degrees according to WGS84 (zero at the prime meridian " "in Greenwich/UK, negative values for western longitudes)"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_ELEVATION, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_ELEVATION, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location elevation"), _("geo elevation of where the media has been recorded or produced in " "meters according to WGS84 (zero is average sea level)"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_COUNTRY, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_COUNTRY, GST_TAG_FLAG_META, G_TYPE_STRING, _("geo location country"), _("country (english name) where the media has been recorded " "or produced"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_CITY, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_CITY, GST_TAG_FLAG_META, G_TYPE_STRING, _("geo location city"), _("city (english name) where the media has been recorded " "or produced"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_SUBLOCATION, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_GEO_LOCATION_SUBLOCATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("geo location sublocation"), _("a location whithin a city where the media has been produced " "or created (e.g. the neighborhood)"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("geo location horizontal error"), + gst_tag_register_static (GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR, + GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location horizontal error"), _("expected error of the horizontal positioning measures (in meters)"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("geo location movement speed"), + gst_tag_register_static (GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, + GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location movement speed"), _("movement speed of the capturing device while performing the capture " "in m/s"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("geo location movement direction"), + gst_tag_register_static (GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, + GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location movement direction"), _("indicates the movement direction of the device performing the capture" " of a media. It is represented as degrees in floating point " "representation, 0 means the geographic north, and increases " "clockwise"), NULL); - gst_tag_register (GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("geo location capture direction"), + gst_tag_register_static (GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, + GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("geo location capture direction"), _("indicates the direction the device is pointing to when capturing " " a media. It is represented as degrees in floating point " " representation, 0 means the geographic north, and increases " "clockwise"), NULL); - gst_tag_register (GST_TAG_SHOW_NAME, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_SHOW_NAME, GST_TAG_FLAG_META, G_TYPE_STRING, /* TRANSLATORS: 'show name' = 'TV/radio/podcast show name' here */ _("show name"), _("Name of the tv/podcast/series show the media is from"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_SHOW_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_SHOW_SORTNAME, GST_TAG_FLAG_META, + G_TYPE_STRING, /* TRANSLATORS: 'show sortname' = 'TV/radio/podcast show name as used for sorting purposes' here */ _("show sortname"), _("Name of the tv/podcast/series show the media is from, for sorting " "purposes"), NULL); - gst_tag_register (GST_TAG_SHOW_EPISODE_NUMBER, GST_TAG_FLAG_META, G_TYPE_UINT, - _("episode number"), + gst_tag_register_static (GST_TAG_SHOW_EPISODE_NUMBER, GST_TAG_FLAG_META, + G_TYPE_UINT, _("episode number"), _("The episode number in the season the media is part of"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_SHOW_SEASON_NUMBER, GST_TAG_FLAG_META, G_TYPE_UINT, - _("season number"), + gst_tag_register_static (GST_TAG_SHOW_SEASON_NUMBER, GST_TAG_FLAG_META, + G_TYPE_UINT, _("season number"), _("The season number of the show the media is part of"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_LYRICS, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_LYRICS, GST_TAG_FLAG_META, G_TYPE_STRING, _("lyrics"), _("The lyrics of the media, commonly used for songs"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COMPOSER_SORTNAME, GST_TAG_FLAG_META, G_TYPE_STRING, - _("composer sortname"), + gst_tag_register_static (GST_TAG_COMPOSER_SORTNAME, GST_TAG_FLAG_META, + G_TYPE_STRING, _("composer sortname"), _("person(s) who composed the recording, for sorting purposes"), NULL); - gst_tag_register (GST_TAG_GROUPING, GST_TAG_FLAG_META, G_TYPE_STRING, + gst_tag_register_static (GST_TAG_GROUPING, GST_TAG_FLAG_META, G_TYPE_STRING, _("grouping"), _("Groups related media that spans multiple tracks, like the different " "pieces of a concerto. It is a higher level than a track, " "but lower than an album"), NULL); - gst_tag_register (GST_TAG_USER_RATING, GST_TAG_FLAG_META, G_TYPE_UINT, + gst_tag_register_static (GST_TAG_USER_RATING, GST_TAG_FLAG_META, G_TYPE_UINT, _("user rating"), _("Rating attributed by a user. The higher the rank, " "the more the user likes this media"), NULL); - gst_tag_register (GST_TAG_DEVICE_MANUFACTURER, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_DEVICE_MANUFACTURER, GST_TAG_FLAG_META, G_TYPE_STRING, _("device manufacturer"), _("Manufacturer of the device used to create this media"), NULL); - gst_tag_register (GST_TAG_DEVICE_MODEL, GST_TAG_FLAG_META, G_TYPE_STRING, - _("device model"), + gst_tag_register_static (GST_TAG_DEVICE_MODEL, GST_TAG_FLAG_META, + G_TYPE_STRING, _("device model"), _("Model of the device used to create this media"), NULL); - gst_tag_register (GST_TAG_APPLICATION_NAME, GST_TAG_FLAG_META, G_TYPE_STRING, - _("application name"), _("Application used to create the media"), NULL); - gst_tag_register (GST_TAG_APPLICATION_DATA, GST_TAG_FLAG_META, + gst_tag_register_static (GST_TAG_APPLICATION_NAME, GST_TAG_FLAG_META, + G_TYPE_STRING, _("application name"), + _("Application used to create the media"), NULL); + gst_tag_register_static (GST_TAG_APPLICATION_DATA, GST_TAG_FLAG_META, GST_TYPE_BUFFER, _("application data"), _("Arbitrary application data to be serialized into the media"), NULL); - gst_tag_register (GST_TAG_IMAGE_ORIENTATION, GST_TAG_FLAG_META, G_TYPE_STRING, - _("image orientation"), + gst_tag_register_static (GST_TAG_IMAGE_ORIENTATION, GST_TAG_FLAG_META, + G_TYPE_STRING, _("image orientation"), _("How the image should be rotated or flipped before display"), NULL); } @@ -479,9 +486,37 @@ gst_tag_lookup (const gchar * tag_name) void gst_tag_register (const gchar * name, GstTagFlag flag, GType type, const gchar * nick, const gchar * blurb, GstTagMergeFunc func) +{ + g_return_if_fail (name != NULL); + g_return_if_fail (nick != NULL); + g_return_if_fail (blurb != NULL); + g_return_if_fail (type != 0 && type != GST_TYPE_LIST); + + return gst_tag_register_static (g_intern_string (name), flag, type, + g_intern_string (nick), g_intern_string (blurb), func); +} + +/** + * gst_tag_register_static: + * @name: the name or identifier string (string constant) + * @flag: a flag describing the type of tag info + * @type: the type this data is in + * @nick: human-readable name or short description (string constant) + * @blurb: a human-readable description for this tag (string constant) + * @func: function for merging multiple values of this tag, or NULL + * + * Registers a new tag type for the use with GStreamer's type system. + * + * Same as gst_tag_register(), but @name, @nick, and @blurb must be + * static strings or inlined strings, as they will not be copied. (GStreamer + * plugins will be made resident once loaded, so this function can be used + * even from dynamically loaded plugins.) + */ +void +gst_tag_register_static (const gchar * name, GstTagFlag flag, GType type, + const gchar * nick, const gchar * blurb, GstTagMergeFunc func) { GstTagInfo *info; - gchar *name_dup; g_return_if_fail (name != NULL); g_return_if_fail (nick != NULL); @@ -498,17 +533,13 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type, info = g_slice_new (GstTagInfo); info->flag = flag; info->type = type; - info->nick = g_strdup (nick); - info->blurb = g_strdup (blurb); + info->name_quark = g_quark_from_static_string (name); + info->nick = nick; + info->blurb = blurb; info->merge_func = func; - /* we make a copy for the hash table anyway, which will stay around, so - * can use that for the quark table too */ - name_dup = g_strdup (name); - info->name_quark = g_quark_from_static_string (name_dup); - TAG_LOCK; - g_hash_table_insert (__tags, (gpointer) name_dup, info); + g_hash_table_insert (__tags, (gpointer) name, info); TAG_UNLOCK; } diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index 426f870234..7940a3103f 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -132,6 +132,7 @@ typedef enum { * * Extra tag flags used when registering tags. */ +/* FIXME: these are not really flags .. */ typedef enum { GST_TAG_FLAG_UNDEFINED, GST_TAG_FLAG_META, @@ -190,6 +191,13 @@ void gst_tag_register (const gchar * name, const gchar * blurb, GstTagMergeFunc func); +void gst_tag_register_static (const gchar * name, + GstTagFlag flag, + GType type, + const gchar * nick, + const gchar * blurb, + GstTagMergeFunc func); + /* some default merging functions */ void gst_tag_merge_use_first (GValue * dest, const GValue * src); void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src); diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index f17645784b..ce04b941e7 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -1088,6 +1088,7 @@ EXPORTS gst_tag_merge_strings_with_comma gst_tag_merge_use_first gst_tag_register + gst_tag_register_static gst_tag_setter_add_tag_valist gst_tag_setter_add_tag_valist_values gst_tag_setter_add_tag_value