tag: Adds GST_TAG_CAPTURING_METERING_MODE

Adds a tag to inform what mode was used by a camera to calculate
the picture capturing exposure

Also adds mapping to exif and tests

API: GST_TAG_CAPTURING_METERING_MODE

https://bugzilla.gnome.org/show_bug.cgi?id=631773
This commit is contained in:
Thiago Santos 2010-10-08 15:51:28 -03:00 committed by Tim-Philipp Müller
parent f67e7aacf3
commit b49f83d738
7 changed files with 115 additions and 2 deletions

View file

@ -1669,6 +1669,7 @@ GST_TAG_CAPTURING_SATURATION
GST_TAG_CAPTURING_SHARPNESS
GST_TAG_CAPTURING_FLASH_FIRED
GST_TAG_CAPTURING_FLASH_MODE
GST_TAG_CAPTURING_METERING_MODE
GST_TAG_IMAGE_HORIZONTAL_PPI
GST_TAG_IMAGE_VERTICAL_PPI
gst_tag_register_musicbrainz_tags

View file

@ -234,6 +234,7 @@ EXIF_SERIALIZATION_DESERIALIZATION_FUNC (gain_control);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_coordinate);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_direction);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_elevation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (metering_mode);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (scene_capture_type);
@ -284,6 +285,7 @@ EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
#define EXIF_TAG_DATE_TIME_DIGITIZED 0x9004
#define EXIF_TAG_SHUTTER_SPEED_VALUE 0x9201
#define EXIF_TAG_APERTURE_VALUE 0x9202
#define EXIF_TAG_METERING_MODE 0x9207
#define EXIF_TAG_FLASH 0x9209
#define EXIF_TAG_FOCAL_LENGTH 0x920A
#define EXIF_TAG_MAKER_NOTE 0x927C
@ -368,6 +370,8 @@ static const GstExifTagMatch tag_map_exif[] = {
{GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_APERTURE_VALUE, EXIF_TYPE_RATIONAL,
0,
serialize_aperture_value, deserialize_aperture_value},
{GST_TAG_CAPTURING_METERING_MODE, EXIF_TAG_METERING_MODE, EXIF_TYPE_SHORT, 0,
serialize_metering_mode, deserialize_metering_mode},
{GST_TAG_CAPTURING_FLASH_FIRED, EXIF_TAG_FLASH, EXIF_TYPE_SHORT, 0,
serialize_flash, deserialize_flash},
{GST_TAG_CAPTURING_FOCAL_LENGTH, EXIF_TAG_FOCAL_LENGTH, EXIF_TYPE_RATIONAL, 0,
@ -1759,6 +1763,8 @@ EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (exposure_program,
capturing_exposure_program);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (gain_control,
capturing_gain_adjustment);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (metering_mode,
capturing_metering_mode);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (orientation,
image_orientation);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (saturation,

View file

@ -374,3 +374,57 @@ __exif_tag_capturing_sharpness_from_exif_value (gint value)
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
"sharpness");
}
gint
__exif_tag_capturing_metering_mode_to_exif_value (const gchar * str)
{
if (str == NULL)
goto end;
if (strcmp (str, "unknown") == 0)
return 0;
else if (strcmp (str, "average") == 0)
return 1;
else if (strcmp (str, "center-weighted-average") == 0)
return 2;
else if (strcmp (str, "spot") == 0)
return 3;
else if (strcmp (str, "multi-spot") == 0)
return 4;
else if (strcmp (str, "pattern") == 0)
return 5;
else if (strcmp (str, "partial") == 0)
return 6;
else if (strcmp (str, "other") == 0)
return 255;
end:
GST_WARNING ("Invalid metering mode type: %s", str);
return -1;
}
const gchar *
__exif_tag_capturing_metering_mode_from_exif_value (gint value)
{
switch (value) {
case 0:
return "unknown";
case 1:
return "average";
case 2:
return "center-weighted-average";
case 3:
return "spot";
case 4:
return "multi-spot";
case 5:
return "pattern";
case 6:
return "partial";
case 255:
return "other";
default:
GST_WARNING ("Invalid metering mode type: %d", value);
return NULL;
}
}

View file

@ -62,6 +62,9 @@ const gchar * __exif_tag_capturing_saturation_from_exif_value (gint value);
gint __exif_tag_capturing_sharpness_to_exif_value (const gchar * str);
const gchar * __exif_tag_capturing_sharpness_from_exif_value (gint value);
gint __exif_tag_capturing_metering_mode_to_exif_value (const gchar * str);
const gchar * __exif_tag_capturing_metering_mode_from_exif_value (gint value);
G_END_DECLS
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */

View file

@ -320,6 +320,25 @@ G_BEGIN_DECLS
*/
#define GST_TAG_CAPTURING_FLASH_MODE "capturing-flash-mode"
/**
* GST_TAG_CAPTURING_METERING_MODE:
*
* Defines the way a camera determines the exposure. (string)
*
* The allowed values are:
* "unknown"
* "average"
* "center-weighted-average"
* "spot"
* "multi-spot"
* "pattern"
* "partial"
* "other"
*
* Since: 0.10.31
*/
#define GST_TAG_CAPTURING_METERING_MODE "capturing-metering-mode"
/**
* GST_TAG_IMAGE_HORIZONTAL_PPI:
*

View file

@ -162,11 +162,16 @@ gst_tag_register_tags_internal (gpointer unused)
gst_tag_register (GST_TAG_CAPTURING_FLASH_FIRED, GST_TAG_FLAG_META,
G_TYPE_BOOLEAN, _("capturing flash fired"),
_("If the flash fired while capturing and image"), NULL);
_("If the flash fired while capturing an image"), NULL);
gst_tag_register (GST_TAG_CAPTURING_FLASH_MODE, GST_TAG_FLAG_META,
G_TYPE_STRING, _("capturing flash mode"),
_("The selected flash mode while capturing and image"), NULL);
_("The selected flash mode while capturing an image"), NULL);
gst_tag_register (GST_TAG_CAPTURING_METERING_MODE, GST_TAG_FLAG_META,
G_TYPE_STRING, _("capturing metering mode"),
_("The metering mode used while determining exposure for capturing an"
" image"), NULL);
gst_tag_register (GST_TAG_IMAGE_HORIZONTAL_PPI, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, _("image horizontal ppi"),

View file

@ -1394,6 +1394,31 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
g_value_set_static_string (&value, "soft");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_set_static_string (&value, "unknown");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "average");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "center-weighted-average");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "spot");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "multi-spot");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "pattern");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "partial");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_set_static_string (&value, "other");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_METERING_MODE, &value);
g_value_unset (&value);
g_value_init (&value, G_TYPE_DOUBLE);