diff --git a/gst-libs/gst/tag/gstxmptag.c b/gst-libs/gst/tag/gstxmptag.c index 6c424baebb..ca05895010 100644 --- a/gst-libs/gst/tag/gstxmptag.c +++ b/gst-libs/gst/tag/gstxmptag.c @@ -897,6 +897,9 @@ _init_xmp_tag_map (gpointer user_data) _gst_xmp_schema_add_simple_mapping (schema, GST_TAG_GEO_LOCATION_LONGITUDE, "exif:GPSLongitude", GST_XMP_TAG_TYPE_SIMPLE, serialize_exif_longitude, deserialize_exif_longitude); + _gst_xmp_schema_add_simple_mapping (schema, + GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, "exif:ExposureBiasValue", + GST_XMP_TAG_TYPE_SIMPLE, NULL, NULL); /* compound exif tags */ array = g_ptr_array_sized_new (2); @@ -984,7 +987,7 @@ static void xmp_tags_initialize () { static GOnce my_once = G_ONCE_INIT; - g_once (&my_once, (GThreadFunc)_init_xmp_tag_map, NULL); + g_once (&my_once, (GThreadFunc) _init_xmp_tag_map, NULL); } typedef struct _GstXmpNamespaceMatch GstXmpNamespaceMatch; @@ -1034,6 +1037,18 @@ read_one_tag (GstTagList * list, const gchar * tag, XmpTag * xmptag, gst_tag_list_add (list, merge_mode, tag, v, NULL); break; } + case G_TYPE_DOUBLE:{ + gdouble value = 0; + gint frac_n, frac_d; + + if (sscanf (v, "%d/%d", &frac_n, &frac_d) == 2) { + gst_util_fraction_to_double (frac_n, frac_d, &value); + gst_tag_list_add (list, merge_mode, tag, value, NULL); + } else { + GST_WARNING ("Failed to parse fraction: %s", v); + } + break; + } default: if (tag_type == GST_TYPE_DATE_TIME) { GstDateTime *datetime = NULL; @@ -1461,6 +1476,8 @@ gst_value_serialize_xmp (const GValue * value) return g_strdup_printf ("%d", g_value_get_int (value)); case G_TYPE_UINT: return g_strdup_printf ("%u", g_value_get_uint (value)); + case G_TYPE_DOUBLE: + return double_to_fraction_string (g_value_get_double (value)); default: break; } diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c index de0a132f36..af6f726fd2 100644 --- a/tests/check/libs/tag.c +++ b/tests/check/libs/tag.c @@ -945,6 +945,8 @@ GST_START_TEST (test_xmp_tags_serialization_deserialization) GDate *date; GstDateTime *datetime; + gst_tag_register_musicbrainz_tags (); + g_value_init (&value, G_TYPE_STRING); g_value_set_static_string (&value, "my string"); do_simple_xmp_tag_serialization_deserialization (GST_TAG_ARTIST, &value); @@ -1055,6 +1057,16 @@ GST_START_TEST (test_xmp_tags_serialization_deserialization) g_value_set_double (&value, 359.99); do_simple_xmp_tag_serialization_deserialization (GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, &value); + + g_value_set_double (&value, 0.0); + do_simple_xmp_tag_serialization_deserialization + (GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, &value); + g_value_set_double (&value, 1.0); + do_simple_xmp_tag_serialization_deserialization + (GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, &value); + g_value_set_double (&value, -2.5); + do_simple_xmp_tag_serialization_deserialization + (GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, &value); g_value_unset (&value); g_value_init (&value, GST_TYPE_DATE);