5 * Copyright (C) <2010> Thiago Santos <thiago.sousa.santos@collabora.co.uk>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
30 #include <glib/gstdio.h>
32 #include <gst/check/gstcheck.h>
33 #include <gst/tag/tag.h>
35 #include <libexif/exif-data.h>
36 #include <libexif/exif-loader.h>
41 const GstTagList *taglist;
45 /* taken from the exif helper lib in -base */
47 #define EXIF_TYPE_BYTE 1
48 #define EXIF_TYPE_ASCII 2
49 #define EXIF_TYPE_SHORT 3
50 #define EXIF_TYPE_LONG 4
51 #define EXIF_TYPE_RATIONAL 5
52 #define EXIF_TYPE_UNDEFINED 7
53 #define EXIF_TYPE_SLONG 9
54 #define EXIF_TYPE_SRATIONAL 10
56 typedef struct _GstExifTagMatch GstExifTagMatch;
57 typedef void (*CompareFunc) (ExifEntry * entry, ExifTagCheckData * testdata);
59 struct _GstExifTagMatch
64 CompareFunc compare_func;
69 /* Copied over from gst-libs/gst/tag/gsttagedittingprivate.c from -base */
71 __exif_tag_image_orientation_to_exif_value (const gchar * str)
76 if (strcmp (str, "rotate-0") == 0)
78 else if (strcmp (str, "flip-rotate-0") == 0)
80 else if (strcmp (str, "rotate-180") == 0)
82 else if (strcmp (str, "flip-rotate-180") == 0)
84 else if (strcmp (str, "flip-rotate-270") == 0)
86 else if (strcmp (str, "rotate-90") == 0)
88 else if (strcmp (str, "flip-rotate-90") == 0)
90 else if (strcmp (str, "rotate-270") == 0)
94 GST_WARNING ("Invalid image orientation tag: %s", str);
99 __exif_tag_capture_exposure_program_to_exif_value (const gchar * str)
104 if (strcmp (str, "undefined") == 0)
106 else if (strcmp (str, "manual") == 0)
108 else if (strcmp (str, "normal") == 0)
110 else if (strcmp (str, "aperture-priority") == 0)
112 else if (strcmp (str, "shutter-priority") == 0)
114 else if (strcmp (str, "creative") == 0)
116 else if (strcmp (str, "action") == 0)
118 else if (strcmp (str, "portrait") == 0)
120 else if (strcmp (str, "landscape") == 0)
124 GST_WARNING ("Invalid capture exposure program tag: %s", str);
129 __exif_tag_capture_exposure_mode_to_exif_value (const gchar * str)
134 if (strcmp (str, "auto-exposure") == 0)
136 else if (strcmp (str, "manual-exposure") == 0)
138 else if (strcmp (str, "auto-bracket") == 0)
142 GST_WARNING ("Invalid capture exposure mode tag: %s", str);
147 __exif_tag_capture_scene_capture_type_to_exif_value (const gchar * str)
152 if (strcmp (str, "standard") == 0)
154 else if (strcmp (str, "landscape") == 0)
156 else if (strcmp (str, "portrait") == 0)
158 else if (strcmp (str, "night-scene") == 0)
162 GST_WARNING ("Invalid capture scene capture type: %s", str);
167 __exif_tag_capture_gain_adjustment_to_exif_value (const gchar * str)
172 if (strcmp (str, "none") == 0)
174 else if (strcmp (str, "low-gain-up") == 0)
176 else if (strcmp (str, "high-gain-up") == 0)
178 else if (strcmp (str, "low-gain-down") == 0)
180 else if (strcmp (str, "high-gain-down") == 0)
184 GST_WARNING ("Invalid capture gain adjustment type: %s", str);
189 __exif_tag_capture_white_balance_to_exif_value (const gchar * str)
194 if (strcmp (str, "auto") == 0)
196 else /* everything else is just manual */
200 GST_WARNING ("Invalid white balance: %s", str);
205 __exif_tag_capture_contrast_to_exif_value (const gchar * str)
210 if (strcmp (str, "normal") == 0)
212 else if (strcmp (str, "soft") == 0)
214 else if (strcmp (str, "hard") == 0)
218 GST_WARNING ("Invalid contrast type: %s", str);
223 __exif_tag_capture_sharpness_to_exif_value (const gchar * str)
228 if (strcmp (str, "normal") == 0)
230 else if (strcmp (str, "soft") == 0)
232 else if (strcmp (str, "hard") == 0)
236 GST_WARNING ("Invalid sharpness type: %s", str);
241 __exif_tag_capture_saturation_to_exif_value (const gchar * str)
246 if (strcmp (str, "normal") == 0)
248 else if (strcmp (str, "low-saturation") == 0)
250 else if (strcmp (str, "high-saturation") == 0)
254 GST_WARNING ("Invalid saturation type: %s", str);
259 __exif_tag_capture_metering_mode_to_exif_value (const gchar * str)
264 if (strcmp (str, "unknown") == 0)
266 else if (strcmp (str, "average") == 0)
268 else if (strcmp (str, "center-weighted-average") == 0)
270 else if (strcmp (str, "spot") == 0)
272 else if (strcmp (str, "multi-spot") == 0)
274 else if (strcmp (str, "pattern") == 0)
276 else if (strcmp (str, "partial") == 0)
278 else if (strcmp (str, "other") == 0)
282 GST_WARNING ("Invalid metering mode type: %s", str);
287 __exif_tag_capture_source_to_exif_value (const gchar * str)
292 if (strcmp (str, "dsc") == 0)
294 else if (strcmp (str, "other") == 0)
296 else if (strcmp (str, "transparent-scanner") == 0)
298 else if (strcmp (str, "reflex-scanner") == 0)
302 GST_WARNING ("Invalid capturing source type: %s", str);
306 #define GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC(gst_tag,name) \
308 compare_ ## name (ExifEntry * entry, ExifTagCheckData * testdata) \
310 gchar *str_tag = NULL; \
311 gint exif_value = -1; \
314 if (!gst_tag_list_get_string_index (testdata->taglist, \
315 gst_tag, 0, &str_tag)) { \
316 /* fail the test if we can't get the tag */ \
317 fail ("Failed to get %s from taglist", gst_tag); \
320 value = __exif_tag_ ## name ## _to_exif_value (str_tag); \
323 fail ("Invalid %s tag value: %s", gst_tag, str_tag); \
326 if (entry->format == EXIF_TYPE_SHORT) \
327 exif_value = (gint) exif_get_short (entry->data, \
328 exif_data_get_byte_order (entry->parent->parent)); \
329 else if (entry->format == EXIF_TYPE_UNDEFINED) \
330 exif_value = (gint) entry->data[0]; \
332 if (value != exif_value) { \
333 fail ("Gstreamer tag value (%d) is different from libexif (%d)", \
334 value, exif_value); \
337 testdata->result = TRUE; \
342 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC (GST_TAG_IMAGE_ORIENTATION,
344 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
345 (GST_TAG_CAPTURING_EXPOSURE_PROGRAM, capture_exposure_program);
346 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC (GST_TAG_CAPTURING_EXPOSURE_MODE,
347 capture_exposure_mode);
348 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC (GST_TAG_CAPTURING_WHITE_BALANCE,
349 capture_white_balance);
350 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC (GST_TAG_CAPTURING_CONTRAST,
352 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
353 (GST_TAG_CAPTURING_GAIN_ADJUSTMENT, capture_gain_adjustment);
354 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC (GST_TAG_CAPTURING_SATURATION,
356 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
357 (GST_TAG_CAPTURING_SHARPNESS, capture_sharpness);
358 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
359 (GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, capture_scene_capture_type);
360 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
361 (GST_TAG_CAPTURING_METERING_MODE, capture_metering_mode);
362 GST_COMPARE_GST_STRING_TAG_TO_EXIF_SHORT_FUNC
363 (GST_TAG_CAPTURING_SOURCE, capture_source);
366 compare_date_time (ExifEntry * entry, ExifTagCheckData * testdata)
368 gint year = 0, month = 1, day = 1, hour = 0, minute = 0, second = 0;
369 GstDateTime *exif_datetime;
370 GstDateTime *datetime;
373 if (!gst_tag_list_get_date_time_index (testdata->taglist, GST_TAG_DATE_TIME,
375 GST_WARNING ("Failed to get datetime from taglist");
379 str = (gchar *) entry->data;
381 sscanf (str, "%04d:%02d:%02d %02d:%02d:%02d", &year, &month, &day,
382 &hour, &minute, &second);
383 exif_datetime = gst_date_time_new_local_time (year, month, day, hour, minute,
385 fail_if (exif_datetime == NULL);
387 fail_unless (gst_date_time_get_year (datetime) ==
388 gst_date_time_get_year (exif_datetime)
389 && gst_date_time_get_month (datetime) ==
390 gst_date_time_get_month (exif_datetime)
391 && gst_date_time_get_day (datetime) ==
392 gst_date_time_get_day (exif_datetime)
393 && gst_date_time_get_hour (datetime) ==
394 gst_date_time_get_hour (exif_datetime)
395 && gst_date_time_get_minute (datetime) ==
396 gst_date_time_get_minute (exif_datetime)
397 && gst_date_time_get_second (datetime) ==
398 gst_date_time_get_second (exif_datetime));
400 gst_date_time_unref (exif_datetime);
401 gst_date_time_unref (datetime);
403 testdata->result = TRUE;
407 compare_shutter_speed (ExifEntry * entry, ExifTagCheckData * testdata)
409 gdouble gst_num, exif_num;
410 ExifSRational rational;
411 GValue exif_value = { 0 };
412 const GValue *gst_value = NULL;
414 gst_value = gst_tag_list_get_value_index (testdata->taglist,
415 GST_TAG_CAPTURING_SHUTTER_SPEED, 0);
416 if (gst_value == NULL) {
417 GST_WARNING ("Failed to get shutter-speed from taglist");
421 rational = exif_get_srational (entry->data,
422 exif_data_get_byte_order (entry->parent->parent));
424 g_value_init (&exif_value, GST_TYPE_FRACTION);
425 gst_value_set_fraction (&exif_value, rational.numerator,
426 rational.denominator);
427 gst_util_fraction_to_double (gst_value_get_fraction_numerator (&exif_value),
428 gst_value_get_fraction_denominator (&exif_value), &exif_num);
429 g_value_unset (&exif_value);
431 gst_util_fraction_to_double (gst_value_get_fraction_numerator (gst_value),
432 gst_value_get_fraction_denominator (gst_value), &gst_num);
434 exif_num = pow (2, -exif_num);
436 GST_LOG ("Shutter speed in gst=%lf and in exif=%lf", gst_num, exif_num);
437 fail_unless (ABS (gst_num - exif_num) < 0.001);
438 testdata->result = TRUE;
442 compare_aperture_value (ExifEntry * entry, ExifTagCheckData * testdata)
444 gdouble gst_value, exif_value;
445 ExifSRational rational;
446 GValue value = { 0 };
448 if (!gst_tag_list_get_double_index (testdata->taglist,
449 GST_TAG_CAPTURING_FOCAL_RATIO, 0, &gst_value)) {
450 GST_WARNING ("Failed to get focal ratio from taglist");
454 rational = exif_get_srational (entry->data,
455 exif_data_get_byte_order (entry->parent->parent));
457 g_value_init (&value, GST_TYPE_FRACTION);
458 gst_value_set_fraction (&value, rational.numerator, rational.denominator);
459 gst_util_fraction_to_double (gst_value_get_fraction_numerator (&value),
460 gst_value_get_fraction_denominator (&value), &exif_value);
461 g_value_unset (&value);
463 exif_value = pow (2, exif_value / 2);
465 GST_LOG ("Aperture value in gst=%lf and in exif=%lf", gst_value, exif_value);
466 fail_unless (ABS (gst_value - exif_value) < 0.001);
467 testdata->result = TRUE;
471 compare_flash (ExifEntry * entry, ExifTagCheckData * testdata)
474 gboolean flash_fired;
475 const gchar *flash_mode;
477 flags = (gint) exif_get_short (entry->data,
478 exif_data_get_byte_order (entry->parent->parent));
480 if (!gst_tag_list_get_boolean_index (testdata->taglist,
481 GST_TAG_CAPTURING_FLASH_FIRED, 0, &flash_fired)) {
482 GST_WARNING ("Failed to get %s tag", GST_TAG_CAPTURING_FLASH_FIRED);
485 if (!gst_tag_list_peek_string_index (testdata->taglist,
486 GST_TAG_CAPTURING_FLASH_MODE, 0, &flash_mode)) {
487 GST_WARNING ("Failed to get %s tag", GST_TAG_CAPTURING_FLASH_MODE);
492 fail_unless ((flags & 1) == 1);
494 fail_unless ((flags & 1) == 0);
496 if (strcmp (flash_mode, "auto") == 0) {
497 fail_unless (((flags >> 3) & 0x3) == 3);
498 } else if (strcmp (flash_mode, "always") == 0) {
499 fail_unless (((flags >> 3) & 0x3) == 1);
500 } else if (strcmp (flash_mode, "never") == 0) {
501 fail_unless (((flags >> 3) & 0x3) == 2);
503 fail ("unexpected flash mode");
505 testdata->result = TRUE;
509 compare_geo_elevation (ExifEntry * entry, ExifTagCheckData * testdata)
511 gdouble altitude = 0, gst_value;
512 ExifRational rational;
514 fail_unless (gst_tag_list_get_double_index (testdata->taglist,
515 GST_TAG_GEO_LOCATION_ELEVATION, 0, &gst_value));
517 fail_unless (entry->components == 1);
519 rational = exif_get_rational (entry->data,
520 exif_data_get_byte_order (entry->parent->parent));
521 gst_util_fraction_to_double (rational.numerator, rational.denominator,
524 gst_value = ABS (gst_value);
525 fail_unless (ABS (gst_value - altitude) < 0.001);
526 testdata->result = TRUE;
530 compare_geo_elevation_ref (ExifEntry * entry, ExifTagCheckData * testdata)
534 fail_unless (gst_tag_list_get_double_index (testdata->taglist,
535 GST_TAG_GEO_LOCATION_ELEVATION, 0, &gst_value));
537 fail_unless (entry->components == 1);
539 if (gst_value >= 0) {
540 fail_unless (entry->data[0] == 0);
542 fail_unless (entry->data[0] == 1);
544 testdata->result = TRUE;
548 compare_speed (ExifEntry * entry, ExifTagCheckData * testdata)
550 gdouble speed = 0, gst_value;
551 ExifRational rational;
553 fail_unless (gst_tag_list_get_double_index (testdata->taglist,
554 GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, 0, &gst_value));
556 fail_unless (entry->components == 1);
558 rational = exif_get_rational (entry->data,
559 exif_data_get_byte_order (entry->parent->parent));
560 gst_util_fraction_to_double (rational.numerator, rational.denominator,
565 fail_unless (ABS (gst_value - speed) < 0.001);
566 testdata->result = TRUE;
570 compare_speed_ref (ExifEntry * entry, ExifTagCheckData * testdata)
572 fail_unless (entry->components == 2);
573 fail_unless (entry->data[0] == 'K');
574 testdata->result = TRUE;
578 compare_geo_coordinate (ExifEntry * entry, ExifTagCheckData * testdata);
581 compare_geo_coordinate_ref (ExifEntry * entry, ExifTagCheckData * testdata);
584 compare_geo_direction (ExifEntry * entry, ExifTagCheckData * testdata);
587 compare_geo_direction_ref (ExifEntry * entry, ExifTagCheckData * testdata);
589 static const GstExifTagMatch tag_map[] = {
590 {GST_TAG_DESCRIPTION, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_TYPE_ASCII,
592 {GST_TAG_DEVICE_MANUFACTURER, EXIF_TAG_MAKE, EXIF_TYPE_ASCII,
594 {GST_TAG_DEVICE_MODEL, EXIF_TAG_MODEL, EXIF_TYPE_ASCII, NULL},
595 {GST_TAG_IMAGE_ORIENTATION, EXIF_TAG_ORIENTATION, EXIF_TYPE_SHORT,
596 compare_image_orientation},
597 {GST_TAG_IMAGE_HORIZONTAL_PPI, EXIF_TAG_X_RESOLUTION, EXIF_TYPE_RATIONAL,
599 {GST_TAG_IMAGE_VERTICAL_PPI, EXIF_TAG_Y_RESOLUTION, EXIF_TYPE_RATIONAL, NULL},
600 {GST_TAG_APPLICATION_NAME, EXIF_TAG_SOFTWARE, EXIF_TYPE_ASCII,
602 {GST_TAG_DATE_TIME, EXIF_TAG_DATE_TIME, EXIF_TYPE_ASCII,
604 {GST_TAG_ARTIST, EXIF_TAG_ARTIST, EXIF_TYPE_ASCII, NULL},
605 {GST_TAG_COPYRIGHT, EXIF_TAG_COPYRIGHT, EXIF_TYPE_ASCII, NULL},
606 {GST_TAG_CAPTURING_SHUTTER_SPEED, EXIF_TAG_EXPOSURE_TIME,
607 EXIF_TYPE_RATIONAL, NULL},
608 {GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_FNUMBER, EXIF_TYPE_RATIONAL,
610 {GST_TAG_CAPTURING_EXPOSURE_PROGRAM, EXIF_TAG_EXPOSURE_PROGRAM,
611 EXIF_TYPE_SHORT, compare_capture_exposure_program},
613 /* This is called PhotographicSensitivity in 2.3 */
614 {GST_TAG_CAPTURING_ISO_SPEED, EXIF_TAG_ISO_SPEED_RATINGS,
615 EXIF_TYPE_SHORT, NULL},
617 {GST_TAG_CAPTURING_SHUTTER_SPEED, EXIF_TAG_SHUTTER_SPEED_VALUE,
618 EXIF_TYPE_SRATIONAL, compare_shutter_speed},
619 {GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_APERTURE_VALUE, EXIF_TYPE_RATIONAL,
620 compare_aperture_value},
621 {GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, EXIF_TAG_EXPOSURE_BIAS_VALUE,
622 EXIF_TYPE_SRATIONAL},
623 {GST_TAG_CAPTURING_FLASH_FIRED, EXIF_TAG_FLASH, EXIF_TYPE_SHORT,
625 {GST_TAG_CAPTURING_FLASH_MODE, EXIF_TAG_FLASH, EXIF_TYPE_SHORT,
627 {GST_TAG_CAPTURING_FOCAL_LENGTH, EXIF_TAG_FOCAL_LENGTH, EXIF_TYPE_RATIONAL,
629 {GST_TAG_APPLICATION_DATA, EXIF_TAG_MAKER_NOTE, EXIF_TYPE_UNDEFINED, NULL},
630 {GST_TAG_CAPTURING_EXPOSURE_MODE, EXIF_TAG_EXPOSURE_MODE, EXIF_TYPE_SHORT,
631 compare_capture_exposure_mode},
632 {GST_TAG_CAPTURING_WHITE_BALANCE, EXIF_TAG_WHITE_BALANCE, EXIF_TYPE_SHORT,
633 compare_capture_white_balance},
634 {GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO, EXIF_TAG_DIGITAL_ZOOM_RATIO,
635 EXIF_TYPE_RATIONAL, NULL},
636 {GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE, EXIF_TAG_SCENE_CAPTURE_TYPE,
637 EXIF_TYPE_SHORT, compare_capture_scene_capture_type},
638 {GST_TAG_CAPTURING_GAIN_ADJUSTMENT, EXIF_TAG_GAIN_CONTROL,
639 EXIF_TYPE_SHORT, compare_capture_gain_adjustment},
640 {GST_TAG_CAPTURING_CONTRAST, EXIF_TAG_CONTRAST, EXIF_TYPE_SHORT,
641 compare_capture_contrast},
642 {GST_TAG_CAPTURING_SATURATION, EXIF_TAG_SATURATION, EXIF_TYPE_SHORT,
643 compare_capture_saturation},
644 {GST_TAG_CAPTURING_SHARPNESS, EXIF_TAG_SHARPNESS, EXIF_TYPE_SHORT,
645 compare_capture_sharpness},
646 {GST_TAG_CAPTURING_METERING_MODE, EXIF_TAG_METERING_MODE, EXIF_TYPE_SHORT,
647 compare_capture_metering_mode},
648 {GST_TAG_CAPTURING_SOURCE, EXIF_TAG_FILE_SOURCE, EXIF_TYPE_UNDEFINED,
649 compare_capture_source},
652 {GST_TAG_GEO_LOCATION_LATITUDE, EXIF_TAG_GPS_LATITUDE, EXIF_TYPE_RATIONAL,
653 compare_geo_coordinate},
654 {GST_TAG_GEO_LOCATION_LATITUDE, EXIF_TAG_GPS_LATITUDE_REF, EXIF_TYPE_ASCII,
655 compare_geo_coordinate_ref},
656 {GST_TAG_GEO_LOCATION_LONGITUDE, EXIF_TAG_GPS_LONGITUDE, EXIF_TYPE_RATIONAL,
657 compare_geo_coordinate},
658 {GST_TAG_GEO_LOCATION_LONGITUDE, EXIF_TAG_GPS_LONGITUDE_REF, EXIF_TYPE_ASCII,
659 compare_geo_coordinate_ref},
660 {GST_TAG_GEO_LOCATION_ELEVATION, EXIF_TAG_GPS_ALTITUDE, EXIF_TYPE_RATIONAL,
661 compare_geo_elevation},
662 {GST_TAG_GEO_LOCATION_ELEVATION, EXIF_TAG_GPS_ALTITUDE_REF, EXIF_TYPE_BYTE,
663 compare_geo_elevation_ref},
664 {GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, EXIF_TAG_GPS_SPEED, EXIF_TYPE_RATIONAL,
666 {GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, EXIF_TAG_GPS_SPEED_REF, EXIF_TYPE_ASCII,
668 {GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, EXIF_TAG_GPS_TRACK,
669 EXIF_TYPE_RATIONAL, compare_geo_direction},
670 {GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, EXIF_TAG_GPS_TRACK_REF,
671 EXIF_TYPE_ASCII, compare_geo_direction_ref},
672 {GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, EXIF_TAG_GPS_IMG_DIRECTION,
673 EXIF_TYPE_RATIONAL, compare_geo_direction},
674 {GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, EXIF_TAG_GPS_IMG_DIRECTION_REF,
675 EXIF_TYPE_ASCII, compare_geo_direction_ref}
678 * libexif doesn't have these tags
679 * {GST_TAG_CAPTURING_ISO_SPEED, EXIF_TAG_ISO_SPEED, EXIF_TYPE_LONG, NULL},
680 * {GST_TAG_CAPTURING_ISO_SPEED, EXIF_TAG_SENSITIVITY_TYPE,
681 * EXIF_TYPE_SHORT, compare_sensitivity_type},
686 compare_geo_coordinate (ExifEntry * entry, ExifTagCheckData * testdata)
688 gdouble coordinate = 0, aux, gst_value;
689 ExifRational rational;
691 fail_unless (gst_tag_list_get_double_index (testdata->taglist,
692 tag_map[testdata->map_index].gst_tag, 0, &gst_value));
694 fail_unless (entry->components == 3);
696 rational = exif_get_rational (entry->data,
697 exif_data_get_byte_order (entry->parent->parent));
698 gst_util_fraction_to_double (rational.numerator, rational.denominator, &aux);
701 rational = exif_get_rational (entry->data + 8,
702 exif_data_get_byte_order (entry->parent->parent));
703 gst_util_fraction_to_double (rational.numerator, rational.denominator, &aux);
704 coordinate += aux / 60.0;
706 rational = exif_get_rational (entry->data + 16,
707 exif_data_get_byte_order (entry->parent->parent));
708 gst_util_fraction_to_double (rational.numerator, rational.denominator, &aux);
709 coordinate += aux / 3600.0;
711 gst_value = ABS (gst_value);
712 fail_unless (ABS (gst_value - coordinate) < 0.001);
713 testdata->result = TRUE;
717 compare_geo_coordinate_ref (ExifEntry * entry, ExifTagCheckData * testdata)
722 tag = tag_map[testdata->map_index].gst_tag;
724 fail_unless (gst_tag_list_get_double_index (testdata->taglist, tag, 0,
727 fail_unless (entry->components == 2);
729 if (strcmp (tag, GST_TAG_GEO_LOCATION_LATITUDE) == 0) {
730 if (gst_value >= 0) {
731 fail_unless (entry->data[0] == 'N');
733 fail_unless (entry->data[0] == 'S');
736 if (gst_value >= 0) {
737 fail_unless (entry->data[0] == 'E');
739 fail_unless (entry->data[0] == 'W');
742 testdata->result = TRUE;
746 compare_geo_direction (ExifEntry * entry, ExifTagCheckData * testdata)
748 gdouble direction = 0, gst_value;
749 ExifRational rational;
751 fail_unless (gst_tag_list_get_double_index (testdata->taglist,
752 tag_map[testdata->map_index].gst_tag, 0, &gst_value));
754 fail_unless (entry->components == 1);
756 rational = exif_get_rational (entry->data,
757 exif_data_get_byte_order (entry->parent->parent));
758 gst_util_fraction_to_double (rational.numerator, rational.denominator,
761 fail_unless (ABS (gst_value - direction) < 0.001);
762 testdata->result = TRUE;
766 compare_geo_direction_ref (ExifEntry * entry, ExifTagCheckData * testdata)
768 fail_unless (entry->components == 2);
769 fail_unless (entry->data[0] == 'T');
770 testdata->result = TRUE;
774 check_content (ExifContent * content, void *user_data)
776 ExifTagCheckData *test_data = (ExifTagCheckData *) user_data;
781 tagindex = test_data->map_index;
782 gst_tag_type = gst_tag_get_type (tag_map[tagindex].gst_tag);
784 GST_DEBUG ("Got tagindex %u for gsttag %s with type %s", tagindex,
785 tag_map[tagindex].gst_tag, g_type_name (gst_tag_type));
787 /* search for the entry */
788 entry = exif_content_get_entry (content, tag_map[tagindex].exif_tag);
789 GST_DEBUG ("Entry found at %p", entry);
793 fail_unless (entry->format == tag_map[tagindex].exif_type);
795 if (tag_map[tagindex].compare_func) {
796 tag_map[tagindex].compare_func (entry, test_data);
800 switch (entry->format) {
801 case EXIF_TYPE_ASCII:{
805 str = (gchar *) entry->data;
806 fail_unless (gst_tag_list_get_string (test_data->taglist,
807 tag_map[tagindex].gst_tag, &taglist_str));
809 fail_unless (strcmp (str, taglist_str) == 0);
810 test_data->result = TRUE;
811 g_free (taglist_str);
814 case EXIF_TYPE_SRATIONAL:
815 case EXIF_TYPE_RATIONAL:{
816 GValue exif_value = { 0 };
818 g_value_init (&exif_value, GST_TYPE_FRACTION);
819 if (entry->format == EXIF_TYPE_RATIONAL) {
820 ExifRational exif_rational = exif_get_rational (entry->data,
821 exif_data_get_byte_order (entry->parent->parent));
823 gst_value_set_fraction (&exif_value, exif_rational.numerator,
824 exif_rational.denominator);
826 ExifSRational exif_rational = exif_get_srational (entry->data,
827 exif_data_get_byte_order (entry->parent->parent));
829 gst_value_set_fraction (&exif_value, exif_rational.numerator,
830 exif_rational.denominator);
833 if (gst_tag_type == GST_TYPE_FRACTION) {
834 const GValue *value = gst_tag_list_get_value_index (test_data->taglist,
835 tag_map[tagindex].gst_tag, 0);
837 fail_unless (value != NULL);
838 fail_unless (G_VALUE_TYPE (value) == GST_TYPE_FRACTION);
840 fail_unless (gst_value_get_fraction_numerator (value) ==
841 gst_value_get_fraction_numerator (&exif_value) &&
842 gst_value_get_fraction_denominator (value) ==
843 gst_value_get_fraction_denominator (&exif_value));
845 test_data->result = TRUE;
846 } else if (gst_tag_type == G_TYPE_DOUBLE) {
850 gst_util_fraction_to_double (gst_value_get_fraction_numerator
851 (&exif_value), gst_value_get_fraction_denominator (&exif_value),
854 fail_unless (gst_tag_list_get_double_index (test_data->taglist,
855 tag_map[tagindex].gst_tag, 0, &gst_num));
857 fail_unless (gst_num == exif_num);
858 test_data->result = TRUE;
860 GST_WARNING ("Unhandled type for rational tag(%X): %s",
861 entry->tag, g_type_name (gst_tag_type));
863 g_value_unset (&exif_value);
866 case EXIF_TYPE_SHORT:
867 case EXIF_TYPE_LONG:{
871 if (entry->format == EXIF_TYPE_LONG) {
872 exif_num = (gint) exif_get_long (entry->data,
873 exif_data_get_byte_order (entry->parent->parent));
874 } else if (entry->format == EXIF_TYPE_SHORT) {
875 exif_num = (gint) exif_get_short (entry->data,
876 exif_data_get_byte_order (entry->parent->parent));
879 fail_unless (gst_tag_list_get_int_index (test_data->taglist,
880 tag_map[tagindex].gst_tag, 0, &gst_num));
882 fail_unless (exif_num == gst_num);
883 test_data->result = TRUE;
886 case EXIF_TYPE_UNDEFINED:{
892 if (!gst_tag_list_get_sample_index (test_data->taglist,
893 tag_map[tagindex].gst_tag, 0, &sample)) {
896 buf = gst_sample_get_buffer (sample);
897 gst_buffer_map (buf, &map, GST_MAP_READ);
898 fail_unless (entry->size, map.size);
899 for (i = 0; i < map.size; i++) {
900 fail_unless (map.data[i] == (guint8) entry->data[i]);
902 gst_buffer_unmap (buf, &map);
904 test_data->result = TRUE;
905 gst_sample_unref (sample);
909 fail ("unexpected exif type %d", entry->format);
914 * Iterates over the exif data searching for the mapping pointed by index
917 libexif_check_tag_exists (const GstTagList * taglist, gint index, gpointer data)
919 ExifData *exif_data = (ExifData *) data;
920 ExifTagCheckData test_data;
922 test_data.result = FALSE;
923 test_data.taglist = taglist;
924 test_data.map_index = index;
926 exif_data_foreach_content (exif_data, check_content, &test_data);
928 fail_unless (test_data.result);
932 generate_jif_file_with_tags_from_taglist (GstTagList * taglist,
933 const gchar * filepath)
935 GstElement *pipeline;
940 GstTagSetter *setter;
942 launchline = g_strdup_printf ("videotestsrc num-buffers=1 ! jpegenc ! "
943 "jifmux name=jifmux0 ! filesink location=%s", filepath);
945 pipeline = gst_parse_launch (launchline, NULL);
946 fail_unless (pipeline != NULL);
949 jifmux = gst_bin_get_by_name (GST_BIN (pipeline), "jifmux0");
950 fail_unless (jifmux != NULL);
951 setter = GST_TAG_SETTER (jifmux);
952 gst_tag_setter_merge_tags (setter, taglist, GST_TAG_MERGE_REPLACE);
953 gst_object_unref (jifmux);
955 bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
957 fail_if (gst_element_set_state (pipeline, GST_STATE_PLAYING) ==
958 GST_STATE_CHANGE_FAILURE);
960 msg = gst_bus_timed_pop_filtered (bus, GST_SECOND * 10, GST_MESSAGE_EOS |
963 fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
965 gst_message_unref (msg);
966 gst_object_unref (bus);
967 gst_element_set_state (pipeline, GST_STATE_NULL);
968 gst_object_unref (pipeline);
972 generate_jif_file_with_tags (const gchar * tags, const gchar * filepath)
976 taglist = gst_tag_list_new_from_string (tags);
977 generate_jif_file_with_tags_from_taglist (taglist, filepath);
979 gst_tag_list_unref (taglist);
983 libexif_check_tags_from_taglist (GstTagList * taglist, const gchar * filepath)
988 fail_unless (taglist != NULL);
989 exif_data = exif_data_new_from_file (filepath);
991 /* iterate over our tag mapping */
992 for (i = 0; i < G_N_ELEMENTS (tag_map); i++) {
993 if (gst_tag_list_get_value_index (taglist, tag_map[i].gst_tag, 0)) {
994 /* we have added this field to the taglist, check if it was written in
996 libexif_check_tag_exists (taglist, i, exif_data);
1000 exif_data_unref (exif_data);
1004 libexif_check_tags (const gchar * tags, const gchar * filepath)
1006 GstTagList *taglist;
1008 taglist = gst_tag_list_new_from_string (tags);
1009 fail_unless (taglist != NULL);
1011 libexif_check_tags_from_taglist (taglist, filepath);
1013 gst_tag_list_unref (taglist);
1016 GST_START_TEST (test_jifmux_tags)
1020 GstTagList *taglist;
1021 GstDateTime *datetime;
1027 gst_tag_register_musicbrainz_tags ();
1029 tmp = g_strdup_printf ("%s%d", "gst-check-xmp-test-", g_random_int ());
1030 tmpfile = g_build_filename (g_get_tmp_dir (), tmp, NULL);
1033 datetime = gst_date_time_new_local_time (2000, 10, 5, 8, 45, 13);
1034 buffer = gst_buffer_new_and_alloc (100);
1035 gst_buffer_map (buffer, &map, GST_MAP_WRITE);
1036 for (i = 0; i < 100; i++) {
1039 gst_buffer_unmap (buffer, &map);
1041 sample = gst_sample_new (buffer, NULL, NULL, NULL);
1042 gst_buffer_unref (buffer);
1044 taglist = gst_tag_list_new (GST_TAG_ARTIST, "some artist",
1045 GST_TAG_COPYRIGHT, "My copyright notice",
1046 GST_TAG_DEVICE_MANUFACTURER, "MyFavoriteBrand",
1047 GST_TAG_DEVICE_MODEL, "123v42.1",
1048 GST_TAG_DESCRIPTION, "some description",
1049 GST_TAG_APPLICATION_NAME, "jifmux-test v1.2b",
1050 GST_TAG_CAPTURING_SHUTTER_SPEED, 1, 30,
1051 GST_TAG_CAPTURING_FOCAL_RATIO, 2.0,
1052 GST_TAG_CAPTURING_ISO_SPEED, 800, GST_TAG_DATE_TIME, datetime,
1053 GST_TAG_CAPTURING_FOCAL_LENGTH, 22.5,
1054 GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO, 5.25,
1055 GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, -2.5,
1056 GST_TAG_APPLICATION_DATA, sample,
1057 GST_TAG_CAPTURING_FLASH_FIRED, TRUE,
1058 GST_TAG_CAPTURING_FLASH_MODE, "auto",
1059 GST_TAG_CAPTURING_SOURCE, "dsc",
1060 GST_TAG_CAPTURING_METERING_MODE, "multi-spot",
1061 GST_TAG_CAPTURING_SHARPNESS, "normal",
1062 GST_TAG_CAPTURING_SATURATION, "normal",
1063 GST_TAG_CAPTURING_CONTRAST, "normal",
1064 GST_TAG_GEO_LOCATION_LATITUDE, -32.375,
1065 GST_TAG_GEO_LOCATION_LONGITUDE, 76.0125,
1066 GST_TAG_GEO_LOCATION_ELEVATION, 300.85,
1067 GST_TAG_GEO_LOCATION_MOVEMENT_SPEED, 3.6,
1068 GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION, 35.4,
1069 GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION, 12.345,
1070 GST_TAG_IMAGE_HORIZONTAL_PPI, 300.0,
1071 GST_TAG_IMAGE_VERTICAL_PPI, 96.0, NULL);
1072 gst_date_time_unref (datetime);
1073 gst_sample_unref (sample);
1074 generate_jif_file_with_tags_from_taglist (taglist, tmpfile);
1075 libexif_check_tags_from_taglist (taglist, tmpfile);
1076 gst_tag_list_unref (taglist);
1078 #define IMAGE_ORIENTATION_TAG(t) "taglist," GST_TAG_IMAGE_ORIENTATION "=" t
1079 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("rotate-0"), tmpfile);
1080 libexif_check_tags (IMAGE_ORIENTATION_TAG ("rotate-0"), tmpfile);
1081 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-0"),
1083 libexif_check_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-0"), tmpfile);
1084 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("rotate-180"), tmpfile);
1085 libexif_check_tags (IMAGE_ORIENTATION_TAG ("rotate-180"), tmpfile);
1086 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-180"),
1088 libexif_check_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-180"), tmpfile);
1089 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG
1090 ("flip-rotate-270"), tmpfile);
1091 libexif_check_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-270"), tmpfile);
1092 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("rotate-90"), tmpfile);
1093 libexif_check_tags (IMAGE_ORIENTATION_TAG ("rotate-90"), tmpfile);
1094 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG
1095 ("flip-rotate-90"), tmpfile);
1096 libexif_check_tags (IMAGE_ORIENTATION_TAG ("flip-rotate-90"), tmpfile);
1097 generate_jif_file_with_tags (IMAGE_ORIENTATION_TAG ("rotate-270"), tmpfile);
1098 libexif_check_tags (IMAGE_ORIENTATION_TAG ("rotate-270"), tmpfile);
1100 #define EXPOSURE_PROGRAM_TAG(t) "taglist," GST_TAG_CAPTURING_EXPOSURE_PROGRAM \
1102 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("undefined"), tmpfile);
1103 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("undefined"), tmpfile);
1104 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("manual"), tmpfile);
1105 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("manual"), tmpfile);
1106 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("normal"), tmpfile);
1107 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("normal"), tmpfile);
1108 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("aperture-priority"),
1110 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("aperture-priority"), tmpfile);
1111 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("shutter-priority"),
1113 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("shutter-priority"), tmpfile);
1114 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("creative"), tmpfile);
1115 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("creative"), tmpfile);
1116 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("action"), tmpfile);
1117 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("action"), tmpfile);
1118 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("portrait"), tmpfile);
1119 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("portrait"), tmpfile);
1120 generate_jif_file_with_tags (EXPOSURE_PROGRAM_TAG ("landscape"), tmpfile);
1121 libexif_check_tags (EXPOSURE_PROGRAM_TAG ("landscape"), tmpfile);
1123 #define EXPOSURE_MODE_TAG(t) "taglist," GST_TAG_CAPTURING_EXPOSURE_MODE "=" t
1124 generate_jif_file_with_tags (EXPOSURE_MODE_TAG ("auto-exposure"), tmpfile);
1125 libexif_check_tags (EXPOSURE_MODE_TAG ("auto-exposure"), tmpfile);
1126 generate_jif_file_with_tags (EXPOSURE_MODE_TAG ("manual-exposure"), tmpfile);
1127 libexif_check_tags (EXPOSURE_MODE_TAG ("manual-exposure"), tmpfile);
1128 generate_jif_file_with_tags (EXPOSURE_MODE_TAG ("auto-bracket"), tmpfile);
1129 libexif_check_tags (EXPOSURE_MODE_TAG ("auto-bracket"), tmpfile);
1131 #define SCENE_CAPTURE_TYPE_TAG(t) "taglist," GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE\
1133 generate_jif_file_with_tags (SCENE_CAPTURE_TYPE_TAG ("standard"), tmpfile);
1134 libexif_check_tags (SCENE_CAPTURE_TYPE_TAG ("standard"), tmpfile);
1135 generate_jif_file_with_tags (SCENE_CAPTURE_TYPE_TAG ("landscape"), tmpfile);
1136 libexif_check_tags (SCENE_CAPTURE_TYPE_TAG ("landscape"), tmpfile);
1137 generate_jif_file_with_tags (SCENE_CAPTURE_TYPE_TAG ("portrait"), tmpfile);
1138 libexif_check_tags (SCENE_CAPTURE_TYPE_TAG ("portrait"), tmpfile);
1139 generate_jif_file_with_tags (SCENE_CAPTURE_TYPE_TAG ("night-scene"), tmpfile);
1140 libexif_check_tags (SCENE_CAPTURE_TYPE_TAG ("night-scene"), tmpfile);
1142 #define WHITE_BALANCE_TAG(t) "taglist," GST_TAG_CAPTURING_WHITE_BALANCE "=" t
1143 generate_jif_file_with_tags (WHITE_BALANCE_TAG ("auto"), tmpfile);
1144 libexif_check_tags (WHITE_BALANCE_TAG ("auto"), tmpfile);
1145 generate_jif_file_with_tags (WHITE_BALANCE_TAG ("manual"), tmpfile);
1146 libexif_check_tags (WHITE_BALANCE_TAG ("manual"), tmpfile);
1148 #define GAIN_ADJUSTMENT_TAG(t) "taglist," GST_TAG_CAPTURING_GAIN_ADJUSTMENT "=" t
1149 generate_jif_file_with_tags (GAIN_ADJUSTMENT_TAG ("none"), tmpfile);
1150 libexif_check_tags (GAIN_ADJUSTMENT_TAG ("none"), tmpfile);
1151 generate_jif_file_with_tags (GAIN_ADJUSTMENT_TAG ("high-gain-up"), tmpfile);
1152 libexif_check_tags (GAIN_ADJUSTMENT_TAG ("high-gain-up"), tmpfile);
1153 generate_jif_file_with_tags (GAIN_ADJUSTMENT_TAG ("low-gain-up"), tmpfile);
1154 libexif_check_tags (GAIN_ADJUSTMENT_TAG ("low-gain-up"), tmpfile);
1155 generate_jif_file_with_tags (GAIN_ADJUSTMENT_TAG ("high-gain-down"), tmpfile);
1156 libexif_check_tags (GAIN_ADJUSTMENT_TAG ("high-gain-down"), tmpfile);
1157 generate_jif_file_with_tags (GAIN_ADJUSTMENT_TAG ("low-gain-down"), tmpfile);
1158 libexif_check_tags (GAIN_ADJUSTMENT_TAG ("low-gain-down"), tmpfile);
1160 #define CONTRAST_TAG(t) "taglist," GST_TAG_CAPTURING_CONTRAST "=" t
1161 generate_jif_file_with_tags (CONTRAST_TAG ("normal"), tmpfile);
1162 libexif_check_tags (CONTRAST_TAG ("normal"), tmpfile);
1163 generate_jif_file_with_tags (CONTRAST_TAG ("soft"), tmpfile);
1164 libexif_check_tags (CONTRAST_TAG ("soft"), tmpfile);
1165 generate_jif_file_with_tags (CONTRAST_TAG ("hard"), tmpfile);
1166 libexif_check_tags (CONTRAST_TAG ("hard"), tmpfile);
1168 #define SATURATION_TAG(t) "taglist," GST_TAG_CAPTURING_SATURATION "=" t
1169 generate_jif_file_with_tags (SATURATION_TAG ("normal"), tmpfile);
1170 libexif_check_tags (SATURATION_TAG ("normal"), tmpfile);
1171 generate_jif_file_with_tags (SATURATION_TAG ("low-saturation"), tmpfile);
1172 libexif_check_tags (SATURATION_TAG ("low-saturation"), tmpfile);
1173 generate_jif_file_with_tags (SATURATION_TAG ("high-saturation"), tmpfile);
1174 libexif_check_tags (SATURATION_TAG ("high-saturation"), tmpfile);
1176 #define SHARPNESS_TAG(t) "taglist," GST_TAG_CAPTURING_SHARPNESS "=" t
1177 generate_jif_file_with_tags (SHARPNESS_TAG ("normal"), tmpfile);
1178 libexif_check_tags (SHARPNESS_TAG ("normal"), tmpfile);
1179 generate_jif_file_with_tags (SHARPNESS_TAG ("soft"), tmpfile);
1180 libexif_check_tags (SHARPNESS_TAG ("soft"), tmpfile);
1181 generate_jif_file_with_tags (SHARPNESS_TAG ("hard"), tmpfile);
1182 libexif_check_tags (SHARPNESS_TAG ("hard"), tmpfile);
1184 #define METERING_MODE_TAG(t) "taglist," GST_TAG_CAPTURING_METERING_MODE "=" t
1185 generate_jif_file_with_tags (METERING_MODE_TAG ("unknown"), tmpfile);
1186 libexif_check_tags (METERING_MODE_TAG ("unknown"), tmpfile);
1187 generate_jif_file_with_tags (METERING_MODE_TAG ("average"), tmpfile);
1188 libexif_check_tags (METERING_MODE_TAG ("average"), tmpfile);
1189 generate_jif_file_with_tags (METERING_MODE_TAG ("center-weighted-average"),
1191 libexif_check_tags (METERING_MODE_TAG ("center-weighted-average"), tmpfile);
1192 generate_jif_file_with_tags (METERING_MODE_TAG ("spot"), tmpfile);
1193 libexif_check_tags (METERING_MODE_TAG ("spot"), tmpfile);
1194 generate_jif_file_with_tags (METERING_MODE_TAG ("multi-spot"), tmpfile);
1195 libexif_check_tags (METERING_MODE_TAG ("multi-spot"), tmpfile);
1196 generate_jif_file_with_tags (METERING_MODE_TAG ("pattern"), tmpfile);
1197 libexif_check_tags (METERING_MODE_TAG ("pattern"), tmpfile);
1198 generate_jif_file_with_tags (METERING_MODE_TAG ("partial"), tmpfile);
1199 libexif_check_tags (METERING_MODE_TAG ("partial"), tmpfile);
1200 generate_jif_file_with_tags (METERING_MODE_TAG ("other"), tmpfile);
1201 libexif_check_tags (METERING_MODE_TAG ("other"), tmpfile);
1203 #define FILE_SOURCE_TAG(t) "taglist," GST_TAG_CAPTURING_SOURCE "=" t
1204 generate_jif_file_with_tags (FILE_SOURCE_TAG ("dsc"), tmpfile);
1205 libexif_check_tags (FILE_SOURCE_TAG ("dsc"), tmpfile);
1206 generate_jif_file_with_tags (FILE_SOURCE_TAG ("other"), tmpfile);
1207 libexif_check_tags (FILE_SOURCE_TAG ("other"), tmpfile);
1208 generate_jif_file_with_tags (FILE_SOURCE_TAG ("reflex-scanner"), tmpfile);
1209 libexif_check_tags (FILE_SOURCE_TAG ("reflex-scanner"), tmpfile);
1210 generate_jif_file_with_tags (FILE_SOURCE_TAG ("transparent-scanner"),
1212 libexif_check_tags (FILE_SOURCE_TAG ("transparent-scanner"), tmpfile);
1220 #define HAVE_ELEMENT(name) \
1221 gst_registry_check_feature_version (gst_registry_get (), name,\
1222 GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)
1227 Suite *s = suite_create ("jifmux");
1228 TCase *tc_chain = tcase_create ("general");
1230 if (HAVE_ELEMENT ("taginject") && HAVE_ELEMENT ("jpegenc")) {
1231 tcase_add_test (tc_chain, test_jifmux_tags);
1233 GST_WARNING ("jpegenc or taginject element not available, skipping tests");
1236 suite_add_tcase (s, tc_chain);
1241 GST_CHECK_MAIN (jifmux);