Commit f67e7aac authored by Thiago Santos's avatar Thiago Santos Committed by Tim-Philipp Müller
Browse files

tag: Adds GST_TAG_CAPTURING_SHARPNESS

Adds new tag for tagging sharpness processing used
when capturing an image. Also maps it in the exif
tags.

Tests included.

API: GST_TAG_CAPTURING_SHARPNESS

https://bugzilla.gnome.org/show_bug.cgi?id=631773
parent f396a37f
......@@ -1666,6 +1666,7 @@ GST_TAG_CAPTURING_GAIN_ADJUSTMENT
GST_TAG_CAPTURING_WHITE_BALANCE
GST_TAG_CAPTURING_CONTRAST
GST_TAG_CAPTURING_SATURATION
GST_TAG_CAPTURING_SHARPNESS
GST_TAG_CAPTURING_FLASH_FIRED
GST_TAG_CAPTURING_FLASH_MODE
GST_TAG_IMAGE_HORIZONTAL_PPI
......
......@@ -238,6 +238,7 @@ EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (saturation);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (scene_capture_type);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (sensitivity_type);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (sharpness);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (shutter_speed);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (speed);
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (white_balance);
......@@ -293,6 +294,7 @@ EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
#define EXIF_TAG_GAIN_CONTROL 0xA407
#define EXIF_TAG_CONTRAST 0xA408
#define EXIF_TAG_SATURATION 0xA409
#define EXIF_TAG_SHARPNESS 0xA40A
/* IFD pointer tags */
#define EXIF_IFD_TAG 0x8769
......@@ -390,6 +392,8 @@ static const GstExifTagMatch tag_map_exif[] = {
serialize_contrast, deserialize_contrast},
{GST_TAG_CAPTURING_SATURATION, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT, 0,
serialize_saturation, deserialize_saturation},
{GST_TAG_CAPTURING_SHARPNESS, EXIF_TAG_SHARPNESS, EXIF_TYPE_SHORT, 0,
serialize_sharpness, deserialize_sharpness},
{NULL, 0, 0, 0, NULL, NULL}
};
......@@ -1761,6 +1765,8 @@ EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (saturation,
capturing_saturation);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (scene_capture_type,
capturing_scene_capture_type);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (sharpness,
capturing_sharpness);
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (white_balance,
capturing_white_balance);
......
......@@ -277,8 +277,9 @@ __exif_tag_capturing_white_balance_from_exif_value (gint value)
}
}
gint
__exif_tag_capturing_contrast_to_exif_value (const gchar * str)
static gint
__exif_tag_capturing_contrast_sharpness_to_exif_value (const gchar * str,
const gchar * tag_name)
{
if (str == NULL)
goto end;
......@@ -291,12 +292,13 @@ __exif_tag_capturing_contrast_to_exif_value (const gchar * str)
return 2;
end:
GST_WARNING ("Invalid contrast type: %s", str);
GST_WARNING ("Invalid %s type: %s", tag_name, str);
return -1;
}
const gchar *
__exif_tag_capturing_contrast_from_exif_value (gint value)
static const gchar *
__exif_tag_capturing_contrast_sharpness_from_exif_value (gint value,
const gchar * tag_name)
{
switch (value) {
case 0:
......@@ -306,11 +308,25 @@ __exif_tag_capturing_contrast_from_exif_value (gint value)
case 2:
return "hard";
default:
GST_WARNING ("Invalid contrast type: %d", value);
GST_WARNING ("Invalid %s type: %d", tag_name, value);
return NULL;
}
}
gint
__exif_tag_capturing_contrast_to_exif_value (const gchar * str)
{
return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
"contrast");
}
const gchar *
__exif_tag_capturing_contrast_from_exif_value (gint value)
{
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
"contrast");
}
gint
__exif_tag_capturing_saturation_to_exif_value (const gchar * str)
{
......@@ -344,3 +360,17 @@ __exif_tag_capturing_saturation_from_exif_value (gint value)
return NULL;
}
}
gint
__exif_tag_capturing_sharpness_to_exif_value (const gchar * str)
{
return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
"sharpness");
}
const gchar *
__exif_tag_capturing_sharpness_from_exif_value (gint value)
{
return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
"sharpness");
}
......@@ -59,6 +59,9 @@ const gchar * __exif_tag_capturing_contrast_from_exif_value (gint value);
gint __exif_tag_capturing_saturation_to_exif_value (const gchar * str);
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);
G_END_DECLS
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */
......@@ -280,6 +280,20 @@ G_BEGIN_DECLS
*/
#define GST_TAG_CAPTURING_SATURATION "capturing-saturation"
/**
* GST_TAG_CAPTURING_SHARPNESS:
*
* Direction of sharpness processing applied when capturing an image. (string)
*
* The allowed values are:
* "normal"
* "soft"
* "hard"
*
* Since: 0.10.31
*/
#define GST_TAG_CAPTURING_SHARPNESS "capturing-sharpness"
/**
* GST_TAG_CAPTURING_FLASH_FIRED:
*
......
......@@ -155,6 +155,11 @@ gst_tag_register_tags_internal (gpointer unused)
_("The direction of saturation processing applied when "
"capturing an image"), NULL);
gst_tag_register (GST_TAG_CAPTURING_SHARPNESS, GST_TAG_FLAG_META,
G_TYPE_STRING, _("capturing sharpness"),
_("The direction of sharpness processing applied "
"when capturing an image"), NULL);
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);
......
......@@ -1384,6 +1384,16 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
g_value_set_static_string (&value, "high-saturation");
do_simple_exif_tag_serialization_deserialization
(GST_TAG_CAPTURING_SATURATION, &value);
g_value_set_static_string (&value, "normal");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_set_static_string (&value, "hard");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_set_static_string (&value, "soft");
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SHARPNESS,
&value);
g_value_unset (&value);
g_value_init (&value, G_TYPE_DOUBLE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment