threefive3 3.0.27__tar.gz → 3.0.31__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {threefive3-3.0.27/threefive3.egg-info → threefive3-3.0.31}/PKG-INFO +12 -23
- {threefive3-3.0.27 → threefive3-3.0.31}/README.md +11 -22
- {threefive3-3.0.27 → threefive3-3.0.31}/bin/threefive3 +2 -11
- threefive3-3.0.31/threefive3/aac.py +62 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/base.py +5 -14
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/bitn.py +3 -1
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/commands.py +0 -69
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/cue.py +15 -60
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/descriptors.py +3 -119
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/gums.py +9 -11
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/hls.py +17 -60
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/hlstags.py +1 -13
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/new_reader.py +9 -3
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/section.py +0 -15
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/stream.py +90 -92
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/stuff.py +8 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/upids.py +2 -99
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/version.py +1 -1
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/words.py +6 -0
- {threefive3-3.0.27 → threefive3-3.0.31/threefive3.egg-info}/PKG-INFO +12 -23
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3.egg-info/SOURCES.txt +1 -3
- threefive3-3.0.27/threefive3/sxp.py +0 -94
- threefive3-3.0.27/threefive3/x2c.py +0 -253
- threefive3-3.0.27/threefive3/xml.py +0 -355
- {threefive3-3.0.27 → threefive3-3.0.31}/LICENSE +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/setup.cfg +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/setup.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/__init__.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/crc.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/encode.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/iframes.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/packetdata.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/segment.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/segmentation.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/sixfix.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/streamtypes.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3/superkabuki.py +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3.egg-info/dependency_links.txt +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3.egg-info/requires.txt +0 -0
- {threefive3-3.0.27 → threefive3-3.0.31}/threefive3.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threefive3
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.31
|
|
4
4
|
Summary: SCTE-35 decoder and encoder with MPEGTS and HLS and XML support.
|
|
5
5
|
Home-page: https://github.com/superkabuki/threefive3
|
|
6
6
|
Author: Adrian of Doom
|
|
@@ -22,18 +22,18 @@ License-File: LICENSE
|
|
|
22
22
|
Canada has a virtual monopoly on the World's mustard seed supply and they will use it to manipulate financial markets. We must act.
|
|
23
23
|
## Nuke Canada Now!
|
|
24
24
|
|
|
25
|
-
[Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |
|
|
25
|
+
[Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
# threefive3 SCTE-35 cli super tool and python3 library.
|
|
30
30
|
> Brought to you by the fine folks at fu-corp _( Adrian and the two blonde Chinese girls. )_
|
|
31
31
|
|
|
32
|
-
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
32
|
+
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml+binary ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
* Parses SCTE-35 from MPEGTS, HLS, XML
|
|
36
|
-
* Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON,
|
|
35
|
+
* Parses SCTE-35 from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
|
|
36
|
+
* Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, or Xml+binary.
|
|
37
37
|
* Built-in network support for HTTP(S), UDP, and Multicast.
|
|
38
38
|
* Automatic AES decryption for HLS.
|
|
39
39
|
* All HLS SCTE-35 Tags are Supported.
|
|
@@ -73,7 +73,7 @@ Type "help", "copyright", "credits" or "license" for more information.
|
|
|
73
73
|
| six2scte35 | ffmpeg bin data stream back to scte-35 | Done |
|
|
74
74
|
| superkabuki | scte-35 packet injection | Next release |
|
|
75
75
|
| sideways | hls scte-35 tag injecton | No |
|
|
76
|
-
| gums | multicast server |
|
|
76
|
+
| gums | multicast server | Done |
|
|
77
77
|
| adbreak3 | fast cli scte-35 cue creation | No |
|
|
78
78
|
|
|
79
79
|
|
|
@@ -110,12 +110,6 @@ If you want to get involved, just open an issue and we can talk about it.
|
|
|
110
110
|
* [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
#### Xml
|
|
114
|
-
|
|
115
|
-
* [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) The people wanted it so I finally did Xml.
|
|
116
|
-
* I feel cheap and dirty.
|
|
117
|
-
___
|
|
118
|
-
|
|
119
113
|
#### `Classes`
|
|
120
114
|
|
|
121
115
|
* The python built in help is always the most up to date docs for the library.
|
|
@@ -184,17 +178,14 @@ ___
|
|
|
184
178
|
```rebol
|
|
185
179
|
threefive3 udp://@235.2.5.35:3535
|
|
186
180
|
```
|
|
187
|
-
* If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,
|
|
181
|
+
* If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,or xml+bin), redirect the file contents.
|
|
188
182
|
```rebol
|
|
189
183
|
|
|
190
184
|
threefive3 < json.json
|
|
191
185
|
|
|
192
|
-
threefive3 < xml.xml
|
|
193
|
-
|
|
194
|
-
cat xml.xml | threefive3
|
|
195
186
|
```
|
|
196
187
|
|
|
197
|
-
* quoted strings(( base64,hex,int,json
|
|
188
|
+
* quoted strings(( base64,hex,int,json or xml+bin), can be passed directly on the command line as well.
|
|
198
189
|
|
|
199
190
|
```awk
|
|
200
191
|
|
|
@@ -209,8 +200,7 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
209
200
|
| __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
|
|
210
201
|
| __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
|
|
211
202
|
| __JSON__ |`threefive3 < json.json` |
|
|
212
|
-
|
|
|
213
|
-
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
203
|
+
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
214
204
|
|
|
215
205
|
# `Streams`
|
|
216
206
|
|
|
@@ -226,10 +216,10 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
226
216
|
|
|
227
217
|
|
|
228
218
|
#### Outputs
|
|
229
|
-
* output type is determined by the key words __base64, bytes, hex, int, json,
|
|
219
|
+
* output type is determined by the key words __base64, bytes, hex, int, json, and xmlbin__.
|
|
230
220
|
* __json is the default__.
|
|
231
221
|
* __Any input (except HLS,) can be returned as any output__
|
|
232
|
-
* examples __Base64 to Hex__
|
|
222
|
+
* examples __Base64 to Hex__ etc...)
|
|
233
223
|
|
|
234
224
|
|
|
235
225
|
| Output Type | Cli Example |
|
|
@@ -239,7 +229,6 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
239
229
|
| Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
|
|
240
230
|
| Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
|
|
241
231
|
| JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
|
|
242
|
-
| Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
|
|
243
232
|
| Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
|
|
244
233
|
|
|
245
234
|
#### `hls`
|
|
@@ -321,4 +310,4 @@ ___
|
|
|
321
310
|
|
|
322
311
|
___
|
|
323
312
|
|
|
324
|
-
[Install threefive3](#install)
|
|
313
|
+
[Install threefive3](#install) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
Canada has a virtual monopoly on the World's mustard seed supply and they will use it to manipulate financial markets. We must act.
|
|
2
2
|
## Nuke Canada Now!
|
|
3
3
|
|
|
4
|
-
[Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) |
|
|
4
|
+
[Install threefive3](#install) |[SCTE-35 Cli](#the-cli-tool) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
# threefive3 SCTE-35 cli super tool and python3 library.
|
|
9
9
|
> Brought to you by the fine folks at fu-corp _( Adrian and the two blonde Chinese girls. )_
|
|
10
10
|
|
|
11
|
-
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
11
|
+
✅ SCTE-35 Parser ✅ SCTE-35 Encoder ✅ SCTE-35 HLS ✅ SCTE-35 Xml+binary ✅ SCTE-35 Cli ✅ SCTE-35 library
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
* Parses SCTE-35 from MPEGTS, HLS, XML
|
|
15
|
-
* Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON,
|
|
14
|
+
* Parses SCTE-35 from MPEGTS, HLS, XML+Binary, Base64, Bytes, Hex, Integers, or JSON.
|
|
15
|
+
* Encode SCTE-35 to Base64, Bytes, Hex, Int, JSON, or Xml+binary.
|
|
16
16
|
* Built-in network support for HTTP(S), UDP, and Multicast.
|
|
17
17
|
* Automatic AES decryption for HLS.
|
|
18
18
|
* All HLS SCTE-35 Tags are Supported.
|
|
@@ -52,7 +52,7 @@ Type "help", "copyright", "credits" or "license" for more information.
|
|
|
52
52
|
| six2scte35 | ffmpeg bin data stream back to scte-35 | Done |
|
|
53
53
|
| superkabuki | scte-35 packet injection | Next release |
|
|
54
54
|
| sideways | hls scte-35 tag injecton | No |
|
|
55
|
-
| gums | multicast server |
|
|
55
|
+
| gums | multicast server | Done |
|
|
56
56
|
| adbreak3 | fast cli scte-35 cue creation | No |
|
|
57
57
|
|
|
58
58
|
|
|
@@ -89,12 +89,6 @@ If you want to get involved, just open an issue and we can talk about it.
|
|
|
89
89
|
* [Advanced Parsing of SCTE-35 in HLS with threefive3](https://github.com/superkabuki/threefive3/blob/main/hls.md) All HLS SCTE-35 tags, Sidecar Files, AAC ID3 Header Timestamps, SCTE-35 filters... Who loves you baby?
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
#### Xml
|
|
93
|
-
|
|
94
|
-
* [SCTE-35 Xml ](https://github.com/superkabuki/threefive3/blob/main/xml.md) The people wanted it so I finally did Xml.
|
|
95
|
-
* I feel cheap and dirty.
|
|
96
|
-
___
|
|
97
|
-
|
|
98
92
|
#### `Classes`
|
|
99
93
|
|
|
100
94
|
* The python built in help is always the most up to date docs for the library.
|
|
@@ -163,17 +157,14 @@ ___
|
|
|
163
157
|
```rebol
|
|
164
158
|
threefive3 udp://@235.2.5.35:3535
|
|
165
159
|
```
|
|
166
|
-
* If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,
|
|
160
|
+
* If a file comtains a SCTE-35 cue as a string( base64,hex,int,json,or xml+bin), redirect the file contents.
|
|
167
161
|
```rebol
|
|
168
162
|
|
|
169
163
|
threefive3 < json.json
|
|
170
164
|
|
|
171
|
-
threefive3 < xml.xml
|
|
172
|
-
|
|
173
|
-
cat xml.xml | threefive3
|
|
174
165
|
```
|
|
175
166
|
|
|
176
|
-
* quoted strings(( base64,hex,int,json
|
|
167
|
+
* quoted strings(( base64,hex,int,json or xml+bin), can be passed directly on the command line as well.
|
|
177
168
|
|
|
178
169
|
```awk
|
|
179
170
|
|
|
@@ -188,8 +179,7 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
188
179
|
| __Hex__ |`threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b`|
|
|
189
180
|
| __HLS__ |`threefive3 hls https://example.com/master.m3u8` |
|
|
190
181
|
| __JSON__ |`threefive3 < json.json` |
|
|
191
|
-
|
|
|
192
|
-
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
182
|
+
| __Xmlbin__ | `js threefive3 < xmlbin.xml` |
|
|
193
183
|
|
|
194
184
|
# `Streams`
|
|
195
185
|
|
|
@@ -205,10 +195,10 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
205
195
|
|
|
206
196
|
|
|
207
197
|
#### Outputs
|
|
208
|
-
* output type is determined by the key words __base64, bytes, hex, int, json,
|
|
198
|
+
* output type is determined by the key words __base64, bytes, hex, int, json, and xmlbin__.
|
|
209
199
|
* __json is the default__.
|
|
210
200
|
* __Any input (except HLS,) can be returned as any output__
|
|
211
|
-
* examples __Base64 to Hex__
|
|
201
|
+
* examples __Base64 to Hex__ etc...)
|
|
212
202
|
|
|
213
203
|
|
|
214
204
|
| Output Type | Cli Example |
|
|
@@ -218,7 +208,6 @@ threefive3 '/DAWAAAAAAAAAP/wBQb+ztd7owAAdIbbmw=='
|
|
|
218
208
|
| Hex | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' hex` |
|
|
219
209
|
| Integer | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' int` |
|
|
220
210
|
| JSON | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b json ` |
|
|
221
|
-
| Xml | `threefive3 '/DAsAAAAAyiYAP/wCgUAAAABf1+ZmQEBABECD0NVRUkAAAAAf4ABADUAAC2XQZU=' xml ` ` |
|
|
222
211
|
| Xml+bin | `threefive3 0xfc301600000000000000fff00506fed605225b0000b0b65f3b xmlbin ` |`
|
|
223
212
|
|
|
224
213
|
#### `hls`
|
|
@@ -300,4 +289,4 @@ ___
|
|
|
300
289
|
|
|
301
290
|
___
|
|
302
291
|
|
|
303
|
-
[Install threefive3](#install)
|
|
292
|
+
[Install threefive3](#install) | [SCTE-35 HLS](https://github.com/superkabuki/threefive3/blob/main/hls.md) | [Cue Class](https://github.com/superkabuki/threefive3/blob/main/cue.md) | [Stream Class](https://github.com/superkabuki/threefive3/blob/main/stream.md) | [Online SCTE-35 Parser](https://iodisco.com/scte35) | [Encode SCTE-35](https://github.com/superkabuki/threefive3/blob/main/encode.md) | [FFmpeg SCTE35](https://github.com/superkabuki/FFmpeg_SCTE35)
|
|
@@ -56,15 +56,14 @@ HELP = f"""
|
|
|
56
56
|
|
|
57
57
|
{B} Default {U} {BLUE}The default action is to read a input and write a SCTE-35 output.{U}
|
|
58
58
|
|
|
59
|
-
{BLUE}Inputs {U} mpegts, base64, hex, json,
|
|
59
|
+
{BLUE}Inputs {U} mpegts, base64, hex, json,and xmlbin{U}.
|
|
60
60
|
|
|
61
|
-
{BLUE}Outputs{U} base64, bytes, hex, int, json,
|
|
61
|
+
{BLUE}Outputs{U} base64, bytes, hex, int, json, and xmlbin.{U}
|
|
62
62
|
|
|
63
63
|
{BLUE}scte35 can read from {U} strings, files, stdin, http(s), multicast, and Udp.
|
|
64
64
|
|
|
65
65
|
Input {U} Output {U}
|
|
66
66
|
{U}{BLUE} mpegts {U} {U}{BLUE} base64 {NORM} threefive3 https://example.com/video.ts base64
|
|
67
|
-
{U}{BLUE} xml {U} {U}{BLUE} bytes {NORM} threefive3 bytes < xml.xml
|
|
68
67
|
{U}{BLUE} base64 {U} {U}{BLUE} hex {NORM} threefive3 '/DAWAAAAAAAAAP/wBQb+AKmKxwAACzuu2Q==' hex
|
|
69
68
|
{U}{BLUE} xmlbin {U} {U}{BLUE} int {NORM} threefive3 int < xml.xml
|
|
70
69
|
{U}{BLUE} mpegts {U} {U}{BLUE} json {NORM} threefive3 video.ts
|
|
@@ -269,13 +268,6 @@ def json_out(cue):
|
|
|
269
268
|
cue.show()
|
|
270
269
|
|
|
271
270
|
|
|
272
|
-
def xml_out(cue):
|
|
273
|
-
"""
|
|
274
|
-
xml_out prints cue as xml
|
|
275
|
-
"""
|
|
276
|
-
print2(cue.xml())
|
|
277
|
-
|
|
278
|
-
|
|
279
271
|
def xmlbin_out(cue):
|
|
280
272
|
"""
|
|
281
273
|
xml_out prints cue as xml
|
|
@@ -289,7 +281,6 @@ funk_map = {
|
|
|
289
281
|
"hex": hex_out,
|
|
290
282
|
"int": int_out,
|
|
291
283
|
"json": json_out,
|
|
292
|
-
"xml": xml_out,
|
|
293
284
|
"xmlbin": xmlbin_out,
|
|
294
285
|
}
|
|
295
286
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
aac.py
|
|
3
|
+
home of the AacParser for audio only hls renditions
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .new_reader import reader
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ROLLOVER = 95443.717678
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AacParser:
|
|
13
|
+
"""
|
|
14
|
+
AacParser parses aac segments.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
applehead = b"com.apple.streaming.transportStreamTimestamp"
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def is_header(header):
|
|
21
|
+
"""
|
|
22
|
+
is_header tests aac and ac3 files for ID3 headers.
|
|
23
|
+
"""
|
|
24
|
+
if header[:3] == b"ID3":
|
|
25
|
+
return True
|
|
26
|
+
return False
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
def id3_len(header):
|
|
30
|
+
"""
|
|
31
|
+
id3_len parses the length value from ID3 headers
|
|
32
|
+
"""
|
|
33
|
+
id3len = int.from_bytes(header[6:], byteorder="big")
|
|
34
|
+
return id3len
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def syncsafe5(somebytes):
|
|
38
|
+
"""
|
|
39
|
+
syncsafe5 parses PTS from ID3 tags.
|
|
40
|
+
"""
|
|
41
|
+
lsb = len(somebytes) - 1
|
|
42
|
+
syncd = 0
|
|
43
|
+
for idx, bite in enumerate(somebytes):
|
|
44
|
+
syncd += bite << ((lsb - idx) << 3)
|
|
45
|
+
return round(syncd / 90000.0, 6)
|
|
46
|
+
|
|
47
|
+
def parse(self, media):
|
|
48
|
+
"""
|
|
49
|
+
aac_pts parses the ID3 header tags in aac and ac3 audio files
|
|
50
|
+
"""
|
|
51
|
+
pts = 0
|
|
52
|
+
aac = reader(media)
|
|
53
|
+
header = aac.read(10)
|
|
54
|
+
if self.is_header(header):
|
|
55
|
+
id3len = self.id3_len(header)
|
|
56
|
+
data = aac.read(id3len)
|
|
57
|
+
if self.applehead in data:
|
|
58
|
+
try:
|
|
59
|
+
pts = float(data.split(self.applehead)[1].split(b"\x00", 2)[1])
|
|
60
|
+
except:
|
|
61
|
+
pts = self.syncsafe5(data.split(self.applehead)[1][:9])
|
|
62
|
+
return round((pts % ROLLOVER), 6)
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
threefive3.base contains
|
|
3
3
|
the class SCTE35Base.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import json
|
|
7
7
|
from .bitn import NBin
|
|
8
8
|
from .stuff import print2, red
|
|
9
|
-
from .xml import Node
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
class SCTE35Base:
|
|
@@ -36,16 +35,19 @@ class SCTE35Base:
|
|
|
36
35
|
if isinstance(var_value, bool):
|
|
37
36
|
self._err2(var_name, var_value, bit_count, var_type)
|
|
38
37
|
return True
|
|
38
|
+
return False
|
|
39
39
|
|
|
40
40
|
def _wrong_type(self, var_name, var_value, bit_count, var_type):
|
|
41
41
|
if not isinstance(var_value, var_type):
|
|
42
42
|
self._err2(var_name, var_value, bit_count, var_type)
|
|
43
43
|
return True
|
|
44
|
+
return False
|
|
44
45
|
|
|
45
46
|
def _is_none(self, var_name, var_value, bit_count, var_type):
|
|
46
47
|
if var_value is None:
|
|
47
48
|
self._err2(var_name, var_value, bit_count, var_type)
|
|
48
49
|
return True
|
|
50
|
+
return False
|
|
49
51
|
|
|
50
52
|
def _chk_var(self, var_type, nbin_method, var_name, bit_count):
|
|
51
53
|
"""
|
|
@@ -56,6 +58,7 @@ class SCTE35Base:
|
|
|
56
58
|
if me(var_name, var_value, bit_count, var_type):
|
|
57
59
|
return
|
|
58
60
|
nbin_method(var_value, bit_count)
|
|
61
|
+
return
|
|
59
62
|
|
|
60
63
|
@staticmethod
|
|
61
64
|
def as_90k(int_time):
|
|
@@ -184,15 +187,3 @@ class SCTE35Base:
|
|
|
184
187
|
show prints self as json to stderr (2)
|
|
185
188
|
"""
|
|
186
189
|
print2(self.json())
|
|
187
|
-
|
|
188
|
-
def xml(self, ns="scte35"):
|
|
189
|
-
"""
|
|
190
|
-
xml default xml method will return
|
|
191
|
-
all attributes, which is expressly allowed
|
|
192
|
-
for SCTE-35 xml.
|
|
193
|
-
"""
|
|
194
|
-
xml_attrs = self.kv_clean()
|
|
195
|
-
iam = type(self)
|
|
196
|
-
iam = str(iam).split("'", 1)[1].split("'", 1)[0]
|
|
197
|
-
this = Node(iam, attrs=xml_attrs, ns=ns)
|
|
198
|
-
return this
|
|
@@ -157,12 +157,14 @@ class NBin:
|
|
|
157
157
|
and appends it to self.nbits
|
|
158
158
|
via self.add_int
|
|
159
159
|
"""
|
|
160
|
+
dehexed = False
|
|
160
161
|
if isinstance(hex_str, str):
|
|
161
162
|
dehexed = int(hex_str, 16)
|
|
162
163
|
# just in case hex_str is an int....
|
|
163
164
|
if isinstance(hex_str, int):
|
|
164
165
|
dehexed = hex_str
|
|
165
|
-
|
|
166
|
+
if dehexed:
|
|
167
|
+
self.add_int(dehexed, bit_len)
|
|
166
168
|
|
|
167
169
|
def add_flag(self, flg, bit_len=1):
|
|
168
170
|
"""
|
|
@@ -5,7 +5,6 @@ SCTE35 Splice Commands
|
|
|
5
5
|
from .bitn import Bitn
|
|
6
6
|
from .base import SCTE35Base
|
|
7
7
|
from .stuff import red
|
|
8
|
-
from .xml import Node
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class SpliceCommand(SCTE35Base):
|
|
@@ -54,12 +53,6 @@ class BandwidthReservation(SpliceCommand):
|
|
|
54
53
|
BandwidthReservation.decode method
|
|
55
54
|
"""
|
|
56
55
|
|
|
57
|
-
def xml(self, ns="scte35"):
|
|
58
|
-
"""
|
|
59
|
-
create XML Node of type BandwidthReservation
|
|
60
|
-
"""
|
|
61
|
-
return Node("BandwidthReservation", ns=ns)
|
|
62
|
-
|
|
63
56
|
|
|
64
57
|
class PrivateCommand(SpliceCommand):
|
|
65
58
|
"""
|
|
@@ -91,15 +84,6 @@ class PrivateCommand(SpliceCommand):
|
|
|
91
84
|
nbin.add_bites(self.private_bytes)
|
|
92
85
|
return nbin.bites
|
|
93
86
|
|
|
94
|
-
def xml(self, ns="scte35"):
|
|
95
|
-
"""
|
|
96
|
-
create XML Node of type PrivateCommand
|
|
97
|
-
"""
|
|
98
|
-
attrs = {"identifier": self.identifier}
|
|
99
|
-
pc = Node("PrivateCommand", attrs=attrs)
|
|
100
|
-
pc.add_child(Node("PrivateBytes", value=self.private_bytes.hex(), ns=ns))
|
|
101
|
-
return pc
|
|
102
|
-
|
|
103
87
|
|
|
104
88
|
class SpliceNull(SpliceCommand):
|
|
105
89
|
"""
|
|
@@ -111,9 +95,6 @@ class SpliceNull(SpliceCommand):
|
|
|
111
95
|
self.command_type = 0
|
|
112
96
|
self.name = "Splice Null"
|
|
113
97
|
|
|
114
|
-
def xml(self, ns="scte35"):
|
|
115
|
-
return Node("SpliceNull", ns=ns)
|
|
116
|
-
|
|
117
98
|
|
|
118
99
|
class TimeSignal(SpliceCommand):
|
|
119
100
|
"""
|
|
@@ -171,22 +152,6 @@ class TimeSignal(SpliceCommand):
|
|
|
171
152
|
else:
|
|
172
153
|
nbin.reserve(7)
|
|
173
154
|
|
|
174
|
-
def xml(self, ns="scte35"):
|
|
175
|
-
"""
|
|
176
|
-
xml return TimeSignal as an xml node
|
|
177
|
-
"""
|
|
178
|
-
ts = Node("TimeSignal", ns=ns)
|
|
179
|
-
if self.has("pts_time"):
|
|
180
|
-
if self.pts_time:
|
|
181
|
-
self.pts_time = round(self.pts_time, 6)
|
|
182
|
-
st = Node(
|
|
183
|
-
"SpliceTime",
|
|
184
|
-
attrs={"pts_time": self.as_ticks(self.pts_time)},
|
|
185
|
-
ns=ns,
|
|
186
|
-
)
|
|
187
|
-
ts.add_child(st)
|
|
188
|
-
return ts
|
|
189
|
-
|
|
190
155
|
|
|
191
156
|
class SpliceInsert(TimeSignal):
|
|
192
157
|
"""
|
|
@@ -279,40 +244,6 @@ class SpliceInsert(TimeSignal):
|
|
|
279
244
|
nbin.forward(6)
|
|
280
245
|
nbin.add_int(self.as_ticks(self.break_duration), 33)
|
|
281
246
|
|
|
282
|
-
def xml(self, ns="scte35"):
|
|
283
|
-
"""
|
|
284
|
-
xml return the SpliceInsert instance as an xml node.
|
|
285
|
-
"""
|
|
286
|
-
si_attrs = {
|
|
287
|
-
"splice_event_id": self.splice_event_id,
|
|
288
|
-
"splice_event_cancel_Indicator": self.splice_event_cancel_indicator,
|
|
289
|
-
"splice_immediate_flag": self.splice_immediate_flag,
|
|
290
|
-
"event_id_compliance_flag": self.event_id_compliance_flag,
|
|
291
|
-
"avail_num": self.avail_num,
|
|
292
|
-
"avails_expected": self.avails_expected,
|
|
293
|
-
"out_of_network_indicator": self.out_of_network_indicator,
|
|
294
|
-
"unique_program_id": self.unique_program_id,
|
|
295
|
-
}
|
|
296
|
-
for k, v in si_attrs.items():
|
|
297
|
-
if v is None:
|
|
298
|
-
red(f"SpliceInsert.{k} needs to be set")
|
|
299
|
-
si = Node("SpliceInsert", attrs=si_attrs, ns=ns)
|
|
300
|
-
if self.pts_time:
|
|
301
|
-
prgm = Node("Program", ns=ns)
|
|
302
|
-
st = Node(
|
|
303
|
-
"SpliceTime", attrs={"ptsTime": self.as_ticks(self.pts_time)}, ns=ns
|
|
304
|
-
)
|
|
305
|
-
prgm.add_child(st)
|
|
306
|
-
si.add_child(prgm)
|
|
307
|
-
if self.break_duration:
|
|
308
|
-
bd_attrs = {
|
|
309
|
-
"auto_return": self.break_auto_return,
|
|
310
|
-
"duration": self.as_ticks(self.break_duration),
|
|
311
|
-
}
|
|
312
|
-
bd = Node("BreakDuration", attrs=bd_attrs, ns=ns)
|
|
313
|
-
si.add_child(bd)
|
|
314
|
-
return si
|
|
315
|
-
|
|
316
247
|
|
|
317
248
|
# table 7
|
|
318
249
|
command_map = {
|
|
@@ -11,22 +11,8 @@ from .section import SpliceInfoSection
|
|
|
11
11
|
from .commands import command_map, SpliceCommand
|
|
12
12
|
from .descriptors import splice_descriptor, descriptor_map
|
|
13
13
|
from .crc import crc32
|
|
14
|
-
from .xml import Node
|
|
15
14
|
from .segmentation import table22
|
|
16
|
-
from .words import
|
|
17
|
-
minusone,
|
|
18
|
-
zero,
|
|
19
|
-
one,
|
|
20
|
-
two,
|
|
21
|
-
three,
|
|
22
|
-
four,
|
|
23
|
-
eight,
|
|
24
|
-
eleven,
|
|
25
|
-
fourteen,
|
|
26
|
-
sixteen,
|
|
27
|
-
equalsign,
|
|
28
|
-
)
|
|
29
|
-
from .x2c import xml2cue
|
|
15
|
+
from .words import *
|
|
30
16
|
|
|
31
17
|
|
|
32
18
|
class Cue(SCTE35Base):
|
|
@@ -41,7 +27,7 @@ class Cue(SCTE35Base):
|
|
|
41
27
|
>>>> cue.show()
|
|
42
28
|
|
|
43
29
|
* A cue instance can be initialized with
|
|
44
|
-
Base64, Bytes, Hex, Int, Json,
|
|
30
|
+
Base64, Bytes, Hex, Int, Json, or Xml+binary data.
|
|
45
31
|
|
|
46
32
|
* Instance variables can be accessed via dot notation.
|
|
47
33
|
|
|
@@ -214,9 +200,6 @@ class Cue(SCTE35Base):
|
|
|
214
200
|
if isinstance(data, dict):
|
|
215
201
|
self.load(data)
|
|
216
202
|
return self.bites
|
|
217
|
-
if isinstance(data, Node):
|
|
218
|
-
self.load(data.mk())
|
|
219
|
-
return self.bites
|
|
220
203
|
if isinstance(data, bytes):
|
|
221
204
|
data = self._pkt_bits(data)
|
|
222
205
|
bites = self.idxsplit(data, b"\xfc")
|
|
@@ -226,9 +209,6 @@ class Cue(SCTE35Base):
|
|
|
226
209
|
if isinstance(data, str):
|
|
227
210
|
return self._str_bits(data)
|
|
228
211
|
|
|
229
|
-
# self.bites = bites
|
|
230
|
-
# return bites
|
|
231
|
-
|
|
232
212
|
def _mk_descriptors(self, bites):
|
|
233
213
|
"""
|
|
234
214
|
Cue._mk_descriptors parses
|
|
@@ -442,51 +422,26 @@ class Cue(SCTE35Base):
|
|
|
442
422
|
_from_xml converts xml to data that can
|
|
443
423
|
be loaded by a Cue instance.
|
|
444
424
|
"""
|
|
445
|
-
|
|
425
|
+
|
|
446
426
|
if isinstance(
|
|
447
|
-
|
|
427
|
+
gonzo, str
|
|
448
428
|
): # a string is returned for Binary xml tag, make sense?
|
|
449
|
-
|
|
450
|
-
|
|
429
|
+
if "<scte35:Binary>" in gonzo:
|
|
430
|
+
dat = gonzo.split("<scte35:Binary>")[1].split("</scte35:Binary>")[0]
|
|
431
|
+
self.bites = self._mk_bits(dat)
|
|
432
|
+
self.decode()
|
|
433
|
+
else:
|
|
434
|
+
blue("Only xml+binary format supported ")
|
|
451
435
|
else:
|
|
452
|
-
|
|
453
|
-
# Self.encode() will calculate lengths and types and such
|
|
454
|
-
# self.encode()
|
|
455
|
-
|
|
456
|
-
def _xml_mk_descriptor(self, sis, ns):
|
|
457
|
-
"""
|
|
458
|
-
_mk_descriptor_xml make xml nodes for descriptors.
|
|
459
|
-
"""
|
|
460
|
-
for d in self.descriptors:
|
|
461
|
-
if d.has("segmentation_type_id"):
|
|
462
|
-
if d.segmentation_type_id in table22:
|
|
463
|
-
comment = f"{table22[d.segmentation_type_id]}"
|
|
464
|
-
sis.add_comment(comment)
|
|
465
|
-
else:
|
|
466
|
-
red("Segmentation type id not in table 22")
|
|
467
|
-
sis.add_child(d.xml(ns=ns))
|
|
468
|
-
return sis
|
|
469
|
-
|
|
470
|
-
def xml(self, ns="scte35"):
|
|
471
|
-
"""
|
|
472
|
-
xml returns a threefive3.Node instance
|
|
473
|
-
which can be edited as needed or printed.
|
|
474
|
-
"""
|
|
475
|
-
sis = self.info_section.xml(ns=ns)
|
|
476
|
-
cmd = self.command.xml(ns=ns)
|
|
477
|
-
sis.add_child(cmd)
|
|
478
|
-
sis = self._xml_mk_descriptor(sis, ns)
|
|
479
|
-
sis.mk()
|
|
480
|
-
return sis
|
|
436
|
+
blue("xmlbin data needs to be str instance")
|
|
481
437
|
|
|
482
438
|
def xmlbin(self, ns="scte35"):
|
|
483
439
|
"""
|
|
484
440
|
xml returns a threefive3.Node instance
|
|
485
441
|
which can be edited as needed or printed.
|
|
486
442
|
xmlbin
|
|
443
|
+
|
|
487
444
|
"""
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
sig_node.add_child(bin_node)
|
|
492
|
-
return sig_node
|
|
445
|
+
return f"""<scte35:Signal xmlns:scte35="https://scte.org/schemas/35">
|
|
446
|
+
<scte35:Binary>{self.base64()}</scte35:Binary>
|
|
447
|
+
</scte35:Signal>"""
|