summaryrefslogtreecommitdiff
path: root/Tools/schnitt/schnitt3.pl
blob: 7cc0f7f3eac119a9a9e6af928caf91c0acec2d63 (plain)
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
#!/usr/bin/perl

require "/usr/local/bin/my/schnittcommon.pli";

open (INDEX,"index.vdr");
$index = $ARGV[0];
&nextI;

$oldindex = $index;
$tempindex = $index;

$add = -1;

$fi = sprintf ("%03d.vdr",$file);
open (FI2,$fi);
open (FO,">test");
sysseek (FI2,$offset,0);
sysread (FI2,$temp,3000000);
syswrite (FO,$temp,3000000);
close (FI2);
close (FO);
`/usr/local/bin/pvademux.old . test`;
if ( -s "test.mp2")
  {
    `rm test*`;
    print "$index\n";
    exit 0;
  }

while (1)
  {
    if ($index == 0)
      {
        $add = 1;
      }
    if ($add = -1)
      {
       $index--;
       &prevI;
      }
    else
      {
        nextI;
      }
    $fi = sprintf ("%03d.vdr",$file);
    open (FI2,$fi);
    open (FO,">test");
    sysseek (FI2,$offset,0);
    sysread (FI2,$temp,3000000);
    syswrite (FO,$temp,3000000);
    close (FI2);
    close (FO);
    `/usr/local/bin/pvademux.old . test`;
    if ( -s "test.mp2")
      {
        `rm test*`;
        if ($index < 0)
          {
            $index *= -1;
          }
        print "$index\n";
        exit 0;
      }
  }