-
Notifications
You must be signed in to change notification settings - Fork 0
/
Multiplex.pm
executable file
·111 lines (93 loc) · 2.25 KB
/
Multiplex.pm
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/perl
##########################################################################
# Multiplex object
# Copyright (C) 2012 Tomonobu Saito All Rights Reserverd.
package Multiplex;
use strict;
use Carp qw(croak);
use integer;
sub new {
my $pkg = shift;
my $tsid = shift;
my $onid = shift;
bless {
transport_stream_id => $tsid,
original_network_id => $onid,
actual => "",
frequency => -1,
symbol_rate => -1,
modulation => -1,
band_width => -1,
delivery_system => "???",
}, $pkg;
}
sub IsSame {
my $self = shift;
my $tsid = shift;
my $onid = shift;
return
$tsid == $self->{ transport_stream_id } &&
$onid == $self->{ original_network_id };
}
# static method
sub DumpHeaderLine{
print "[Multiplex]\n\n";
print "tsid onid sys act freq(K) BW symbol mod \n";
print "------ ------ --- --- ------- -- ------ --- \n"
}
sub Dump {
my $self = shift;
printf "0x%04x 0x%04x %s %s %7d %2d %6d %3d \n",
$self->{ transport_stream_id },
$self->{ original_network_id },
$self->{ delivery_system },
("a" eq $self->{ actual } ? "act" : " "),
$self->{ frequency },
$self->{ band_width },
$self->{ symbol_rate },
$self->{ modulation };
}
#
# Setter
#
sub SetActual {
my $self = shift;
if ('a' ne $self->{ actual }) {
$self->{ actual } = shift;
}
}
sub SetFrequency {
my $self = shift;
$self->{ frequency } = shift;
}
sub SetSymbolRate {
my $self = shift;
$self->{ symbol_rate } = shift;
}
sub SetModulation {
my $self = shift;
$self->{ modulation } = shift;
}
sub SetBandWidth {
my $self = shift;
$self->{ band_width } = shift;
}
sub FromSatellite {
my $self = shift;
$self->{ delivery_system } = "sat";
}
sub FromS2 {
my $self = shift;
$self->{ delivery_system } = "s2 ";
}
sub FromCable {
my $self = shift;
$self->{ delivery_system } = "cbl";
}
sub FromTerr {
my $self = shift;
$self->{ delivery_system } = "ter";
}
1;