📄 dvb_descriptor.c
字号:
/* 0x48 Service descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_Service (u_char *b){ int len2; // tag = b[0]; // len = = b[1]; outBit_S2x_NL(4,"service_type: ", b, 16, 8, (char *(*)(u_long)) dvbstrService_TYPE ); len2 = outBit_Sx_NL (4,"service_provider_name_length: ", b, 24, 8); b += 4; print_text_468A (4,"service_provider_name: ", b,len2); b += len2; len2 = outBit_Sx_NL (4,"service_name_length: ", b, 0, 8); b += 1; print_text_468A (4, "Service_name: ", b,len2);}/* 0x49 Country Availibility descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_CountryAvail (u_char *b){ int len; // tag = b[0]; len = b[1]; outBit_Sx_NL (4,"country_availability_flag: ", b, 16, 1); outBit_Sx_NL (6,"reserved: ", b, 17, 7); b += 3; len -= 1; indent (+1); while (len > 0) { u_char country_code[4]; strncpy (country_code, b, 3); // 24 bit *(country_code+3) = '\0'; b += 3; len -= 3; out_nl (4,"country_code: %3.3s",country_code); } indent (-1);}/* 0x4A Linkage descriptor */void descriptorDVB_Linkage (u_char *b){ /* ETSI 300 468 6.2.xx */ typedef struct _descLinkage { u_int descriptor_tag; u_int descriptor_length; u_int transport_stream_id; u_int original_network_id; u_int service_id; u_int linkage_type; } descLinkage; descLinkage d; int len; d.descriptor_tag = b[0]; d.descriptor_length = b[1]; d.transport_stream_id = getBits (b, 0, 16, 16); d.original_network_id = getBits (b, 0, 32, 16); d.service_id = getBits (b, 0, 48, 16); d.linkage_type = getBits (b, 0, 64, 8); out_SW_NL (4,"transport_stream_ID: ",d.transport_stream_id); out_S2W_NL (4,"original_network_ID: ",d.original_network_id, dvbstrOriginalNetwork_ID(d.original_network_id)); out_S2W_NL (4,"service_ID: ",d.service_id, " --> refers to PMT program_number"); out_S2B_NL (4,"linkage_type: ",d.linkage_type, dvbstrLinkage_TYPE (d.linkage_type)); len = d.descriptor_length - 7; b += 7 + 2; indent (+1); if (d.linkage_type == 0x08) { /* EN 300 468 */ sub_descriptorDVB_Linkage0x08 (b, len); } else if (d.linkage_type == 0x09) { /* TR 102 006 DSM-CC */ sub_descriptorDVB_Linkage0x09 (b, len); } else if (d.linkage_type == 0x0A) { /* TR 102 006 DSM-CC */ /* SSU SCAN Linkage */ outBit_S2x_NL (4,"Table_type: ", b, 0, 8, (char *(*)(u_long))dsmccStrLinkage0CTable_TYPE ); } else if (d.linkage_type == 0x0B) { /* EN 301 192 DSM-CC */ sub_descriptorDVB_Linkage0x0B (b, len); } else if (d.linkage_type == 0x0C) { /* EN 301 192 DSM-CC */ sub_descriptorDVB_Linkage0x0C (b, len); } else { print_private_data (4, b,len); } indent (-1);}/* * DVB Linkage Subdescriptor 0x08 */void sub_descriptorDVB_Linkage0x08 (u_char *b, int len){ /* ETSI 300 468 6.2.xx */ typedef struct _descLinkage0x08 { u_int handover_type; u_int reserved_1; u_int origin_type; u_int network_id; u_int initial_service_id; } descLinkage0x08; descLinkage0x08 d; d.handover_type = getBits (b, 0, 0, 4); d.reserved_1 = getBits (b, 0, 4, 3); d.origin_type = getBits (b, 0, 7, 1); b += 1; len -= 1; out_S2B_NL (4,"Handover_type: ",d.handover_type, dvbstrHandover_TYPE(d.handover_type)); out_SB_NL (6,"reserved_1: ",d.reserved_1); out_S2B_NL (4,"Origin_type: ",d.origin_type, dvbstrOrigin_TYPE(d.origin_type)); if ( d.handover_type == 0x01 || d.handover_type == 0x02 || d.handover_type == 0x03) { d.network_id = getBits (b, 0, 0, 16); out_S2W_NL (4,"Network_ID: ",d.network_id, dvbstrNetworkIdent_ID(d.network_id)); b += 1; len -= 1; } if (d.origin_type == 0x00) { d.initial_service_id = getBits (b, 0, 0, 16); out_SW_NL (4,"Initial_service_ID: ",d.initial_service_id); b += 1; len -= 1; } if (len > 0) { print_private_data (4, b,len); }}/* * DVB Linkage Subdescriptor 0x09 */void sub_descriptorDVB_Linkage0x09 (u_char *b, int len){ /* ETSI TR 102 006 6.1 */ int OUI_data_length; u_long OUI; int selector_length; OUI_data_length = outBit_Sx_NL (4,"OUI_data_length: ", b,0,8); b++; len --; while (OUI_data_length > 0) { OUI = outBit_S2x_NL (4,"OUI: ", b, 0,24, (char *(*)(u_long))dsmccStrOUI ); b += 3; OUI_data_length -= 3; len -= 3; // the following is special to Premiere DSM-CC to prevent segfaults // Premiere seems to set short OUI_data_length if (OUI_data_length <= 0) continue; selector_length = outBit_Sx_NL (4,"selector_length: ", b, 0, 8); print_databytes (4,"Selector Bytes:", b+1,selector_length); b += (selector_length +1); // +1 = length byte OUI_data_length -= (selector_length +1); len -= (selector_length +1); } if (len > 0) { print_private_data (4, b,len); }}/* * -- as defined as private data for DSM-CC * -- in EN 301 192 */void sub_descriptorDVB_Linkage0x0B (u_char *b, int len) /* $$$ TODO */{ typedef struct _descLinkage0x0B { u_int platform_id_data_length; // inner Loop 1 u_long platform_id; u_int platform_name_loop_length; // inner Loop 2 u_char ISO639_2_language_code[4]; u_int platform_name_length; } descLinkage0x0B; descLinkage0x0B d; int len_loop1; d.platform_id_data_length = b[0]; out_SB_NL (4,"Platform_ID_data_length: ",d.platform_id_data_length); len_loop1 = d.platform_id_data_length; b++; len--; indent (+1); while (len_loop1 > 0) { int len_loop2; d.platform_id = getBits (b, 0, 0, 24); d.platform_name_loop_length = getBits (b, 0, 24, 8); b += 4; len -= 4; out_S2T_NL (4,"Platform_id: ",d.platform_id, dsmccStrPlatform_ID (d.platform_id)); out_SB_NL (4,"Platform_name_loop_length: ",d.platform_name_loop_length); len_loop1 -= 4; len_loop2 = d.platform_name_loop_length; indent (+1); while (len_loop2 > 0) { getISO639_3 (d.ISO639_2_language_code, b); out_nl (4," ISO639_language_code: %3.3s", d.ISO639_2_language_code); d.platform_name_length = getBits (b, 0, 24, 8); print_text_468A (4, "Platform_name: ", b+4,d.platform_name_length); b += d.platform_name_length + 4; len -= d.platform_name_length + 4; len_loop2 -= d.platform_name_length + 4; out_NL (4); } indent (-1); len_loop1 -= d.platform_name_loop_length; } indent (-1); print_private_data (4, b,len);}void sub_descriptorDVB_Linkage0x0C (u_char *b, int len){ typedef struct _descLinkage0x0C { u_int table_id; // conditional u_int bouquet_id; } descLinkage0x0C; descLinkage0x0C d; d.table_id = getBits (b, 0, 0, 8); out_S2W_NL (4,"Table_id: ",d.table_id, dsmccStrLinkage0CTable_TYPE(d.table_id)); if (d.table_id == 2) { d.bouquet_id = getBits (b, 0, 8, 16); out_S2W_NL (4,"Bouquet_id: ",d.bouquet_id, dvbstrBouquetTable_ID (d.bouquet_id)); }}/* 0x4B NVOD Reference descriptor ETSI EN 300 468 6.2.xx --- checked v1.6.1*/void descriptorDVB_NVOD_Reference (u_char *b){ int len; // tag = b[0]; len = b[1]; b += 2; indent (+1); while (len > 0) { // $$$ TODO this part is re-usable outBit_Sx_NL (4,"transport_stream_ID: ", b, 0, 16); outBit_S2x_NL (4,"original_network_id: ", b, 16, 16, (char *(*)(u_long)) dvbstrOriginalNetwork_ID); outBit_S2Tx_NL(4,"service_ID: ", b, 32, 16, " --> refers to PMT program_number"); len -= 6; b += 6; out_NL (4); } indent (-1);}/* 0x4C Time Shifted Service descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_TimeShiftedService (u_char *b){ // tag = b[0]; // len = b[1]; outBit_Sx_NL (4,"reference_service_ID: ", b, 16, 16);}/* 0x4D Short Event descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_ShortEvent (u_char *b){ int len2; u_char ISO639_2_language_code[4]; // tag = b[0]; // len = b[1]; getISO639_3 (ISO639_2_language_code, b+2); out_nl (4," ISO639_2_language_code: %3.3s", ISO639_2_language_code); b+= 5; len2 = outBit_Sx_NL (4,"event_name_length: ", b, 0, 8); b += 1; print_text_468A (4, "event_name: ", b,len2); b += len2; len2 = outBit_Sx_NL (4,"text_length: ", b, 0, 8); b += 1; print_text_468A (4, "text_char: ", b,len2);}/* 0x4E Extended Event descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_ExtendedEvent (u_char *b){ typedef struct _descExtendedEvent { u_int descriptor_tag; u_int descriptor_length; u_int descriptor_number; u_int last_descriptor_number; u_char ISO639_2_language_code[4]; u_int length_of_items; // N Ext. Events List u_int text_length; // N4 char text char } descExtendedEvent; typedef struct _descExtendedEvent2 { u_int item_description_length; // N2 descriptors u_int item_length; // N3 chars } descExtendedEvent2; descExtendedEvent d; descExtendedEvent2 d2; int len1, lenB; d.descriptor_tag = b[0]; d.descriptor_length = b[1]; d.descriptor_number = getBits (b, 0, 16, 4); d.last_descriptor_number = getBits (b, 0, 20, 4); getISO639_3 (d.ISO639_2_language_code, b+3); d.length_of_items = getBits (b, 0, 48, 8); out_SB_NL (4,"descriptor_number: ",d.descriptor_number); out_SB_NL (4,"last_descriptor_number: ",d.last_descriptor_number); out_nl (4,"iSO639_2_language_code: %3.3s", d.ISO639_2_language_code); out_SB_NL (5,"length_of_items: ",d.length_of_items); b += 7; lenB = d.descriptor_length - 5; len1 = d.length_of_items; indent (+1); while (len1 > 0) { d2.item_description_length = getBits (b, 0, 0, 8); out_NL (4); out_SB_NL (5,"item_description_length: ",d2.item_description_length); print_text_468A (4, "item_description: ", b+1, d2.item_description_length); b += 1 + d2.item_description_length; d2.item_length = getBits (b, 0, 0, 8); out_SB_NL (5,"item_length: ",d2.item_length); print_text_468A (4, "item: ", b+1, d2.item_length); b += 1 + d2.item_length; len1 -= (2 + d2.item_description_length + d2.item_length); lenB -= (2 + d2.item_description_length + d2.item_length); } out_NL (4); indent (-1); d.text_length = getBits (b, 0, 0, 8); b += 1; lenB -= 1; out_SB_NL (5,"text_length: ",d.text_length); print_text_468A (4, "text: ", b,d.text_length);}/* 0x4F Time Shifted Event descriptor ETSI EN 300 468 6.2.xx --- checked v1.6.1*/void descriptorDVB_TimeShiftedEvent (u_char *b){ // tag = b[0]; // len = b[1]; outBit_Sx_NL (4,"reference_service_id: ", b, 16, 16); outBit_Sx_NL (4,"reference_event_id: ", b, 32, 16); }/* 0x50 Component descriptor ETSI EN 300 468 6.2.xx -- checked v1.6.1*/void descriptorDVB_Component (u_char *b){ typedef struct _descComponent { u_int descriptor_tag; u_int descriptor_length; u_int reserved_1; u_int stream_content; u_int component_type; u_int component_tag; u_char ISO639_2_language_code[4]; // N2 char Text } descComponent; descComponent d; d.descriptor_tag = b[0]; d.descriptor_length = b[1]; d.reserved_1 = getBits (b, 0, 16, 4); d.stream_content = getBits (b, 0, 20, 4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -