├── .DS_Store ├── .gitignore ├── Base64_2 ├── Base64.java └── Changes.txt ├── README.md ├── SCTE35base ├── build.xml ├── build │ ├── classes-generated │ │ └── com │ │ │ └── turner │ │ │ └── scte35 │ │ │ └── Bundle.java │ ├── classes │ │ ├── META-INF │ │ │ └── generated-layer.xml │ │ └── com │ │ │ └── turner │ │ │ └── scte35 │ │ │ ├── Bundle.class │ │ │ ├── Bundle.properties │ │ │ ├── scte35TopComponent$1.class │ │ │ ├── scte35TopComponent$10.class │ │ │ ├── scte35TopComponent$11.class │ │ │ ├── scte35TopComponent$12.class │ │ │ ├── scte35TopComponent$13.class │ │ │ ├── scte35TopComponent$14.class │ │ │ ├── scte35TopComponent$15.class │ │ │ ├── scte35TopComponent$16.class │ │ │ ├── scte35TopComponent$17.class │ │ │ ├── scte35TopComponent$18.class │ │ │ ├── scte35TopComponent$19.class │ │ │ ├── scte35TopComponent$2.class │ │ │ ├── scte35TopComponent$20.class │ │ │ ├── scte35TopComponent$21.class │ │ │ ├── scte35TopComponent$22.class │ │ │ ├── scte35TopComponent$23.class │ │ │ ├── scte35TopComponent$24.class │ │ │ ├── scte35TopComponent$25.class │ │ │ ├── scte35TopComponent$3.class │ │ │ ├── scte35TopComponent$4.class │ │ │ ├── scte35TopComponent$5.class │ │ │ ├── scte35TopComponent$6.class │ │ │ ├── scte35TopComponent$7.class │ │ │ ├── scte35TopComponent$8.class │ │ │ ├── scte35TopComponent$9.class │ │ │ └── scte35TopComponent.class │ └── no-license.txt ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ └── private.xml │ ├── project.properties │ ├── project.xml │ └── suite.properties └── src │ └── com │ └── turner │ └── scte35 │ ├── Bundle.properties │ ├── scte35TopComponent.form │ └── scte35TopComponent.java ├── branding ├── core │ └── core.jar │ │ └── org │ │ └── netbeans │ │ └── core │ │ └── startup │ │ └── Bundle.properties └── modules │ └── org-netbeans-core-windows.jar │ └── org │ └── netbeans │ └── core │ └── windows │ └── view │ └── ui │ └── Bundle.properties ├── build.xml ├── build ├── .DS_Store ├── cluster │ ├── .lastModified │ ├── config │ │ └── Modules │ │ │ ├── com-turner-decoder.xml │ │ │ ├── com-turner-scte35-common-codec.xml │ │ │ ├── com-turner-scte35.xml │ │ │ ├── org-netbeans-api-visual.xml_hidden │ │ │ ├── org-netbeans-core-execution.xml_hidden │ │ │ ├── org-netbeans-libs-jsr223.xml_hidden │ │ │ ├── org-netbeans-modules-autoupdate-cli.xml_hidden │ │ │ ├── org-netbeans-modules-autoupdate-services.xml_hidden │ │ │ ├── org-netbeans-modules-autoupdate-ui.xml_hidden │ │ │ ├── org-netbeans-modules-core-kit.xml_hidden │ │ │ ├── org-netbeans-modules-favorites.xml_hidden │ │ │ ├── org-openide-compat.xml_hidden │ │ │ ├── org-openide-options.xml_hidden │ │ │ └── org-openide-util-enumerations.xml_hidden │ ├── core │ │ └── locale │ │ │ └── core_scte35.jar │ ├── modules │ │ ├── com-turner-decoder.jar │ │ ├── com-turner-scte35-common-codec.jar │ │ ├── com-turner-scte35.jar │ │ ├── ext │ │ │ └── commons-codec-1.7.jar │ │ └── locale │ │ │ └── org-netbeans-core-windows_scte35.jar │ └── update_tracking │ │ ├── com-turner-decoder.xml │ │ ├── com-turner-scte35-common-codec.xml │ │ └── com-turner-scte35.xml └── public-package-jars │ ├── com-turner-scte35-common-codec.jar │ ├── org-netbeans-modules-settings.jar │ ├── org-openide-awt.jar │ ├── org-openide-util-lookup.jar │ ├── org-openide-util.jar │ └── org-openide-windows.jar ├── commons-codec ├── build.xml ├── build │ ├── classes │ │ └── com │ │ │ └── turner │ │ │ └── scte35 │ │ │ └── common │ │ │ └── codec │ │ │ └── Bundle.properties │ └── no-license.txt ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ ├── project.xml │ └── suite.properties ├── release │ └── modules │ │ └── ext │ │ └── commons-codec-1.7.jar └── src │ └── com │ └── turner │ └── scte35 │ └── common │ └── codec │ └── Bundle.properties ├── decoder ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ ├── project.xml │ └── suite.properties └── src │ └── com │ └── turner │ └── decoder │ ├── Base64.java │ ├── Bundle.properties │ ├── decoderTopComponent.form │ └── decoderTopComponent.java ├── javafx12 ├── release │ └── modules │ │ └── ext │ │ ├── javafx-swt.jar │ │ ├── javafx.base.jar │ │ ├── javafx.controls.jar │ │ ├── javafx.fxml.jar │ │ ├── javafx.graphics.jar │ │ ├── javafx.media.jar │ │ ├── javafx.swing.jar │ │ └── javafx.web.jar └── src │ └── javafx │ └── Bundle.properties └── nbproject ├── build-impl.xml ├── genfiles.properties ├── platform.properties ├── platform.xml ├── private └── platform-private.properties ├── project.properties └── project.xml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /decoder/build/ 2 | /decoder/nbproject/private/ 3 | /dist/ 4 | /SCTE35base/build/ 5 | /commons-codec/build/ 6 | /javafx12/nbproject/private/ -------------------------------------------------------------------------------- /Base64_2/Base64.java: -------------------------------------------------------------------------------- 1 | package util; 2 | 3 | import java.util.Arrays; 4 | 5 | /** A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance 6 | * with RFC 2045.

7 | * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster 8 | * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes) 9 | * compared to sun.misc.Encoder()/Decoder().

10 | * 11 | * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and 12 | * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small 13 | * arrays (< 30 bytes). If source/destination is a String this 14 | * version is about three times as fast due to the fact that the Commons Codec result has to be recoded 15 | * to a String from byte[], which is very expensive.

16 | * 17 | * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only 18 | * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice 19 | * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown 20 | * whether Sun's sun.misc.Encoder()/Decoder() produce temporary arrays but since performance 21 | * is quite low it probably does.

22 | * 23 | * The encoder produces the same output as the Sun one except that the Sun's encoder appends 24 | * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the 25 | * length and is probably a side effect. Both are in conformance with RFC 2045 though.
26 | * Commons codec seem to always att a trailing line separator.

27 | * 28 | * Note! 29 | * The encode/decode method pairs (types) come in three versions with the exact same algorithm and 30 | * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different 31 | * format types. The methods not used can simply be commented out.

32 | * 33 | * There is also a "fast" version of all decode methods that works the same way as the normal ones, but 34 | * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if 35 | * the input is known and it hasn't bee tampered with.

36 | * 37 | * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com. 38 | * 39 | * Licence (BSD): 40 | * ============== 41 | * 42 | * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com) 43 | * All rights reserved. 44 | * 45 | * Redistribution and use in source and binary forms, with or without modification, 46 | * are permitted provided that the following conditions are met: 47 | * Redistributions of source code must retain the above copyright notice, this list 48 | * of conditions and the following disclaimer. 49 | * Redistributions in binary form must reproduce the above copyright notice, this 50 | * list of conditions and the following disclaimer in the documentation and/or other 51 | * materials provided with the distribution. 52 | * Neither the name of the MiG InfoCom AB nor the names of its contributors may be 53 | * used to endorse or promote products derived from this software without specific 54 | * prior written permission. 55 | * 56 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 57 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 58 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 59 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 60 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 61 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 62 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 63 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 64 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 65 | * OF SUCH DAMAGE. 66 | * 67 | * @version 2.2 68 | * @author Mikael Grev 69 | * Date: 2004-aug-02 70 | * Time: 11:31:11 71 | */ 72 | 73 | public class Base64 74 | { 75 | private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); 76 | private static final int[] IA = new int[256]; 77 | static { 78 | Arrays.fill(IA, -1); 79 | for (int i = 0, iS = CA.length; i < iS; i++) 80 | IA[CA[i]] = i; 81 | IA['='] = 0; 82 | } 83 | 84 | // **************************************************************************************** 85 | // * char[] version 86 | // **************************************************************************************** 87 | 88 | /** Encodes a raw byte array into a BASE64 char[] representation i accordance with RFC 2045. 89 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 90 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
91 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 92 | * little faster. 93 | * @return A BASE64 encoded array. Never null. 94 | */ 95 | public final static char[] encodeToChar(byte[] sArr, boolean lineSep) 96 | { 97 | // Check special case 98 | int sLen = sArr != null ? sArr.length : 0; 99 | if (sLen == 0) 100 | return new char[0]; 101 | 102 | int eLen = (sLen / 3) * 3; // Length of even 24-bits. 103 | int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count 104 | int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array 105 | char[] dArr = new char[dLen]; 106 | 107 | // Encode even 24-bits 108 | for (int s = 0, d = 0, cc = 0; s < eLen;) { 109 | // Copy next three bytes into lower 24 bits of int, paying attension to sign. 110 | int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); 111 | 112 | // Encode the int into four chars 113 | dArr[d++] = CA[(i >>> 18) & 0x3f]; 114 | dArr[d++] = CA[(i >>> 12) & 0x3f]; 115 | dArr[d++] = CA[(i >>> 6) & 0x3f]; 116 | dArr[d++] = CA[i & 0x3f]; 117 | 118 | // Add optional line separator 119 | if (lineSep && ++cc == 19 && d < dLen - 2) { 120 | dArr[d++] = '\r'; 121 | dArr[d++] = '\n'; 122 | cc = 0; 123 | } 124 | } 125 | 126 | // Pad and encode last bits if source isn't even 24 bits. 127 | int left = sLen - eLen; // 0 - 2. 128 | if (left > 0) { 129 | // Prepare the int 130 | int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); 131 | 132 | // Set last four chars 133 | dArr[dLen - 4] = CA[i >> 12]; 134 | dArr[dLen - 3] = CA[(i >>> 6) & 0x3f]; 135 | dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '='; 136 | dArr[dLen - 1] = '='; 137 | } 138 | return dArr; 139 | } 140 | 141 | /** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with 142 | * and without line separators. 143 | * @param sArr The source array. null or length 0 will return an empty array. 144 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 145 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 146 | */ 147 | public final static byte[] decode(char[] sArr) 148 | { 149 | // Check special case 150 | int sLen = sArr != null ? sArr.length : 0; 151 | if (sLen == 0) 152 | return new byte[0]; 153 | 154 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 155 | // so we don't have to reallocate & copy it later. 156 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 157 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 158 | if (IA[sArr[i]] < 0) 159 | sepCnt++; 160 | 161 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 162 | if ((sLen - sepCnt) % 4 != 0) 163 | return null; 164 | 165 | int pad = 0; 166 | for (int i = sLen; i > 1 && IA[sArr[--i]] <= 0;) 167 | if (sArr[i] == '=') 168 | pad++; 169 | 170 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 171 | 172 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 173 | 174 | for (int s = 0, d = 0; d < len;) { 175 | // Assemble three bytes into an int from four "valid" characters. 176 | int i = 0; 177 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 178 | int c = IA[sArr[s++]]; 179 | if (c >= 0) 180 | i |= c << (18 - j * 6); 181 | else 182 | j--; 183 | } 184 | // Add the bytes 185 | dArr[d++] = (byte) (i >> 16); 186 | if (d < len) { 187 | dArr[d++]= (byte) (i >> 8); 188 | if (d < len) 189 | dArr[d++] = (byte) i; 190 | } 191 | } 192 | return dArr; 193 | } 194 | 195 | /** Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as 196 | * fast as {@link #decode(char[])}. The preconditions are:
197 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
198 | * + Line separator must be "\r\n", as specified in RFC 2045 199 | * + The array must not contain illegal characters within the encoded string
200 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
201 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 202 | * @return The decoded array of bytes. May be of length 0. 203 | */ 204 | public final static byte[] decodeFast(char[] sArr) 205 | { 206 | // Check special case 207 | int sLen = sArr.length; 208 | if (sLen == 0) 209 | return new byte[0]; 210 | 211 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 212 | 213 | // Trim illegal chars from start 214 | while (sIx < eIx && IA[sArr[sIx]] < 0) 215 | sIx++; 216 | 217 | // Trim illegal chars from end 218 | while (eIx > 0 && IA[sArr[eIx]] < 0) 219 | eIx--; 220 | 221 | // get the padding count (=) (0, 1 or 2) 222 | int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. 223 | int cCnt = eIx - sIx + 1; // Content count including possible separators 224 | int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; 225 | 226 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 227 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 228 | 229 | // Decode all but the last 0 - 2 bytes. 230 | int d = 0; 231 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 232 | // Assemble three bytes into an int from four "valid" characters. 233 | int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; 234 | 235 | // Add the bytes 236 | dArr[d++] = (byte) (i >> 16); 237 | dArr[d++] = (byte) (i >> 8); 238 | dArr[d++] = (byte) i; 239 | 240 | // If line separator, jump over it. 241 | if (sepCnt > 0 && ++cc == 19) { 242 | sIx += 2; 243 | cc = 0; 244 | } 245 | } 246 | 247 | if (d < len) { 248 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 249 | int i = 0; 250 | for (int j = 0; sIx <= eIx - pad; j++) 251 | i |= IA[sArr[sIx++]] << (18 - j * 6); 252 | 253 | for (int r = 16; d < len; r -= 8) 254 | dArr[d++] = (byte) (i >> r); 255 | } 256 | 257 | return dArr; 258 | } 259 | 260 | // **************************************************************************************** 261 | // * byte[] version 262 | // **************************************************************************************** 263 | 264 | /** Encodes a raw byte array into a BASE64 byte[] representation i accordance with RFC 2045. 265 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 266 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
267 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 268 | * little faster. 269 | * @return A BASE64 encoded array. Never null. 270 | */ 271 | public final static byte[] encodeToByte(byte[] sArr, boolean lineSep) 272 | { 273 | // Check special case 274 | int sLen = sArr != null ? sArr.length : 0; 275 | if (sLen == 0) 276 | return new byte[0]; 277 | 278 | int eLen = (sLen / 3) * 3; // Length of even 24-bits. 279 | int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count 280 | int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array 281 | byte[] dArr = new byte[dLen]; 282 | 283 | // Encode even 24-bits 284 | for (int s = 0, d = 0, cc = 0; s < eLen;) { 285 | // Copy next three bytes into lower 24 bits of int, paying attension to sign. 286 | int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); 287 | 288 | // Encode the int into four chars 289 | dArr[d++] = (byte) CA[(i >>> 18) & 0x3f]; 290 | dArr[d++] = (byte) CA[(i >>> 12) & 0x3f]; 291 | dArr[d++] = (byte) CA[(i >>> 6) & 0x3f]; 292 | dArr[d++] = (byte) CA[i & 0x3f]; 293 | 294 | // Add optional line separator 295 | if (lineSep && ++cc == 19 && d < dLen - 2) { 296 | dArr[d++] = '\r'; 297 | dArr[d++] = '\n'; 298 | cc = 0; 299 | } 300 | } 301 | 302 | // Pad and encode last bits if source isn't an even 24 bits. 303 | int left = sLen - eLen; // 0 - 2. 304 | if (left > 0) { 305 | // Prepare the int 306 | int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); 307 | 308 | // Set last four chars 309 | dArr[dLen - 4] = (byte) CA[i >> 12]; 310 | dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f]; 311 | dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) '='; 312 | dArr[dLen - 1] = '='; 313 | } 314 | return dArr; 315 | } 316 | 317 | /** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with 318 | * and without line separators. 319 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 320 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 321 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 322 | */ 323 | public final static byte[] decode(byte[] sArr) 324 | { 325 | // Check special case 326 | int sLen = sArr.length; 327 | 328 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 329 | // so we don't have to reallocate & copy it later. 330 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 331 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 332 | if (IA[sArr[i] & 0xff] < 0) 333 | sepCnt++; 334 | 335 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 336 | if ((sLen - sepCnt) % 4 != 0) 337 | return null; 338 | 339 | int pad = 0; 340 | for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0;) 341 | if (sArr[i] == '=') 342 | pad++; 343 | 344 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 345 | 346 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 347 | 348 | for (int s = 0, d = 0; d < len;) { 349 | // Assemble three bytes into an int from four "valid" characters. 350 | int i = 0; 351 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 352 | int c = IA[sArr[s++] & 0xff]; 353 | if (c >= 0) 354 | i |= c << (18 - j * 6); 355 | else 356 | j--; 357 | } 358 | 359 | // Add the bytes 360 | dArr[d++] = (byte) (i >> 16); 361 | if (d < len) { 362 | dArr[d++]= (byte) (i >> 8); 363 | if (d < len) 364 | dArr[d++] = (byte) i; 365 | } 366 | } 367 | 368 | return dArr; 369 | } 370 | 371 | 372 | /** Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as 373 | * fast as {@link #decode(byte[])}. The preconditions are:
374 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
375 | * + Line separator must be "\r\n", as specified in RFC 2045 376 | * + The array must not contain illegal characters within the encoded string
377 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
378 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 379 | * @return The decoded array of bytes. May be of length 0. 380 | */ 381 | public final static byte[] decodeFast(byte[] sArr) 382 | { 383 | // Check special case 384 | int sLen = sArr.length; 385 | if (sLen == 0) 386 | return new byte[0]; 387 | 388 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 389 | 390 | // Trim illegal chars from start 391 | while (sIx < eIx && IA[sArr[sIx] & 0xff] < 0) 392 | sIx++; 393 | 394 | // Trim illegal chars from end 395 | while (eIx > 0 && IA[sArr[eIx] & 0xff] < 0) 396 | eIx--; 397 | 398 | // get the padding count (=) (0, 1 or 2) 399 | int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. 400 | int cCnt = eIx - sIx + 1; // Content count including possible separators 401 | int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; 402 | 403 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 404 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 405 | 406 | // Decode all but the last 0 - 2 bytes. 407 | int d = 0; 408 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 409 | // Assemble three bytes into an int from four "valid" characters. 410 | int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; 411 | 412 | // Add the bytes 413 | dArr[d++] = (byte) (i >> 16); 414 | dArr[d++] = (byte) (i >> 8); 415 | dArr[d++] = (byte) i; 416 | 417 | // If line separator, jump over it. 418 | if (sepCnt > 0 && ++cc == 19) { 419 | sIx += 2; 420 | cc = 0; 421 | } 422 | } 423 | 424 | if (d < len) { 425 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 426 | int i = 0; 427 | for (int j = 0; sIx <= eIx - pad; j++) 428 | i |= IA[sArr[sIx++]] << (18 - j * 6); 429 | 430 | for (int r = 16; d < len; r -= 8) 431 | dArr[d++] = (byte) (i >> r); 432 | } 433 | 434 | return dArr; 435 | } 436 | 437 | // **************************************************************************************** 438 | // * String version 439 | // **************************************************************************************** 440 | 441 | /** Encodes a raw byte array into a BASE64 String representation i accordance with RFC 2045. 442 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 443 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
444 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 445 | * little faster. 446 | * @return A BASE64 encoded array. Never null. 447 | */ 448 | public final static String encodeToString(byte[] sArr, boolean lineSep) 449 | { 450 | // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower. 451 | return new String(encodeToChar(sArr, lineSep)); 452 | } 453 | 454 | /** Decodes a BASE64 encoded String. All illegal characters will be ignored and can handle both strings with 455 | * and without line separators.
456 | * Note! It can be up to about 2x the speed to call decode(str.toCharArray()) instead. That 457 | * will create a temporary array though. This version will use str.charAt(i) to iterate the string. 458 | * @param str The source string. null or length 0 will return an empty array. 459 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 460 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 461 | */ 462 | public final static byte[] decode(String str) 463 | { 464 | // Check special case 465 | int sLen = str != null ? str.length() : 0; 466 | if (sLen == 0) 467 | return new byte[0]; 468 | 469 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 470 | // so we don't have to reallocate & copy it later. 471 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 472 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 473 | if (IA[str.charAt(i)] < 0) 474 | sepCnt++; 475 | 476 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 477 | if ((sLen - sepCnt) % 4 != 0) 478 | return null; 479 | 480 | // Count '=' at end 481 | int pad = 0; 482 | for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;) 483 | if (str.charAt(i) == '=') 484 | pad++; 485 | 486 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 487 | 488 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 489 | 490 | for (int s = 0, d = 0; d < len;) { 491 | // Assemble three bytes into an int from four "valid" characters. 492 | int i = 0; 493 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 494 | int c = IA[str.charAt(s++)]; 495 | if (c >= 0) 496 | i |= c << (18 - j * 6); 497 | else 498 | j--; 499 | } 500 | // Add the bytes 501 | dArr[d++] = (byte) (i >> 16); 502 | if (d < len) { 503 | dArr[d++]= (byte) (i >> 8); 504 | if (d < len) 505 | dArr[d++] = (byte) i; 506 | } 507 | } 508 | return dArr; 509 | } 510 | 511 | /** Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as 512 | * fast as {@link #decode(String)}. The preconditions are:
513 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
514 | * + Line separator must be "\r\n", as specified in RFC 2045 515 | * + The array must not contain illegal characters within the encoded string
516 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
517 | * @param s The source string. Length 0 will return an empty array. null will throw an exception. 518 | * @return The decoded array of bytes. May be of length 0. 519 | */ 520 | public final static byte[] decodeFast(String s) 521 | { 522 | // Check special case 523 | int sLen = s.length(); 524 | if (sLen == 0) 525 | return new byte[0]; 526 | 527 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 528 | 529 | // Trim illegal chars from start 530 | while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0) 531 | sIx++; 532 | 533 | // Trim illegal chars from end 534 | while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0) 535 | eIx--; 536 | 537 | // get the padding count (=) (0, 1 or 2) 538 | int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end. 539 | int cCnt = eIx - sIx + 1; // Content count including possible separators 540 | int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0; 541 | 542 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 543 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 544 | 545 | // Decode all but the last 0 - 2 bytes. 546 | int d = 0; 547 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 548 | // Assemble three bytes into an int from four "valid" characters. 549 | int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 | IA[s.charAt(sIx++)]; 550 | 551 | // Add the bytes 552 | dArr[d++] = (byte) (i >> 16); 553 | dArr[d++] = (byte) (i >> 8); 554 | dArr[d++] = (byte) i; 555 | 556 | // If line separator, jump over it. 557 | if (sepCnt > 0 && ++cc == 19) { 558 | sIx += 2; 559 | cc = 0; 560 | } 561 | } 562 | 563 | if (d < len) { 564 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 565 | int i = 0; 566 | for (int j = 0; sIx <= eIx - pad; j++) 567 | i |= IA[s.charAt(sIx++)] << (18 - j * 6); 568 | 569 | for (int r = 16; d < len; r -= 8) 570 | dArr[d++] = (byte) (i >> r); 571 | } 572 | 573 | return dArr; 574 | } 575 | } -------------------------------------------------------------------------------- /Base64_2/Changes.txt: -------------------------------------------------------------------------------- 1 | Changelog 2.1 > 2.2 2 | 3 | * Added a "fast" decode method that is a little more than two times faster 4 | than the normal one but has some moderate restriction on input. 5 | 6 | * Normal decode now handles negative bytes and just disregard them as 7 | specified in RFC 2045. 8 | 9 | * Some minor enhancements -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | scte35 2 | ====== 3 | 4 | SCTE 35 encoder and decoder with Base64 Support 5 | 6 | Netbeans 7.3, Java 1.7 SE JDK 7 | -------------------------------------------------------------------------------- /SCTE35base/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Builds, tests, and runs the project com.turner.scte35. 7 | 8 | 9 | -------------------------------------------------------------------------------- /SCTE35base/build/classes-generated/com/turner/scte35/Bundle.java: -------------------------------------------------------------------------------- 1 | package com.turner.scte35; 2 | /** Localizable strings for {@link com.turner.scte35}. */ 3 | class Bundle { 4 | /** 5 | * @return scte35 6 | * @see scte35TopComponent 7 | */ 8 | static String CTL_scte35Action() { 9 | return org.openide.util.NbBundle.getMessage(Bundle.class, "CTL_scte35Action"); 10 | } 11 | /** 12 | * @return scte35 Window 13 | * @see scte35TopComponent 14 | */ 15 | static String CTL_scte35TopComponent() { 16 | return org.openide.util.NbBundle.getMessage(Bundle.class, "CTL_scte35TopComponent"); 17 | } 18 | /** 19 | * @return This is a scte35 window 20 | * @see scte35TopComponent 21 | */ 22 | static String HINT_scte35TopComponent() { 23 | return org.openide.util.NbBundle.getMessage(Bundle.class, "HINT_scte35TopComponent"); 24 | } 25 | private Bundle() {} 26 | } 27 | -------------------------------------------------------------------------------- /SCTE35base/build/classes/META-INF/generated-layer.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/Bundle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/Bundle.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/Bundle.properties: -------------------------------------------------------------------------------- 1 | CTL_scte35Action=scte35 2 | CTL_scte35TopComponent=scte35 Window 3 | HINT_scte35TopComponent=This is a scte35 window 4 | OpenIDE-Module-Name=SCTE35base 5 | scte35TopComponent.jLabel1.text=table_id 6 | scte35TopComponent.jLabel2.text=0xFC 7 | scte35TopComponent.jLabel3.text=0 8 | scte35TopComponent.jLabel4.text=section_syntax_indicator 9 | scte35TopComponent.jLabel5.text=private_indicator 10 | scte35TopComponent.jLabel6.text=0 11 | scte35TopComponent.jLabel7.text=section_length 12 | scte35TopComponent.jLabel8.text=0x000 13 | scte35TopComponent.jLabel9.text=reserved 14 | scte35TopComponent.jLabel10.text=11 15 | scte35TopComponent.jLabel11.text=protocol_version 16 | scte35TopComponent.jLabel12.text=encrypted_packet 17 | scte35TopComponent.jLabel13.text=encryption_algorithm 18 | scte35TopComponent.jLabel14.text=pts_adjustment 19 | scte35TopComponent.jLabel15.text=cw_index 20 | scte35TopComponent.jLabel16.text=tier 21 | scte35TopComponent.jLabel17.text=splice_command_length 22 | scte35TopComponent.jLabel18.text=splice_command_type 23 | scte35TopComponent.jLabel19.text=0x00 24 | scte35TopComponent.jLabel20.text=0 25 | scte35TopComponent.jLabel21.text=000000 26 | scte35TopComponent.jLabel22.text=0 0x0000 27 | scte35TopComponent.jLabel23.text=0x00 28 | scte35TopComponent.jLabel24.text=0x000 29 | scte35TopComponent.jLabel25.text=Command 30 | scte35TopComponent.jLabel26.text=Command 31 | scte35TopComponent.jLabel27.text=descriptor_loop_length 32 | scte35TopComponent.jLabel28.text=0x0000 33 | scte35TopComponent.jLabel29.text=Descriptor1 34 | scte35TopComponent.jLabel30.text=Descriptor2 35 | scte35TopComponent.jLabel31.text=Descriptor3 36 | scte35TopComponent.jLabel32.text=alignment_stuffing 37 | scte35TopComponent.jLabel33.text=0x 38 | scte35TopComponent.jLabel34.text=CRC32 39 | scte35TopComponent.jLabel35.text=0x00000000 40 | scte35TopComponent.jLabel36.text=Base64 SCTE 35 Command 41 | scte35TopComponent.jLabel37.text=Hex SCTE 35 Command 42 | scte35TopComponent.jPanel1.border.title=splice_info_section 43 | scte35TopComponent.jLabel38.text=pts_time 44 | scte35TopComponent.timeSpecified.text=time_specified 45 | scte35TopComponent.ptsTime.text=0x000000000 46 | scte35TopComponent.timeSignal.border.title=time_signal 47 | scte35TopComponent.jLabel39.text=splice_descriptor_tag 48 | scte35TopComponent.jLabel40.text=0x02 49 | scte35TopComponent.jLabel41.text=descriptor_length 50 | scte35TopComponent.jLabel42.text=0x00 51 | scte35TopComponent.jLabel43.text=identifier 52 | scte35TopComponent.jLabel44.text=0x43554549 53 | scte35TopComponent.jLabel45.text=segmentation_event_id 54 | scte35TopComponent.jLabel46.text=segmentation_duration 55 | scte35TopComponent.jLabel47.text=segmentation_upid_type 56 | scte35TopComponent.jLabel48.text=segmentation_upid_length 57 | scte35TopComponent.jLabel49.text=segmentation_upid 58 | scte35TopComponent.jLabel50.text=segmentation_type_id 59 | scte35TopComponent.jLabel51.text=segment_num 60 | scte35TopComponent.jLabel52.text=segments_expected 61 | scte35TopComponent.seci.text=segmentation_event_cancel_indicator 62 | scte35TopComponent.psf.text=program_segmentation_flag 63 | scte35TopComponent.sdf.text=segmentation_duration_flag 64 | scte35TopComponent.dnrf.text=delivery_not_restricted_flag 65 | scte35TopComponent.wdaf.text=web_delivery_allowed_flag 66 | scte35TopComponent.nrbf.text=no_regional_blackout_flag 67 | scte35TopComponent.aaf.text=archive_allowed_flag 68 | scte35TopComponent.drmsb.text= 69 | scte35TopComponent.drlsb.text=device_restrictions 70 | scte35TopComponent.segDuration.text=0x0000000000 71 | scte35TopComponent.upidLength.text=0x00 72 | scte35TopComponent.upid.text=0x0000000000000000 73 | scte35TopComponent.segnum.text=0x00 74 | scte35TopComponent.segexp.text=0x00 75 | scte35TopComponent.segEventID.text=0x00000000 76 | scte35TopComponent.segDesc1.border.title=segmentation_descriptor_1 77 | scte35TopComponent.b6435.text=jTextField1 78 | scte35TopComponent.hex35.text=jTextField1 79 | -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$1.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$10.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$11.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$12.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$13.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$13.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$14.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$14.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$15.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$15.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$16.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$16.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$17.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$17.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$18.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$18.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$19.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$19.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$2.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$20.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$20.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$21.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$21.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$22.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$22.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$23.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$23.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$24.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$24.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$25.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$25.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$3.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$4.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$5.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$6.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$7.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$8.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent$9.class -------------------------------------------------------------------------------- /SCTE35base/build/classes/com/turner/scte35/scte35TopComponent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/SCTE35base/build/classes/com/turner/scte35/scte35TopComponent.class -------------------------------------------------------------------------------- /SCTE35base/build/no-license.txt: -------------------------------------------------------------------------------- 1 | [NO LICENSE SPECIFIED] -------------------------------------------------------------------------------- /SCTE35base/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | OpenIDE-Module: com.turner.scte35 3 | OpenIDE-Module-Localizing-Bundle: com/turner/scte35/Bundle.properties 4 | OpenIDE-Module-Requires: org.openide.windows.WindowManager 5 | OpenIDE-Module-Specification-Version: 1.0 6 | 7 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | You must set 'suite.dir' to point to your containing module suite 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 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=162c1786 2 | build.xml.script.CRC32=e13b700e 3 | build.xml.stylesheet.CRC32=15ca8a54@2.77 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=162c1786 7 | nbproject/build-impl.xml.script.CRC32=eff7e863 8 | nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.77 9 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/Users/sriedl/NetBeansProjects/scte35/SCTE35base/src/com/turner/scte35/scte35TopComponent.java 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | javac.source=12 2 | javac.compilerargs=-Xlint -Xlint:-serial 3 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.apisupport.project 4 | 5 | 6 | com.turner.scte35 7 | 8 | 9 | 10 | com.turner.scte35.common.codec 11 | 12 | 13 | 14 | 1.0 15 | 16 | 17 | 18 | org.netbeans.modules.settings 19 | 20 | 21 | 22 | 1 23 | 1.38.1 24 | 25 | 26 | 27 | org.openide.awt 28 | 29 | 30 | 31 | 7.55.1 32 | 33 | 34 | 35 | org.openide.util 36 | 37 | 38 | 39 | 8.29.1 40 | 41 | 42 | 43 | org.openide.util.lookup 44 | 45 | 46 | 47 | 8.19.1 48 | 49 | 50 | 51 | org.openide.windows 52 | 53 | 54 | 55 | 6.60.1 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /SCTE35base/nbproject/suite.properties: -------------------------------------------------------------------------------- 1 | suite.dir=${basedir}/.. 2 | -------------------------------------------------------------------------------- /SCTE35base/src/com/turner/scte35/Bundle.properties: -------------------------------------------------------------------------------- 1 | OpenIDE-Module-Name=SCTE35base 2 | scte35TopComponent.jLabel1.text=table_id 3 | scte35TopComponent.jLabel2.text=0xFC 4 | scte35TopComponent.jLabel3.text=0 5 | scte35TopComponent.jLabel4.text=section_syntax_indicator 6 | scte35TopComponent.jLabel5.text=private_indicator 7 | scte35TopComponent.jLabel6.text=0 8 | scte35TopComponent.jLabel7.text=section_length 9 | scte35TopComponent.jLabel8.text=0x000 10 | scte35TopComponent.jLabel9.text=reserved 11 | scte35TopComponent.jLabel10.text=11 12 | scte35TopComponent.jLabel11.text=protocol_version 13 | scte35TopComponent.jLabel12.text=encrypted_packet 14 | scte35TopComponent.jLabel13.text=encryption_algorithm 15 | scte35TopComponent.jLabel14.text=pts_adjustment 16 | scte35TopComponent.jLabel15.text=cw_index 17 | scte35TopComponent.jLabel16.text=tier 18 | scte35TopComponent.jLabel17.text=splice_command_length 19 | scte35TopComponent.jLabel18.text=splice_command_type 20 | scte35TopComponent.jLabel19.text=0x00 21 | scte35TopComponent.jLabel20.text=0 22 | scte35TopComponent.jLabel21.text=000000 23 | scte35TopComponent.jLabel22.text=0 0x0000 24 | scte35TopComponent.jLabel23.text=0x00 25 | scte35TopComponent.jLabel24.text=0x000 26 | scte35TopComponent.jLabel25.text=Command 27 | scte35TopComponent.jLabel26.text=Command 28 | scte35TopComponent.jLabel27.text=descriptor_loop_length 29 | scte35TopComponent.jLabel28.text=0x0000 30 | scte35TopComponent.jLabel29.text=Descriptor1 31 | scte35TopComponent.jLabel30.text=Descriptor2 32 | scte35TopComponent.jLabel31.text=Descriptor3 33 | scte35TopComponent.jLabel32.text=alignment_stuffing 34 | scte35TopComponent.jLabel33.text=0x 35 | scte35TopComponent.jLabel34.text=CRC32 36 | scte35TopComponent.jLabel35.text=0x00000000 37 | scte35TopComponent.jLabel36.text=Base64 SCTE 35 Command 38 | scte35TopComponent.jLabel37.text=Hex SCTE 35 Command 39 | scte35TopComponent.jPanel1.border.title=splice_info_section 40 | scte35TopComponent.jLabel38.text=pts_time 41 | scte35TopComponent.timeSpecified.text=time_specified 42 | scte35TopComponent.ptsTime.text=0x000000000 43 | scte35TopComponent.timeSignal.border.title=time_signal 44 | scte35TopComponent.jLabel39.text=splice_descriptor_tag 45 | scte35TopComponent.jLabel40.text=0x02 46 | scte35TopComponent.jLabel41.text=descriptor_length 47 | scte35TopComponent.jLabel42.text=0x00 48 | scte35TopComponent.jLabel43.text=identifier 49 | scte35TopComponent.jLabel44.text=0x43554549 50 | scte35TopComponent.jLabel45.text=segmentation_event_id 51 | scte35TopComponent.jLabel46.text=segmentation_duration 52 | scte35TopComponent.jLabel47.text=segmentation_upid_type 53 | scte35TopComponent.jLabel48.text=segmentation_upid_length 54 | scte35TopComponent.jLabel49.text=segmentation_upid 55 | scte35TopComponent.jLabel50.text=segmentation_type_id 56 | scte35TopComponent.jLabel51.text=segment_num 57 | scte35TopComponent.jLabel52.text=segments_expected 58 | scte35TopComponent.seci.text=segmentation_event_cancel_indicator 59 | scte35TopComponent.psf.text=program_segmentation_flag 60 | scte35TopComponent.sdf.text=segmentation_duration_flag 61 | scte35TopComponent.dnrf.text=delivery_not_restricted_flag 62 | scte35TopComponent.wdaf.text=web_delivery_allowed_flag 63 | scte35TopComponent.nrbf.text=no_regional_blackout_flag 64 | scte35TopComponent.aaf.text=archive_allowed_flag 65 | scte35TopComponent.drmsb.text= 66 | scte35TopComponent.drlsb.text=device_restrictions 67 | scte35TopComponent.segDuration.text=0x0000000000 68 | scte35TopComponent.upidLength.text=0x00 69 | scte35TopComponent.upid.text=0x0000000000000000 70 | scte35TopComponent.segnum.text=0x00 71 | scte35TopComponent.segexp.text=0x00 72 | scte35TopComponent.segEventID.text=0x00000000 73 | scte35TopComponent.segDesc1.border.title=segmentation_descriptor_1 74 | scte35TopComponent.b6435.text=jTextField1 75 | scte35TopComponent.hex35.text=jTextField1 76 | -------------------------------------------------------------------------------- /branding/core/core.jar/org/netbeans/core/startup/Bundle.properties: -------------------------------------------------------------------------------- 1 | currentVersion=scte35 {0} 2 | LBL_splash_window_title=Starting scte35 3 | -------------------------------------------------------------------------------- /branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties: -------------------------------------------------------------------------------- 1 | CTL_MainWindow_Title=scte35 {0} 2 | CTL_MainWindow_Title_No_Project=scte35 {0} 3 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Builds the module suite scte35. 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/.DS_Store -------------------------------------------------------------------------------- /build/cluster/.lastModified: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/.lastModified -------------------------------------------------------------------------------- /build/cluster/config/Modules/com-turner-decoder.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | false 6 | false 7 | true 8 | modules/com-turner-decoder.jar 9 | false 10 | 11 | -------------------------------------------------------------------------------- /build/cluster/config/Modules/com-turner-scte35-common-codec.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | true 6 | false 7 | modules/com-turner-scte35-common-codec.jar 8 | false 9 | 10 | -------------------------------------------------------------------------------- /build/cluster/config/Modules/com-turner-scte35.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | false 6 | false 7 | true 8 | modules/com-turner-scte35.jar 9 | false 10 | 11 | -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-api-visual.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-api-visual.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-core-execution.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-core-execution.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-libs-jsr223.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-libs-jsr223.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-modules-autoupdate-cli.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-modules-autoupdate-cli.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-modules-autoupdate-services.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-modules-autoupdate-services.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-modules-autoupdate-ui.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-modules-autoupdate-ui.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-modules-core-kit.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-modules-core-kit.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-netbeans-modules-favorites.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-netbeans-modules-favorites.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-openide-compat.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-openide-compat.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-openide-options.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-openide-options.xml_hidden -------------------------------------------------------------------------------- /build/cluster/config/Modules/org-openide-util-enumerations.xml_hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/config/Modules/org-openide-util-enumerations.xml_hidden -------------------------------------------------------------------------------- /build/cluster/core/locale/core_scte35.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/core/locale/core_scte35.jar -------------------------------------------------------------------------------- /build/cluster/modules/com-turner-decoder.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/modules/com-turner-decoder.jar -------------------------------------------------------------------------------- /build/cluster/modules/com-turner-scte35-common-codec.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/modules/com-turner-scte35-common-codec.jar -------------------------------------------------------------------------------- /build/cluster/modules/com-turner-scte35.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/modules/com-turner-scte35.jar -------------------------------------------------------------------------------- /build/cluster/modules/ext/commons-codec-1.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/modules/ext/commons-codec-1.7.jar -------------------------------------------------------------------------------- /build/cluster/modules/locale/org-netbeans-core-windows_scte35.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/cluster/modules/locale/org-netbeans-core-windows_scte35.jar -------------------------------------------------------------------------------- /build/cluster/update_tracking/com-turner-decoder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/cluster/update_tracking/com-turner-scte35-common-codec.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/cluster/update_tracking/com-turner-scte35.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/public-package-jars/com-turner-scte35-common-codec.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/com-turner-scte35-common-codec.jar -------------------------------------------------------------------------------- /build/public-package-jars/org-netbeans-modules-settings.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/org-netbeans-modules-settings.jar -------------------------------------------------------------------------------- /build/public-package-jars/org-openide-awt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/org-openide-awt.jar -------------------------------------------------------------------------------- /build/public-package-jars/org-openide-util-lookup.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/org-openide-util-lookup.jar -------------------------------------------------------------------------------- /build/public-package-jars/org-openide-util.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/org-openide-util.jar -------------------------------------------------------------------------------- /build/public-package-jars/org-openide-windows.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/build/public-package-jars/org-openide-windows.jar -------------------------------------------------------------------------------- /commons-codec/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Builds, tests, and runs the project com.turner.scte35.common.codec. 7 | 8 | 9 | -------------------------------------------------------------------------------- /commons-codec/build/classes/com/turner/scte35/common/codec/Bundle.properties: -------------------------------------------------------------------------------- 1 | OpenIDE-Module-Name=commons-codec 2 | -------------------------------------------------------------------------------- /commons-codec/build/no-license.txt: -------------------------------------------------------------------------------- 1 | [NO LICENSE SPECIFIED] -------------------------------------------------------------------------------- /commons-codec/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | OpenIDE-Module: com.turner.scte35.common.codec 3 | OpenIDE-Module-Localizing-Bundle: com/turner/scte35/common/codec/Bundle.properties 4 | OpenIDE-Module-Specification-Version: 1.0 5 | 6 | -------------------------------------------------------------------------------- /commons-codec/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | You must set 'suite.dir' to point to your containing module suite 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 | -------------------------------------------------------------------------------- /commons-codec/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=60d7d455 2 | build.xml.script.CRC32=325cc620 3 | build.xml.stylesheet.CRC32=15ca8a54@2.77 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=60d7d455 7 | nbproject/build-impl.xml.script.CRC32=cb543a18 8 | nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.77 9 | -------------------------------------------------------------------------------- /commons-codec/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | is.autoload=true 2 | javac.compilerargs=-Xlint -Xlint:-serial 3 | javac.source=12 4 | -------------------------------------------------------------------------------- /commons-codec/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.apisupport.project 4 | 5 | 6 | com.turner.scte35.common.codec 7 | 8 | 9 | 10 | org.apache.commons.codec 11 | org.apache.commons.codec.binary 12 | org.apache.commons.codec.digest 13 | org.apache.commons.codec.language 14 | org.apache.commons.codec.language.bm 15 | org.apache.commons.codec.net 16 | 17 | 18 | ext/commons-codec-1.7.jar 19 | release/modules/ext/commons-codec-1.7.jar 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /commons-codec/nbproject/suite.properties: -------------------------------------------------------------------------------- 1 | suite.dir=${basedir}/.. 2 | -------------------------------------------------------------------------------- /commons-codec/release/modules/ext/commons-codec-1.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/commons-codec/release/modules/ext/commons-codec-1.7.jar -------------------------------------------------------------------------------- /commons-codec/src/com/turner/scte35/common/codec/Bundle.properties: -------------------------------------------------------------------------------- 1 | OpenIDE-Module-Name=commons-codec 2 | -------------------------------------------------------------------------------- /decoder/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Builds, tests, and runs the project com.turner.decoder. 7 | 8 | 9 | -------------------------------------------------------------------------------- /decoder/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | OpenIDE-Module: com.turner.decoder 3 | OpenIDE-Module-Localizing-Bundle: com/turner/decoder/Bundle.properties 4 | OpenIDE-Module-Requires: org.openide.windows.WindowManager 5 | OpenIDE-Module-Specification-Version: 1.0 6 | 7 | -------------------------------------------------------------------------------- /decoder/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | You must set 'suite.dir' to point to your containing module suite 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 | -------------------------------------------------------------------------------- /decoder/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=be824481 2 | build.xml.script.CRC32=16c360b7 3 | build.xml.stylesheet.CRC32=15ca8a54@2.77 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=be824481 7 | nbproject/build-impl.xml.script.CRC32=ac9641de 8 | nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.77 9 | -------------------------------------------------------------------------------- /decoder/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | javac.source=12 2 | javac.compilerargs=-Xlint -Xlint:-serial 3 | -------------------------------------------------------------------------------- /decoder/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.apisupport.project 4 | 5 | 6 | com.turner.decoder 7 | 8 | 9 | 10 | com.turner.scte35.common.codec 11 | 12 | 13 | 14 | 1.0 15 | 16 | 17 | 18 | org.netbeans.modules.settings 19 | 20 | 21 | 22 | 1 23 | 1.38.1 24 | 25 | 26 | 27 | org.openide.awt 28 | 29 | 30 | 31 | 7.55.1 32 | 33 | 34 | 35 | org.openide.util 36 | 37 | 38 | 39 | 8.29.2 40 | 41 | 42 | 43 | org.openide.util.lookup 44 | 45 | 46 | 47 | 8.19.1 48 | 49 | 50 | 51 | org.openide.windows 52 | 53 | 54 | 55 | 6.60.1 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /decoder/nbproject/suite.properties: -------------------------------------------------------------------------------- 1 | suite.dir=${basedir}/.. 2 | -------------------------------------------------------------------------------- /decoder/src/com/turner/decoder/Base64.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.turner.decoder; 6 | 7 | /** 8 | * 9 | * @author sriedl 10 | */ 11 | 12 | import java.util.Arrays; 13 | 14 | /** A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance 15 | * with RFC 2045.

16 | * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster 17 | * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes) 18 | * compared to sun.misc.Encoder()/Decoder().

19 | * 20 | * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and 21 | * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small 22 | * arrays (< 30 bytes). If source/destination is a String this 23 | * version is about three times as fast due to the fact that the Commons Codec result has to be recoded 24 | * to a String from byte[], which is very expensive.

25 | * 26 | * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only 27 | * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice 28 | * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown 29 | * whether Sun's sun.misc.Encoder()/Decoder() produce temporary arrays but since performance 30 | * is quite low it probably does.

31 | * 32 | * The encoder produces the same output as the Sun one except that the Sun's encoder appends 33 | * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the 34 | * length and is probably a side effect. Both are in conformance with RFC 2045 though.
35 | * Commons codec seem to always att a trailing line separator.

36 | * 37 | * Note! 38 | * The encode/decode method pairs (types) come in three versions with the exact same algorithm and 39 | * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different 40 | * format types. The methods not used can simply be commented out.

41 | * 42 | * There is also a "fast" version of all decode methods that works the same way as the normal ones, but 43 | * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if 44 | * the input is known and it hasn't bee tampered with.

45 | * 46 | * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com. 47 | * 48 | * Licence (BSD): 49 | * ============== 50 | * 51 | * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com) 52 | * All rights reserved. 53 | * 54 | * Redistribution and use in source and binary forms, with or without modification, 55 | * are permitted provided that the following conditions are met: 56 | * Redistributions of source code must retain the above copyright notice, this list 57 | * of conditions and the following disclaimer. 58 | * Redistributions in binary form must reproduce the above copyright notice, this 59 | * list of conditions and the following disclaimer in the documentation and/or other 60 | * materials provided with the distribution. 61 | * Neither the name of the MiG InfoCom AB nor the names of its contributors may be 62 | * used to endorse or promote products derived from this software without specific 63 | * prior written permission. 64 | * 65 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 66 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 67 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 68 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 69 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 70 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 71 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 72 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 73 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 74 | * OF SUCH DAMAGE. 75 | * 76 | * @version 2.2 77 | * @author Mikael Grev 78 | * Date: 2004-aug-02 79 | * Time: 11:31:11 80 | */ 81 | 82 | public class Base64 83 | { 84 | private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); 85 | private static final int[] IA = new int[256]; 86 | static { 87 | Arrays.fill(IA, -1); 88 | for (int i = 0, iS = CA.length; i < iS; i++) 89 | IA[CA[i]] = i; 90 | IA['='] = 0; 91 | } 92 | 93 | // **************************************************************************************** 94 | // * char[] version 95 | // **************************************************************************************** 96 | 97 | /** Encodes a raw byte array into a BASE64 char[] representation i accordance with RFC 2045. 98 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 99 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
100 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 101 | * little faster. 102 | * @return A BASE64 encoded array. Never null. 103 | */ 104 | public final static char[] encodeToChar(byte[] sArr, boolean lineSep) 105 | { 106 | // Check special case 107 | int sLen = sArr != null ? sArr.length : 0; 108 | if (sLen == 0) 109 | return new char[0]; 110 | 111 | int eLen = (sLen / 3) * 3; // Length of even 24-bits. 112 | int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count 113 | int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array 114 | char[] dArr = new char[dLen]; 115 | 116 | // Encode even 24-bits 117 | for (int s = 0, d = 0, cc = 0; s < eLen;) { 118 | // Copy next three bytes into lower 24 bits of int, paying attension to sign. 119 | int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); 120 | 121 | // Encode the int into four chars 122 | dArr[d++] = CA[(i >>> 18) & 0x3f]; 123 | dArr[d++] = CA[(i >>> 12) & 0x3f]; 124 | dArr[d++] = CA[(i >>> 6) & 0x3f]; 125 | dArr[d++] = CA[i & 0x3f]; 126 | 127 | // Add optional line separator 128 | if (lineSep && ++cc == 19 && d < dLen - 2) { 129 | dArr[d++] = '\r'; 130 | dArr[d++] = '\n'; 131 | cc = 0; 132 | } 133 | } 134 | 135 | // Pad and encode last bits if source isn't even 24 bits. 136 | int left = sLen - eLen; // 0 - 2. 137 | if (left > 0) { 138 | // Prepare the int 139 | int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); 140 | 141 | // Set last four chars 142 | dArr[dLen - 4] = CA[i >> 12]; 143 | dArr[dLen - 3] = CA[(i >>> 6) & 0x3f]; 144 | dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '='; 145 | dArr[dLen - 1] = '='; 146 | } 147 | return dArr; 148 | } 149 | 150 | /** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with 151 | * and without line separators. 152 | * @param sArr The source array. null or length 0 will return an empty array. 153 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 154 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 155 | */ 156 | /* public final static byte[] decode(char[] sArr) 157 | { 158 | // Check special case 159 | int sLen = sArr != null ? sArr.length : 0; 160 | if (sLen == 0) 161 | return new byte[0]; 162 | 163 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 164 | // so we don't have to reallocate & copy it later. 165 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 166 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 167 | if (IA[sArr[i]] < 0) 168 | sepCnt++; 169 | 170 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 171 | if ((sLen - sepCnt) % 4 != 0) 172 | return null; 173 | 174 | int pad = 0; 175 | for (int i = sLen; i > 1 && IA[sArr[--i]] <= 0;) 176 | if (sArr[i] == '=') 177 | pad++; 178 | 179 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 180 | 181 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 182 | 183 | for (int s = 0, d = 0; d < len;) { 184 | // Assemble three bytes into an int from four "valid" characters. 185 | int i = 0; 186 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 187 | int c = IA[sArr[s++]]; 188 | if (c >= 0) 189 | i |= c << (18 - j * 6); 190 | else 191 | j--; 192 | } 193 | // Add the bytes 194 | dArr[d++] = (byte) (i >> 16); 195 | if (d < len) { 196 | dArr[d++]= (byte) (i >> 8); 197 | if (d < len) 198 | dArr[d++] = (byte) i; 199 | } 200 | } 201 | return dArr; 202 | } 203 | 204 | /** Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as 205 | * fast as {@link #decode(char[])}. The preconditions are:
206 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
207 | * + Line separator must be "\r\n", as specified in RFC 2045 208 | * + The array must not contain illegal characters within the encoded string
209 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
210 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 211 | * @return The decoded array of bytes. May be of length 0. 212 | */ 213 | /* public final static byte[] decodeFast(char[] sArr) 214 | { 215 | // Check special case 216 | int sLen = sArr.length; 217 | if (sLen == 0) 218 | return new byte[0]; 219 | 220 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 221 | 222 | // Trim illegal chars from start 223 | while (sIx < eIx && IA[sArr[sIx]] < 0) 224 | sIx++; 225 | 226 | // Trim illegal chars from end 227 | while (eIx > 0 && IA[sArr[eIx]] < 0) 228 | eIx--; 229 | 230 | // get the padding count (=) (0, 1 or 2) 231 | int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. 232 | int cCnt = eIx - sIx + 1; // Content count including possible separators 233 | int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; 234 | 235 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 236 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 237 | 238 | // Decode all but the last 0 - 2 bytes. 239 | int d = 0; 240 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 241 | // Assemble three bytes into an int from four "valid" characters. 242 | int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; 243 | 244 | // Add the bytes 245 | dArr[d++] = (byte) (i >> 16); 246 | dArr[d++] = (byte) (i >> 8); 247 | dArr[d++] = (byte) i; 248 | 249 | // If line separator, jump over it. 250 | if (sepCnt > 0 && ++cc == 19) { 251 | sIx += 2; 252 | cc = 0; 253 | } 254 | } 255 | 256 | if (d < len) { 257 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 258 | int i = 0; 259 | for (int j = 0; sIx <= eIx - pad; j++) 260 | i |= IA[sArr[sIx++]] << (18 - j * 6); 261 | 262 | for (int r = 16; d < len; r -= 8) 263 | dArr[d++] = (byte) (i >> r); 264 | } 265 | 266 | return dArr; 267 | } 268 | 269 | // **************************************************************************************** 270 | // * byte[] version 271 | // **************************************************************************************** 272 | 273 | /** Encodes a raw byte array into a BASE64 byte[] representation i accordance with RFC 2045. 274 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 275 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
276 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 277 | * little faster. 278 | * @return A BASE64 encoded array. Never null. 279 | */ 280 | /* public final static byte[] encodeToByte(byte[] sArr, boolean lineSep) 281 | { 282 | // Check special case 283 | int sLen = sArr != null ? sArr.length : 0; 284 | if (sLen == 0) 285 | return new byte[0]; 286 | 287 | int eLen = (sLen / 3) * 3; // Length of even 24-bits. 288 | int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count 289 | int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array 290 | byte[] dArr = new byte[dLen]; 291 | 292 | // Encode even 24-bits 293 | for (int s = 0, d = 0, cc = 0; s < eLen;) { 294 | // Copy next three bytes into lower 24 bits of int, paying attension to sign. 295 | int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); 296 | 297 | // Encode the int into four chars 298 | dArr[d++] = (byte) CA[(i >>> 18) & 0x3f]; 299 | dArr[d++] = (byte) CA[(i >>> 12) & 0x3f]; 300 | dArr[d++] = (byte) CA[(i >>> 6) & 0x3f]; 301 | dArr[d++] = (byte) CA[i & 0x3f]; 302 | 303 | // Add optional line separator 304 | if (lineSep && ++cc == 19 && d < dLen - 2) { 305 | dArr[d++] = '\r'; 306 | dArr[d++] = '\n'; 307 | cc = 0; 308 | } 309 | } 310 | 311 | // Pad and encode last bits if source isn't an even 24 bits. 312 | int left = sLen - eLen; // 0 - 2. 313 | if (left > 0) { 314 | // Prepare the int 315 | int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); 316 | 317 | // Set last four chars 318 | dArr[dLen - 4] = (byte) CA[i >> 12]; 319 | dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f]; 320 | dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) '='; 321 | dArr[dLen - 1] = '='; 322 | } 323 | return dArr; 324 | } 325 | 326 | /** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with 327 | * and without line separators. 328 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 329 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 330 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 331 | */ 332 | /* public final static byte[] decode(byte[] sArr) 333 | { 334 | // Check special case 335 | int sLen = sArr.length; 336 | 337 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 338 | // so we don't have to reallocate & copy it later. 339 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 340 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 341 | if (IA[sArr[i] & 0xff] < 0) 342 | sepCnt++; 343 | 344 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 345 | if ((sLen - sepCnt) % 4 != 0) 346 | return null; 347 | 348 | int pad = 0; 349 | for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0;) 350 | if (sArr[i] == '=') 351 | pad++; 352 | 353 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 354 | 355 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 356 | 357 | for (int s = 0, d = 0; d < len;) { 358 | // Assemble three bytes into an int from four "valid" characters. 359 | int i = 0; 360 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 361 | int c = IA[sArr[s++] & 0xff]; 362 | if (c >= 0) 363 | i |= c << (18 - j * 6); 364 | else 365 | j--; 366 | } 367 | 368 | // Add the bytes 369 | dArr[d++] = (byte) (i >> 16); 370 | if (d < len) { 371 | dArr[d++]= (byte) (i >> 8); 372 | if (d < len) 373 | dArr[d++] = (byte) i; 374 | } 375 | } 376 | 377 | return dArr; 378 | } 379 | 380 | 381 | /** Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as 382 | * fast as {@link #decode(byte[])}. The preconditions are:
383 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
384 | * + Line separator must be "\r\n", as specified in RFC 2045 385 | * + The array must not contain illegal characters within the encoded string
386 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
387 | * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. 388 | * @return The decoded array of bytes. May be of length 0. 389 | */ 390 | /* public final static byte[] decodeFast(byte[] sArr) 391 | { 392 | // Check special case 393 | int sLen = sArr.length; 394 | if (sLen == 0) 395 | return new byte[0]; 396 | 397 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 398 | 399 | // Trim illegal chars from start 400 | while (sIx < eIx && IA[sArr[sIx] & 0xff] < 0) 401 | sIx++; 402 | 403 | // Trim illegal chars from end 404 | while (eIx > 0 && IA[sArr[eIx] & 0xff] < 0) 405 | eIx--; 406 | 407 | // get the padding count (=) (0, 1 or 2) 408 | int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. 409 | int cCnt = eIx - sIx + 1; // Content count including possible separators 410 | int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; 411 | 412 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 413 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 414 | 415 | // Decode all but the last 0 - 2 bytes. 416 | int d = 0; 417 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 418 | // Assemble three bytes into an int from four "valid" characters. 419 | int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; 420 | 421 | // Add the bytes 422 | dArr[d++] = (byte) (i >> 16); 423 | dArr[d++] = (byte) (i >> 8); 424 | dArr[d++] = (byte) i; 425 | 426 | // If line separator, jump over it. 427 | if (sepCnt > 0 && ++cc == 19) { 428 | sIx += 2; 429 | cc = 0; 430 | } 431 | } 432 | 433 | if (d < len) { 434 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 435 | int i = 0; 436 | for (int j = 0; sIx <= eIx - pad; j++) 437 | i |= IA[sArr[sIx++]] << (18 - j * 6); 438 | 439 | for (int r = 16; d < len; r -= 8) 440 | dArr[d++] = (byte) (i >> r); 441 | } 442 | 443 | return dArr; 444 | } 445 | 446 | // **************************************************************************************** 447 | // * String version 448 | // **************************************************************************************** 449 | 450 | /** Encodes a raw byte array into a BASE64 String representation i accordance with RFC 2045. 451 | * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. 452 | * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
453 | * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 454 | * little faster. 455 | * @return A BASE64 encoded array. Never null. 456 | */ 457 | public final static String encodeToString(byte[] sArr, boolean lineSep) 458 | { 459 | // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower. 460 | return new String(encodeToChar(sArr, lineSep)); 461 | } 462 | 463 | /** Decodes a BASE64 encoded String. All illegal characters will be ignored and can handle both strings with 464 | * and without line separators.
465 | * Note! It can be up to about 2x the speed to call decode(str.toCharArray()) instead. That 466 | * will create a temporary array though. This version will use str.charAt(i) to iterate the string. 467 | * @param str The source string. null or length 0 will return an empty array. 468 | * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters 469 | * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 470 | */ 471 | public final static byte[] decode(String str) 472 | { 473 | // Check special case 474 | int sLen = str != null ? str.length() : 0; 475 | if (sLen == 0) 476 | return new byte[0]; 477 | 478 | // Count illegal characters (including '\r', '\n') to know what size the returned array will be, 479 | // so we don't have to reallocate & copy it later. 480 | int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) 481 | for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. 482 | if (IA[str.charAt(i)] < 0) 483 | sepCnt++; 484 | 485 | // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. 486 | if ((sLen - sepCnt) % 4 != 0) 487 | return null; 488 | 489 | // Count '=' at end 490 | int pad = 0; 491 | for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;) 492 | if (str.charAt(i) == '=') 493 | pad++; 494 | 495 | int len = ((sLen - sepCnt) * 6 >> 3) - pad; 496 | 497 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 498 | 499 | for (int s = 0, d = 0; d < len;) { 500 | // Assemble three bytes into an int from four "valid" characters. 501 | int i = 0; 502 | for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. 503 | int c = IA[str.charAt(s++)]; 504 | if (c >= 0) 505 | i |= c << (18 - j * 6); 506 | else 507 | j--; 508 | } 509 | // Add the bytes 510 | dArr[d++] = (byte) (i >> 16); 511 | if (d < len) { 512 | dArr[d++]= (byte) (i >> 8); 513 | if (d < len) 514 | dArr[d++] = (byte) i; 515 | } 516 | } 517 | return dArr; 518 | } 519 | 520 | /** Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as 521 | * fast as {@link #decode(String)}. The preconditions are:
522 | * + The array must have a line length of 76 chars OR no line separators at all (one line).
523 | * + Line separator must be "\r\n", as specified in RFC 2045 524 | * + The array must not contain illegal characters within the encoded string
525 | * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
526 | * @param s The source string. Length 0 will return an empty array. null will throw an exception. 527 | * @return The decoded array of bytes. May be of length 0. 528 | */ 529 | public final static byte[] decodeFast(String s) 530 | { 531 | // Check special case 532 | int sLen = s.length(); 533 | if (sLen == 0) 534 | return new byte[0]; 535 | 536 | int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. 537 | 538 | // Trim illegal chars from start 539 | while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0) 540 | sIx++; 541 | 542 | // Trim illegal chars from end 543 | while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0) 544 | eIx--; 545 | 546 | // get the padding count (=) (0, 1 or 2) 547 | int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end. 548 | int cCnt = eIx - sIx + 1; // Content count including possible separators 549 | int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0; 550 | 551 | int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes 552 | byte[] dArr = new byte[len]; // Preallocate byte[] of exact length 553 | 554 | // Decode all but the last 0 - 2 bytes. 555 | int d = 0; 556 | for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { 557 | // Assemble three bytes into an int from four "valid" characters. 558 | int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 | IA[s.charAt(sIx++)]; 559 | 560 | // Add the bytes 561 | dArr[d++] = (byte) (i >> 16); 562 | dArr[d++] = (byte) (i >> 8); 563 | dArr[d++] = (byte) i; 564 | 565 | // If line separator, jump over it. 566 | if (sepCnt > 0 && ++cc == 19) { 567 | sIx += 2; 568 | cc = 0; 569 | } 570 | } 571 | 572 | if (d < len) { 573 | // Decode last 1-3 bytes (incl '=') into 1-3 bytes 574 | int i = 0; 575 | for (int j = 0; sIx <= eIx - pad; j++) 576 | i |= IA[s.charAt(sIx++)] << (18 - j * 6); 577 | 578 | for (int r = 16; d < len; r -= 8) 579 | dArr[d++] = (byte) (i >> r); 580 | } 581 | 582 | return dArr; 583 | } 584 | } -------------------------------------------------------------------------------- /decoder/src/com/turner/decoder/Bundle.properties: -------------------------------------------------------------------------------- 1 | OpenIDE-Module-Name=decoder 2 | decoderTopComponent.base64in.text= 3 | decoderTopComponent.hexin.text= 4 | decoderTopComponent.hexDecode.text=SCTE 35 Hex Decode 5 | decoderTopComponent.base64Decode.text=SCTE 35 Base64 Decode 6 | decoderTopComponent.copyToClipboard.text=Copy to Clipboard 7 | decoderTopComponent.jLabel1.text=Hex should start with FC3xxx where xxx is length usually starts with a 0xx. Base64 usually starts with /DB 8 | -------------------------------------------------------------------------------- /decoder/src/com/turner/decoder/decoderTopComponent.form: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /decoder/src/com/turner/decoder/decoderTopComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.turner.decoder; 6 | 7 | import java.awt.Toolkit; 8 | import java.awt.datatransfer.Clipboard; 9 | import java.awt.datatransfer.StringSelection; 10 | import org.apache.commons.codec.DecoderException; 11 | import org.netbeans.api.settings.ConvertAsProperties; 12 | import org.openide.awt.ActionID; 13 | import org.openide.awt.ActionReference; 14 | import org.openide.windows.TopComponent; 15 | import org.openide.util.NbBundle.Messages; 16 | import org.apache.commons.codec.binary.Hex; 17 | import org.openide.util.Exceptions; 18 | 19 | /** 20 | * Top component which displays something. 21 | */ 22 | @ConvertAsProperties( 23 | dtd = "-//com.turner.decoder//decoder//EN", 24 | autostore = false) 25 | @TopComponent.Description( 26 | preferredID = "decoderTopComponent", 27 | //iconBase="SET/PATH/TO/ICON/HERE", 28 | persistenceType = TopComponent.PERSISTENCE_ALWAYS) 29 | @TopComponent.Registration(mode = "output", openAtStartup = true) 30 | @ActionID(category = "Window", id = "com.turner.decoder.decoderTopComponent") 31 | @ActionReference(path = "Menu/Window" /*, position = 333 */) 32 | @TopComponent.OpenActionRegistration( 33 | displayName = "#CTL_decoderAction", 34 | preferredID = "decoderTopComponent") 35 | @Messages({ 36 | "CTL_decoderAction=decoder", 37 | "CTL_decoderTopComponent=decoder Window", 38 | "HINT_decoderTopComponent=This is a decoder window" 39 | }) 40 | public final class decoderTopComponent extends TopComponent { 41 | 42 | public static final int SPLICE_NULL = 0x00; 43 | public static final int SPLICE_SCHEDULE = 0x04; 44 | public static final int SPLICE_INSERT = 0x05; 45 | public static final int TIME_SIGNAL = 0x06; 46 | public static final int BANDWIDTH_RESERVATION = 0x07; 47 | public static final int PRIVATE_COMMAND = 0x00ff; 48 | public static byte[] b64; 49 | 50 | public static class spliceInfoSection { 51 | 52 | public static int tableID; 53 | public static int sectionSyntaxIndicator; 54 | public static int privateIndicator; 55 | public static int reserved1; 56 | public static int sectionLength; 57 | public static int protocolVersion; 58 | public static int encryptedPacket; 59 | public static int encryptionAlgorithm; 60 | public static long ptsAdjustment; 61 | public static int cwIndex; 62 | public static int tier; 63 | public static int spliceCommandLength; 64 | public static int spliceCommandType; 65 | public static int descriptorLoopLength; 66 | public static int alignmentStuffing; 67 | public static int eCRC32; 68 | public static int CRC32; 69 | } 70 | 71 | public static class spliceTime { 72 | 73 | public int timeSpecifiedFlag; 74 | public int reserved1; 75 | public long ptsTime; 76 | public int reserved2; 77 | } 78 | 79 | public static class breakDuration { 80 | 81 | int autoReturn; 82 | int reserved1; 83 | long duration; 84 | } 85 | 86 | public static class spliceInsert { 87 | 88 | public static int spliceEventID; 89 | public static int spliceEventCancelIndicator; 90 | public static int reserved1; 91 | public static int outOfNetworkIndicator; 92 | public static int programSpliceFlag; 93 | public static spliceTime sisp = new spliceTime(); 94 | public static int durationFlag; 95 | public static int spliceImmediateFlag; 96 | public static breakDuration brdr = new breakDuration(); 97 | public static int reserved2; 98 | public static int uniqueProgramID; 99 | public static int availNum; 100 | public static int availsExpected; 101 | } 102 | 103 | public static class timeSignal { 104 | 105 | public static spliceTime tssp = new spliceTime(); 106 | } 107 | 108 | public class availDescriptor { 109 | 110 | int spliceDescriptorTag; 111 | int descriptorLength; 112 | int identifier; 113 | int providerAvailID; 114 | } 115 | 116 | public class DTMFDescriptor { 117 | 118 | int spliceDescriptorTag; 119 | int descriptorLength; 120 | int identifier; 121 | int preroll; 122 | int dtmfCount; 123 | int reserved; 124 | byte[] DTMFChar = new byte[8]; 125 | } 126 | 127 | public static class segmentationDescriptor { 128 | 129 | int spliceDescriptorTag; 130 | int descriptorLength; 131 | int identifier; 132 | int segmentationEventID; 133 | int segmentationEventCancelIndicator; 134 | int reserved1; 135 | int programSegmentationFlag; 136 | int segmentationDurationFlag; 137 | int deliveryNotRestricted; 138 | int webDeliveryAllowedFlag; 139 | int noRegionalBlackoutFlag; 140 | int archiveAllowed; 141 | int deviceRestriction; 142 | int reserved2; 143 | long segmentationDuration; 144 | long turnerIdentifier; 145 | int segmentationUPIDtype; 146 | int segmentationUPIDlength; 147 | int segmentationTypeID; 148 | int segmentNum; 149 | int segmentsExpected; 150 | } 151 | public static segmentationDescriptor[] seg = new segmentationDescriptor[10]; 152 | 153 | public String ot = ""; 154 | 155 | public decoderTopComponent() { 156 | initComponents(); 157 | setName(Bundle.CTL_decoderTopComponent()); 158 | setToolTipText(Bundle.HINT_decoderTopComponent()); 159 | 160 | } 161 | 162 | public static final int[] CrcTable = { 163 | 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 164 | 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 165 | 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 166 | 0x709F7B7A, 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 167 | 0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, 0xD4326D90, 0xD0F37027, 168 | 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 169 | 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 170 | 0x2E003DC5, 0x2AC12072, 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 171 | 0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08, 172 | 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 173 | 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 174 | 0x902B669D, 0x94EA7B2A, 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 175 | 0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 176 | 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 177 | 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 178 | 0x3F9B762C, 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 179 | 0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 0xD727BBB6, 0xD3E6A601, 180 | 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 181 | 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 182 | 0x81B02D74, 0x857130C3, 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 183 | 0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E, 184 | 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 185 | 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 186 | 0xDF2F6BCB, 0xDBEE767C, 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 187 | 0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 188 | 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 189 | }; 190 | 191 | public long crc32(int startIdx, int endIdx) { 192 | int value = 0xFFFFFFFF; 193 | int ptr; 194 | 195 | for (int i = startIdx; i < endIdx; i++) { 196 | ptr = (((value >> 24) & 0x00ff) ^ b64[i]) & 0x00FF; 197 | value = (value << 8) ^ CrcTable[ptr]; 198 | } 199 | 200 | return (value & 0xFFFFFFFFL); 201 | } 202 | 203 | public void decode35() { 204 | 205 | int i1; 206 | int i2; 207 | long l1; 208 | long l2; 209 | long l3; 210 | long l4; 211 | long l5; 212 | long l6; 213 | long l7; 214 | long l8; 215 | int bufptr; 216 | int desptr; 217 | int segptr = 0; 218 | 219 | String stemp = ""; 220 | ot = "Hex=0x"; 221 | 222 | for (int i = 0; i < b64.length; i++) { 223 | stemp += String.format("%02X", b64[i]); 224 | } 225 | ot += stemp + "\nBase64=" + Base64.encodeToString(b64, false) + "\n\n"; 226 | 227 | ot += "Decoded length = " + b64.length + "\n"; 228 | 229 | 230 | spliceInfoSection.tableID = b64[0] & 0x00ff; 231 | if (spliceInfoSection.tableID != 0x0FC) { 232 | ot = "Invalid Table ID != 0xFC"; 233 | outText.setText(ot); 234 | return; 235 | } 236 | ot += "Table ID = 0xFC\n"; 237 | 238 | spliceInfoSection.sectionSyntaxIndicator = (b64[1] >> 7) & 0x01; 239 | if (spliceInfoSection.sectionSyntaxIndicator != 0) { 240 | ot += "ERROR Long section used\n"; 241 | } else { 242 | ot += "MPEG Short Section\n"; 243 | } 244 | 245 | spliceInfoSection.privateIndicator = (b64[1] >> 6) & 0x01; 246 | if (spliceInfoSection.privateIndicator != 0) { 247 | ot += "ERROR Private section signaled\n"; 248 | } else { 249 | ot += "Not Private\n"; 250 | } 251 | 252 | spliceInfoSection.reserved1 = (b64[1] >> 4) & 0x03; 253 | ot += String.format("Reserved = 0x%x\n", spliceInfoSection.reserved1); 254 | 255 | i1 = b64[1] & 0x0f; 256 | i2 = b64[2] & 0x00ff; 257 | spliceInfoSection.sectionLength = (i1 << 8) + i2; 258 | ot += ("Section Length = " + spliceInfoSection.sectionLength + "\n"); 259 | 260 | spliceInfoSection.protocolVersion = b64[3]; 261 | ot += ("Protocol Version = " + spliceInfoSection.protocolVersion + "\n"); 262 | 263 | spliceInfoSection.encryptedPacket = (b64[4] >> 7) & 0x01; 264 | spliceInfoSection.encryptionAlgorithm = (b64[4] >> 1) & 0x3F; 265 | if (spliceInfoSection.encryptedPacket != 0) { 266 | ot += "Encrypted Packet\n"; 267 | ot += String.format("Encryption Algorithm = 0x%x\n", spliceInfoSection.encryptionAlgorithm); 268 | } else { 269 | ot += "unencrypted Packet\n"; 270 | } 271 | 272 | l1 = b64[4] & 0x01; 273 | l2 = b64[5] & 0x00ff; 274 | l3 = b64[6] & 0x00ff; 275 | l4 = b64[7] & 0x00ff; 276 | l5 = b64[8] & 0x00ff; 277 | spliceInfoSection.ptsAdjustment = (l1 << 32) + (l2 << 24) + (l3 << 16) + (l4 << 8) + l5; 278 | ot += String.format("PTS Adjustment = 0x%09x\n", spliceInfoSection.ptsAdjustment); 279 | 280 | spliceInfoSection.cwIndex = b64[9] & 0x00ff; 281 | if (spliceInfoSection.encryptedPacket != 0) { 282 | ot += String.format("CW Index = 0x%x\n", spliceInfoSection.cwIndex); 283 | } 284 | 285 | i1 = b64[10] & 0x00ff; 286 | i2 = (b64[11] & 0x00f0) >> 4; 287 | spliceInfoSection.tier = (i1 << 4) + i2; 288 | ot += String.format("Tier = 0x%03x\n", spliceInfoSection.tier); 289 | 290 | i1 = b64[11] & 0x000f; 291 | i2 = b64[12] & 0x00ff; 292 | spliceInfoSection.spliceCommandLength = (i1 << 8) + i2; 293 | ot += String.format("Splice Command Length = 0x%03x\n", spliceInfoSection.spliceCommandLength); 294 | 295 | spliceInfoSection.spliceCommandType = b64[13] & 0x00ff; 296 | bufptr = 14; 297 | switch (spliceInfoSection.spliceCommandType) { 298 | case SPLICE_NULL: 299 | ot += "Splice Null\n"; 300 | break; 301 | case SPLICE_SCHEDULE: 302 | ot += "Splice Schedule\n"; 303 | break; 304 | case SPLICE_INSERT: 305 | ot += "Splice Insert\n"; 306 | l1 = b64[bufptr] & 0x00ff; 307 | bufptr++; 308 | l2 = b64[bufptr] & 0x00ff; 309 | bufptr++; 310 | l3 = b64[bufptr] & 0x00ff; 311 | bufptr++; 312 | l4 = b64[bufptr] & 0x00ff; 313 | bufptr++; 314 | spliceInsert.spliceEventID = (int) (((l1 << 24) + (l2 << 16) + (l3 << 8) + l4) & 0x00ffffffff); 315 | ot += String.format("Splice Event ID = 0x%x\n", spliceInsert.spliceEventID); 316 | 317 | i1 = b64[bufptr] & 0x080; 318 | bufptr++; 319 | if (i1 != 0) { 320 | spliceInsert.spliceEventCancelIndicator = 1; 321 | ot += "Splice Event Canceled\n"; 322 | } else { 323 | spliceInsert.spliceEventCancelIndicator = 0; 324 | } 325 | 326 | spliceInsert.outOfNetworkIndicator = (b64[bufptr] & 0x080) >> 7; 327 | spliceInsert.programSpliceFlag = (b64[bufptr] & 0x040) >> 6; 328 | spliceInsert.durationFlag = (b64[bufptr] & 0x020) >> 5; 329 | spliceInsert.spliceImmediateFlag = (b64[bufptr] & 0x010) >> 4; 330 | bufptr++; 331 | ot += "Flags OON=" + spliceInsert.outOfNetworkIndicator + " Prog=" + spliceInsert.programSpliceFlag 332 | + " Duration=" + spliceInsert.durationFlag + " Immediate=" + spliceInsert.spliceImmediateFlag + "\n"; 333 | 334 | if ((spliceInsert.programSpliceFlag == 1) && (spliceInsert.spliceImmediateFlag == 0)) { 335 | if ((b64[bufptr] & 0x080) != 0) { 336 | // time specified 337 | l1 = b64[bufptr] & 0x01; 338 | bufptr++; 339 | l2 = b64[bufptr] & 0x00ff; 340 | bufptr++; 341 | l3 = b64[bufptr] & 0x00ff; 342 | bufptr++; 343 | l4 = b64[bufptr] & 0x00ff; 344 | bufptr++; 345 | l5 = b64[bufptr] & 0x00ff; 346 | spliceInsert.sisp.ptsTime = (l1 << 32) + (l2 << 24) + (l3 << 16) + (l4 << 8) + l5; 347 | ot += String.format("Splice time = 0x%09x\n", spliceInsert.sisp.ptsTime); 348 | } 349 | bufptr++; 350 | } 351 | 352 | if (spliceInsert.durationFlag != 0) { 353 | spliceInsert.brdr.autoReturn = (b64[bufptr] & 0x080) >> 7; 354 | if (spliceInsert.brdr.autoReturn != 0) { 355 | ot += "Auto Return\n"; 356 | } 357 | l1 = b64[bufptr] & 0x01; 358 | bufptr++; 359 | l2 = b64[bufptr] & 0x00ff; 360 | bufptr++; 361 | l3 = b64[bufptr] & 0x00ff; 362 | bufptr++; 363 | l4 = b64[bufptr] & 0x00ff; 364 | bufptr++; 365 | l5 = b64[bufptr] & 0x00ff; 366 | bufptr++; 367 | spliceInsert.brdr.duration = (l1 << 32) + (l2 << 24) + (l3 << 16) + (l4 << 8) + l5; 368 | double bsecs = spliceInsert.brdr.duration; 369 | bsecs /= 90000.0; 370 | ot += String.format("break duration = 0x%09x = %f seconds\n", spliceInsert.brdr.duration, bsecs); 371 | } 372 | i1 = b64[bufptr] & 0x00ff; 373 | bufptr++; 374 | i2 = b64[bufptr] & 0x00ff; 375 | bufptr++; 376 | spliceInsert.uniqueProgramID = (i1 << 8) + i2; 377 | ot += "Unique Program ID = " + spliceInsert.uniqueProgramID + "\n"; 378 | 379 | spliceInsert.availNum = b64[bufptr] & 0x00ff; 380 | bufptr++; 381 | ot += "Avail Num = " + spliceInsert.availNum + "\n"; 382 | 383 | spliceInsert.availsExpected = b64[bufptr] & 0x00ff; 384 | bufptr++; 385 | ot += "Avails Expected = " + spliceInsert.availsExpected + "\n"; 386 | 387 | break; 388 | case TIME_SIGNAL: 389 | ot += "Time Signal\n"; 390 | timeSignal.tssp.timeSpecifiedFlag = (b64[bufptr] & 0x080) >> 7; 391 | if (timeSignal.tssp.timeSpecifiedFlag != 0) { 392 | if (spliceInfoSection.spliceCommandLength != 5) { 393 | String ptemp = String.format("\n!!!!\n Time Signal with time length != 5 %x\n", spliceInfoSection.spliceCommandLength); 394 | outText.setText(ot + ptemp); 395 | return; 396 | } 397 | // time specified 398 | l1 = b64[bufptr] & 0x01; 399 | bufptr++; 400 | l2 = b64[bufptr] & 0x00ff; 401 | bufptr++; 402 | l3 = b64[bufptr] & 0x00ff; 403 | bufptr++; 404 | l4 = b64[bufptr] & 0x00ff; 405 | bufptr++; 406 | l5 = b64[bufptr] & 0x00ff; 407 | timeSignal.tssp.ptsTime = (l1 << 32) + (l2 << 24) + (l3 << 16) + (l4 << 8) + l5; 408 | ot += String.format("Time = 0x%09x\n", timeSignal.tssp.ptsTime); 409 | } else { 410 | if (spliceInfoSection.spliceCommandLength != 1) { 411 | String ptemp = String.format("\n!!!!\n Time Signal no time length != 1 %x\n", spliceInfoSection.spliceCommandLength); 412 | outText.setText(ot + ptemp); 413 | return; 414 | } 415 | } 416 | bufptr++; 417 | break; 418 | case BANDWIDTH_RESERVATION: 419 | ot += "Bandwidth Reservation\n"; 420 | break; 421 | case PRIVATE_COMMAND: 422 | ot += "Private Command\n"; 423 | break; 424 | default: 425 | ot += String.format("ERROR Unknown command = 0x%x\n", spliceInfoSection.spliceCommandType); 426 | // Unknown command, oops 427 | break; 428 | } 429 | 430 | if (spliceInfoSection.spliceCommandLength != 0x0fff) { // legacy check 431 | if (bufptr != (spliceInfoSection.spliceCommandLength + 14)) { 432 | ot += "ERROR decoded command length " + bufptr + " not equal to specified command length " + (13 + spliceInfoSection.spliceCommandLength) + "\n"; 433 | outText.setText(ot); 434 | return; 435 | } 436 | } 437 | 438 | i1 = b64[bufptr] & 0x00ff; 439 | bufptr++; 440 | i2 = b64[bufptr] & 0x00ff; 441 | bufptr++; 442 | spliceInfoSection.descriptorLoopLength = (i1 << 8) + i2; 443 | ot += "Descriptor Loop Length = " + spliceInfoSection.descriptorLoopLength + "\n"; 444 | //System.out.println(ot); 445 | desptr = bufptr; 446 | /* 447 | if (b64.length < (bufptr + spliceInfoSection.descriptorLoopLength + 4)) { 448 | ot += "\nERROR buffer length " + b64.length + " less then descriptor loop length " + (bufptr + spliceInfoSection.descriptorLoopLength + 4) + "\n"; 449 | outText.setText(ot); 450 | return; 451 | }*/ 452 | 453 | if (spliceInfoSection.descriptorLoopLength > 0) { 454 | while ((bufptr - desptr) < spliceInfoSection.descriptorLoopLength) { 455 | int tag = b64[bufptr] & 0x00ff; 456 | bufptr++; 457 | int len = b64[bufptr] & 0x00ff; 458 | if (b64.length < (bufptr + len + 4)) { 459 | ot += "\nERROR buffer length " + b64.length + " less then descriptor " + tag + " length " + (bufptr + len + 4) + "\n"; 460 | outText.setText(ot); 461 | return; 462 | } 463 | bufptr++; 464 | l1 = b64[bufptr] & 0x00ff; 465 | bufptr++; 466 | l2 = b64[bufptr] & 0x00ff; 467 | bufptr++; 468 | l3 = b64[bufptr] & 0x00ff; 469 | bufptr++; 470 | l4 = b64[bufptr] & 0x00ff; 471 | bufptr++; 472 | int identifier = (int) ((l1 << 24) + (l2 << 16) + (l3 << 8) + l4); 473 | if (identifier == 0x43554549) { 474 | switch (tag) { 475 | case 0: 476 | ot += "Avail Descriptor - Length=" + len + "\n"; 477 | l1 = b64[bufptr] & 0x00ff; 478 | bufptr++; 479 | l2 = b64[bufptr] & 0x00ff; 480 | bufptr++; 481 | l3 = b64[bufptr] & 0x00ff; 482 | bufptr++; 483 | l4 = b64[bufptr] & 0x00ff; 484 | bufptr++; 485 | int availDesc = (int) (((l1 << 24) + (l2 << 16) + (l3 << 8) + l4) & 0x00ffffffff); 486 | ot += String.format("Avail Descriptor = 0x%08x\n", availDesc); 487 | break; 488 | case 1: 489 | ot += "DTMF Descriptor - Length=" + len + "\n"; 490 | double preroll = b64[bufptr] & 0x00ff; 491 | preroll /= 10; 492 | ot += "Preroll = " + preroll + "\n"; 493 | bufptr ++; 494 | int dtmfCount = (b64[bufptr] & 0x00E0) >> 5; 495 | bufptr++; 496 | ot += dtmfCount + "DTMF chars = "; 497 | for (int i=0;i> 7; 517 | bufptr++; 518 | if (seg[segptr].segmentationEventCancelIndicator == 0) { 519 | ot += "Segmentation Event Cancel Indicator NOT set\n"; 520 | seg[segptr].programSegmentationFlag = (b64[bufptr] & 0x080) >> 7; 521 | seg[segptr].segmentationDurationFlag = (b64[bufptr] & 0x040) >> 6; 522 | seg[segptr].deliveryNotRestricted = (b64[bufptr] & 0x020) >> 5; 523 | ot += "Delivery Not Restricted flag = " + seg[segptr].deliveryNotRestricted + "\n"; 524 | if (seg[segptr].deliveryNotRestricted == 0) { 525 | seg[segptr].webDeliveryAllowedFlag = (b64[bufptr] & 0x010) >> 4; 526 | ot += "Web Delivery Allowed flag = " + seg[segptr].webDeliveryAllowedFlag + "\n"; 527 | seg[segptr].noRegionalBlackoutFlag = (b64[bufptr] & 0x008) >> 3; 528 | ot += "No Regional Blackout flag = " + seg[segptr].noRegionalBlackoutFlag + "\n"; 529 | seg[segptr].archiveAllowed = (b64[bufptr] & 0x004) >> 2; 530 | ot += "Archive Allowed flag = " + seg[segptr].archiveAllowed + "\n"; 531 | seg[segptr].deviceRestriction = (b64[bufptr] & 0x003); 532 | ot += "Device Restrictions = " + seg[segptr].deviceRestriction + "\n"; 533 | } 534 | bufptr++; 535 | if (seg[segptr].programSegmentationFlag == 0) { 536 | ot += "Component segmention NOT IMPLEMENTED\n"; 537 | } else { 538 | ot += "Program Segmentation flag SET\n"; 539 | } 540 | if (seg[segptr].segmentationDurationFlag == 1) { 541 | l1 = b64[bufptr] & 0x0ff; 542 | bufptr++; 543 | l2 = b64[bufptr] & 0x00ff; 544 | bufptr++; 545 | l3 = b64[bufptr] & 0x00ff; 546 | bufptr++; 547 | l4 = b64[bufptr] & 0x00ff; 548 | bufptr++; 549 | l5 = b64[bufptr] & 0x00ff; 550 | bufptr++; 551 | seg[segptr].segmentationDuration = (l1 << 32) + (l2 << 24) + (l3 << 16) + (l4 << 8) + l5; 552 | double secs = seg[segptr].segmentationDuration; 553 | secs /= 90000.0; 554 | ot += String.format("Segmentation Duration = 0x%010x = %f seconds\n", seg[segptr].segmentationDuration, secs); 555 | } 556 | seg[segptr].segmentationUPIDtype = b64[bufptr] & 0x00ff; 557 | bufptr++; 558 | seg[segptr].segmentationUPIDlength = b64[bufptr] & 0x00ff; 559 | bufptr++; 560 | switch (seg[segptr].segmentationUPIDtype) { 561 | case 0x00: 562 | ot += "UPID Type = Not Used length = " + seg[segptr].segmentationUPIDlength + "\n"; 563 | break; 564 | case 0x01: 565 | ot += "UPID Type = User Defined (Deprecated) length =" + seg[segptr].segmentationUPIDlength + "\nHex=0x"; 566 | for (int j=bufptr;j<(bufptr + seg[segptr].segmentationUPIDlength); j++) { 567 | ot += String.format("%02X.", b64[j]); 568 | } 569 | ot += "\n"; 570 | bufptr += seg[segptr].segmentationUPIDlength; 571 | break; 572 | case 0x02: 573 | ot += "UPID Type = ISCII (deprecated)length = " + seg[segptr].segmentationUPIDlength + "\n"; 574 | String siTemp = "ISCII="; 575 | for (int j=bufptr;j<(bufptr + seg[segptr].segmentationUPIDlength); j++) { 576 | siTemp += (char)b64[j]; 577 | } 578 | siTemp += "\n"; 579 | ot += siTemp; 580 | bufptr += seg[segptr].segmentationUPIDlength; 581 | break; 582 | case 0x03: 583 | ot += "UPID Type = Ad-IDlength = " + seg[segptr].segmentationUPIDlength + "\n"; 584 | String stTemp = "AdId="; 585 | for (int j=bufptr;j<(bufptr + seg[segptr].segmentationUPIDlength); j++) { 586 | stTemp += (char)b64[j]; 587 | } 588 | stTemp += "\n"; 589 | ot += stTemp; 590 | bufptr += seg[segptr].segmentationUPIDlength; 591 | break; 592 | case 0x04: 593 | ot += "UPID Type = UMID SMPTE 330M length = " + seg[segptr].segmentationUPIDlength + "\n"; 594 | bufptr += seg[segptr].segmentationUPIDlength; 595 | break; 596 | case 0x05: 597 | ot += "UPID Type = ISAN (Deprecated) length = " + seg[segptr].segmentationUPIDlength + "\n"; 598 | bufptr += seg[segptr].segmentationUPIDlength; 599 | break; 600 | case 0x06: 601 | ot += "UPID Type = ISAN length = " + seg[segptr].segmentationUPIDlength + "\n"; 602 | bufptr += seg[segptr].segmentationUPIDlength; 603 | break; 604 | case 0x07: 605 | ot += "UPID Type = Tribune ID length = " + seg[segptr].segmentationUPIDlength + "\n"; 606 | bufptr += seg[segptr].segmentationUPIDlength; 607 | break; 608 | case 0x08: 609 | ot += "UPID Type = Turner Identifier length = " + seg[segptr].segmentationUPIDlength + "\n"; 610 | l1 = b64[bufptr] & 0x0ff; 611 | bufptr++; 612 | l2 = b64[bufptr] & 0x00ff; 613 | bufptr++; 614 | l3 = b64[bufptr] & 0x00ff; 615 | bufptr++; 616 | l4 = b64[bufptr] & 0x00ff; 617 | bufptr++; 618 | l5 = b64[bufptr] & 0x00ff; 619 | bufptr++; 620 | l6 = b64[bufptr] & 0x00ff; 621 | bufptr++; 622 | l7 = b64[bufptr] & 0x00ff; 623 | bufptr++; 624 | l8 = b64[bufptr] & 0x00ff; 625 | bufptr++; 626 | seg[segptr].turnerIdentifier = (l1 << 56) + (l2 << 48) + (l3 << 40) + (l4 << 32) + (l5 << 24) + (l6 << 16) + (l7 << 8) + l8; 627 | ot += String.format("Turner Identifier = 0x%016x\n", seg[segptr].turnerIdentifier); 628 | break; 629 | case 0x09: 630 | ot += "UPID Type = ADI length = " + seg[segptr].segmentationUPIDlength + "\n"; 631 | bufptr += seg[segptr].segmentationUPIDlength; 632 | break; 633 | case 0x0A: 634 | ot += "UPID Type = EIDR length = " + seg[segptr].segmentationUPIDlength + "\n"; 635 | bufptr += seg[segptr].segmentationUPIDlength; 636 | break; 637 | case 0x0B: 638 | ot += "UPID Type = ATSC Content Identifier length = " + seg[segptr].segmentationUPIDlength + "\n"; 639 | bufptr += seg[segptr].segmentationUPIDlength; 640 | break; 641 | case 0x0C: 642 | ot += "UPID Type = Managed Private UPID length = " + seg[segptr].segmentationUPIDlength + "\n"; 643 | bufptr += seg[segptr].segmentationUPIDlength; 644 | break; 645 | case 0x0D: 646 | ot += "UPID Type = Multiple UPID length = " + seg[segptr].segmentationUPIDlength + "\nHex=0x"; 647 | for (int j = bufptr; j < (bufptr + seg[segptr].segmentationUPIDlength); j++) { 648 | ot += String.format("%02X.", b64[j]); 649 | } 650 | ot += "\n"; 651 | bufptr += seg[segptr].segmentationUPIDlength; 652 | break; 653 | default: 654 | ot += "UPID Type = UNKNOWN length = " + seg[segptr].segmentationUPIDlength + "\nHex=0x"; 655 | for (int j = bufptr; j < (bufptr + seg[segptr].segmentationUPIDlength); j++) { 656 | ot += String.format("%02X.", b64[j]); 657 | } 658 | ot += "\n"; 659 | bufptr += seg[segptr].segmentationUPIDlength; 660 | break; 661 | } 662 | seg[segptr].segmentationTypeID = b64[bufptr] & 0x00ff; 663 | bufptr++; 664 | switch (seg[segptr].segmentationTypeID) { 665 | case 0x00: 666 | ot += "Type = Not Indicated\n"; 667 | break; 668 | case 0x01: 669 | ot += "Type = Content Identification\n"; 670 | break; 671 | case 0x10: 672 | ot += "Type = Program Start\n"; 673 | break; 674 | case 0x11: 675 | ot += "Type = Program End\n"; 676 | break; 677 | case 0x12: 678 | ot += "Type = Program Early Termination\n"; 679 | break; 680 | case 0x13: 681 | ot += "Type = Program Breakaway\n"; 682 | break; 683 | case 0x14: 684 | ot += "Type = Program Resumption\n"; 685 | break; 686 | case 0x15: 687 | ot += "Type = Program Runover Planned\n"; 688 | break; 689 | case 0x16: 690 | ot += "Type = Program Runover Unplanned\n"; 691 | break; 692 | case 0x17: 693 | ot += "Type = Program Overlap Start\n"; 694 | break; 695 | case 0x20: 696 | ot += "Type = Chapter Start\n"; 697 | break; 698 | case 0x21: 699 | ot += "Type = Chapter End\n"; 700 | break; 701 | case 0x30: 702 | ot += "Type = Provider Advertisement Start\n"; 703 | break; 704 | case 0x31: 705 | ot += "Type = Provider Advertisement End\n"; 706 | break; 707 | case 0x32: 708 | ot += "Type = Distributor Advertisement Start\n"; 709 | break; 710 | case 0x33: 711 | ot += "Type = Distributor Advertisement End\n"; 712 | break; 713 | case 0x34: 714 | ot += "Type = Placement Opportunity Start\n"; 715 | break; 716 | case 0x35: 717 | ot += "Type = Placement Opportunity End\n"; 718 | break; 719 | case 0x40: 720 | ot += "Type = Unscheduled Event Start\n"; 721 | break; 722 | case 0x41: 723 | ot += "Type = Unscheduled Event End\n"; 724 | break; 725 | case 0x50: 726 | ot += "Type = Network Start\n"; 727 | break; 728 | case 0x51: 729 | ot += "Type = Network End\n"; 730 | break; 731 | default: 732 | ot += "Type = Unknown = " + seg[segptr].segmentationTypeID + "\n"; 733 | break; 734 | } 735 | seg[segptr].segmentNum = b64[bufptr] & 0x00ff; 736 | bufptr++; 737 | seg[segptr].segmentsExpected = b64[bufptr] & 0x00ff; 738 | bufptr++; 739 | ot += "Segment num = " + seg[segptr].segmentNum + " Segments Expected = " + seg[segptr].segmentsExpected + "\n"; 740 | segptr++; 741 | } else { 742 | ot += "Segmentation Event Cancel Indicator SET\n"; 743 | } 744 | break; 745 | } 746 | } else { 747 | ot += String.format("Private Descriptor tag=%d Length=%d identifier = 0x%08x Value = 0x", tag, len, identifier); 748 | for (int j = bufptr; j < (bufptr + (len-4)); j++) { 749 | ot += String.format("%02X.", b64[j]); 750 | } 751 | ot += "\n"; 752 | bufptr += len - 4; 753 | } 754 | } 755 | } 756 | 757 | if (bufptr != (spliceInfoSection.descriptorLoopLength + desptr)) { 758 | int dlen = bufptr - desptr; 759 | ot += "ERROR decoded descriptor length " + dlen + " not equal to specified descriptor length " + spliceInfoSection.descriptorLoopLength + "\n"; 760 | bufptr = desptr + spliceInfoSection.descriptorLoopLength; 761 | ot += "SKIPPING REST OF THE COMMAND!!!!!!\n"; 762 | } else { 763 | 764 | if (spliceInfoSection.encryptedPacket != 0) { 765 | spliceInfoSection.alignmentStuffing = 0; 766 | spliceInfoSection.eCRC32 = 0; 767 | } 768 | 769 | l1 = b64[bufptr] & 0x00ff; 770 | bufptr++; 771 | l2 = b64[bufptr] & 0x00ff; 772 | bufptr++; 773 | l3 = b64[bufptr] & 0x00ff; 774 | bufptr++; 775 | l4 = b64[bufptr] & 0x00ff; 776 | bufptr++; 777 | spliceInfoSection.CRC32 = (int) (((l1 << 24) + (l2 << 16) + (l3 << 8) + l4) & 0x00ffffffff); 778 | ot += String.format("CRC32 = 0x%08x\n", spliceInfoSection.CRC32); 779 | } 780 | ot += String.format("calc CRC32 = 0x%08x --- Should = 0x00000000\n", crc32(0,bufptr)); 781 | outText.setText(ot); 782 | } 783 | 784 | /** 785 | * This method is called from within the constructor to initialize the form. 786 | * WARNING: Do NOT modify this code. The content of this method is always 787 | * regenerated by the Form Editor. 788 | */ 789 | // //GEN-BEGIN:initComponents 790 | private void initComponents() { 791 | 792 | jPanel1 = new javax.swing.JPanel(); 793 | base64in = new javax.swing.JTextField(); 794 | hexin = new javax.swing.JTextField(); 795 | hexDecode = new javax.swing.JButton(); 796 | base64Decode = new javax.swing.JButton(); 797 | copyToClipboard = new javax.swing.JButton(); 798 | jLabel1 = new javax.swing.JLabel(); 799 | jPanel2 = new javax.swing.JPanel(); 800 | jScrollPane1 = new javax.swing.JScrollPane(); 801 | outText = new javax.swing.JTextPane(); 802 | 803 | base64in.setText(org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.base64in.text")); // NOI18N 804 | base64in.addActionListener(new java.awt.event.ActionListener() { 805 | public void actionPerformed(java.awt.event.ActionEvent evt) { 806 | base64inActionPerformed(evt); 807 | } 808 | }); 809 | 810 | hexin.setText(org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.hexin.text")); // NOI18N 811 | 812 | org.openide.awt.Mnemonics.setLocalizedText(hexDecode, org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.hexDecode.text")); // NOI18N 813 | hexDecode.addActionListener(new java.awt.event.ActionListener() { 814 | public void actionPerformed(java.awt.event.ActionEvent evt) { 815 | hexDecodeActionPerformed(evt); 816 | } 817 | }); 818 | 819 | org.openide.awt.Mnemonics.setLocalizedText(base64Decode, org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.base64Decode.text")); // NOI18N 820 | base64Decode.addActionListener(new java.awt.event.ActionListener() { 821 | public void actionPerformed(java.awt.event.ActionEvent evt) { 822 | base64DecodeActionPerformed(evt); 823 | } 824 | }); 825 | 826 | org.openide.awt.Mnemonics.setLocalizedText(copyToClipboard, org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.copyToClipboard.text")); // NOI18N 827 | copyToClipboard.addActionListener(new java.awt.event.ActionListener() { 828 | public void actionPerformed(java.awt.event.ActionEvent evt) { 829 | copyToClipboardActionPerformed(evt); 830 | } 831 | }); 832 | 833 | org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(decoderTopComponent.class, "decoderTopComponent.jLabel1.text")); // NOI18N 834 | 835 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 836 | jPanel1.setLayout(jPanel1Layout); 837 | jPanel1Layout.setHorizontalGroup( 838 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 839 | .addGroup(jPanel1Layout.createSequentialGroup() 840 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 841 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 842 | .addGroup(jPanel1Layout.createSequentialGroup() 843 | .addComponent(hexDecode) 844 | .addGap(31, 31, 31)) 845 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 846 | .addComponent(base64Decode) 847 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) 848 | .addGroup(jPanel1Layout.createSequentialGroup() 849 | .addContainerGap() 850 | .addComponent(copyToClipboard) 851 | .addGap(42, 42, 42))) 852 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 853 | .addGroup(jPanel1Layout.createSequentialGroup() 854 | .addComponent(jLabel1) 855 | .addGap(0, 0, Short.MAX_VALUE)) 856 | .addComponent(hexin, javax.swing.GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE) 857 | .addComponent(base64in)) 858 | .addContainerGap()) 859 | ); 860 | jPanel1Layout.setVerticalGroup( 861 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 862 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 863 | .addContainerGap() 864 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 865 | .addComponent(base64in, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 866 | .addComponent(base64Decode)) 867 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 868 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 869 | .addComponent(hexin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 870 | .addComponent(hexDecode)) 871 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 872 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 873 | .addComponent(copyToClipboard) 874 | .addComponent(jLabel1)) 875 | .addContainerGap(8, Short.MAX_VALUE)) 876 | ); 877 | 878 | outText.setFont(new java.awt.Font("Arial Narrow", 0, 8)); // NOI18N 879 | outText.setPreferredSize(new java.awt.Dimension(256, 40)); 880 | jScrollPane1.setViewportView(outText); 881 | 882 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); 883 | jPanel2.setLayout(jPanel2Layout); 884 | jPanel2Layout.setHorizontalGroup( 885 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 886 | .addGroup(jPanel2Layout.createSequentialGroup() 887 | .addContainerGap() 888 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1009, Short.MAX_VALUE) 889 | .addContainerGap()) 890 | ); 891 | jPanel2Layout.setVerticalGroup( 892 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 893 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() 894 | .addContainerGap() 895 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 525, Short.MAX_VALUE) 896 | .addContainerGap()) 897 | ); 898 | 899 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 900 | this.setLayout(layout); 901 | layout.setHorizontalGroup( 902 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 903 | .addGroup(layout.createSequentialGroup() 904 | .addContainerGap() 905 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 906 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 907 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 908 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 909 | ); 910 | layout.setVerticalGroup( 911 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 912 | .addGroup(layout.createSequentialGroup() 913 | .addContainerGap() 914 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 915 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 916 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 917 | .addContainerGap()) 918 | ); 919 | }// //GEN-END:initComponents 920 | 921 | private void base64inActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_base64inActionPerformed 922 | // TODO add your handling code here: 923 | }//GEN-LAST:event_base64inActionPerformed 924 | 925 | private void hexDecodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hexDecodeActionPerformed 926 | try { 927 | b64 = Hex.decodeHex(hexin.getText().toCharArray()); 928 | base64in.setText(Base64.encodeToString(b64, false)); 929 | decode35(); 930 | } catch (DecoderException ex) { 931 | Exceptions.printStackTrace(ex); 932 | } 933 | }//GEN-LAST:event_hexDecodeActionPerformed 934 | 935 | private void base64DecodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_base64DecodeActionPerformed 936 | b64 = Base64.decodeFast(base64in.getText()); 937 | String stemp = ""; 938 | for (int i = 0; i < b64.length; i++) { 939 | stemp += String.format("%02X", b64[i]); 940 | } 941 | hexin.setText(stemp); 942 | 943 | decode35(); 944 | }//GEN-LAST:event_base64DecodeActionPerformed 945 | 946 | private void copyToClipboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyToClipboardActionPerformed 947 | 948 | StringSelection stringSelection = new StringSelection(outText.getText()); 949 | Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); 950 | clipboard.setContents( stringSelection, null ); 951 | }//GEN-LAST:event_copyToClipboardActionPerformed 952 | 953 | // Variables declaration - do not modify//GEN-BEGIN:variables 954 | private javax.swing.JButton base64Decode; 955 | private javax.swing.JTextField base64in; 956 | private javax.swing.JButton copyToClipboard; 957 | private javax.swing.JButton hexDecode; 958 | private javax.swing.JTextField hexin; 959 | private javax.swing.JLabel jLabel1; 960 | private javax.swing.JPanel jPanel1; 961 | private javax.swing.JPanel jPanel2; 962 | private javax.swing.JScrollPane jScrollPane1; 963 | private javax.swing.JTextPane outText; 964 | // End of variables declaration//GEN-END:variables 965 | 966 | @Override 967 | public void componentOpened() { 968 | // TODO add custom code on component opening 969 | } 970 | 971 | @Override 972 | public void componentClosed() { 973 | // TODO add custom code on component closing 974 | } 975 | 976 | void writeProperties(java.util.Properties p) { 977 | // better to version settings since initial version as advocated at 978 | // http://wiki.apidesign.org/wiki/PropertyFiles 979 | p.setProperty("version", "1.0"); 980 | // TODO store your settings 981 | } 982 | 983 | void readProperties(java.util.Properties p) { 984 | String version = p.getProperty("version"); 985 | // TODO read your settings according to their version 986 | } 987 | } 988 | -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx-swt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx-swt.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.base.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.base.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.controls.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.controls.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.fxml.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.fxml.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.graphics.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.graphics.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.media.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.media.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.swing.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.swing.jar -------------------------------------------------------------------------------- /javafx12/release/modules/ext/javafx.web.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riedlse/scte35/78e0463ea5556360e62294e896edf43459ebe03a/javafx12/release/modules/ext/javafx.web.jar -------------------------------------------------------------------------------- /javafx12/src/javafx/Bundle.properties: -------------------------------------------------------------------------------- 1 | OpenIDE-Module-Name=javafx12 2 | -------------------------------------------------------------------------------- /nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=ae69886c 2 | build.xml.script.CRC32=82b2a265 3 | build.xml.stylesheet.CRC32=70ce5c94@2.77 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=ae69886c 7 | nbproject/build-impl.xml.script.CRC32=94c413b7 8 | nbproject/build-impl.xml.stylesheet.CRC32=473dc988@2.77 9 | nbproject/platform.xml.data.CRC32=ae69886c 10 | nbproject/platform.xml.script.CRC32=6dcbd131 11 | nbproject/platform.xml.stylesheet.CRC32=ae64f0b6@2.77 12 | -------------------------------------------------------------------------------- /nbproject/platform.properties: -------------------------------------------------------------------------------- 1 | branding.token=scte35 2 | cluster.path=\ 3 | ${nbplatform.active.dir}/platform 4 | disabled.modules=\ 5 | org.netbeans.api.visual,\ 6 | org.netbeans.core.execution,\ 7 | org.netbeans.libs.jsr223,\ 8 | org.netbeans.modules.autoupdate.cli,\ 9 | org.netbeans.modules.autoupdate.services,\ 10 | org.netbeans.modules.autoupdate.ui,\ 11 | org.netbeans.modules.core.kit,\ 12 | org.netbeans.modules.favorites,\ 13 | org.openide.compat,\ 14 | org.openide.options,\ 15 | org.openide.util.enumerations 16 | nbplatform.active=default 17 | -------------------------------------------------------------------------------- /nbproject/platform.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /nbproject/private/platform-private.properties: -------------------------------------------------------------------------------- 1 | user.properties.file=/Users/riedlse/Library/Application Support/NetBeans/11.1/build.properties 2 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | app.name=${branding.token} 2 | app.title=scte35 3 | auxiliary.org-netbeans-modules-apisupport-installer.license-type=apache.v2 4 | auxiliary.org-netbeans-modules-apisupport-installer.os-linux=false 5 | auxiliary.org-netbeans-modules-apisupport-installer.os-macosx=true 6 | auxiliary.org-netbeans-modules-apisupport-installer.os-solaris=false 7 | auxiliary.org-netbeans-modules-apisupport-installer.os-windows=true 8 | auxiliary.org-netbeans-modules-apisupport-installer.pack200-enabled=false 9 | auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml 10 | modules=\ 11 | ${project.com.turner.scte35}:\ 12 | ${project.com.turner.scte35.common.codec}:\ 13 | ${project.com.turner.decoder} 14 | project.com.turner.decoder=decoder 15 | project.com.turner.scte35=SCTE35base 16 | project.com.turner.scte35.common.codec=commons-codec 17 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.apisupport.project.suite 4 | 5 | 6 | scte35 7 | 8 | 9 | 10 | --------------------------------------------------------------------------------