-
Notifications
You must be signed in to change notification settings - Fork 11
/
standard-ts-test.sh
executable file
·206 lines (145 loc) · 6.7 KB
/
standard-ts-test.sh
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# Perform the "standard" set of tests on a transport stream file.
# Syntax: source "$COMMONDIR"/standard-ts-test.sh input.ts [--atsc|--isdb]
# ------------------------------------------------------------------------------
INFILE="$INDIR/$1"
STDOPT="$2"
# ==== tsanalyze, as a command
$(tspath tsanalyze) $(fpath "$INFILE") --title "$SCRIPT tsanalyze full" $STDOPT \
>"$OUTDIR/$SCRIPT.tsanalyze.full.txt" \
2>"$OUTDIR/$SCRIPT.tsanalyze.full.log"
test_text $SCRIPT.tsanalyze.full.txt
test_text $SCRIPT.tsanalyze.full.log
# ==== tsanalyze, as a command, wide display
$(tspath tsanalyze) $(fpath "$INFILE") --title "$SCRIPT tsanalyze wide" --wide-display $STDOPT \
>"$OUTDIR/$SCRIPT.tsanalyze.wide.txt" \
2>"$OUTDIR/$SCRIPT.tsanalyze.wide.log"
test_text $SCRIPT.tsanalyze.wide.txt
test_text $SCRIPT.tsanalyze.wide.log
# ==== tsanalyze, as a command, normalized format
$(tspath tsanalyze) $(fpath "$INFILE") --title "$SCRIPT tsanalyze norm" --normalized --deterministic $STDOPT \
>"$OUTDIR/$SCRIPT.tsanalyze.norm.txt" \
2>"$OUTDIR/$SCRIPT.tsanalyze.norm.log"
test_text $SCRIPT.tsanalyze.norm.txt
test_text $SCRIPT.tsanalyze.norm.log
# ==== tsanalyze, error report
$(tspath tsanalyze) $(fpath "$INFILE") --title "$SCRIPT tsanalyze errors" --error-analysis --deterministic $STDOPT \
>"$OUTDIR/$SCRIPT.tsanalyze.errors.txt" \
2>"$OUTDIR/$SCRIPT.tsanalyze.errors.log"
test_text $SCRIPT.tsanalyze.errors.txt
test_text $SCRIPT.tsanalyze.errors.log
# ==== tspsi, as a command
$(tspath tspsi) $(fpath "$INFILE") $STDOPT \
>"$OUTDIR/$SCRIPT.tspsi.txt" \
2>"$OUTDIR/$SCRIPT.tspsi.log"
test_text $SCRIPT.tspsi.txt
test_text $SCRIPT.tspsi.log
# ==== analyze and psi, as plugins
test_tsp \
-I file $(fpath "$INFILE") \
-P analyze -o $(fpath "$OUTDIR/$SCRIPT.tsp.analyze.full.txt") --title "$SCRIPT full" $STDOPT \
-P analyze --normalized --deterministic -o $(fpath "$OUTDIR/$SCRIPT.tsp.analyze.norm.txt") --title "$SCRIPT normalized" $STDOPT \
-P analyze --json --deterministic -o $(fpath "$OUTDIR/$SCRIPT.tsp.analyze.json") --title "$SCRIPT JSON" $STDOPT \
-P analyze --error-analysis --deterministic -o $(fpath "$OUTDIR/$SCRIPT.tsp.analyze.errors.txt") --title "$SCRIPT errors" $STDOPT \
-P psi --all -o $(fpath "$OUTDIR/$SCRIPT.tsp.psi.txt") $STDOPT \
-O drop \
>"$OUTDIR/$SCRIPT.tsp.log" 2>&1
test_text $SCRIPT.tsp.analyze.full.txt
test_text $SCRIPT.tsp.analyze.norm.txt
test_text $SCRIPT.tsp.analyze.json
test_text $SCRIPT.tsp.analyze.errors.txt
test_text $SCRIPT.tsp.psi.txt
test_text $SCRIPT.tsp.log
# ==== tsbitrate using PCR
$(tspath tsbitrate) $(fpath "$INFILE") --full --all \
>"$OUTDIR/$SCRIPT.tsbitrate.pcr.txt" \
2>"$OUTDIR/$SCRIPT.tsbitrate.pcr.log"
test_text $SCRIPT.tsbitrate.pcr.txt
test_text $SCRIPT.tsbitrate.pcr.log
# ==== tsbitrate using DTS
$(tspath tsbitrate) $(fpath "$INFILE") --full --all --dts \
>"$OUTDIR/$SCRIPT.tsbitrate.dts.txt" \
2>"$OUTDIR/$SCRIPT.tsbitrate.dts.log"
test_text $SCRIPT.tsbitrate.dts.txt
test_text $SCRIPT.tsbitrate.dts.log
# ==== tsdate
$(tspath tsdate) $(fpath "$INFILE") --all \
>"$OUTDIR/$SCRIPT.tsdate.txt" \
2>"$OUTDIR/$SCRIPT.tsdate.log"
# In the input database, we have one test with a corrupted TDT:
# - Received: 70 70 05 *82* 84 11 03 35 => 1950/05/11 11:03:35.000
# - Instead of: 70 70 05 *E2* 84 11 03 35 => 2017/08/23 11:03:35.000
# The problem is that 1950 is not a valid UNIX time. So, depending on the platform,
# the date is displayed either as 1950 or 1970/01/01 (UNIX epoch, invalid time).
# Remove them all.
sed -i -e '/1950\/05\/11/d' -e '/1970\/01\/01/d' "$OUTDIR/$SCRIPT.tsdate.txt"
test_text $SCRIPT.tsdate.txt
test_text $SCRIPT.tsdate.log
# ==== tsdump, first 10 packets.
(test_tsp -I file $(fpath "$INFILE") -P until --packet 10 | $(tspath tsdump)) \
>"$OUTDIR/$SCRIPT.tsdump.txt" \
2>"$OUTDIR/$SCRIPT.tsdump.log"
test_text $SCRIPT.tsdump.txt
test_text $SCRIPT.tsdump.log
(test_tsp -I file $(fpath "$INFILE") -P until --packet 10 | $(tspath tsdump) --header) \
>"$OUTDIR/$SCRIPT.tsdump.header.txt" \
2>"$OUTDIR/$SCRIPT.tsdump.header.log"
test_text $SCRIPT.tsdump.header.txt
test_text $SCRIPT.tsdump.header.log
# ==== tstables, save all psi/si, search for PMT's
PMTPIDS=$(grep '^table:.*tid=2:' $OUTDIR/$SCRIPT.tsanalyze.norm.txt | sed -e 's/^.*:pid=/-p /' -e 's/:.*$//' | tr '\n' ' ')
PIDS="-p 0 -p 1 -p 2 -p 16 -p 17 -p 18 -p 19 -p 0x1FFB $PMTPIDS"
$(tspath tstables) $(fpath "$INFILE") --invalid-sections $PIDS $STDOPT \
--output-file $(fpath "$OUTDIR/$SCRIPT.tstables.text.txt") \
>"$OUTDIR/$SCRIPT.tstables.text.log" 2>&1
test_text $SCRIPT.tstables.text.txt
test_text $SCRIPT.tstables.text.log
# ==== tstables, XML files
$(tspath tstables) $(fpath "$INFILE") $PIDS --packet-index $STDOPT \
--xml $(fpath "$OUTDIR/$SCRIPT.tstables.xml") \
>"$OUTDIR/$SCRIPT.tstables.xml.log" 2>&1
test_text $SCRIPT.tstables.xml
test_text $SCRIPT.tstables.xml.log
$(tspath tstables) $(fpath "$INFILE") $PIDS --packet-index $STDOPT \
--strict-xml --xml $(fpath "$OUTDIR/$SCRIPT.tstables.strict.xml") \
>"$OUTDIR/$SCRIPT.tstables.strict.xml.log" 2>&1
test_text $SCRIPT.tstables.strict.xml
test_text $SCRIPT.tstables.strict.xml.log
# ==== tstables, JSON files
$(tspath tstables) $(fpath "$INFILE") $PIDS --packet-index $STDOPT \
--json $(fpath "$OUTDIR/$SCRIPT.tstables.json") \
>"$OUTDIR/$SCRIPT.tstables.json.log" 2>&1
test_text $SCRIPT.tstables.json
test_text $SCRIPT.tstables.json.log
# ==== tstables, XML and JSON one-liners
$(tspath tstables) $(fpath "$INFILE") $PIDS --packet-index $STDOPT \
--log-xml-line=XML: --log-json-line=JSON: \
>"$OUTDIR/$SCRIPT.tstables.oneliner.log" 2>&1
test_text $SCRIPT.tstables.oneliner.log
# ==== tstables, binary sections
$(tspath tstables) $(fpath "$INFILE") $PIDS $STDOPT \
--binary $(fpath "$OUTDIR/$SCRIPT.tstables.bin") \
>"$OUTDIR/$SCRIPT.tstables.bin.log" 2>&1
test_bin $SCRIPT.tstables.bin
test_text $SCRIPT.tstables.bin.log
# ==== tstabdump
$(tspath tstabdump) $(fpath "$OUTDIR/$SCRIPT.tstables.bin") $STDOPT \
>"$OUTDIR/$SCRIPT.tstabdump.txt" \
2>"$OUTDIR/$SCRIPT.tstabdump.log"
test_text $SCRIPT.tstabdump.txt
test_text $SCRIPT.tstabdump.log
# ==== psi plugin, XML one-liners
test_tsp \
-I file $(fpath "$INFILE") \
-P psi --all --log-xml-line='[PSIXML]' $STDOPT \
-O drop \
>"$OUTDIR/$SCRIPT.psi.xml.line.log" 2>&1
test_text $SCRIPT.psi.xml.line.log
# ==== analyze plugin, JSON one-liners
test_tsp \
-I file $(fpath "$INFILE") \
-P analyze --json-line='[TSJSON]' --deterministic --title "$SCRIPT JSON" $STDOPT \
-O drop \
>"$OUTDIR/$SCRIPT.analyze.json.line.log" 2>&1
test_text $SCRIPT.analyze.json.line.log