mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
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:
parent
f67e7aacf3
commit
b49f83d738
7 changed files with 115 additions and 2 deletions
|
@ -1669,6 +1669,7 @@ GST_TAG_CAPTURING_SATURATION
|
||||||
GST_TAG_CAPTURING_SHARPNESS
|
GST_TAG_CAPTURING_SHARPNESS
|
||||||
GST_TAG_CAPTURING_FLASH_FIRED
|
GST_TAG_CAPTURING_FLASH_FIRED
|
||||||
GST_TAG_CAPTURING_FLASH_MODE
|
GST_TAG_CAPTURING_FLASH_MODE
|
||||||
|
GST_TAG_CAPTURING_METERING_MODE
|
||||||
GST_TAG_IMAGE_HORIZONTAL_PPI
|
GST_TAG_IMAGE_HORIZONTAL_PPI
|
||||||
GST_TAG_IMAGE_VERTICAL_PPI
|
GST_TAG_IMAGE_VERTICAL_PPI
|
||||||
gst_tag_register_musicbrainz_tags
|
gst_tag_register_musicbrainz_tags
|
||||||
|
|
|
@ -234,6 +234,7 @@ EXIF_SERIALIZATION_DESERIALIZATION_FUNC (gain_control);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_coordinate);
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_coordinate);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_direction);
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_direction);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_elevation);
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (geo_elevation);
|
||||||
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (metering_mode);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation);
|
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (scene_capture_type);
|
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_DATE_TIME_DIGITIZED 0x9004
|
||||||
#define EXIF_TAG_SHUTTER_SPEED_VALUE 0x9201
|
#define EXIF_TAG_SHUTTER_SPEED_VALUE 0x9201
|
||||||
#define EXIF_TAG_APERTURE_VALUE 0x9202
|
#define EXIF_TAG_APERTURE_VALUE 0x9202
|
||||||
|
#define EXIF_TAG_METERING_MODE 0x9207
|
||||||
#define EXIF_TAG_FLASH 0x9209
|
#define EXIF_TAG_FLASH 0x9209
|
||||||
#define EXIF_TAG_FOCAL_LENGTH 0x920A
|
#define EXIF_TAG_FOCAL_LENGTH 0x920A
|
||||||
#define EXIF_TAG_MAKER_NOTE 0x927C
|
#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,
|
{GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_APERTURE_VALUE, EXIF_TYPE_RATIONAL,
|
||||||
0,
|
0,
|
||||||
serialize_aperture_value, deserialize_aperture_value},
|
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,
|
{GST_TAG_CAPTURING_FLASH_FIRED, EXIF_TAG_FLASH, EXIF_TYPE_SHORT, 0,
|
||||||
serialize_flash, deserialize_flash},
|
serialize_flash, deserialize_flash},
|
||||||
{GST_TAG_CAPTURING_FOCAL_LENGTH, EXIF_TAG_FOCAL_LENGTH, EXIF_TYPE_RATIONAL, 0,
|
{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);
|
capturing_exposure_program);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (gain_control,
|
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (gain_control,
|
||||||
capturing_gain_adjustment);
|
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,
|
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (orientation,
|
||||||
image_orientation);
|
image_orientation);
|
||||||
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (saturation,
|
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (saturation,
|
||||||
|
|
|
@ -374,3 +374,57 @@ __exif_tag_capturing_sharpness_from_exif_value (gint value)
|
||||||
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
|
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
|
||||||
"sharpness");
|
"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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
gint __exif_tag_capturing_sharpness_to_exif_value (const gchar * str);
|
||||||
const gchar * __exif_tag_capturing_sharpness_from_exif_value (gint value);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */
|
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */
|
||||||
|
|
|
@ -320,6 +320,25 @@ G_BEGIN_DECLS
|
||||||
*/
|
*/
|
||||||
#define GST_TAG_CAPTURING_FLASH_MODE "capturing-flash-mode"
|
#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:
|
* GST_TAG_IMAGE_HORIZONTAL_PPI:
|
||||||
*
|
*
|
||||||
|
|
|
@ -162,11 +162,16 @@ gst_tag_register_tags_internal (gpointer unused)
|
||||||
|
|
||||||
gst_tag_register (GST_TAG_CAPTURING_FLASH_FIRED, GST_TAG_FLAG_META,
|
gst_tag_register (GST_TAG_CAPTURING_FLASH_FIRED, GST_TAG_FLAG_META,
|
||||||
G_TYPE_BOOLEAN, _("capturing flash fired"),
|
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,
|
gst_tag_register (GST_TAG_CAPTURING_FLASH_MODE, GST_TAG_FLAG_META,
|
||||||
G_TYPE_STRING, _("capturing flash mode"),
|
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,
|
gst_tag_register (GST_TAG_IMAGE_HORIZONTAL_PPI, GST_TAG_FLAG_META,
|
||||||
G_TYPE_DOUBLE, _("image horizontal ppi"),
|
G_TYPE_DOUBLE, _("image horizontal ppi"),
|
||||||
|
|
|
@ -1394,6 +1394,31 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
|
||||||
g_value_set_static_string (&value, "soft");
|
g_value_set_static_string (&value, "soft");
|
||||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
|
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
|
||||||
&value);
|
&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_unset (&value);
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_DOUBLE);
|
g_value_init (&value, G_TYPE_DOUBLE);
|
||||||
|
|
Loading…
Reference in a new issue