File: cuepointlist.config

package info (click to toggle)
libimage-exiftool-perl 12.57%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 27,740 kB
  • sloc: perl: 280,930; xml: 120; makefile: 13
file content (70 lines) | stat: -rw-r--r-- 2,935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#------------------------------------------------------------------------------
# File:         cuepointlist.config
#
# Description:  ExifTool config file to generate list of cue points and labels
#               in WAV audio files
#
# Usage:        exiftool -config cuepointlist.config -cuepointlist -b FILE
#
# Requires:     ExifTool version 12.25 or later
#
# Revisions:    2021-04-20 - P. Harvey Created
#------------------------------------------------------------------------------

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        CuePointList => {
            Require => {
                0 => 'CuePoints',
                1 => 'SampleRate',
            },
            Desire => {
                2 => 'CuePointLabel',
                3 => 'CuePointNotes',
                4 => 'LabeledText',
            },
            ValueConv => q{
                SetByteOrder('II');
                my (%lbl, %rgn, %rtyp, %rlbl, %note, $pos, $i);
                # get labels if available
                for ($i=1; defined $val[2]; ++$i) {
                    $lbl{$1} = $2 if $val[2] =~ /^(\d+) (.*)/ and length $2;
                    $val[2] = $self->GetValue("CuePointLabel ($i)");
                }
                # get notes if available
                for ($i=1; defined $val[3]; ++$i) {
                    $note{$1} = $2 if $val[3] =~ /^(\d+) (.*)/ and length $2;
                    $val[3] = $self->GetValue("CuePointNotes ($i)");
                }
                # get regions if available
                for ($i=1; defined $val[4]; ++$i) {
                    if ($val[4] =~ /^(\d+) (\d+) '(.*)' \d+ \d+ \d+ \d+ (.*)/) {
                        $rgn{$1} = $2;
                        $rtyp{$1} = $3;
                        $rlbl{$1} = $4;
                    }
                    $val[4] = $self->GetValue("LabeledText ($i)");
                }
                my $buff = "Cue\tStart\tEnd\tLabel\tPurpose\tText\tNotes\n";
                for ($pos=4; $pos+24<=length(${$val[0]}); $pos+=24) {
                    my $n = Get32u($val[0], $pos);
                    my $start = Get32u($val[0], $pos + 4);
                    my (@lbl, $lbl);
                    push @lbl, $lbl{$n} if defined $lbl{$n};
                    push @lbl, $rlbl{$n} if defined $rlbl{$n};
                    push @lbl, '-', $note{$n} if defined $note{$n};
                    my $lbl = join ' ', @lbl;
                    $buff .= sprintf("%d\t%.3f\t%.3f\t%s\t%s\t%s\t%s\n",
                             $n, $start/$val[1], ($start+($rgn{$n}||0))/$val[1],
                             defined($lbl{$n}) ? $lbl{$n} : '',
                             defined($rtyp{$n}) ? $rtyp{$n} : '',
                             defined($rlbl{$n}) ? $rlbl{$n} : '',
                             defined($note{$n}) ? $note{$n} : '');
                }
                return $buff;
            },
        },
    },
);

1; # end