Lines 740-746
get_exif_default_category (const Exiv2::Exifdatum &md)
Link Here
|
740 |
|
740 |
|
741 |
|
741 |
|
742 |
static void |
742 |
static void |
|
|
743 |
#if EXIV2_TEST_VERSION(0,28,0) |
744 |
exiv2_read_metadata (Exiv2::Image::UniquePtr image, |
745 |
#else |
743 |
exiv2_read_metadata (Exiv2::Image::AutoPtr image, |
746 |
exiv2_read_metadata (Exiv2::Image::AutoPtr image, |
|
|
747 |
#endif |
744 |
GFileInfo *info, |
748 |
GFileInfo *info, |
745 |
gboolean update_general_attributes) |
749 |
gboolean update_general_attributes) |
746 |
{ |
750 |
{ |
Lines 875-881
exiv2_read_metadata_from_file (GFile *file,
Link Here
|
875 |
return FALSE; |
879 |
return FALSE; |
876 |
} |
880 |
} |
877 |
|
881 |
|
|
|
882 |
#if EXIV2_TEST_VERSION(0,28,0) |
883 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); |
884 |
#else |
878 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); |
885 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); |
|
|
886 |
#endif |
879 |
g_free (path); |
887 |
g_free (path); |
880 |
|
888 |
|
881 |
if (image.get() == 0) { |
889 |
if (image.get() == 0) { |
Lines 885-893
exiv2_read_metadata_from_file (GFile *file,
Link Here
|
885 |
} |
893 |
} |
886 |
// Set the log level to only show errors (and suppress warnings, informational and debug messages) |
894 |
// Set the log level to only show errors (and suppress warnings, informational and debug messages) |
887 |
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::error); |
895 |
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::error); |
|
|
896 |
#if EXIV2_TEST_VERSION(0,28,0) |
897 |
exiv2_read_metadata (std::move(image), info, update_general_attributes); |
898 |
#else |
888 |
exiv2_read_metadata (image, info, update_general_attributes); |
899 |
exiv2_read_metadata (image, info, update_general_attributes); |
|
|
900 |
#endif |
889 |
} |
901 |
} |
|
|
902 |
#if EXIV2_TEST_VERSION(0,28,0) |
903 |
catch (Exiv2::Error& e) { |
904 |
#else |
890 |
catch (Exiv2::AnyError& e) { |
905 |
catch (Exiv2::AnyError& e) { |
|
|
906 |
#endif |
891 |
if (error != NULL) |
907 |
if (error != NULL) |
892 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
908 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
893 |
return FALSE; |
909 |
return FALSE; |
Lines 906-912
exiv2_read_metadata_from_buffer (void *buffer,
Link Here
|
906 |
GError **error) |
922 |
GError **error) |
907 |
{ |
923 |
{ |
908 |
try { |
924 |
try { |
|
|
925 |
#if EXIV2_TEST_VERSION(0,28,0) |
926 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) buffer, buffer_size); |
927 |
#else |
909 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) buffer, buffer_size); |
928 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) buffer, buffer_size); |
|
|
929 |
#endif |
910 |
|
930 |
|
911 |
if (image.get() == 0) { |
931 |
if (image.get() == 0) { |
912 |
if (error != NULL) |
932 |
if (error != NULL) |
Lines 914-922
exiv2_read_metadata_from_buffer (void *buffer,
Link Here
|
914 |
return FALSE; |
934 |
return FALSE; |
915 |
} |
935 |
} |
916 |
|
936 |
|
|
|
937 |
#if EXIV2_TEST_VERSION(0,28,0) |
938 |
exiv2_read_metadata (std::move(image), info, update_general_attributes); |
939 |
#else |
917 |
exiv2_read_metadata (image, info, update_general_attributes); |
940 |
exiv2_read_metadata (image, info, update_general_attributes); |
|
|
941 |
#endif |
918 |
} |
942 |
} |
|
|
943 |
#if EXIV2_TEST_VERSION(0,28,0) |
944 |
catch (Exiv2::Error& e) { |
945 |
#else |
919 |
catch (Exiv2::AnyError& e) { |
946 |
catch (Exiv2::AnyError& e) { |
|
|
947 |
#endif |
920 |
if (error != NULL) |
948 |
if (error != NULL) |
921 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
949 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
922 |
return FALSE; |
950 |
return FALSE; |
Lines 965-971
exiv2_read_sidecar (GFile *file,
Link Here
|
965 |
g_free (path); |
993 |
g_free (path); |
966 |
|
994 |
|
967 |
std::string xmpPacket; |
995 |
std::string xmpPacket; |
|
|
996 |
#if EXIV2_TEST_VERSION(0,28,0) |
997 |
xmpPacket.assign(reinterpret_cast<char*>(buf.data()), buf.size()); |
998 |
#else |
968 |
xmpPacket.assign(reinterpret_cast<char*>(buf.pData_), buf.size_); |
999 |
xmpPacket.assign(reinterpret_cast<char*>(buf.pData_), buf.size_); |
|
|
1000 |
#endif |
969 |
Exiv2::XmpData xmpData; |
1001 |
Exiv2::XmpData xmpData; |
970 |
|
1002 |
|
971 |
if (0 != Exiv2::XmpParser::decode(xmpData, xmpPacket)) |
1003 |
if (0 != Exiv2::XmpParser::decode(xmpData, xmpPacket)) |
Lines 1011-1017
exiv2_read_sidecar (GFile *file,
Link Here
|
1011 |
|
1043 |
|
1012 |
set_attributes_from_tagsets (info, update_general_attributes); |
1044 |
set_attributes_from_tagsets (info, update_general_attributes); |
1013 |
} |
1045 |
} |
|
|
1046 |
#if EXIV2_TEST_VERSION(0,28,0) |
1047 |
catch (Exiv2::Error& e) { |
1048 |
#else |
1014 |
catch (Exiv2::AnyError& e) { |
1049 |
catch (Exiv2::AnyError& e) { |
|
|
1050 |
#endif |
1015 |
std::cerr << "Caught Exiv2 exception '" << e << "'\n"; |
1051 |
std::cerr << "Caught Exiv2 exception '" << e << "'\n"; |
1016 |
return FALSE; |
1052 |
return FALSE; |
1017 |
} |
1053 |
} |
Lines 1111-1117
dump_exif_data (Exiv2::ExifData &exifData,
Link Here
|
1111 |
|
1147 |
|
1112 |
|
1148 |
|
1113 |
static Exiv2::DataBuf |
1149 |
static Exiv2::DataBuf |
|
|
1150 |
#if EXIV2_TEST_VERSION(0,28,0) |
1151 |
exiv2_write_metadata_private (Exiv2::Image::UniquePtr image, |
1152 |
#else |
1114 |
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image, |
1153 |
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image, |
|
|
1154 |
#endif |
1115 |
GFileInfo *info, |
1155 |
GFileInfo *info, |
1116 |
GthImage *image_data) |
1156 |
GthImage *image_data) |
1117 |
{ |
1157 |
{ |
Lines 1148-1160
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1148 |
const char *value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1188 |
const char *value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1149 |
|
1189 |
|
1150 |
if ((raw_value != NULL) && (strcmp (raw_value, "") != 0) && (value_type != NULL)) { |
1190 |
if ((raw_value != NULL) && (strcmp (raw_value, "") != 0) && (value_type != NULL)) { |
|
|
1191 |
#if EXIV2_TEST_VERSION(0,28,0) |
1192 |
Exiv2::Value::UniquePtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1193 |
#else |
1151 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1194 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
|
|
1195 |
#endif |
1152 |
value->read (raw_value); |
1196 |
value->read (raw_value); |
1153 |
Exiv2::ExifKey exif_key(key); |
1197 |
Exiv2::ExifKey exif_key(key); |
1154 |
ed.add (exif_key, value.get()); |
1198 |
ed.add (exif_key, value.get()); |
1155 |
} |
1199 |
} |
1156 |
} |
1200 |
} |
|
|
1201 |
#if EXIV2_TEST_VERSION(0,28,0) |
1202 |
catch (Exiv2::Error& e) { |
1203 |
#else |
1157 |
catch (Exiv2::AnyError& e) { |
1204 |
catch (Exiv2::AnyError& e) { |
|
|
1205 |
#endif |
1158 |
/* we don't care about invalid key errors */ |
1206 |
/* we don't care about invalid key errors */ |
1159 |
g_warning ("%s", e.what()); |
1207 |
g_warning ("%s", e.what()); |
1160 |
} |
1208 |
} |
Lines 1270-1276
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1270 |
value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1318 |
value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1271 |
if (value_type != NULL) { |
1319 |
if (value_type != NULL) { |
1272 |
/* See the exif data code above for an explanation. */ |
1320 |
/* See the exif data code above for an explanation. */ |
|
|
1321 |
#if EXIV2_TEST_VERSION(0,28,0) |
1322 |
Exiv2::Value::UniquePtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1323 |
#else |
1273 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1324 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
|
|
1325 |
#endif |
1274 |
Exiv2::IptcKey iptc_key(key); |
1326 |
Exiv2::IptcKey iptc_key(key); |
1275 |
|
1327 |
|
1276 |
const char *raw_value; |
1328 |
const char *raw_value; |
Lines 1296-1302
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1296 |
} |
1348 |
} |
1297 |
} |
1349 |
} |
1298 |
} |
1350 |
} |
|
|
1351 |
#if EXIV2_TEST_VERSION(0,28,0) |
1352 |
catch (Exiv2::Error& e) { |
1353 |
#else |
1299 |
catch (Exiv2::AnyError& e) { |
1354 |
catch (Exiv2::AnyError& e) { |
|
|
1355 |
#endif |
1300 |
/* we don't care about invalid key errors */ |
1356 |
/* we don't care about invalid key errors */ |
1301 |
g_warning ("%s", e.what()); |
1357 |
g_warning ("%s", e.what()); |
1302 |
} |
1358 |
} |
Lines 1320-1326
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1320 |
value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1376 |
value_type = gth_main_get_metadata_type (metadatum, attributes[i]); |
1321 |
if (value_type != NULL) { |
1377 |
if (value_type != NULL) { |
1322 |
/* See the exif data code above for an explanation. */ |
1378 |
/* See the exif data code above for an explanation. */ |
|
|
1379 |
#if EXIV2_TEST_VERSION(0,28,0) |
1380 |
Exiv2::Value::UniquePtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1381 |
#else |
1323 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
1382 |
Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (value_type)); |
|
|
1383 |
#endif |
1324 |
Exiv2::XmpKey xmp_key(key); |
1384 |
Exiv2::XmpKey xmp_key(key); |
1325 |
|
1385 |
|
1326 |
const char *raw_value; |
1386 |
const char *raw_value; |
Lines 1346-1352
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1346 |
} |
1406 |
} |
1347 |
} |
1407 |
} |
1348 |
} |
1408 |
} |
|
|
1409 |
#if EXIV2_TEST_VERSION(0,28,0) |
1410 |
catch (Exiv2::Error& e) { |
1411 |
#else |
1349 |
catch (Exiv2::AnyError& e) { |
1412 |
catch (Exiv2::AnyError& e) { |
|
|
1413 |
#endif |
1350 |
/* we don't care about invalid key errors */ |
1414 |
/* we don't care about invalid key errors */ |
1351 |
g_warning ("%s", e.what()); |
1415 |
g_warning ("%s", e.what()); |
1352 |
} |
1416 |
} |
Lines 1362-1368
exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
Link Here
|
1362 |
image->setXmpData(xd); |
1426 |
image->setXmpData(xd); |
1363 |
image->writeMetadata(); |
1427 |
image->writeMetadata(); |
1364 |
} |
1428 |
} |
|
|
1429 |
#if EXIV2_TEST_VERSION(0,28,0) |
1430 |
catch (Exiv2::Error& e) { |
1431 |
#else |
1365 |
catch (Exiv2::AnyError& e) { |
1432 |
catch (Exiv2::AnyError& e) { |
|
|
1433 |
#endif |
1366 |
g_warning ("%s", e.what()); |
1434 |
g_warning ("%s", e.what()); |
1367 |
} |
1435 |
} |
1368 |
|
1436 |
|
Lines 1389-1404
exiv2_write_metadata (GthImageSaveData *data)
Link Here
|
1389 |
{ |
1457 |
{ |
1390 |
if (exiv2_supports_writes (data->mime_type) && (data->file_data != NULL)) { |
1458 |
if (exiv2_supports_writes (data->mime_type) && (data->file_data != NULL)) { |
1391 |
try { |
1459 |
try { |
|
|
1460 |
#if EXIV2_TEST_VERSION(0,28,0) |
1461 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) data->buffer, data->buffer_size); |
1462 |
#else |
1392 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) data->buffer, data->buffer_size); |
1463 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) data->buffer, data->buffer_size); |
|
|
1464 |
#endif |
1393 |
g_assert (image.get() != 0); |
1465 |
g_assert (image.get() != 0); |
1394 |
|
1466 |
|
|
|
1467 |
#if EXIV2_TEST_VERSION(0,28,0) |
1468 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (std::move(image), data->file_data->info, data->image); |
1469 |
#else |
1395 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (image, data->file_data->info, data->image); |
1470 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (image, data->file_data->info, data->image); |
|
|
1471 |
#endif |
1396 |
|
1472 |
|
1397 |
g_free (data->buffer); |
1473 |
g_free (data->buffer); |
|
|
1474 |
#if EXIV2_TEST_VERSION(0,28,0) |
1475 |
data->buffer = g_memdup (buf.data(), buf.size()); |
1476 |
data->buffer_size = buf.size(); |
1477 |
#else |
1398 |
data->buffer = g_memdup (buf.pData_, buf.size_); |
1478 |
data->buffer = g_memdup (buf.pData_, buf.size_); |
1399 |
data->buffer_size = buf.size_; |
1479 |
data->buffer_size = buf.size_; |
|
|
1480 |
#endif |
1400 |
} |
1481 |
} |
|
|
1482 |
#if EXIV2_TEST_VERSION(0,28,0) |
1483 |
catch (Exiv2::Error& e) { |
1484 |
#else |
1401 |
catch (Exiv2::AnyError& e) { |
1485 |
catch (Exiv2::AnyError& e) { |
|
|
1486 |
#endif |
1402 |
if (data->error != NULL) |
1487 |
if (data->error != NULL) |
1403 |
*data->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1488 |
*data->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1404 |
g_warning ("%s\n", e.what()); |
1489 |
g_warning ("%s\n", e.what()); |
Lines 1419-1434
exiv2_write_metadata_to_buffer (void **buffer,
Link Here
|
1419 |
GError **error) |
1504 |
GError **error) |
1420 |
{ |
1505 |
{ |
1421 |
try { |
1506 |
try { |
|
|
1507 |
#if EXIV2_TEST_VERSION(0,28,0) |
1508 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
1509 |
#else |
1422 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
1510 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
|
|
1511 |
#endif |
1423 |
g_assert (image.get() != 0); |
1512 |
g_assert (image.get() != 0); |
1424 |
|
1513 |
|
|
|
1514 |
#if EXIV2_TEST_VERSION(0,28,0) |
1515 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (std::move(image), info, image_data); |
1516 |
#else |
1425 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (image, info, image_data); |
1517 |
Exiv2::DataBuf buf = exiv2_write_metadata_private (image, info, image_data); |
|
|
1518 |
#endif |
1426 |
|
1519 |
|
1427 |
g_free (*buffer); |
1520 |
g_free (*buffer); |
|
|
1521 |
#if EXIV2_TEST_VERSION(0,28,0) |
1522 |
*buffer = g_memdup (buf.data(), buf.size()); |
1523 |
*buffer_size = buf.size(); |
1524 |
#else |
1428 |
*buffer = g_memdup (buf.pData_, buf.size_); |
1525 |
*buffer = g_memdup (buf.pData_, buf.size_); |
1429 |
*buffer_size = buf.size_; |
1526 |
*buffer_size = buf.size_; |
|
|
1527 |
#endif |
1430 |
} |
1528 |
} |
|
|
1529 |
#if EXIV2_TEST_VERSION(0,28,0) |
1530 |
catch (Exiv2::Error& e) { |
1531 |
#else |
1431 |
catch (Exiv2::AnyError& e) { |
1532 |
catch (Exiv2::AnyError& e) { |
|
|
1533 |
#endif |
1432 |
if (error != NULL) |
1534 |
if (error != NULL) |
1433 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1535 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1434 |
return FALSE; |
1536 |
return FALSE; |
Lines 1445-1451
exiv2_clear_metadata (void **buffer,
Link Here
|
1445 |
GError **error) |
1547 |
GError **error) |
1446 |
{ |
1548 |
{ |
1447 |
try { |
1549 |
try { |
|
|
1550 |
#if EXIV2_TEST_VERSION(0,28,0) |
1551 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
1552 |
#else |
1448 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
1553 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open ((Exiv2::byte*) *buffer, *buffer_size); |
|
|
1554 |
#endif |
1449 |
|
1555 |
|
1450 |
if (image.get() == 0) { |
1556 |
if (image.get() == 0) { |
1451 |
if (error != NULL) |
1557 |
if (error != NULL) |
Lines 1457-1463
exiv2_clear_metadata (void **buffer,
Link Here
|
1457 |
image->clearMetadata(); |
1563 |
image->clearMetadata(); |
1458 |
image->writeMetadata(); |
1564 |
image->writeMetadata(); |
1459 |
} |
1565 |
} |
|
|
1566 |
#if EXIV2_TEST_VERSION(0,28,0) |
1567 |
catch (Exiv2::Error& e) { |
1568 |
#else |
1460 |
catch (Exiv2::AnyError& e) { |
1569 |
catch (Exiv2::AnyError& e) { |
|
|
1570 |
#endif |
1461 |
g_warning ("%s", e.what()); |
1571 |
g_warning ("%s", e.what()); |
1462 |
} |
1572 |
} |
1463 |
|
1573 |
|
Lines 1466-1475
exiv2_clear_metadata (void **buffer,
Link Here
|
1466 |
Exiv2::DataBuf buf = io.read(io.size()); |
1576 |
Exiv2::DataBuf buf = io.read(io.size()); |
1467 |
|
1577 |
|
1468 |
g_free (*buffer); |
1578 |
g_free (*buffer); |
|
|
1579 |
#if EXIV2_TEST_VERSION(0,28,0) |
1580 |
*buffer = g_memdup (buf.data(), buf.size()); |
1581 |
*buffer_size = buf.size(); |
1582 |
#else |
1469 |
*buffer = g_memdup (buf.pData_, buf.size_); |
1583 |
*buffer = g_memdup (buf.pData_, buf.size_); |
1470 |
*buffer_size = buf.size_; |
1584 |
*buffer_size = buf.size_; |
|
|
1585 |
#endif |
1471 |
} |
1586 |
} |
|
|
1587 |
#if EXIV2_TEST_VERSION(0,28,0) |
1588 |
catch (Exiv2::Error& e) { |
1589 |
#else |
1472 |
catch (Exiv2::AnyError& e) { |
1590 |
catch (Exiv2::AnyError& e) { |
|
|
1591 |
#endif |
1473 |
if (error != NULL) |
1592 |
if (error != NULL) |
1474 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1593 |
*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what()); |
1475 |
return FALSE; |
1594 |
return FALSE; |
Lines 1502-1527
exiv2_generate_thumbnail (const char *uri,
Link Here
|
1502 |
if (path == NULL) |
1621 |
if (path == NULL) |
1503 |
return NULL; |
1622 |
return NULL; |
1504 |
|
1623 |
|
|
|
1624 |
#if EXIV2_TEST_VERSION(0,28,0) |
1625 |
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open (path); |
1626 |
#else |
1505 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open (path); |
1627 |
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open (path); |
|
|
1628 |
#endif |
1506 |
image->readMetadata (); |
1629 |
image->readMetadata (); |
1507 |
Exiv2::ExifThumbC exifThumb (image->exifData ()); |
1630 |
Exiv2::ExifThumbC exifThumb (image->exifData ()); |
1508 |
Exiv2::DataBuf thumb = exifThumb.copy (); |
1631 |
Exiv2::DataBuf thumb = exifThumb.copy (); |
1509 |
|
1632 |
|
1510 |
g_free (path); |
1633 |
g_free (path); |
1511 |
|
1634 |
|
|
|
1635 |
#if EXIV2_TEST_VERSION(0,28,0) |
1636 |
if (thumb.data() == NULL) |
1637 |
#else |
1512 |
if (thumb.pData_ == NULL) |
1638 |
if (thumb.pData_ == NULL) |
|
|
1639 |
#endif |
1513 |
return NULL; |
1640 |
return NULL; |
1514 |
|
1641 |
|
1515 |
Exiv2::ExifData &ed = image->exifData(); |
1642 |
Exiv2::ExifData &ed = image->exifData(); |
1516 |
|
1643 |
|
|
|
1644 |
#if EXIV2_TEST_VERSION(0,28,0) |
1645 |
long orientation = (ed["Exif.Image.Orientation"].count() > 0) ? ed["Exif.Image.Orientation"].toUint32() : 1; |
1646 |
long image_width = (ed["Exif.Photo.PixelXDimension"].count() > 0) ? ed["Exif.Photo.PixelXDimension"].toUint32() : -1; |
1647 |
long image_height = (ed["Exif.Photo.PixelYDimension"].count() > 0) ? ed["Exif.Photo.PixelYDimension"].toUint32() : -1; |
1648 |
#else |
1517 |
long orientation = (ed["Exif.Image.Orientation"].count() > 0) ? ed["Exif.Image.Orientation"].toLong() : 1; |
1649 |
long orientation = (ed["Exif.Image.Orientation"].count() > 0) ? ed["Exif.Image.Orientation"].toLong() : 1; |
1518 |
long image_width = (ed["Exif.Photo.PixelXDimension"].count() > 0) ? ed["Exif.Photo.PixelXDimension"].toLong() : -1; |
1650 |
long image_width = (ed["Exif.Photo.PixelXDimension"].count() > 0) ? ed["Exif.Photo.PixelXDimension"].toLong() : -1; |
1519 |
long image_height = (ed["Exif.Photo.PixelYDimension"].count() > 0) ? ed["Exif.Photo.PixelYDimension"].toLong() : -1; |
1651 |
long image_height = (ed["Exif.Photo.PixelYDimension"].count() > 0) ? ed["Exif.Photo.PixelYDimension"].toLong() : -1; |
|
|
1652 |
#endif |
1520 |
|
1653 |
|
1521 |
if ((orientation != 1) || (image_width <= 0) || (image_height <= 0)) |
1654 |
if ((orientation != 1) || (image_width <= 0) || (image_height <= 0)) |
1522 |
return NULL; |
1655 |
return NULL; |
1523 |
|
1656 |
|
|
|
1657 |
#if EXIV2_TEST_VERSION(0,28,0) |
1658 |
GInputStream *stream = g_memory_input_stream_new_from_data (thumb.data(), thumb.size(), NULL); |
1659 |
#else |
1524 |
GInputStream *stream = g_memory_input_stream_new_from_data (thumb.pData_, thumb.size_, NULL); |
1660 |
GInputStream *stream = g_memory_input_stream_new_from_data (thumb.pData_, thumb.size_, NULL); |
|
|
1661 |
#endif |
1525 |
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL); |
1662 |
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL); |
1526 |
g_object_unref (stream); |
1663 |
g_object_unref (stream); |
1527 |
|
1664 |
|
Lines 1575-1581
exiv2_generate_thumbnail (const char *uri,
Link Here
|
1575 |
gdk_pixbuf_set_option (pixbuf, "orientation", orientation_s); |
1712 |
gdk_pixbuf_set_option (pixbuf, "orientation", orientation_s); |
1576 |
g_free (orientation_s); |
1713 |
g_free (orientation_s); |
1577 |
} |
1714 |
} |
|
|
1715 |
#if EXIV2_TEST_VERSION(0,28,0) |
1716 |
catch (Exiv2::Error& e) { |
1717 |
#else |
1578 |
catch (Exiv2::AnyError& e) { |
1718 |
catch (Exiv2::AnyError& e) { |
|
|
1719 |
#endif |
1579 |
} |
1720 |
} |
1580 |
|
1721 |
|
1581 |
return pixbuf; |
1722 |
return pixbuf; |