u_long outBit_Sx_NL (int verbosity, const char *text, u_char *buf, int startbit, int bitlen) { u_long value; value = outBit_Sx (verbosity,text,buf,startbit,bitlen); out_NL (verbosity); return value; }
void mpeg_pack_header (int v, u_char *b, int len) { /* z.B. H.222 ISO 13818-1 Table 2-33 */ /* ISO 11172-1 pack header */ int v1 = v+1; int pack_stuffing_len; if (len == 0) return; out_nl (v,"Pack_header: "); indent (+1); if (len > 0) { // -- within PES packet, not PS! outBit_Sx_NL (v1,"pack_start_code: ", b, 0, 32); } outBit_Sx_NL (v1,"fixed '01': ", b, 32, 2); print_xTS_field (v1, "system_clock_reference_base", b, 34) ; // len 36b outBit_Sx_NL (v1,"system_clock_reference_extension: ",b, 70, 9); outBit_Sx_NL (v1,"marker_bit: ", b, 79, 1); outBit_Sx (v1,"program_mux_rate: ", b, 80,22); out_nl (v1," [= x 50 bytes/sec]"); outBit_Sx_NL (v1,"marker_bit: ", b, 102, 1); outBit_Sx_NL (v1,"marker_bit: ", b, 103, 1); outBit_Sx_NL (v1,"reserved: ", b, 104, 5); pack_stuffing_len = outBit_Sx_NL (v1,"pack_stuffing_len: ", b, 109, 3); print_databytes (6,"stuffing bytes 0xFF:", b+14, pack_stuffing_len); b += 14 + pack_stuffing_len; if (len >= 0) len -= 14 + pack_stuffing_len; if (len > 0) mpeg_system_header (v1, b, len); // only if len > 0 (PES packet) indent (-1); }
int dsmcc_DownloadInfoIndication (int v, u_char *b, u_int len) { int len_org = len; int n_modules; int len2; int i, x; // already read dsmcc_MessageHeader (v, b, len, &dmh); outBit_Sx_NL (v,"downloadId: ", b , 0, 32); outBit_Sx_NL (v,"blockSize: ", b+ 4, 0, 16); outBit_Sx_NL (v,"windowSize: ", b+ 6, 0, 8); outBit_Sx_NL (v,"ackPeriod: ", b+ 7, 0, 8); outBit_Sx_NL (v,"tCDownloadWindow: ", b+ 8, 0, 32); outBit_Sx_NL (v,"tCDownloadScenario: ", b+12, 0, 32); b += 16; len -= 16; x = dsmcc_CompatibilityDescriptor (b); b += x; len -= x; n_modules = outBit_Sx_NL (v,"numberOfModules: ", b, 0, 16); b += 2; len -= 2; for (i=0; i < n_modules; i++) { u_int mId; out_NL (v); out_nl (v, "Module (%d):",i); indent (+1); mId = outBit_Sx (v,"moduleId: ", b, 0, 16); out_nl (4, "%s", (mId < 0xFFF0) ? "" : " [= DAVIC application]"); outBit_Sx_NL (v,"moduleSize: " , b, 16, 32); outBit_Sx_NL (v,"moduleVersion: ", b, 48, 8); len2 = outBit_Sx_NL (v,"moduleInfoLength: ", b, 56, 8); b += 8; len -= 8; // moduleInfoByte: these fields shall convey a list of descriptors // which each define one or more attributes of the described module, // except when the moduleId is within the range of 0xFFF0-0xFFFF. In // this case, the moduleInfoByte structure contains the ModuleInfo // structure as defined by DAVIC with the privateDataByte field of that // structure as a loop of descriptors. // ISO 13818-6:2000 11.3.3.2 if (mId < 0xFFF0) { BIOP_ModuleInfo (v, b, len2); } else { print_databytes (v, "moduleInfoBytes: ", b, len2); // $$$ TODO Davic } b += len2; len -= len2; indent (-1); } out_NL (v); indent (-1); len2 = outBit_Sx_NL (v,"privateDataLength: ", b, 0, 16); print_databytes (v, "privat Data: ", b+2, len2); // $$$ TODO ??? // b += 2 + len2; // len -= 2 + len2; return len_org; }
int print_vps_decode (int v, u_char *b, int len) { // warning! Nipples e.g. _2_7 may not be msb...lsb order! // see: ETSI EN 300 231 for this notation! u_int pcs; u_int cni_1_4; u_int pil; u_int pty; u_int day, month, hour, minute; u_int country_5_8; u_int npp, npp_0_1, npp_2_7; out_nl (v,"VPS data:"); print_databytes (8,"Data:", b, len); indent (+1); // -- starts at EN 300 231 8.2.2 Fig.9 Table // -- Byte 3..15 , so byte 3 => [0] // -- vps_data_block: // -- Byte 3+4: not relevant to PDC // -- Info from datasheet SAA4700 (Philips) outBit_Sx_NL (v,"(program source identification (binary coded)): ", b, 0, 8); outBit_Sx_NL (v,"(program source identification (ASCII seq)): ", b+1, 0, 8); // -- PCS pcs = outBit_S2x_NL (v,"PCS audio: ", b+2, 0, 2, (char *(*)(u_long)) dvbstrVPS_pcs_audio ); pcs = outBit_Sx_NL (v,"PCS reserved: ", b+2, 2, 2); cni_1_4 = outBit_Sx (v,"CNI reserved: ", b+2, 4, 4); if (cni_1_4 == 0x0F) out_nl (4, " [= Unenhanced VPS]"); else out_nl (4, " [= Enhanced VPS]"); // -- Byte 6..10: not relevant to PDC // -- Info from datasheet SAA4700 (Philips) outBit_Sx_NL (v,"(program/test picture identification): ", b+3, 0, 8); outBit_Sx_NL (v,"(internal information exchange): ", b+4, 0, 8); outBit_Sx_NL (v,"(address assignment of signal distribution): ", b+5, 0, 16); outBit_Sx_NL (v,"(messages/commands): ", b+7, 0, 8); pil = getBits (b, 8, 2, 20); npp_0_1 = getBits (b, 8, 0, 2); day = getBits (b, 8, 2, 5); month = getBits (b, 8, 7, 4); hour = getBits (b, 8, 11, 5); minute = getBits (b, 8, 16, 6); country_5_8 = getBits (b, 8, 22, 4); npp_2_7 = getBits (b, 8, 26, 6); pty = getBits (b, 8, 32, 8); // byte 15 out_SB_NL (v,"NPP_1: ", npp_0_1); out_ST (v,"Program Identificaion Label (PIL): ", pil); if (day != 0x00) { out_nl (v," [= month=%d day=%d hour=%d min=%d]", month, day, hour, minute); } else { char *s; switch (pil) { case 0x07FFF: s = "Timer-control code (TC)"; break; case 0x07FBF: s = "Record inhibit/Terminate (RI/T)"; break; case 0x07F7F: s = "Interrruption code (INT)"; break; case 0x07F3F: s = "Continuation code"; break; case 0xFFFFF: s = "Program selected by PTY"; break; default: s = "UNKOWN code"; break; } out_nl (v," [= %s]",s); } out_S2B_NL (v,"Country: ", country_5_8, dvbstrVPS_cni_countrycode(1+(country_5_8 << 4)) ); out_SB_NL (v,"NPP_2: ", npp_2_7); npp = (npp_0_1 << 6) + (npp_2_7); // msb ... lsb out_S2B_NL (v," ==> Network/Program Provider (NPP): ", npp, dvbstrVPS_npp(npp) ); out_S2B_NL (v,"Program Type (PTY): ", pty, dvbstrVPS_pty(pty) ); indent (-1); return len; }