Ignore:
Timestamp:
2021-02-26T19:39:51+13:00 (3 years ago)
Author:
anupama
Message:

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/Image/ExifTool/CanonCustom.pm

    r24107 r34921  
    2020use Image::ExifTool::Exif;
    2121
    22 $VERSION = '1.40';
     22$VERSION = '1.58';
    2323
    2424sub ProcessCanonCustom($$$);
     
    12741274            Name => 'ISOExpansion',
    12751275            Notes => 'other models',
    1276             PrintConv => {
    1277                 0 => 'Off',
    1278                 1 => 'On',
    1279             },
     1276            PrintConv => \%offOn,
    12801277        },
    12811278    ],
     
    12931290        },
    12941291    },
    1295     0x0106 => {
     1292    0x0106 => [{
    12961293        Name => 'AEBShotCount',
    1297         Count => -1,
    1298         Notes => '1 value for the 1DmkIII, 2 for the 1DmkIV',
    1299         PrintConv => [{
    1300             0 => 3,
    1301             1 => 2,
    1302             2 => 5,
    1303             3 => 7,
    1304         }],
    1305     },
     1294        Condition => '$count == 1',
     1295        Notes => 'one value for some models...',
     1296        PrintConv => {
     1297            0 => '3 shots',
     1298            1 => '2 shots',
     1299            2 => '5 shots',
     1300            3 => '7 shots',
     1301        },
     1302    },{
     1303        Name => 'AEBShotCount',
     1304        Count => 2,
     1305        Notes => 'two values for others',
     1306        PrintConv => {
     1307            '3 0' => '3 shots',
     1308            '2 1' => '2 shots',
     1309            '5 2' => '5 shots',
     1310            '7 3' => '7 shots',
     1311        },
     1312    }],
    13061313    0x0107 => {
    13071314        Name => 'SpotMeterLinkToAFPoint',
     
    13131320    0x0108 => {
    13141321        Name => 'SafetyShift',
    1315         Notes => 'value of 2 not used by 40D, 50D, 60D, 5DmkII and 7D',
     1322        Notes => 'value of 2 not used by some models', # eg. 40D, 50D, 60D, 5DmkII, 7D, 250D
    13161323        PrintConv => {
    13171324            0 => 'Disable',
     
    13201327        },
    13211328    },
    1322     0x0109 => {
     1329    0x0109 => [{ # (1DXmkIII)
     1330        Name => 'UsableShootingModes',
     1331        Condition => '$count == 1',
     1332        Count => 1,
     1333        PrintConv => 'sprintf("Flags 0x%x",$val)',
     1334        PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
     1335    },{
    13231336        Name => 'UsableShootingModes',
    13241337        Count => 2,
     
    13311344            '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
    13321345        ],
    1333     },
    1334     0x010a => {
     1346    }],
     1347    0x010a => [{ # (1DXmkIII)
    13351348        Name => 'UsableMeteringModes',
    1336         Count => 2,
     1349        Condition => '$count == 1',
     1350        Count => 1,
     1351        PrintConv => 'sprintf("Flags 0x%x",$val)',
     1352        PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
     1353    },{
     1354        Name => 'UsableMeteringModes',
     1355        Count => 2,
    13371356        PrintConv => [
    13381357            \%disableEnable,
     
    13431362            '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
    13441363        ],
    1345     },
     1364    }],
    13461365    0x010b => {
    13471366        Name => 'ExposureModeInManual',
     
    13541373        },
    13551374    },
    1356     0x010c => {
     1375    0x010c => [{
    13571376        Name => 'ShutterSpeedRange',
     1377        Condition => '$count == 3',
    13581378        Count => 3,
    13591379        ValueConv => [
     
    13771397            '$val=~m{([\d./]+)} ? eval $1 : 0',
    13781398        ],
    1379     },
    1380     0x010d => {
     1399    },{ # (EOS R)
     1400        Name => 'ShutterSpeedRange',
     1401        Condition => '$count == 4',
     1402        Count => 4,
     1403        ValueConv => [ # (NC)
     1404            'exp(-$val/(1600*log(2)))',
     1405            'exp(-$val/(1600*log(2)))',
     1406            'exp(-$val/(1600*log(2)))',
     1407            'exp(-$val/(1600*log(2)))',
     1408        ],
     1409        ValueConvInv => [
     1410            'int(-log($val)*1600*log(2) + 0.5)',
     1411            'int(-log($val)*1600*log(2) + 0.5)',
     1412            'int(-log($val)*1600*log(2) + 0.5)',
     1413            'int(-log($val)*1600*log(2) + 0.5)',
     1414        ],
     1415        PrintConv => [ # (NC)
     1416            '"Manual: Hi " . Image::ExifTool::Exif::PrintExposureTime($val)',
     1417            '"Lo " . Image::ExifTool::Exif::PrintExposureTime($val)',
     1418            '"Auto: Hi " . Image::ExifTool::Exif::PrintExposureTime($val)',
     1419            '"Lo " . Image::ExifTool::Exif::PrintExposureTime($val)',
     1420        ],
     1421        PrintConvInv => [
     1422            '$val=~m{([\d./]+)} ? eval $1 : 0',
     1423            '$val=~m{([\d./]+)} ? eval $1 : 0',
     1424            '$val=~m{([\d./]+)} ? eval $1 : 0',
     1425            '$val=~m{([\d./]+)} ? eval $1 : 0',
     1426        ],
     1427    }],
     1428    0x010d => [{
    13811429        Name => 'ApertureRange',
     1430        Condition => '$count == 3',
    13821431        Count => 3,
    13831432        ValueConv => [
     
    14011450            '$val=~/([\d.]+)/ ? $1 : 0',
    14021451        ],
    1403     },
     1452    },{ # (EOS R)
     1453        Name => 'ApertureRange',
     1454        Condition => '$count == 4',
     1455        Count => 4,
     1456        ValueConv => [ # (NC)
     1457            'exp($val/2400)',
     1458            'exp($val/2400)',
     1459            'exp($val/2400)',
     1460            'exp($val/2400)',
     1461        ],
     1462        ValueConvInv => [
     1463            'int(log($val)*2400) + 0.5)',
     1464            'int(log($val)*2400) + 0.5)',
     1465            'int(log($val)*2400) + 0.5)',
     1466            'int(log($val)*2400) + 0.5)',
     1467        ],
     1468        PrintConv => [ # (NC)
     1469            'sprintf("Manual: Closed %.2g",$val)',
     1470            'sprintf("Open %.2g",$val)',
     1471            'sprintf("Auto: Closed %.2g",$val)',
     1472            'sprintf("Open %.2g",$val)',
     1473        ],
     1474        PrintConvInv => [
     1475            '$val=~/([\d.]+)/ ? $1 : 0',
     1476            '$val=~/([\d.]+)/ ? $1 : 0',
     1477            '$val=~/([\d.]+)/ ? $1 : 0',
     1478            '$val=~/([\d.]+)/ ? $1 : 0',
     1479        ],
     1480    }],
    14041481    0x010e => {
    14051482        Name => 'ApplyShootingMeteringMode',
     
    14101487        {
    14111488            Name => 'FlashSyncSpeedAv',
    1412             Condition => '$$self{Model} =~ /\b40D\b/',
    1413             Notes => '40D',
     1489            Condition => '$$self{Model} =~ /\b(40D|1Ds Mark III)\b/',
     1490            Notes => '40D and 1Ds Mark III',
    14141491            PrintConv => {
    14151492                0 => 'Auto',
     
    14381515        {
    14391516            Name => 'FlashSyncSpeedAv',
    1440             Condition => '$$self{Model} =~ /\b(5D Mark II|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/',
    1441             Notes => '5D Mark II, 500D and 550D',
     1517            Condition => '$$self{Model} =~ /\bEOS-1Ds? Mark III\b/',
     1518            Notes => '1D Mark III and 1Ds Mark III',
     1519            PrintConv => {
     1520                0 => 'Auto',
     1521                1 => '1/300 Fixed',
     1522            },
     1523        },
     1524        {
     1525            Name => 'FlashSyncSpeedAv',
     1526            Condition => '$$self{Model} =~ /\bEOS-1D Mark IV\b/',
     1527            Notes => '1D Mark IV',
     1528            PrintConv => {
     1529                0 => 'Auto',
     1530                1 => '1/300-1/60 Auto',
     1531                2 => '1/300 Fixed',
     1532            },
     1533        },
     1534        {
     1535            Name => 'FlashSyncSpeedAv',
     1536            Notes => '5D Mark II, 5D Mark III, 500D, 550D, 600D and 1100D',
    14421537            PrintConv => {
    14431538                0 => 'Auto',
     
    14461541            },
    14471542        },
    1448         {
    1449             Name => 'FlashSyncSpeedAv',
    1450             Condition => '$$self{Model} =~ /\b(EOS-1D Mark IV)\b/',
    1451             Notes => '1D Mark IV',
    1452             PrintConv => {
    1453                 0 => 'Auto',
    1454                 1 => '1/300-1/60 Auto',
    1455                 2 => '1/300 Fixed',
    1456             },
    1457         },
    1458         {
    1459             Name => 'FlashSyncSpeedAv',
    1460             Notes => '1D Mark III',
    1461             PrintConv => {
    1462                 0 => 'Auto',
    1463                 1 => '1/300 Fixed',
    1464             },
    1465         },
    14661543    ],
    14671544    0x0110 => { # new for 1DmkIV
     1545        Name => 'AEMicroadjustment',
     1546        Count => 3,
     1547        PrintConv => [ \%disableEnable ],
     1548    },
     1549    0x0111 => { # new for 1DmkIV
    14681550        Name => 'FEMicroadjustment',
    14691551        Count => 3,
    14701552        PrintConv => [ \%disableEnable ],
    14711553    },
    1472     0x0111 => { # new for 1DmkIV
    1473         Name => 'AEMicroadjustment',
    1474         Count => 3,
    1475         PrintConv => [ \%disableEnable ],
     1554    0x0112 => [{ # (5DS)
     1555        Name => 'SameExposureForNewAperture',
     1556        PrintConv => {
     1557            0 => 'Disable',
     1558            1 => 'ISO Speed',
     1559            2 => 'Shutter Speed',
     1560        },
     1561    },{ # (EOS R)
     1562        Name => 'SameExposureForNewAperture',
     1563        Notes => 'EOS R',
     1564        PrintConv => {
     1565            0 => 'Disable',
     1566            1 => 'ISO Speed',
     1567            2 => 'ISO Speed/Shutter Speed',
     1568            3 => 'Shutter Speed',
     1569        },
     1570    }],
     1571    0x0113 => { # (200D)
     1572        Name => 'ExposureCompAutoCancel',
     1573        PrintConv => \%enableDisable,
     1574    },
     1575    0x0114 => { # (R)
     1576        Name => 'AELockMeterModeAfterFocus',
     1577        # metering modes where AE lock after focus applies:
     1578        PrintConv => { BITMASK => { # (NC)
     1579            0 => 'Evaluative',
     1580            1 => 'Partial',
     1581            2 => 'Spot',
     1582            3 => 'Center-weighted',
     1583        }},
    14761584    },
    14771585    #### 2a) Image
     
    14871595        {
    14881596            Name => 'HighISONoiseReduction',
    1489             Condition => '$$self{Model} =~ /\b(50D|60D|5D Mark II|7D|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/',
    1490             Notes => '50D, 60D, 500D, 550D, 5DmkII and 7D',
     1597            Condition => q{
     1598                $$self{Model} =~ /\b(50D|60D|5D Mark II|7D|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/ or
     1599                $$self{Model} =~ /\b(600D|T3i|Kiss X5|1100D|T3|Kiss X50)\b/
     1600            },
     1601            Notes => '50D, 60D, 500D, 550D, 600D, 1100D, 5DmkII and 7D',
    14911602            PrintConv => {
    14921603                0 => 'Standard',
     
    15241635        },
    15251636    ],
     1637    # 0x0205 - Added in 5DmkII firmware update
    15261638    #### 2b) Flash exposure
    15271639    0x0304 => {
     
    15761688        },
    15771689    ],
     1690    0x040a => { # new for 5DmkIII
     1691        Name => 'ViewfinderWarnings',
     1692        PrintConv => { BITMASK => { #(NC)
     1693            0 => 'Monochrome',              # (have seen for: 5DmkII, 6D, 250D, 90D)
     1694            1 => 'WB corrected',            # (have seen for: 5DmkII, 6D, 90D)
     1695            2 => 'One-touch image quality', # (have seen for: 5DmkII; doesn't exist for 6D)
     1696            3 => 'ISO expansion',           # (have seen for: 5DmkII)
     1697            4 => 'Spot metering',           # (have seen for: 5DmkII, 6D)
     1698            6 => 'Noise reduction',         # (have seen for: 250D, 90D)
     1699            7 => 'HDR',                     # (have seen for: 90D)
     1700        }},
     1701    },
     1702    0x040b => { # new for 5DmkIII
     1703        Name => 'LVShootingAreaDisplay',
     1704        PrintConv => {
     1705            0 => 'Masked',
     1706            1 => 'Outlined',
     1707        },
     1708    },
     1709    0x040c => { # (7DmkII)
     1710        Name => 'LVShootingAreaDisplay',
     1711        PrintConv => {
     1712            0 => 'Masked',
     1713            1 => 'Outlined',
     1714        },
     1715    },
    15781716    #### 3a) Auto focus
    15791717    0x0501 => {
     
    15881726        Name => 'AIServoTrackingSensitivity',
    15891727        PrintConv => {
    1590            -2 => 'Slow',
    1591            -1 => 'Medium Slow',
     1728           -2 => 'Slow',        # (Locked on -2 for 6D)
     1729           -1 => 'Medium Slow', # (Locked on -1 for 6D)
    15921730            0 => 'Standard',
    1593             1 => 'Medium Fast',
    1594             2 => 'Fast',
     1731            1 => 'Medium Fast', # (Responsive +1 for 6D)
     1732            2 => 'Fast',        # (Responsive +2 for 6D)
    15951733        },
    15961734    },
     
    16561794        {
    16571795            Name => 'AFPointAreaExpansion',
     1796            Condition => '$$self{Model} =~ /\b1Ds Mark III\b/',
     1797            Notes => '1Ds Mark III',
     1798            PrintConv => {
     1799                0 => 'Disable',
     1800                1 => 'Enable (left/right Assist AF points)',
     1801                2 => 'Enable (surrounding Assist AF points)',
     1802            },
     1803        },
     1804        {
     1805            Name => 'AFPointAreaExpansion',
     1806            Notes => 'other models',
    16581807            PrintConv => {
    16591808                0 => 'Disable',
     
    17151864        },
    17161865    },
    1717     0x050c => {
    1718         Name => 'AFPointDisplayDuringFocus',
    1719         PrintConv => {
    1720             0 => 'On',
    1721             1 => 'Off',
    1722             2 => 'On (when focus achieved)',
    1723         },
    1724     },
     1866    0x050c => [
     1867        {
     1868            Name => 'AFPointDisplayDuringFocus',
     1869            Condition => '$$self{Model} =~ /\b1D\b/',
     1870            Notes => '1D models',
     1871            PrintConv => {
     1872                0 => 'On',
     1873                1 => 'Off',
     1874                2 => 'On (when focus achieved)',
     1875            },
     1876        },
     1877        {
     1878            Name => 'AFPointDisplayDuringFocus',
     1879            Notes => 'other models', # (7D, 70D, 750D, 760D)
     1880            PrintConv => {
     1881                0 => 'Selected (constant)',
     1882                1 => 'All (constant)',
     1883                2 => 'Selected (pre-AF, focused)',
     1884                3 => 'Selected (focused)',
     1885                4 => 'Disable display',
     1886            },
     1887        },
     1888    ],
    17251889    0x050d => {
    17261890        Name => 'AFPointBrightness',
     
    17331897        {
    17341898            Name => 'AFAssistBeam',
    1735             Condition => '$$self{Model} =~ /\b1D Mark IV\b/',
    1736             Notes => '1D Mark IV',
     1899            Condition => '$$self{Model} =~ /\b(1D Mark IV|6D)\b/',
     1900            Notes => '1D Mark IV and 6D',
    17371901            PrintConv => {
    17381902                0 => 'Emits',
     
    17711935            },
    17721936        },
     1937        # (this is 2 values for 90D,M6mkII, seen: "1046 1046")
    17731938    ],
    17741939    0x0510 => [ # new for 40D
    17751940        {
    1776             Name => 'VFDisplayIllumination',
     1941            Name => 'VFDisplayIllumination', # (7D quirk, or decoded incorrectly?)
    17771942            Condition => '$$self{Model} =~ /\b7D\b/',
    17781943            Notes => '7D',
     
    18141979                2 => 'Register',
    18151980                3 => 'Select AF-modes',
    1816             },
    1817             # must decode 2nd value
     1981                # also seen: 87 (90D), 1142 (RP)
     1982            },
     1983            'sprintf("Flags 0x%x",$val)', # (70D=Manual 1pt,Manual zone,Auto 19pt)
     1984        ],
     1985        PrintConvInv => [
     1986            undef,
     1987            '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
    18181988        ],
    18191989    },
     
    18362006        Name => 'OrientationLinkedAFPoint',
    18372007        PrintConv => {
    1838             0 => 'Same for verical and horizontal',
     2008            0 => 'Same for vertical and horizontal',
    18392009            1 => 'Select different AF points',
    18402010        },
     
    18452015            0 => 'Off',
    18462016            1 => 'AF point selection',
     2017        },
     2018    },
     2019    0x0518 => { # new for 6D
     2020        Name => 'AccelerationTracking',
     2021    },
     2022    0x0519 => { # new for 6D
     2023        Name => 'AIServoFirstImagePriority',
     2024        PrintConv => { #(NC)
     2025            -1 => 'Release priority',
     2026            0 => 'Equal priority',
     2027            1 => 'Focus priority',
     2028        },
     2029    },
     2030    0x051a => { # new for 6D
     2031        Name => 'AIServoSecondImagePriority',
     2032        PrintConv => { #(NC)
     2033            -1 => 'Shooting speed priority',
     2034            0 => 'Equal priority',
     2035            1 => 'Focus priority',
     2036        },
     2037    },
     2038    0x051b => { # (70D)
     2039        Name => 'AFAreaSelectMethod',
     2040        PrintConv => {
     2041            0 => 'AF area selection button',
     2042            1 => 'Main dial',
     2043        },
     2044    },
     2045    0x051c => { # (750D)
     2046        Name => 'AutoAFPointColorTracking',
     2047        PrintConv => {
     2048            0 => 'On-Shot AF only',
     2049            1 => 'Disable',
     2050        },
     2051    },
     2052    0x051d => { # (750D/760D)
     2053        Name => 'VFDisplayIllumination',
     2054        PrintConv => [{
     2055            0 => 'Auto',
     2056            1 => 'Enable',
     2057            2 => 'Disable',
     2058        },{
     2059            0 => 'Non-illuminated', #(NC)
     2060            1 => 'Illuminated', #(NC)
     2061        }],
     2062    },
     2063    0x051e => { # (80D)
     2064        Name => 'InitialAFPointAIServoAF',
     2065        PrintConv => {
     2066            0 => 'Auto',
     2067            1 => 'Initial AF point selected',
     2068            2 => 'Manual AF point',
    18472069        },
    18482070    },
     
    18572079        },
    18582080    },
    1859     0x0610 => {
     2081    0x0610 => [{ # (1DXmkIII)
     2082        Name => 'ContinuousShootingSpeed',
     2083        Condition => '$count == 6',
     2084        Count => 6,
     2085        PrintConv => [
     2086            \%disableEnable,
     2087            '"Hi $val"',
     2088            '"Cont $val"',
     2089            '"Lo $val"',
     2090            '"Soft $val"',
     2091            '"Soft LS $val"',
     2092        ],
     2093        PrintConvInv => [
     2094            undef,
     2095            '$val=~/(\d+)/ ? $1 : 0',
     2096            '$val=~/(\d+)/ ? $1 : 0',
     2097            '$val=~/(\d+)/ ? $1 : 0',
     2098            '$val=~/(\d+)/ ? $1 : 0',
     2099            '$val=~/(\d+)/ ? $1 : 0',
     2100        ],
     2101    },{ # (1DXmkIII firmware 1.3)
     2102        Name => 'ContinuousShootingSpeed',
     2103        Condition => '$count == 5',
     2104        Count => 5,
     2105        PrintConv => [
     2106            '"Hi $val"',
     2107            '"Cont $val"',
     2108            '"Lo $val"',
     2109            '"Soft $val"',
     2110            '"Soft LS $val"',
     2111        ],
     2112        PrintConvInv => [
     2113            '$val=~/(\d+)/ ? $1 : 0',
     2114            '$val=~/(\d+)/ ? $1 : 0',
     2115            '$val=~/(\d+)/ ? $1 : 0',
     2116            '$val=~/(\d+)/ ? $1 : 0',
     2117            '$val=~/(\d+)/ ? $1 : 0',
     2118        ],
     2119    },{ # others
    18602120        Name => 'ContinuousShootingSpeed',
    18612121        Count => 3,
     
    18702130            '$val=~/(\d+)/ ? $1 : 0',
    18712131        ],
    1872     },
     2132    }],
    18732133    0x0611 => {
    18742134        Name => 'ContinuousShotLimit',
     
    18832143        ],
    18842144    },
     2145    0x0612 => [{ # (1DXmkIII)
     2146        Name => 'RestrictDriveModes',
     2147        Condition => '$count == 1',
     2148        Count => 1,
     2149        PrintConv => 'sprintf("Flags 0x%x",$val)',
     2150        PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
     2151    },{ # (1DX)
     2152        Name => 'RestrictDriveModes',
     2153        Count => 2,
     2154        PrintConv => [
     2155            \%disableEnable,
     2156            'sprintf("Flags 0x%x",$val)', # (Single,Cont Hi,Cont Lo,Timer 10,Timer 2,Silent,Super Hi)
     2157        ],
     2158        PrintConvInv => [
     2159            undef,
     2160            '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
     2161        ],
     2162    }],
    18852163    #### 4a) Operation
    18862164    0x0701 => [
    18872165        {
    18882166            Name => 'Shutter-AELock',
    1889             Condition => '$$self{Model} =~ /\b(1000D|XS|Kiss F|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/',
    1890             Notes => '500D, 550D and 1000D',
     2167            Condition => q{
     2168                $$self{Model} =~ /\b(1000D|XS|Kiss F|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/ or
     2169                $$self{Model} =~ /\b(600D|T3i|Kiss X5|1100D|T3|Kiss X50)\b/
     2170            },
     2171            Notes => '500D, 550D, 600D, 1000D and 1100D',
    18912172            PrintConv => {
    18922173                0 => 'AF/AE lock',
     
    18942175                2 => 'AF/AF lock, No AE lock',
    18952176                3 => 'AE/AF, No AE lock',
     2177            },
     2178        },
     2179        {
     2180            Name => 'Shutter-AELock',
     2181            Condition => '$count == 2',
     2182            Notes => '250D',
     2183            PrintConv => {
     2184                '0 0' => 'AF/AE lock',
     2185                '1 0' => 'AE lock/AF',
     2186                '2 0' => 'AF/AF lock, No AE lock',
     2187                '3 0' => 'AE/AF, No AE lock',
    18962188            },
    18972189        },
     
    19642256        {
    19652257            Name => 'SetButtonWhenShooting',
    1966             Condition => '$$self{Model} =~ /\b(450D|XSi|Kiss X2|550D|T2i|Kiss X4)\b/',
    1967             Notes => '450D and 550D; value of 5 is new for 550D',
     2258            Condition => '$$self{Model} =~ /\b(450D|XSi|Kiss X2|550D|T2i|Kiss X4|600D|T3i|Kiss X5)\b/',
     2259            Notes => '450D, 550D and 600D; value of 5 is new for 550D',
    19682260            PrintConv => {
    19692261                0 => 'Normal (disabled)',
     
    19772269        {
    19782270            Name => 'SetButtonWhenShooting',
     2271            Condition => '$$self{Model} =~ /\b(1100D|T3|Kiss X50)\b/',
     2272            Notes => '1100D',
     2273            PrintConv => {
     2274                0 => 'Normal (disabled)',
     2275                1 => 'Image quality',
     2276                2 => 'Flash exposure compensation',
     2277                3 => 'LCD monitor On/Off',
     2278                4 => 'Menu display',
     2279                5 => 'Depth-of-field preview',
     2280            },
     2281        },
     2282        {
     2283            Name => 'SetButtonWhenShooting',
    19792284            Condition => '$$self{Model} =~ /\b(1000D|XS|Kiss F)\b/',
    19802285            Notes => '1000D',
     
    19992304                5 => 'Disabled',
    20002305            },
     2306        },
     2307        {
     2308            Name => 'SetButtonWhenShooting',
     2309            Notes => '250D',
     2310            Condition => '$count == 2',
     2311            # (not sure how to decode this.  seen: "37 0")
     2312            PrintConv => { },
    20012313        },
    20022314        {
     
    20392351            0 => 'Rear LCD panel',
    20402352            1 => 'LCD monitor',
     2353            2 => 'Off (disable button)', # (1DX)
    20412354        },
    20422355    },
    20432356    0x0709 => {
    20442357        Name => 'LockMicrophoneButton',
    2045         PrintConv => {
     2358        PrintConv => [{
    20462359            # called "sound" in 1DmkIII manual, and "memo" in 1DmkIV manual
    20472360            0 => 'Protect (hold:record memo)',
    20482361            1 => 'Record memo (protect:disable)',
    20492362            2 => 'Play memo (hold:record memo)', # new with 1DmkIV
    2050         },
     2363            3 => 'Rating (protect/memo:disable)', # new with 1DX
     2364        }],
     2365        # (not sure what the 2nd number is -- new for 1DX.  Seen a value of 31.
     2366        # Memo quality may be set to 48kHz or 8kHz through another option that
     2367        # doesn't seem to be stored separately -- is this it?)
    20512368    },
    20522369    0x070a => {
     
    20782395        },
    20792396    },
     2397    0x070e => { # new for 1100D
     2398        Name => 'FlashButtonFunction',
     2399        PrintConv => {
     2400            0 => 'Raise built-in flash',
     2401            1 => 'ISO speed',
     2402        },
     2403    },
     2404    0x070f => { # new for 5DmkIII
     2405        Name => 'MultiFunctionLock',
     2406        PrintConv => [
     2407            { #(NC)
     2408                0 => 'Off',
     2409                1 => 'On', # "On (main dial)" for 750D/760D?
     2410                2 => 'On (quick control dial)', #(NC)
     2411                3 => 'On (main dial and quick control dial)', #(NC)
     2412            },
     2413            { BITMASK => { #(NC)
     2414                0 => 'Main dial',
     2415                1 => 'Quick control dial',
     2416                2 => 'Multi-controller',
     2417            }},
     2418        ],
     2419    },
     2420    0x0710 => { # (M)
     2421        Name => 'TrashButtonFunction',
     2422        PrintConv => {
     2423            0 => 'Normal (set center AF point)',
     2424            1 => 'Depth-of-field preview',
     2425        },
     2426    },
     2427    0x0711 => { # (M)
     2428        Name => 'ShutterReleaseWithoutLens',
     2429        PrintConv => \%disableEnable,
     2430    },
     2431    0x0712 => { # (R)
     2432        Name => 'ControlRingRotation',
     2433        PrintConv => {
     2434            0 => 'Normal',
     2435            1 => 'Reversed',
     2436        },
     2437    },
     2438    0x0713 => { # (R)
     2439        Name => 'FocusRingRotation',
     2440        PrintConv => {
     2441            0 => 'Normal',
     2442            1 => 'Reversed',
     2443        },
     2444    },
     2445    0x0714 => { # (R)
     2446        Name => 'RFLensMFFocusRingSensitivity',
     2447        PrintConv => {
     2448            0 => 'Varies With Rotation Speed',
     2449            1 => 'Linked To Rotation Angle',
     2450        },
     2451    },
     2452    0x0715 => { # (R)
     2453        Name => 'CustomizeDials', # (NC, may be CustomizeM-FnBar)
     2454        # (too much stuff to decode)
     2455    },
    20802456    #### 4b) Others
    20812457    0x080b => [
     
    21022478        {
    21032479            Name => 'FocusingScreen',
    2104             Notes => '1DmkIII and 1DmkIV',
     2480            Condition => '$$self{Model} =~ /\b6D\b/',
     2481            Notes => '6D',
     2482            PrintConv => {
     2483                0 => 'Eg-A II',
     2484                1 => 'Eg-D',
     2485                2 => 'Eg-S',
     2486            },
     2487        },
     2488        {
     2489            Name => 'FocusingScreen',
     2490            Condition => '$$self{Model} =~ /\b7D Mark II\b/',
     2491            Notes => '7D Mark II',
     2492            PrintConv => {
     2493                0 => 'Eh-A',
     2494                1 => 'Eh-S',
     2495            },
     2496        },
     2497        {
     2498            Name => 'FocusingScreen',
     2499            Condition => '$$self{Model} =~ /\b1D X\b/',
     2500            Notes => '1DX',
     2501            PrintConv => {
     2502                0 => 'Ec-CV',
     2503                1 => 'Ec-A,B,D,H,I,L',
     2504            },
     2505        },
     2506        {
     2507            Name => 'FocusingScreen',
     2508            Notes => '1DmkIII, 1DSmkIII and 1DmkIV',
    21052509            PrintConv => {
    21062510                0 => 'Ec-CIV',
     
    21112515        },
    21122516    ],
    2113     0x080c => {
     2517    0x080c => [{ # (1DXmkIII)
     2518        Name => 'TimerLength',
     2519        Condition => '$count == 3',
     2520        Count => 3,
     2521        PrintConv => [
     2522            '"6 s: $val"',
     2523            '"16 s: $val"',
     2524            '"After release: $val"',
     2525        ],
     2526        PrintConvInv => [
     2527            '$val=~/(\d+)$/ ? $1 : 0',
     2528            '$val=~/(\d+)$/ ? $1 : 0',
     2529            '$val=~/(\d+)$/ ? $1 : 0',
     2530        ],
     2531    },{
    21142532        Name => 'TimerLength',
    21152533        Count => 4,
     
    21262544            '$val=~/(\d+)$/ ? $1 : 0',
    21272545        ],
    2128     },
     2546    }],
    21292547    0x080d => {
    21302548        Name => 'ShortReleaseTimeLag',
     
    21612579        },
    21622580    },
     2581    0x0812 => { # (1DX)
     2582        Name => 'MemoAudioQuality',
     2583        PrintConv => {
     2584            0 => 'High (48 kHz)',
     2585            1 => 'Low (8 kHz)',
     2586        },
     2587    },
     2588    0x0813 => { # (5DmkIII)
     2589        Name => 'DefaultEraseOption',
     2590        PrintConv => {
     2591            0 => 'Cancel selected',
     2592            1 => 'Erase selected',
     2593            2 => 'Erase RAW selected', # (1DXmkIII)
     2594            3 => 'Erase non-RAW selected', # (1DXmkIII)
     2595        },
     2596    },
     2597    0x0814 => { # (5DS)
     2598        Name => 'RetractLensOnPowerOff',
     2599        PrintConv => \%enableDisable,
     2600    },
     2601    0x0815 => { # (R)
     2602        Name => 'AddIPTCInformation',
     2603        PrintConv => \%disableEnable,
     2604    },
     2605    0x0816 => { # (90D,RP)
     2606        Name => 'AudioCompression',
     2607        PrintConv => \%enableDisable,
     2608    }
    21632609);
    21642610
     
    21812627
    21822628#------------------------------------------------------------------------------
    2183 # Read/Write Canon custom 2 directory (used by 1D Mark III)
     2629# Read/Write Canon custom 2 directory (new for 1D Mark III)
    21842630# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
    21852631# Returns: 1 on success
    21862632sub ProcessCanonCustom2($$$)
    21872633{
    2188     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     2634    my ($et, $dirInfo, $tagTablePtr) = @_;
    21892635    my $dataPt = $$dirInfo{DataPt};
    21902636    my $offset = $$dirInfo{DirStart};
    21912637    my $size = $$dirInfo{DirLen};
    21922638    my $write = $$dirInfo{Write};
    2193     my $verbose = $exifTool->Options('Verbose');
     2639    my $verbose = $et->Options('Verbose');
    21942640    my $newTags;
    21952641
     2642    return 0 if $size < 2;
    21962643    # first entry in array must be the size
    21972644    my $len = Get16u($dataPt, $offset);
    21982645    unless ($len == $size and $len >= 8) {
    2199         $exifTool->Warn("Invalid CanonCustom2 data");
     2646        $et->Warn('Invalid CanonCustom2 data');
    22002647        return 0;
    22012648    }
     
    22032650    my $count = Get32u($dataPt, $offset + 4);
    22042651    if ($write) {
    2205         $newTags = $exifTool->GetNewTagInfoHash($tagTablePtr);
    2206         $exifTool->VPrint(0, "  Rewriting CanonCustom2\n");
     2652        $newTags = $et->GetNewTagInfoHash($tagTablePtr);
     2653        $et->VPrint(0, "  Rewriting CanonCustom2\n");
    22072654    } elsif ($verbose) {
    2208         $exifTool->VerboseDir('CanonCustom2', $count);
     2655        $et->VerboseDir('CanonCustom2', $count, $len);
    22092656    }
    22102657    my $pos = $offset + 8;
     
    22192666        $pos += 12;
    22202667        my $recPos = $pos;
    2221         my $recEnd = $pos + $recLen;
     2668        my $recEnd = $pos + $recLen - 8;
     2669        if ($recEnd > $end) {
     2670            $et->Warn("Corrupted CanonCustom2 group $recNum");
     2671            return 0;
     2672        }
    22222673        if ($verbose and not $write) {
    2223             $exifTool->VerboseDir("CanonCustom2 group $recNum", $recCount);
     2674            $et->VerboseDir("CanonCustom2 group $recNum", $recCount, $recLen);
    22242675        }
    22252676        my ($i, $num, $tag);
     
    22272678            $tag = Get32u($dataPt, $recPos);
    22282679            $num = Get32u($dataPt, $recPos + 4);
     2680            my $nextRec = $recPos + 8 + $num * 4;
     2681            last if $nextRec > $recEnd;
     2682            # patch for EOS-1DXmkIII firmware 1.0.0 bug:
     2683            if ($tag == 0x70c and $num == 0x66 and $nextRec + 8 < $recEnd) {
     2684                my $tmp = Get32u($dataPt, $nextRec + 4);
     2685                if ($tmp == 0x70f) {
     2686                    $et->Warn('Fixed incorrect CanonCustom tag 0x70c size', 1);
     2687                    ++$num; # (count should be one greater)
     2688                }
     2689            }
    22292690            $recPos += 8;
    2230             last if $recPos + $num * 4 > $recEnd;
    22312691            my $val = ReadValue($dataPt, $recPos, 'int32s', $num, $num * 4);
    22322692            if ($write) {
    22332693                # write new value
    22342694                my $tagInfo = $$newTags{$tag};
    2235                 next unless $tagInfo;
    2236                 my $nvHash = $exifTool->GetNewValueHash($tagInfo);
    2237                 next unless Image::ExifTool::IsOverwriting($nvHash, $val);
    2238                 my $newVal = Image::ExifTool::GetNewValues($nvHash);
     2695                next unless $$newTags{$tag};
     2696                $tagInfo = $et->GetTagInfo($tagTablePtr, $tag, \$val, undef, $num) or next;
     2697                my $nvHash = $et->GetNewValueHash($tagInfo) or next;
     2698                next unless $et->IsOverwriting($nvHash, $val);
     2699                my $newVal = $et->GetNewValue($nvHash);
    22392700                next unless defined $newVal;    # can't delete from a custom table
    22402701                WriteValue($newVal, 'int32s', $num, $dataPt, $recPos);
    2241                 $exifTool->VerboseValue("- CanonCustom:$$tagInfo{Name}", $val);
    2242                 $exifTool->VerboseValue("+ CanonCustom:$$tagInfo{Name}", $newVal);
    2243                 ++$exifTool->{CHANGED};
     2702                $et->VerboseValue("- CanonCustom:$$tagInfo{Name}", $val);
     2703                $et->VerboseValue("+ CanonCustom:$$tagInfo{Name}", $newVal);
     2704                ++$$et{CHANGED};
    22442705            } else {
    22452706                # save extracted tag
    22462707                my $oldInfo = $$tagTablePtr{$tag};
    2247                 $exifTool->HandleTag($tagTablePtr, $tag, $val,
     2708                $et->HandleTag($tagTablePtr, $tag, $val,
    22482709                    Index  => $i,
    22492710                    Format => 'int32u',
     
    22592720            }
    22602721        }
    2261         $pos += $recLen - 8;
     2722        if ($i != $recCount) {
     2723            $et->Warn('Missing '.($recCount-$i)." entries in CanonCustom2 group $recNum directory", 1);
     2724        }
     2725        $pos = $recEnd;
    22622726    }
    22632727    if ($pos != $end) {
    2264         $exifTool->Warn('Possibly corrupted CanonCustom2 data');
     2728        # Note: a firmware bug in the EOS M5 and M6 stores an incorrect
     2729        # size for the 2nd CanonCustom2 record, so this message is expected
     2730        # for these models...
     2731        $et->Warn('Possibly corrupted CanonCustom2 data');
    22652732        return 0;
    22662733    }
     
    22742741sub WriteCanonCustom2($$$)
    22752742{
    2276     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    2277     $exifTool or return 1;    # allow dummy access to autoload this package
     2743    my ($et, $dirInfo, $tagTablePtr) = @_;
     2744    $et or return 1;    # allow dummy access to autoload this package
    22782745    my $dataPt = $$dirInfo{DataPt};
    22792746    # edit a copy of the custom function 2 data
     
    22852752        Write    => 1,
    22862753    );
    2287     ProcessCanonCustom2($exifTool, \%dirInfo, $tagTablePtr) or return undef;
     2754    ProcessCanonCustom2($et, \%dirInfo, $tagTablePtr) or return undef;
    22882755    return $buff;
    22892756}
     
    22952762sub ProcessCanonCustom($$$)
    22962763{
    2297     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     2764    my ($et, $dirInfo, $tagTablePtr) = @_;
    22982765    my $dataPt = $$dirInfo{DataPt};
    22992766    my $offset = $$dirInfo{DirStart};
    23002767    my $size = $$dirInfo{DirLen};
    2301     my $verbose = $exifTool->Options('Verbose');
     2768    my $verbose = $et->Options('Verbose');
    23022769
    23032770    # first entry in array must be the size
    23042771    my $len = Get16u($dataPt,$offset);
    2305     unless ($len == $size or ($$exifTool{Model}=~/\bD60\b/ and $len+2 == $size)) {
    2306         $exifTool->Warn("Invalid CanonCustom data");
     2772    unless ($len == $size or ($$et{Model}=~/\bD60\b/ and $len+2 == $size)) {
     2773        $et->Warn("Invalid CanonCustom data");
    23072774        return 0;
    23082775    }
    2309     $verbose and $exifTool->VerboseDir('CanonCustom', $size/2-1);
     2776    $verbose and $et->VerboseDir('CanonCustom', $size/2-1);
    23102777    my $pos;
    23112778    for ($pos=2; $pos<$size; $pos+=2) {
     
    23142781        my $tag = ($val >> 8);
    23152782        $val = ($val & 0xff);
    2316         $exifTool->HandleTag($tagTablePtr, $tag, $val,
     2783        $et->HandleTag($tagTablePtr, $tag, $val,
    23172784            Index  => $pos/2-1,
    23182785            Format => 'int8u',
     
    23302797sub CheckCanonCustom($$$)
    23312798{
    2332     my ($exifTool, $tagInfo, $valPtr) = @_;
     2799    my ($et, $tagInfo, $valPtr) = @_;
    23332800    return Image::ExifTool::CheckValue($valPtr, 'int8u');
    23342801}
     
    23402807sub WriteCanonCustom($$$)
    23412808{
    2342     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    2343     $exifTool or return 1;    # allow dummy access to autoload this package
     2809    my ($et, $dirInfo, $tagTablePtr) = @_;
     2810    $et or return 1;    # allow dummy access to autoload this package
    23442811    my $dataPt = $$dirInfo{DataPt};
    23452812    my $dirStart = $$dirInfo{DirStart} || 0;
     
    23512818    # first entry in array must be the size
    23522819    my $len = Get16u($dataPt, 0);
    2353     unless ($len == $dirLen or ($$exifTool{Model}=~/\bD60\b/ and $len+2 == $dirLen)) {
    2354         $exifTool->Warn("Invalid CanonCustom data");
     2820    unless ($len == $dirLen or ($$et{Model}=~/\bD60\b/ and $len+2 == $dirLen)) {
     2821        $et->Warn("Invalid CanonCustom data");
    23552822        return undef;
    23562823    }
    2357     my $newTags = $exifTool->GetNewTagInfoHash($tagTablePtr);
     2824    my $newTags = $et->GetNewTagInfoHash($tagTablePtr);
    23582825    my $pos;
    23592826    for ($pos=2; $pos<$dirLen; $pos+=2) {
     
    23622829        my $tagInfo = $$newTags{$tag};
    23632830        next unless $tagInfo;
    2364         my $nvHash = $exifTool->GetNewValueHash($tagInfo);
     2831        my $nvHash = $et->GetNewValueHash($tagInfo);
    23652832        $val = ($val & 0xff);
    2366         next unless Image::ExifTool::IsOverwriting($nvHash, $val);
    2367         my $newVal = Image::ExifTool::GetNewValues($nvHash);
     2833        next unless $et->IsOverwriting($nvHash, $val);
     2834        my $newVal = $et->GetNewValue($nvHash);
    23682835        next unless defined $newVal;    # can't delete from a custom table
    23692836        Set16u(($newVal & 0xff) + ($tag << 8), $dataPt, $pos);
    2370         $exifTool->VerboseValue("- $dirName:$$tagInfo{Name}", $val);
    2371         $exifTool->VerboseValue("+ $dirName:$$tagInfo{Name}", $newVal);
    2372         ++$exifTool->{CHANGED};
     2837        $et->VerboseValue("- $dirName:$$tagInfo{Name}", $val);
     2838        $et->VerboseValue("+ $dirName:$$tagInfo{Name}", $newVal);
     2839        ++$$et{CHANGED};
    23732840    }
    23742841    return $newData;
     
    23972864=head1 AUTHOR
    23982865
    2399 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     2866Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    24002867
    24012868This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.