⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dvb_str.c

📁 DVB MPEG2 system stream 分析, 包含 各個talbe(EIT,PMT,PAT,SDT),以及video,audio. 對於學習數字電視有很大幫助.
💻 C
📖 第 1 页 / 共 2 页
字号:
/*$Id: dvb_str.c,v 1.49 2004/03/31 21:14:23 rasc Exp $ DVBSNOOP a dvb sniffer  and mpeg2 stream analyzer tool http://dvbsnoop.sourceforge.net/ (c) 2001-2004   Rainer.Scherg@gmx.de  -- DVB-Strings  -- dvb decoder helper functions$Log: dvb_str.c,v $Revision 1.49  2004/03/31 21:14:23  rascNew: Spider section pids  (snoop referenced section pids),some minor changesRevision 1.48  2004/03/21 00:37:47  rascQuery FrontEnd Info  (option: -s feinfo)Revision 1.47  2004/03/10 21:05:53  rascWSS (Wide Screen Signalling)  data decodingRevision 1.46  2004/03/09 20:59:23  rascVPS decoding (someone check the NPP & PTY code output please...)Revision 1.45  2004/02/15 18:58:31  rascDSM-CC  data/object carousell continued   (DSI, DII, DDB, DCancel)Revision 1.44  2004/02/12 21:21:22  rascMHP AIT descriptorssome smaller changesRevision 1.43  2004/02/09 22:57:01  rascBugfix VBI Data descriptorRevision 1.42  2004/02/09 21:25:01  rascAIT descriptorsminor redesign on output routinesRevision 1.41  2004/02/04 22:36:29  rascmore EBU/teletext stuffRevision 1.40  2004/02/02 23:34:11  rasc- output indent changed to avoid \r  (which sucks on logged output)- EBU PES data started (teletext, vps, wss, ...)- bugfix: PES synch. data stream- some other stuffRevision 1.39  2004/01/25 21:37:28  rascbugfixes, minor changes & enhancmentsRevision 1.38  2004/01/12 22:49:53  rascget rid of stream descriptor moduleRevision 1.37  2004/01/11 22:49:41  rascPES restructuredRevision 1.36  2004/01/06 14:06:10  rascno messageRevision 1.35  2004/01/06 03:13:25  rascTS prints PES/Section ID on payload_startRevision 1.34  2004/01/05 02:03:42  rascno messageRevision 1.33  2004/01/01 20:09:40  rascDSM-CC INT/UNT descriptorsPES-sync changed, TS sync changed,descriptor scopeother changesRevision 1.32  2003/12/30 14:05:38  rascjust some annotations, so I do not forget these over Sylvester party...(some alkohol may reformat parts of /devbrain/0 ... )cheers!Revision 1.31  2003/12/28 00:01:15  rascsome minor changes/adds...Revision 1.30  2003/12/27 18:17:18  rascdsmcc PES dsmcc_program_stream_descriptorlistRevision 1.29  2003/12/27 00:21:17  rascdsmcc section tablesRevision 1.28  2003/11/26 19:55:34  rascno messageRevision 1.27  2003/11/25 00:17:11  rasc-sync option, some TS and PES stuff;dsm_addr inactive, may be wrong - due to missing ISO 13818-6Revision 1.26  2003/11/24 23:52:18  rasc-sync option, some TS and PES stuff;dsm_addr inactive, may be wrong - due to missing ISO 13818-6Revision 1.25  2003/11/24 14:16:07  obi- corrected transport scrambling control bits according to ETSI ETR 289- fixed lots of broken stringsRevision 1.24  2003/11/09 20:48:35  rascpes data packet (DSM-CC)Revision 1.23  2003/11/07 16:33:32  rascno messageRevision 1.22  2003/11/01 21:40:28  rascsome broadcast/linkage descriptor stuffRevision 1.21  2003/10/29 20:54:57  rascmore PES stuff, DSM descriptors, testdataRevision 1.20  2003/10/27 22:43:50  rasccarousel info descriptor and moreRevision 1.19  2003/10/26 23:00:43  rascfixRevision 1.18  2003/10/25 19:11:50  rascno messageRevision 1.17  2003/10/21 19:54:43  rascno messageRevision 1.16  2003/10/19 22:22:57  rasc- some datacarousell stuff startedRevision 1.15  2003/10/19 21:05:53  rasc- some datacarousell stuff startedRevision 1.14  2003/10/19 13:54:25  rasc-more table decodingRevision 1.13  2003/10/17 19:04:11  rasc- started more work on newer ISO 13818  descriptors- some reorg/update work startedRevision 1.12  2003/10/17 18:16:54  rasc- started more work on newer ISO 13818  descriptors- some reorg work startedRevision 1.11  2003/10/16 19:02:28  rascsome updates to dvbsnoop...- small bugfixes- tables updates from ETR 162Revision 1.10  2003/07/08 19:59:50  rascrestructuring... some new, some fixes,trying to include DSM-CC, Well someone a ISO13818-6 and latest version of ISO 18313-1 to spare?Revision 1.9  2003/06/24 23:51:03  rascbugfixes and enhancementsRevision 1.8  2002/08/17 20:36:12  obino more compiler warningsRevision 1.7  2001/12/07 22:17:20  rascno messageRevision 1.6  2001/12/06 15:33:18  rascsome small work on pespacket.cRevision 1.5  2001/12/01 12:34:17  rascpespacket weitergestrickt, leider z.Zt. zuwenig Zeit um es richtig fertig zu machen.Revision 1.4  2001/10/06 18:19:18  ToerliSteuerzeichen entfernt. rasc wuerdest du mal bitte nen gescheiten unix-konformen Editor verwenden... windows editoren sind ungeeignetRevision 1.3  2001/10/05 17:43:37  rasctypo...Revision 1.2  2001/10/02 21:52:44  rasc- init der time_delta- PES erweitert, PES arbeitet im read() noch nicht richtig!!- muss tmbinc fragem, ob ich Mist baue, oder der Treiber (??)Revision 1.1  2001/09/30 13:05:20  rascdvbsnoop v0.7  -- Commit to CVS*/#include "dvbsnoop.h"#include "dvb_str.h"typedef struct _STR_TABLE {    u_int    from;          /* e.g. from id 1  */    u_int    to;            /*      to   id 3  */    u_char   *str;          /*      is   string xxx */} STR_TABLE;/*  -- match id in range from STR_TABLE*/static char *findTableID (STR_TABLE *t, u_int id){  while (t->str) {    if (t->from <= id && t->to >= id)       return t->str;    t++;  }  return ">>ERROR: not (yet) defined... Report!<<";}/* -----------------------------------------  *//*  --  Table IDs (sections) ETSI EN 468   5.2 EN 301 192 TR 102 006 RE 101 202 ISO 13818-1*/char *dvbstrTableID (u_int id){  STR_TABLE  TableIDs[] = { 	// updated -- 2003-11-04	// ATSC Table IDs could be included...     {  0x00, 0x00,  "Program Association Table (PAT)" },     {  0x01, 0x01,  "Conditional Access Table (CAT)" },     {  0x02, 0x02,  "Program Map Table (PMT)" },     {  0x03, 0x03,  "Transport Stream Description Table (TSDT)" },     {  0x04, 0x04,  "ISO_IEC_14496_scene_description_section" },	/* $$$ TODO */     {  0x05, 0x05,  "ISO_IEC_14496_object_description_section" },	/* $$$ TODO */     {  0x06, 0x37,  "ITU-T Rec. H.222.0|ISO/IEC13818 reserved" },     {  0x38, 0x39,  "ISO/IEC 13818-6 reserved" },     {  0x3a, 0x3a,  "DSM-CC - multiprotocol encapsulated data" },     {  0x3b, 0x3b,  "DSM-CC - U-N messages (DSI or DII)" },     {  0x3c, 0x3c,  "DSM-CC - Download Data Messages (DDB)" },    /* TR 101 202 */     {  0x3d, 0x3d,  "DSM-CC - stream descriptorlist" },     {  0x3e, 0x3e,  "DSM-CC - private data section  // DVB datagram" }, /* EN 301 192 // ISO 13818-6 */     {  0x3f, 0x3f,  "ISO/IEC 13818-6 reserved" },     {  0x40, 0x40,  "Network Information Table (NIT) - actual network" },     {  0x41, 0x41,  "Network Information Table (NIT) - other network" },     {  0x42, 0x42,  "Service Description Table (SDT) - actual transport stream" },     {  0x43, 0x45,  "reserved" },     {  0x46, 0x46,  "Service Description Table (SDT) - other transport stream" },     {  0x47, 0x49,  "reserved" },     {  0x4A, 0x4A,  "Bouquet Association Table (BAT)" },     {  0x4B, 0x4B,  "Update Notification Table (UNT)" },	/* TR 102 006 */     {  0x4C, 0x4C,  "IP/MAC Notification Table (INT) [EN 301 192]" },  /* EN 192 */     {  0x4D, 0x4D,  "reserved" },     {  0x4E, 0x4E,  "Event Information Table (EIT) - actual transport stream, present/following" },     {  0x4F, 0x4F,  "Event Information Table (EIT) - other transport stream, present/following" },     {  0x50, 0x5F,  "Event Information Table (EIT) - actual transport stream, schedule" },     {  0x60, 0x6F,  "Event Information Table (EIT) - other transport stream, schedule" },     {  0x70, 0x70,  "Time Date Table (TDT)" },     {  0x71, 0x71,  "Running Status Table (RST)" },     {  0x72, 0x72,  "Stuffing Table (ST)" },     {  0x73, 0x73,  "Time Offset Table (TOT)" },     {  0x74, 0x74,  "MHP- Application Information Table (AIT)" }, /* MHP */     {  0x75, 0x7D,  "reserved" },     {  0x7E, 0x7E,  "Discontinuity Information Table (DIT)" },     {  0x7F, 0x7F,  "Selection Information Table (SIT)" },     {  0x80, 0x8F,  "DVB CA message section (EMM/ECM)" },   /* ITU-R BT.1300 ref. */     {  0x90, 0xBF,  "User private" },     {  0xC0, 0xFE,  "ATSC reserved" },		/* ETR 211e02 */     {  0xFF, 0xFF,  "forbidden" },     {  0,0, NULL }  };  return findTableID (TableIDs, id);}/*  -- Descriptor table tags*/char *dvbstrMPEGDescriptorTAG (u_int tag){  STR_TABLE  Tags[] = {// ISO 13818-1     {  0x00, 0x01,  "Reserved" },     {  0x02, 0x02,  "video_stream_descriptor" },     {  0x03, 0x03,  "audio_stream_descriptor" },     {  0x04, 0x04,  "hierarchy_descriptor" },     {  0x05, 0x05,  "registration_descriptor" },     {  0x06, 0x06,  "data_stream_alignment_descriptor" },     {  0x07, 0x07,  "target_background_grid_descriptor" },     {  0x08, 0x08,  "video_window_descriptor" },     {  0x09, 0x09,  "CA_descriptor" },     {  0x0A, 0x0A,  "ISO_639_language_descriptor" },     {  0x0B, 0x0B,  "system_clock_descriptor" },     {  0x0C, 0x0C,  "multiplex_buffer_utilization_descriptor" },     {  0x0D, 0x0D,  "copyright_descriptor" },     {  0x0E, 0x0E,  "maximum_bitrate_descriptor" },     {  0x0F, 0x0F,  "private_data_indicator_descriptor" },     {  0x10, 0x10,  "smoothing_buffer_descriptor" },     {  0x11, 0x11,  "STD_descriptor" },     {  0x12, 0x12,  "IBP_descriptor" },          /* MPEG DSM-CC */     {  0x13, 0x13,  "carousel_identifier_descriptor" },     {  0x14, 0x14,  "association_tag_descriptor" },     {  0x15, 0x15,  "deferred_association_tag_descriptor" },     {  0x16, 0x16,  "ISO/IEC13818-6 Reserved" },     	  /* DSM-CC stream descriptors */     {  0x17, 0x17,  "NPT_reference_descriptor" },     {  0x18, 0x18,  "NPT_endpoint_descriptor" },     {  0x19, 0x19,  "stream_mode_descriptor" },     {  0x1A, 0x1A,  "stream_event_descriptor" },          /* MPEG-4 descriptors */     {  0x1B, 0x1B,  "MPEG4_video_descriptor" },     {  0x1C, 0x1C,  "MPEG4_audio_descriptor" },     {  0x1D, 0x1D,  "IOD_descriptor" },     {  0x1E, 0x1E,  "SL_descriptor" },     {  0x1F, 0x1F,  "FMC_descriptor" },     {  0x20, 0x20,  "External_ES_ID_descriptor" },     {  0x21, 0x21,  "MuxCode_descriptor" },     {  0x22, 0x22,  "FMXBufferSize_descriptor" },     {  0x23, 0x23,  "MultiplexBuffer_descriptor" },     {  0x24, 0x24,  "FlexMuxTiming_descriptor" },     {  0x25, 0x3F,  "ITU-T.Rec.H.222.0|ISO/IEC13818-1 Reserved" },     {  0x40, 0xFF,  "Forbidden descriptor in MPEG context" },	// DVB Context     {  0,0, NULL }  };  return findTableID (Tags, tag);}/*  -- Descriptor table tags*/char *dvbstrDVBDescriptorTAG (u_int tag){  STR_TABLE  Tags[] = {     {  0x00, 0x3F,  "Forbidden descriptor in DVB context" },   // MPEG Context// ETSI 300 468     {  0x40, 0x40,  "network_name_descriptor" },     {  0x41, 0x41,  "service_list_descriptor" },     {  0x42, 0x42,  "stuffing_descriptor" },     {  0x43, 0x43,  "satellite_delivery_system_descriptor" },     {  0x44, 0x44,  "cable_delivery_system_descriptor" },     {  0x45, 0x45,  "VBI_data_descriptor" },     {  0x46, 0x46,  "VBI_teletext_descriptor" },     {  0x47, 0x47,  "bouquet_name_descriptor" },     {  0x48, 0x48,  "service_descriptor" },     {  0x49, 0x49,  "country_availibility_descriptor" },     {  0x4A, 0x4A,  "linkage_descriptor" },     {  0x4B, 0x4B,  "NVOD_reference_descriptor" },     {  0x4C, 0x4C,  "time_shifted_service_descriptor" },     {  0x4D, 0x4D,  "short_event_descriptor" },     {  0x4E, 0x4E,  "extended_event_descriptor" },     {  0x4F, 0x4F,  "time_shifted_event_descriptor" },     {  0x50, 0x50,  "component_descriptor" },     {  0x51, 0x51,  "mosaic_descriptor" },     {  0x52, 0x52,  "stream_identifier_descriptor" },     {  0x53, 0x53,  "CA_identifier_descriptor" },     {  0x54, 0x54,  "content_descriptor" },     {  0x55, 0x55,  "parental_rating_descriptor" },     {  0x56, 0x56,  "teletext_descriptor" },     {  0x57, 0x57,  "telephone_descriptor" },     {  0x58, 0x58,  "local_time_offset_descriptor" },     {  0x59, 0x59,  "subtitling_descriptor" },     {  0x5A, 0x5A,  "terrestrial_delivery_system_descriptor" },     {  0x5B, 0x5B,  "multilingual_network_name_descriptor" },     {  0x5C, 0x5C,  "multilingual_bouquet_name_descriptor" },     {  0x5D, 0x5D,  "multilingual_service_name_descriptor" },     {  0x5E, 0x5E,  "multilingual_component_descriptor" },     {  0x5F, 0x5F,  "private_data_specifier_descriptor" },     {  0x60, 0x60,  "service_move_descriptor" },     {  0x61, 0x61,  "short_smoothing_buffer_descriptor" },     {  0x62, 0x62,  "frequency_list_descriptor" },     {  0x63, 0x63,  "partial_transport_stream_descriptor" },     {  0x64, 0x64,  "data_broadcast_descriptor" },     {  0x65, 0x65,  "CA_system_descriptor" },     {  0x66, 0x66,  "data_broadcast_id_descriptor" },     {  0x67, 0x67,  "transport_stream_descriptor" },     {  0x68, 0x68,  "DSNG_descriptor" },     {  0x69, 0x69,  "PDC_descriptor" },     {  0x6A, 0x6A,  "AC3_descriptor" },     {  0x6B, 0x6B,  "ancillary_data_descriptor" },     {  0x6C, 0x6C,  "cell_list_descriptor" },     {  0x6D, 0x6D,  "cell_frequency_list_descriptor" },     {  0x6E, 0x6E,  "announcement_support_descriptor" },     {  0x6F, 0x6F,  "application_signalling_descriptor" },     {  0x70, 0x70,  "adaption_field_data_descriptor" },     {  0x71, 0x71,  "service_identifier_descriptor" },     {  0x72, 0x72,  "service_availability_descriptor" },     {  0x73, 0x7F,  "reserved_descriptor" },     {  0x80, 0xAF,  "ATSC reserved" },		/* ETR 211e02 */     {  0xB0, 0xFE,  "User defined" },     {  0xFF, 0xFF,  "Forbidden" },     {  0,0, NULL }  };  return findTableID (Tags, tag);}/* -- current_next_indicator -- ISO/IEC13818-1|ITU H.222.0*/char *dvbstrCurrentNextIndicator (u_int flag){  STR_TABLE  Table[] = {     {  0x00, 0x00,  "valid next" },     {  0x01, 0x01,  "valid now" },     {  0,0, NULL }  };  return findTableID (Table, flag);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -