mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
tag: exif: More photography mappings
Adds mappings from: GST_TAG_CAPTURING_EXPOSURE_PROGRAM -> ExposureProgram GST_TAG_CAPTURING_EXPOSURE_MODE -> ExposureMode GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE -> SceneCaptureType GST_TAG_CAPTURING_GAIN_ADJUSTMENT -> GainControl GST_TAG_CAPTURING_WHITE_BALANCE -> WhiteBalance GST_TAG_CAPTURING_CONTRAST -> Constrast GST_TAG_CAPTURING_SATURATION -> Saturation Also renames gst_tag_image_orientation_from_exif_value and gst_tag_image_orientation_to_exif_value to remove the 'gst' prefix and not including in the win32 defs. Tests included.
This commit is contained in:
parent
cc8bd8bcec
commit
ac361dcc3a
6 changed files with 522 additions and 68 deletions
|
@ -102,6 +102,84 @@ static gint deserialize_ ## name (GstExifReader * exif_reader, \
|
|||
EXIF_SERIALIZATION_FUNC (name); \
|
||||
EXIF_DESERIALIZATION_FUNC (name)
|
||||
|
||||
/*
|
||||
* A common case among serialization/deserialization routines is that
|
||||
* the gstreamer tag is a string (with a predefined set of allowed values)
|
||||
* and exif is an int. These macros cover these cases
|
||||
*/
|
||||
#define EXIF_SERIALIZATION_MAP_STRING_TO_INT_FUNC(name,funcname) \
|
||||
static void \
|
||||
serialize_ ## name (GstExifWriter * writer, const GstTagList * taglist, \
|
||||
const GstExifTagMatch * exiftag) \
|
||||
{ \
|
||||
gchar *str = NULL; \
|
||||
gint exif_value; \
|
||||
\
|
||||
if (!gst_tag_list_get_string_index (taglist, exiftag->gst_tag, 0, &str)) { \
|
||||
GST_WARNING ("No %s tag present in taglist", exiftag->gst_tag); \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
exif_value = __exif_tag_ ## funcname ## _to_exif_value (str); \
|
||||
if (exif_value == -1) { \
|
||||
g_free (str); \
|
||||
return; \
|
||||
} \
|
||||
g_free (str); \
|
||||
\
|
||||
switch (exiftag->exif_type) { \
|
||||
case EXIF_TYPE_SHORT: \
|
||||
gst_exif_writer_write_short_tag (writer, exiftag->exif_tag, exif_value); \
|
||||
break; \
|
||||
case EXIF_TYPE_LONG: \
|
||||
gst_exif_writer_write_long_tag (writer, exiftag->exif_tag, exif_value); \
|
||||
break; \
|
||||
default: \
|
||||
g_assert_not_reached (); \
|
||||
GST_WARNING ("Unmapped serialization for type %d", exiftag->exif_type); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define EXIF_DESERIALIZATION_MAP_STRING_TO_INT_FUNC(name,funcname) \
|
||||
static gint \
|
||||
deserialize_ ## name (GstExifReader * exif_reader, \
|
||||
GstByteReader * reader, const GstExifTagMatch * exiftag, \
|
||||
GstExifTagData * tagdata) \
|
||||
{ \
|
||||
const gchar *str = NULL; \
|
||||
gint value; \
|
||||
\
|
||||
GST_LOG ("Starting to parse %s tag in exif 0x%x", exiftag->gst_tag, \
|
||||
exiftag->exif_tag); \
|
||||
\
|
||||
/* validate tag */ \
|
||||
if (tagdata->tag_type != EXIF_TYPE_SHORT || tagdata->count != 1) { \
|
||||
GST_WARNING ("0x%X has unexpected type/count", tagdata->tag); \
|
||||
return 0; \
|
||||
} \
|
||||
\
|
||||
if (exif_reader->byte_order == G_LITTLE_ENDIAN) { \
|
||||
value = GST_READ_UINT16_LE (tagdata->offset_as_data); \
|
||||
} else { \
|
||||
value = GST_READ_UINT16_BE (tagdata->offset_as_data); \
|
||||
} \
|
||||
\
|
||||
str = __exif_tag_## funcname ## _from_exif_value (value); \
|
||||
if (str == NULL) { \
|
||||
GST_WARNING ("Invalid value for tag 0x%X: %d", tagdata->tag, value); \
|
||||
return 0; \
|
||||
} \
|
||||
gst_tag_list_add (exif_reader->taglist, GST_TAG_MERGE_REPLACE, \
|
||||
exiftag->gst_tag, str, NULL); \
|
||||
\
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC(name,funcname) \
|
||||
EXIF_SERIALIZATION_MAP_STRING_TO_INT_FUNC(name,funcname); \
|
||||
EXIF_DESERIALIZATION_MAP_STRING_TO_INT_FUNC(name,funcname);
|
||||
|
||||
struct _GstExifTagMatch
|
||||
{
|
||||
const gchar *gst_tag;
|
||||
|
@ -147,14 +225,22 @@ struct _GstExifReader
|
|||
GSList *pending_tags;
|
||||
};
|
||||
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (orientation);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (aperture_value);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (contrast);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (exposure_program);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (exposure_mode);
|
||||
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 (shutter_speed);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (aperture_value);
|
||||
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 (shutter_speed);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (speed);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_FUNC (white_balance);
|
||||
|
||||
EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
|
||||
|
||||
/* FIXME copyright tag has a weird "artist\0editor\0" format that is
|
||||
|
@ -183,6 +269,7 @@ EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
|
|||
#define EXIF_TAG_COPYRIGHT 0x8298
|
||||
#define EXIF_TAG_EXPOSURE_TIME 0x829A
|
||||
#define EXIF_TAG_F_NUMBER 0x829D
|
||||
#define EXIF_TAG_EXPOSURE_PROGRAM 0x8822
|
||||
#define EXIF_TAG_PHOTOGRAPHIC_SENSITIVITY 0x8827
|
||||
#define EXIF_TAG_SENSITIVITY_TYPE 0x8830
|
||||
#define EXIF_TAG_ISO_SPEED 0x8833
|
||||
|
@ -192,7 +279,13 @@ EXIF_DESERIALIZATION_FUNC (add_to_pending_tags);
|
|||
#define EXIF_TAG_APERTURE_VALUE 0x9202
|
||||
#define EXIF_TAG_FOCAL_LENGTH 0x920A
|
||||
#define EXIF_TAG_MAKER_NOTE 0x927C
|
||||
#define EXIF_TAG_EXPOSURE_MODE 0xA402
|
||||
#define EXIF_TAG_WHITE_BALANCE 0xA403
|
||||
#define EXIF_TAG_DIGITAL_ZOOM_RATIO 0xA404
|
||||
#define EXIF_TAG_SCENE_CAPTURE_TYPE 0xA406
|
||||
#define EXIF_TAG_GAIN_CONTROL 0xA407
|
||||
#define EXIF_TAG_CONTRAST 0xA408
|
||||
#define EXIF_TAG_SATURATION 0xA409
|
||||
|
||||
/* IFD pointer tags */
|
||||
#define EXIF_IFD_TAG 0x8769
|
||||
|
@ -229,6 +322,9 @@ static const GstExifTagMatch tag_map_ifd0[] = {
|
|||
{GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_F_NUMBER, EXIF_TYPE_RATIONAL, 0,
|
||||
NULL,
|
||||
NULL},
|
||||
{GST_TAG_CAPTURING_EXPOSURE_PROGRAM, EXIF_TAG_EXPOSURE_PROGRAM,
|
||||
EXIF_TYPE_SHORT, 0, serialize_exposure_program,
|
||||
deserialize_exposure_program},
|
||||
|
||||
/* don't need the serializer as we always write the iso speed alone */
|
||||
{GST_TAG_CAPTURING_ISO_SPEED, EXIF_TAG_PHOTOGRAPHIC_SENSITIVITY,
|
||||
|
@ -258,9 +354,23 @@ static const GstExifTagMatch tag_map_exif[] = {
|
|||
NULL, NULL},
|
||||
{GST_TAG_APPLICATION_DATA, EXIF_TAG_MAKER_NOTE, EXIF_TYPE_UNDEFINED, 0, NULL,
|
||||
NULL},
|
||||
{GST_TAG_CAPTURING_EXPOSURE_MODE, EXIF_TAG_EXPOSURE_MODE, EXIF_TYPE_SHORT,
|
||||
0, serialize_exposure_mode, deserialize_exposure_mode},
|
||||
{GST_TAG_CAPTURING_WHITE_BALANCE, EXIF_TAG_WHITE_BALANCE, EXIF_TYPE_SHORT,
|
||||
0, serialize_white_balance, deserialize_white_balance},
|
||||
{GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO, EXIF_TAG_DIGITAL_ZOOM_RATIO,
|
||||
EXIF_TYPE_RATIONAL, 0, NULL,
|
||||
NULL},
|
||||
{GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, EXIF_TAG_SCENE_CAPTURE_TYPE,
|
||||
EXIF_TYPE_SHORT, 0, serialize_scene_capture_type,
|
||||
deserialize_scene_capture_type},
|
||||
{GST_TAG_CAPTURING_GAIN_ADJUSTMENT, EXIF_TAG_GAIN_CONTROL,
|
||||
EXIF_TYPE_SHORT, 0, serialize_gain_control,
|
||||
deserialize_gain_control},
|
||||
{GST_TAG_CAPTURING_CONTRAST, EXIF_TAG_CONTRAST, EXIF_TYPE_SHORT, 0,
|
||||
serialize_contrast, deserialize_contrast},
|
||||
{GST_TAG_CAPTURING_SATURATION, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT, 0,
|
||||
serialize_saturation, deserialize_saturation},
|
||||
{NULL, 0, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -1586,63 +1696,22 @@ byte_reader_fail:
|
|||
}
|
||||
|
||||
/* special serialization functions */
|
||||
static void
|
||||
serialize_orientation (GstExifWriter * writer, const GstTagList * taglist,
|
||||
const GstExifTagMatch * exiftag)
|
||||
{
|
||||
gchar *str = NULL;
|
||||
gint exif_value;
|
||||
|
||||
if (!gst_tag_list_get_string_index (taglist, GST_TAG_IMAGE_ORIENTATION, 0,
|
||||
&str)) {
|
||||
GST_WARNING ("No image orientation tag present in taglist");
|
||||
return;
|
||||
}
|
||||
|
||||
exif_value = gst_tag_image_orientation_to_exif_value (str);
|
||||
if (exif_value == -1) {
|
||||
GST_WARNING ("Invalid image orientation value: %s", str);
|
||||
g_free (str);
|
||||
return;
|
||||
}
|
||||
g_free (str);
|
||||
|
||||
gst_exif_writer_write_short_tag (writer, exiftag->exif_tag, exif_value);
|
||||
}
|
||||
|
||||
static gint
|
||||
deserialize_orientation (GstExifReader * exif_reader,
|
||||
GstByteReader * reader, const GstExifTagMatch * exiftag,
|
||||
GstExifTagData * tagdata)
|
||||
{
|
||||
const gchar *str = NULL;
|
||||
gint value;
|
||||
|
||||
GST_LOG ("Starting to parse %s tag in exif 0x%x", exiftag->gst_tag,
|
||||
exiftag->exif_tag);
|
||||
|
||||
/* validate tag */
|
||||
if (tagdata->tag_type != EXIF_TYPE_SHORT || tagdata->count != 1) {
|
||||
GST_WARNING ("Orientation tag has unexpected type/count");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (exif_reader->byte_order == G_LITTLE_ENDIAN) {
|
||||
value = GST_READ_UINT16_LE (tagdata->offset_as_data);
|
||||
} else {
|
||||
value = GST_READ_UINT16_BE (tagdata->offset_as_data);
|
||||
}
|
||||
|
||||
str = gst_tag_image_orientation_from_exif_value (value);
|
||||
if (str == NULL) {
|
||||
GST_WARNING ("Invalid value for exif orientation tag: %d", value);
|
||||
return 0;
|
||||
}
|
||||
gst_tag_list_add (exif_reader->taglist, GST_TAG_MERGE_REPLACE,
|
||||
exiftag->gst_tag, str, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (contrast,
|
||||
capturing_contrast);
|
||||
EXIF_SERIALIZATION_DESERIALIZATION_MAP_STRING_TO_INT_FUNC (exposure_mode,
|
||||
capturing_exposure_mode);
|
||||
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 (orientation,
|
||||
image_orientation);
|
||||
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 (white_balance,
|
||||
capturing_white_balance);
|
||||
|
||||
static void
|
||||
serialize_geo_coordinate (GstExifWriter * writer, const GstTagList * taglist,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <string.h>
|
||||
|
||||
gint
|
||||
gst_tag_image_orientation_to_exif_value (const gchar * str)
|
||||
__exif_tag_image_orientation_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
@ -50,7 +50,7 @@ end:
|
|||
}
|
||||
|
||||
const gchar *
|
||||
gst_tag_image_orientation_from_exif_value (gint value)
|
||||
__exif_tag_image_orientation_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 1:
|
||||
|
@ -74,3 +74,273 @@ gst_tag_image_orientation_from_exif_value (gint value)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_exposure_program_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "undefined") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "manual") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "normal") == 0)
|
||||
return 2;
|
||||
else if (strcmp (str, "aperture-priority") == 0)
|
||||
return 3;
|
||||
else if (strcmp (str, "shutter-priority") == 0)
|
||||
return 4;
|
||||
else if (strcmp (str, "creative") == 0)
|
||||
return 5;
|
||||
else if (strcmp (str, "action") == 0)
|
||||
return 6;
|
||||
else if (strcmp (str, "portrait") == 0)
|
||||
return 7;
|
||||
else if (strcmp (str, "landscape") == 0)
|
||||
return 8;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid capturing exposure program tag: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_exposure_program_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "undefined";
|
||||
case 1:
|
||||
return "manual";
|
||||
case 2:
|
||||
return "normal";
|
||||
case 3:
|
||||
return "aperture-priority";
|
||||
case 4:
|
||||
return "shutter-priority";
|
||||
case 5:
|
||||
return "creative";
|
||||
case 6:
|
||||
return "action";
|
||||
case 7:
|
||||
return "portrait";
|
||||
case 8:
|
||||
return "landscape";
|
||||
default:
|
||||
GST_WARNING ("Invalid exif exposure program: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_exposure_mode_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "auto-exposure") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "manual-exposure") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "auto-bracket") == 0)
|
||||
return 2;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid capturing exposure mode tag: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_exposure_mode_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "auto-exposure";
|
||||
case 1:
|
||||
return "manual-exposure";
|
||||
case 2:
|
||||
return "auto-bracket";
|
||||
default:
|
||||
GST_WARNING ("Invalid exif exposure mode: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_scene_capture_type_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "standard") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "landscape") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "portrait") == 0)
|
||||
return 2;
|
||||
else if (strcmp (str, "night-scene") == 0)
|
||||
return 3;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid capturing scene capture type: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_scene_capture_type_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "standard";
|
||||
case 1:
|
||||
return "landscape";
|
||||
case 2:
|
||||
return "portrait";
|
||||
case 3:
|
||||
return "night-scene";
|
||||
default:
|
||||
GST_WARNING ("Invalid exif scene capture type: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_gain_adjustment_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "none") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "low-gain-up") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "high-gain-up") == 0)
|
||||
return 2;
|
||||
else if (strcmp (str, "low-gain-down") == 0)
|
||||
return 3;
|
||||
else if (strcmp (str, "high-gain-down") == 0)
|
||||
return 4;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid capturing gain adjustment type: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_gain_adjustment_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "none";
|
||||
case 1:
|
||||
return "low-gain-up";
|
||||
case 2:
|
||||
return "high-gain-up";
|
||||
case 3:
|
||||
return "low-gain-down";
|
||||
case 4:
|
||||
return "high-gain-down";
|
||||
default:
|
||||
GST_WARNING ("Invalid exif gain control type: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_white_balance_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "auto") == 0)
|
||||
return 0;
|
||||
else /* everything else is just manual */
|
||||
return 1;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid white balance: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_white_balance_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "auto";
|
||||
case 1:
|
||||
return "manual";
|
||||
default:
|
||||
GST_WARNING ("Invalid white balance type: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_contrast_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "normal") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "soft") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "hard") == 0)
|
||||
return 2;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid contrast type: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_contrast_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "normal";
|
||||
case 1:
|
||||
return "soft";
|
||||
case 2:
|
||||
return "hard";
|
||||
default:
|
||||
GST_WARNING ("Invalid contrast type: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
__exif_tag_capturing_saturation_to_exif_value (const gchar * str)
|
||||
{
|
||||
if (str == NULL)
|
||||
goto end;
|
||||
|
||||
if (strcmp (str, "normal") == 0)
|
||||
return 0;
|
||||
else if (strcmp (str, "low-saturation") == 0)
|
||||
return 1;
|
||||
else if (strcmp (str, "high-saturation") == 0)
|
||||
return 2;
|
||||
|
||||
end:
|
||||
GST_WARNING ("Invalid saturation type: %s", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
__exif_tag_capturing_saturation_from_exif_value (gint value)
|
||||
{
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "normal";
|
||||
case 1:
|
||||
return "low-saturation";
|
||||
case 2:
|
||||
return "high-saturation";
|
||||
default:
|
||||
GST_WARNING ("Invalid saturation type: %d", value);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,29 @@ struct _GstTagEntryMatch {
|
|||
|
||||
GType gst_vorbis_tag_get_type (void);
|
||||
|
||||
gint gst_tag_image_orientation_to_exif_value (const gchar * str);
|
||||
const gchar * gst_tag_image_orientation_from_exif_value (gint value);
|
||||
gint __exif_tag_image_orientation_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_image_orientation_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_exposure_program_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_capturing_exposure_program_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_exposure_mode_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_capturing_exposure_mode_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_scene_capture_type_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_capturing_scene_capture_type_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_gain_adjustment_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_capturing_gain_adjustment_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_white_balance_to_exif_value (const gchar * str);
|
||||
const gchar * __exif_tag_capturing_white_balance_from_exif_value (gint value);
|
||||
|
||||
gint __exif_tag_capturing_contrast_to_exif_value (const gchar * str);
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -747,7 +747,7 @@ serialize_tiff_orientation (const GValue * value)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
num = gst_tag_image_orientation_to_exif_value (str);
|
||||
num = __exif_tag_image_orientation_to_exif_value (str);
|
||||
if (num == -1)
|
||||
return NULL;
|
||||
|
||||
|
@ -773,7 +773,7 @@ deserialize_tiff_orientation (XmpTag * xmptag, GstTagList * taglist,
|
|||
return;
|
||||
}
|
||||
|
||||
orientation = gst_tag_image_orientation_from_exif_value (value);
|
||||
orientation = __exif_tag_image_orientation_from_exif_value (value);
|
||||
if (orientation == NULL)
|
||||
return;
|
||||
gst_tag_list_add (taglist, xmp_tag_get_merge_mode (xmptag), gst_tag,
|
||||
|
|
|
@ -1282,6 +1282,103 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
|
|||
g_value_set_static_string (&value, "rotate-270");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_IMAGE_ORIENTATION,
|
||||
&value);
|
||||
|
||||
/* exposure program */
|
||||
g_value_set_static_string (&value, "undefined");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "manual");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "normal");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "aperture-priority");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "shutter-priority");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "creative");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "action");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "portrait");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
g_value_set_static_string (&value, "landscape");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_PROGRAM, &value);
|
||||
|
||||
/* exposure mode */
|
||||
g_value_set_static_string (&value, "auto-exposure");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_MODE, &value);
|
||||
g_value_set_static_string (&value, "manual-exposure");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_MODE, &value);
|
||||
g_value_set_static_string (&value, "auto-bracket");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_EXPOSURE_MODE, &value);
|
||||
|
||||
/* scene capture type */
|
||||
g_value_set_static_string (&value, "standard");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, &value);
|
||||
g_value_set_static_string (&value, "portrait");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, &value);
|
||||
g_value_set_static_string (&value, "landscape");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, &value);
|
||||
g_value_set_static_string (&value, "night-scene");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, &value);
|
||||
|
||||
g_value_set_static_string (&value, "none");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_GAIN_ADJUSTMENT, &value);
|
||||
g_value_set_static_string (&value, "high-gain-up");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_GAIN_ADJUSTMENT, &value);
|
||||
g_value_set_static_string (&value, "low-gain-up");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_GAIN_ADJUSTMENT, &value);
|
||||
g_value_set_static_string (&value, "high-gain-down");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_GAIN_ADJUSTMENT, &value);
|
||||
g_value_set_static_string (&value, "low-gain-down");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_GAIN_ADJUSTMENT, &value);
|
||||
|
||||
g_value_set_static_string (&value, "auto");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_WHITE_BALANCE, &value);
|
||||
g_value_set_static_string (&value, "manual");
|
||||
do_simple_exif_tag_serialization_deserialization
|
||||
(GST_TAG_CAPTURING_WHITE_BALANCE, &value);
|
||||
|
||||
g_value_set_static_string (&value, "normal");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_CONTRAST,
|
||||
&value);
|
||||
g_value_set_static_string (&value, "hard");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_CONTRAST,
|
||||
&value);
|
||||
g_value_set_static_string (&value, "soft");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_CONTRAST,
|
||||
&value);
|
||||
|
||||
g_value_set_static_string (&value, "normal");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SATURATION,
|
||||
&value);
|
||||
g_value_set_static_string (&value, "low-saturation");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SATURATION,
|
||||
&value);
|
||||
g_value_set_static_string (&value, "high-saturation");
|
||||
do_simple_exif_tag_serialization_deserialization (GST_TAG_CAPTURING_SATURATION,
|
||||
&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_value_init (&value, G_TYPE_DOUBLE);
|
||||
|
|
|
@ -13,8 +13,6 @@ EXPORTS
|
|||
gst_tag_id3_genre_count
|
||||
gst_tag_id3_genre_get
|
||||
gst_tag_image_data_to_image_buffer
|
||||
gst_tag_image_orientation_from_exif_value
|
||||
gst_tag_image_orientation_to_exif_value
|
||||
gst_tag_image_type_get_type
|
||||
gst_tag_list_add_id3_image
|
||||
gst_tag_list_from_exif_buffer
|
||||
|
|
Loading…
Reference in a new issue