summaryrefslogtreecommitdiff
path: root/lib/Image/ExifTool/XMP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Image/ExifTool/XMP.pm')
-rw-r--r--lib/Image/ExifTool/XMP.pm23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/Image/ExifTool/XMP.pm b/lib/Image/ExifTool/XMP.pm
index 2fcced23..970151ec 100644
--- a/lib/Image/ExifTool/XMP.pm
+++ b/lib/Image/ExifTool/XMP.pm
@@ -50,7 +50,7 @@ use Image::ExifTool::Exif;
use Image::ExifTool::GPS;
require Exporter;
-$VERSION = '3.40';
+$VERSION = '3.41';
@ISA = qw(Exporter);
@EXPORT_OK = qw(EscapeXML UnescapeXML);
@@ -71,6 +71,13 @@ sub ConvertRational($);
sub ConvertRationalList($);
sub WriteGSpherical($$$);
+# standard path locations for XMP in major file types
+my %stdPath = (
+ JPEG => 'JPEG-APP1-XMP',
+ TIFF => 'TIFF-IFD0-XMP',
+ PSD => 'PSD-XMP',
+);
+
# lookup for translating to ExifTool namespaces (and family 1 group names)
%stdXlatNS = (
# shorten ugly namespace prefixes
@@ -3844,6 +3851,7 @@ sub ProcessXMP($$;$)
my ($buff, $fmt, $hasXMP, $isXML, $isRDF, $isSVG);
my $rtnVal = 0;
my $bom = 0;
+ my $path = $et->MetadataPath();
# namespaces and prefixes currently in effect while parsing the file,
# and lookup to translate brain-dead-Microsoft-Photo-software prefixes
@@ -3861,11 +3869,7 @@ sub ProcessXMP($$;$)
(($$dirInfo{DirName} || '') eq 'XMP' or $$et{FILE_TYPE} eq 'XMP'))
{
$$et{XmpValidate} = { } if $$et{OPTIONS}{Validate};
- my $path = $et->MetadataPath();
- my $nonStd;
- if ($$et{FILE_TYPE} =~ /^(JPEG|TIFF|PSD)$/ and $path !~ /^(JPEG-APP1-XMP|TIFF-IFD0-XMP|PSD-XMP)$/) {
- $nonStd = 1;
- }
+ my $nonStd = ($stdPath{$$et{FILE_TYPE}} and $path ne $stdPath{$$et{FILE_TYPE}});
if ($nonStd and $Image::ExifTool::MWG::strict) {
$et->Warn("Ignored non-standard XMP at $path");
return 1;
@@ -4125,6 +4129,13 @@ sub ProcessXMP($$;$)
}
defined $fmt or $et->Warn('XMP character encoding error');
}
+ # warn if standard XMP is missing xpacket wrapper
+ if ($$et{XMP_NO_XPACKET} and $$et{OPTIONS}{Validate} and
+ $stdPath{$$et{FILE_TYPE}} and $path eq $stdPath{$$et{FILE_TYPE}} and
+ not $$dirInfo{IsExtended} and not $$et{DOC_NUM})
+ {
+ $et->Warn('XMP is missing xpacket wrapper', 1);
+ }
if ($fmt) {
# trim if necessary to avoid converting non-UTF data
if ($dirStart or $dirEnd != length($$dataPt)) {