ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Video-Capture-V4l/examples/nbcmp3
Revision: 1.2
Committed: Mon Feb 25 15:08:58 2002 UTC (24 years, 8 months ago) by pcg
Branch: MAIN
CVS Tags: rel-0_9, rel-0_902, HEAD
Changes since 1.1: +2 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/usr/bin/perl
2
3 use Video::Capture::V4l;
4 use Video::Capture::VBI;
5 use Fcntl;
6
7 $vbi = new Video::Capture::V4l::VBI or die;
8
9 # the next line is optional (it enables buffering)
10 $vbi->backlog(50); # max. 1 second backlog (~900kB)
11
12 open $fh, ">/dev/null" or die;
13
14 # 162203 -> 162586 jinglesize (5000)
15 # line 0 - relatively normal teletext line (80a Data)
16 # line 1 - hhFFOOOOLLLLcccccc
17 # h maybe vertical/horizontal ecc like in intercast?
18 # F fileno?
19 # O offset in file
20 # L length of file
21 # c checksum?
22
23 my $head;
24 my $body;
25
26 for (;;) {
27 for (decode_field $vbi->field, VBI_VT) {
28 if ($_->[1] == 0) {
29 if ($_->[2] == 0) {
30 printf "\n %04x %s", $_->[5], (unpack "H*", $_->[3]);
31 } elsif ($_->[2] == 1) {
32 $head = $_->[3];
33 $body = "";
34 } else {
35 print " ",unpack "H8", $_->[3];
36 $body .= substr ($_->[3], 1);
37 if ($_->[2] == 23 && length($body) == (22*39) && $head) {
38 my ($fno, $t2, $t3) = unpack "xxvVV", $head;
39 my $seq = Video::Capture::VBI::unham8($head);
40 if ($t2 <= $t3 && $fno) {
41 (print "\n$seq X"), next if substr($head,0,1) eq "\xea";
42 (print "\n$seq Y"), next if substr($head,0,1) eq "\xfd";
43 my ($s) = unpack "H*", $head;
44 printf "\n(%2x, %5d, %8d, %8d) # %s-%s", $seq, $fno, $t2, $t3, substr($s,12*2,6*2), substr($s,18*2);
45 print "X" if substr($head,0,1) eq "\xea";
46 print "Y" if substr($head,0,1) eq "\xfd";
47 sysopen FH, "/tmp/nbc/$fno", O_CREAT|O_RDWR, 0666 or die "/tmp/nbc/$fno: $!";
48 seek FH, $t2, 0;
49 print " offset $t2 appending (",tell(FH),")";
50 print FH substr($head, 18);
51 print FH $body;
52 close FH;
53 }
54 }
55 }
56 }
57 }
58 }