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/DV.pm

    r24107 r34921  
    1616use Image::ExifTool qw(:DataAccess :Utils);
    1717
    18 $VERSION = '1.00';
     18$VERSION = '1.02';
    1919
    2020# DV profiles (ref 1)
     
    2525        FrameSize => 120000,
    2626        VideoFormat => 'IEC 61834, SMPTE-314M - 525/60 (NTSC)',
    27         VideoScanType => 'Progressive',
    2827        Colorimetry => '4:1:1',
    2928        FrameRate => 30000/1001,
     
    3534        FrameSize => 144000,
    3635        VideoFormat => 'IEC 61834 - 625/50 (PAL)',
    37         VideoScanType => 'Progressive',
    3836        Colorimetry => '4:2:0',
    3937        FrameRate => 25/1,
     
    4543        FrameSize => 144000,
    4644        VideoFormat => 'SMPTE-314M - 625/50 (PAL)',
    47         VideoScanType => 'Progressive',
    4845        Colorimetry => '4:1:1',
    4946        FrameRate => 25/1,
     
    5552        FrameSize => 240000,
    5653        VideoFormat => 'DVCPRO50: SMPTE-314M - 525/60 (NTSC) 50 Mbps',
    57         VideoScanType => 'Progressive',
    5854        Colorimetry => '4:2:2',
    5955        FrameRate => 30000/1001,
     
    6561        FrameSize => 288000,
    6662        VideoFormat => 'DVCPRO50: SMPTE-314M - 625/50 (PAL) 50 Mbps',
    67         VideoScanType => 'Progressive',
    6863        Colorimetry => '4:2:2',
    6964        FrameRate => 25/1,
     
    7570        FrameSize => 480000,
    7671        VideoFormat => 'DVCPRO HD: SMPTE-370M - 1080i60 100 Mbps',
    77         VideoScanType => 'Interlaced',
    7872        Colorimetry => '4:2:2',
    7973        FrameRate => 30000/1001,
     
    8579        FrameSize => 576000,
    8680        VideoFormat => 'DVCPRO HD: SMPTE-370M - 1080i50 100 Mbps',
    87         VideoScanType => 'Interlaced',
    8881        Colorimetry => '4:2:2',
    8982        FrameRate => 25/1,
     
    9588        FrameSize => 240000,
    9689        VideoFormat => 'DVCPRO HD: SMPTE-370M - 720p60 100 Mbps',
    97         VideoScanType => 'Progressive',
    9890        Colorimetry => '4:2:2',
    9991        FrameRate => 60000/1001,
     
    10597        FrameSize => 288000,
    10698        VideoFormat => 'DVCPRO HD: SMPTE-370M - 720p50 100 Mbps',
    107         VideoScanType => 'Progressive',
    10899        Colorimetry => '4:2:2',
    109100        FrameRate => 50/1,
     
    115106        FrameSize => 144000,
    116107        VideoFormat => 'IEC 61883-5 - 625/50 (PAL)',
    117         VideoScanType => 'Progressive',
    118108        Colorimetry => '4:2:0',
    119109        FrameRate => 25/1,
     
    137127    NOTES => 'The following tags are extracted from DV videos.',
    138128    DateTimeOriginal => {
     129        Description => 'Date/Time Original',
    139130        Groups => { 2 => 'Time' },
    140131        PrintConv => '$self->ConvertDateTime($val)',
     
    160151sub ProcessDV($$)
    161152{
    162     my ($exifTool, $dirInfo) = @_;
     153    my ($et, $dirInfo) = @_;
    163154    local $_;
    164155    my $raf = $$dirInfo{RAF};
     
    180171    return 0 if $start + 80 * 6 > $len;
    181172
    182     $exifTool->SetFileType();
     173    $et->SetFileType();
    183174
    184175    my $pos = $start;
    185     my $dsf = Get8u(\$buff, $pos + 3) & 0x80 >> 7;
     176    my $dsf = (Get8u(\$buff, $pos + 3) & 0x80) >> 7;
    186177    my $stype = Get8u(\$buff, $pos + 80*5 + 48 + 3) & 0x1f;
    187178
     
    195186            last;
    196187        }
    197         $profile or $exifTool->Warn("Unrecognized DV profile"), return 1;
     188        $profile or $et->Warn("Unrecognized DV profile"), return 1;
    198189    }
    199190    my $tagTablePtr = GetTagTable('Image::ExifTool::DV::Main');
     
    201192    # calculate total bit rate and duration
    202193    my $byteRate = $$profile{FrameSize} * $$profile{FrameRate};
    203     my $fileSize = $$exifTool{VALUE}{FileSize};
     194    my $fileSize = $$et{VALUE}{FileSize};
    204195    $$profile{TotalBitrate} = 8 * $byteRate;
    205196    $$profile{Duration} = $fileSize / $byteRate if defined $fileSize;
     
    208199    delete $$profile{DateTimeOriginal};
    209200    delete $$profile{AspectRatio};
    210     my ($date, $time, $is16_9);
     201    delete $$profile{VideoScanType};
     202    my ($date, $time, $is16_9, $interlace);
    211203    for ($i=1; $i<6; ++$i) {
    212204        $pos += 80;
     
    220212                my $t = Get8u(\$buff, $p + 2);
    221213                $is16_9 = (($t & 0x07) == 0x02 or (not $apt and ($t & 0x07) == 0x07));
     214                $interlace = Get8u(\$buff, $p + 3) & 0x10; # (ref 2)
    222215            } elsif ($type == 0x62) { # date
    223216                # mask off unused bits
     
    245238    if ($date and $time) {
    246239        $$profile{DateTimeOriginal} = "$date $time";
    247         $$profile{AspectRatio} = $is16_9 ? '16:9' : '5:4' if defined $is16_9;
     240        if (defined $is16_9) {
     241            $$profile{AspectRatio} = $is16_9 ? '16:9' : '4:3';
     242            $$profile{VideoScanType} = $interlace ? 'Interlaced' : 'Progressive';
     243        }
    248244    }
    249245
     
    271267    foreach $tag (@dvTags) {
    272268        next unless defined $$profile{$tag};
    273         $exifTool->HandleTag($tagTablePtr, $tag, $$profile{$tag});
     269        $et->HandleTag($tagTablePtr, $tag, $$profile{$tag});
    274270    }
    275271
     
    296292=head1 AUTHOR
    297293
    298 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     294Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    299295
    300296This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.