summaryrefslogtreecommitdiff
path: root/Tools/schnitt/schnitt3.pl.new
blob: 04a6239bed1b1388cac9be637f7b94fdfc275a9d (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
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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,">test2");
sysseek (FI2,$offset,0);
sysread (FI2,$temp,3000000);
syswrite (FO,$temp,3000000);
close (FI2);
close (FO);

system ("pes2av_pes test2 > test 2>/dev/null");
open (PVA,"/usr/local/bin/pvademux.old . test 2>&1 |");

@a=<PVA>; close PVA;
@b=split (/\s/,$a[2]);

if (!($b[4] =~ /\-/) && $b[4] < 2000)
  {
    unlink <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,">test2");
    sysseek (FI2,$offset,0);
    sysread (FI2,$temp,3000000);
    syswrite (FO,$temp,3000000);
    close (FI2);
    close (FO);

system ("/usr/local/bin/pes2av_pes test2 > test 2>/dev/null");
open (PVA,"/usr/local/bin/pvademux.old . test 2>&1 |");

@a=<PVA>; close PVA;
@b=split (/\s/,$a[2]);

if (!($b[4] =~ /\-/) && $b[4] < 2000)
  {
    unlink <test*>;
        if ($index < 0)
          {
            $index *= -1;
          }
    print "$index\n";
    exit 0;
  }
}