Exemplo n.º 1
0
void  guess_table (u_char *buf, int len, u_int pid)

{

  TABLE_ID_FUNC *t = table_id_func;
  u_int		table_id;



  /* -- scan id table for decode function */

  table_id =  (u_int) buf[0];
  while (t->func) {
    if (t->from <= table_id && t->to >= table_id)
       break;
    t++;
  }



  out_nl (2,"Guess table from table id...");

  if (t->func == NULL) {
   	out_SB_NL (2,"Unknown, reserved or not (yet) implemented - TableID: ",table_id);
	out_nl    (2,"--> %s",dvbstrTableID (table_id));
	printhex_buf (5,buf,len);
	return;
  }


  (*(t->func))(buf,len);		/* exec decode function */
  return;
}
/*
   0xA0  Logic Channel Descriptor
   NorDig-Unified ver 2.0, 01.07.2008
*/
void descriptor_PRIVATE_NordigORG_ContentProtectionDescriptor (u_char *b)
{
	unsigned int tag = b[0];
	unsigned int len = b[1];
	unsigned int protectionLevel = b[2];

	out_nl(4, "--> NorDig Content Protection Descriptor ");

	b += 2;

	indent(+1);
	out_NL(4);
	out_SB_NL(2, "value: ", protectionLevel);

	switch(protectionLevel)
	{
		default:
		case 0x00:
			out_nl(4, "Outputs shall not be protected.");
			break;
		case 0x01:
			out_nl(4, "Content protection not required.");
			break;
		case 0x02:
			out_nl(4, "Content protection mandatory for video resolution > 576 lines.");
			break;
		case 0x03:
			out_nl(4, "Content protection mandatory regardless of video format and resolution.");
			break;
	}
	indent(-1);
	out_NL(4);
}
Exemplo n.º 3
0
void section_TDT (u_char *b, int len)
{

   u_int      table_id;
   u_long     UTC_time_MJD;
   u_long     UTC_time_UTC;



   out_nl (3,"TDT-decoding....");
   table_id = outBit_S2x_NL (3,"Table_ID: ",  b,  0, 8,
		  (char *(*)(u_long)) dvbstrTableID );     
   if (table_id != 0x70) {
	out_nl (3,"wrong Table ID");
	return;
   }



  outBit_Sx_NL (3,"section_syntax_indicator: ",		b,  8,  1);
  outBit_Sx_NL (6,"reserved_1: ",			b,  9,  1);
  outBit_Sx_NL (6,"reserved_2: ",			b, 10,  2);
  outBit_Sx_NL (3,"Section_length: ",			b, 12, 12);


  out (3,"UTC_time: ");
  UTC_time_MJD		 = getBits (b, 0, 24, 16);
  UTC_time_UTC		 = getBits (b, 0, 40, 24);
  print_time40 (3, UTC_time_MJD,UTC_time_UTC);
  out_NL (3);

}
Exemplo n.º 4
0
static int teletext_data_field (int v, u_char *b, int len)
{
   int  v1 = v+1;
   int  len2;


   out_nl (v,"Teletext data:");
   indent (+1);

   	ebu_rfl_out (v1,b);
   	outBit_S2x_NL (v1,"frame_coding: ", b, 8, 8,
			(char *(*)(u_long)) dvbstrTELETEXT_framingcode );
	b += 2;
	len -= 2;


	print_databytes (8,"data_block:", b, 42);
	out_nl (v1," => decoded:");
		indent (+1);

		invertBuffer (b, 42);
		len2 = print_teletext_control_decode (v1, b, 42);
		b += len2;
		len -= len2;

		indent (-1);


   indent (-1);
   return 44;
}
Exemplo n.º 5
0
void mpeg_system_header (int v, u_char *b, int len)
{

	/* z.B. H.222 ISO 13818-1 Table 2-34 */
	/* 	ISO 11172-1 system header */


   if (len == 0) return;

   out_nl (v,"System_header: ");
   indent (+1);

   if (len > 0) {
	// -- within PES packet, not PS!
	outBit_Sx_NL (v,"system_header_start_code: ",	b,  0, 32);
   }



   // -- get real length from system_header data
   len = outBit_Sx_NL (v,"header_length: ",	b,  32, 16);

   outBit_Sx_NL (v,"marker_bit: ",		b,  48,  1);
   outBit_Sx_NL (v,"rate_bound: ",		b,  49,  22);
   outBit_Sx_NL (v,"marker_bit: ",		b,  71,  1);
   outBit_Sx_NL (v,"audio_bound: ",		b,  72,  6);
   outBit_Sx_NL (v,"fixed_flag: ",		b,  78,  1);
   outBit_Sx_NL (v,"CSPS_flag: ",		b,  79,  1);
   outBit_Sx_NL (v,"system_audio_lock_flag: ",	b,  80,  1);
   outBit_Sx_NL (v,"system_video_lock_flag: ",	b,  81,  1);
   outBit_Sx_NL (v,"marker_bit: ",		b,  82,  1);
   outBit_Sx_NL (v,"video_bound: ",		b,  83,  5);
   outBit_Sx_NL (v,"packet_rate_restriction_flag: ",	b,  88,  1);
   outBit_Sx_NL (v,"reserved_byte: ",		b,  89,  7);

   b += 12;
   len -= 12;


   // while (nextbits () == '1') {	
   // while  ((bit = getBits (b, 0,0,1)) == 0x01) {
   while  ( (*b & 0x80) ) {
	if (len <= 0)  break;

	out_NL (v);
	outBit_S2x_NL(v,"Stream_id: ",			b,  0,  8,
		 	(char *(*)(u_long))dvbstrPESstream_ID );
   	outBit_Sx_NL (v,"fixed (0x02): ",		b,  8,  2);
   	outBit_Sx_NL (v,"P-STD_buffer_bound_scale: ",	b, 10,  1);
   	outBit_Sx_NL (v,"P-STD_buffer_size_bound: ",	b, 11, 13);

	b   += 3;
	len -= 3;
	if (len < 0)  out_nl (1, "$$$ something wrong here (length<0)");
   }


   indent (-1);
}
Exemplo n.º 6
0
void print_text_468A (int v, const char *s,  u_char *b, u_int len)
{

 out (v, s);

 if (len <= 0) {
    out_nl (v,"\"\"");
 } else {
    out (v,"\"");
    print_text2_468A (v, b,len);
    out (v,"\"");
    out_nl (v,"  -- Charset: %s", dvbstrTextCharset_TYPE (*b));
 }

}
Exemplo n.º 7
0
void  print_xTS_field (int v, const char *str, u_char *b, int bit_offset) 
{
  long long   xTS_32_30;
  long long   xTS_29_15;
  long long   xTS_14_0;
  long long   ull;
  int         bo = bit_offset;
  int         v1 = v+1;


  out_nl (v,"%s:",str);
  indent (+1);

    xTS_32_30 = outBit_Sx_NL (v1,"bit[32..30]: ",	b, bo+0,  3);
                outBit_Sx_NL (v1,"marker_bit: ",	b, bo+3,  1);
    xTS_29_15 = outBit_Sx_NL (v1,"bit[29..15]: ",	b, bo+4, 15);
                outBit_Sx_NL (v1,"marker_bit: ",	b, bo+19, 1);
    xTS_14_0  = outBit_Sx_NL (v1,"bit[14..0]: ",	b, bo+20,15);
                outBit_Sx_NL (v1,"marker_bit: ",	b, bo+35, 1);

    ull = (xTS_32_30<<30) + (xTS_29_15<<15) + xTS_14_0;
    out (v," ==> %s: ", str);
    print_timebase90kHz (v, ull);
    out_NL (v);

  indent (-1);
}
Exemplo n.º 8
0
int  print_PCR_field (int v, const char *str, u_char *b, int bit_offset) 
{
  long long   pcr_H, pcr_L, pcr_Ext;
  long long   ull;
  int         bo = bit_offset;
  int         v1 = v+1;


  out_nl (v,"%s:",str);
  indent (+1);

    pcr_H    = outBit_Sx_NL (v1,"baseH: ",	b, bo+ 0,  1);
    pcr_L    = outBit_Sx_NL (v1,"baseL: ",	b, bo+ 1, 32);
               outBit_Sx_NL (v1,"reserved: ",	b, bo+33,  6);
    pcr_Ext  = outBit_Sx_NL (v1,"extension: ",	b, bo+39,  9);

    ull = (pcr_H << 32) + pcr_L;

    out (v," ==> %s: ", str);
    // print_timebase90kHz (v, ull);
    print_pcr_time (v, ull,pcr_Ext);
    out_NL (v);

  indent (-1);

  return 6;
}
Exemplo n.º 9
0
/*---------------------------------------------------------------------------
 * Purpose:     Prints a usage message to the standard error stream.  If
 *              SNAME is non-null then print only usage information for
 *              that particular switch, otherwise print full usage
 *              information.
 *
 * Programmer:  Robb Matzke
 *              Wednesday, May 31, 2000
 *
 * Modifications:
 *---------------------------------------------------------------------------
 */
void
switch_usage(switches_t *switches, const char *arg0, const char *sname)
{
    size_t      i;
    char        synopsis[256];

    /* Base name of executable */
    const char  *base = strrchr(arg0, '/');
    base = base ? base+1 : arg0;

    if (!sname) {
        sprintf(synopsis, "usage: %s [SWITCHES] [--] [FILES]", base);
        out_line(OUT_STDERR, synopsis);
        out_line(OUT_STDERR, "  Where SWITCHES are:");
    }

    for (i=0; i<switches->nused; i++) {
        switch_t *sw = switches->sw+i;
        if (sname &&
            (!sw->short_name || strcmp(sw->short_name, sname)) &&
            (!sw->long_name || strcmp(sw->long_name, sname))) {
            continue;
        }
        out_line(OUT_STDERR, switch_synopsis(sw, synopsis));
        out_putw(OUT_STDERR, sw->doc_string);
        out_nl(OUT_STDERR);
    }
}
void descriptor_PRIVATE_PremiereDE_ContentOrder (u_char *b)
{
 int  tag, len;

  tag		 = b[0];
  len       	 = b[1];
 
  out_nl (4,"--> Premiere Content Order descriptor ");

  b+=2;
  out_SB_NL (5,"Order_number_length: ", *b);
  print_text_468A (4, "Order_number: ", b+1, *b);
 
  b += *b + 1;
  out_SB_NL (5,"Order_price_length: ", *b);
  print_text_468A (4, "Order_price: ", b+1, *b);
 
  b += *b + 1;
  out_SB_NL (5,"Order_phone_number_length: ", *b);
  print_text_468A (4, "Order_phone_number: ", b+1, *b);
 
  b += *b + 1;
  out_SB_NL (5,"SMS_order_information_length: ", *b);
  print_text_468A (4, "SMS_order_information: ", b+1, *b);
 
  b += *b + 1;
  out_SB_NL (5,"URL_order_information_length: ", *b);
  print_text_468A (4, "URL_order_information: ", b+1, *b);

}
Exemplo n.º 11
0
void processPS_PES_packet (u_int pid, long pkt_nr, u_char *buf, int len)
{
	
  OPTION *opt  = getOptionPtr();
  char *strx   = (opt->packet_mode == PES) ? "PES" : "PS";


       indent (0);
       print_packet_header (opt, strx, opt->pid, pkt_nr, len);


       if (opt->buffer_hexdump) {
           printhex_buf (0, buf, len);
           out_NL(0);
       }


       // decode protocol
       if (opt->printdecode) {
          decodePS_PES_packet (buf, len ,opt->pid);
          out_nl (3,"==========================================================");
          out_NL (3);
       }


}
Exemplo n.º 12
0
void descriptorMHP_AIT_pre_fetch (u_char *b)
{
  int  len;
  int  len2;


  // descriptor_tag	= b[0];
  len		        = b[1];

  outBit_Sx_NL (4,"transport_protcol_label: ",	b+2, 0, 8);
  b += 3;
  len --;

  indent(+1);
  while (len > 0) {
	out_NL (4);
  	len2 = outBit_Sx_NL (4,"label_length: ",	b, 0, 8);
  	print_text_UTF8 (4, "label: ", b+1, len2);
	out_nl (4, "  ==> [= matches DII modul label]");
	b += 1 + len2;
	len -= 1 + len2;

  	outBit_Sx_NL (4,"prefetch_priority: ",	b, 0, 8);
	b++;
	len--;
  }
  indent(-1);

}
Exemplo n.º 13
0
void descriptorMHP_AIT_application_name (u_char *b)
{
  int        len;
  u_char     ISO639_language_code[4];


  // descriptor_tag	= b[0];
  len		        = b[1];
  b += 2;

  indent (+1);
  while (len > 0) {
	int len2;

	getISO639_3 (ISO639_language_code, b);
	out_nl (4,"ISO639_language_code:  %3.3s", ISO639_language_code);

 	len2 = outBit_Sx_NL (4,"application_name_length: ",	b, 24, 8);
 	print_text_468A (4, "application_name: ", b+4, len2);

	b += 4 + len2;
	len -= 4 + len2;

	out_NL (4);
  }
  indent (-1);

}
Exemplo n.º 14
0
long long getBits48 (u_char *buf, int byte_offset, int startbit, int bitlen)
{
 u_char *b;
 unsigned long long v;
 unsigned long long mask;
 unsigned long long tmp;

 if (bitlen > 48) {
	out_nl (1," Error: getBits48() request out of bound!!!! (report!!) \n");
	return 0xFEFEFEFEFEFEFEFELL;
 }
 

 b = &buf[byte_offset + (startbit / 8)];
 startbit %= 8;


 // -- safe is 48 bitlen
 tmp = (unsigned long long)(
	 ((unsigned long long)*(b  )<<48) + ((unsigned long long)*(b+1)<<40) +
	 ((unsigned long long)*(b+2)<<32) + ((unsigned long long)*(b+3)<<24) +
	 (*(b+4)<<16) + (*(b+5)<< 8) + *(b+6) );

 startbit = 56 - startbit - bitlen;
 tmp      = tmp >> startbit;
 mask     = (1ULL << bitlen) - 1;	// 1ULL !!!
 v        = tmp & mask;

 return v;
}
Exemplo n.º 15
0
/*
 * 0x83: Logical Channel Descriptor
 * e-book_ed_2.02 corr-acro.doc
 */
void descriptor_PRIVATE_EictaORG_LogicalChannelDescriptor (u_char *b)
{
	unsigned int len = b[1];
	unsigned int i;

	out_nl(4, "--> eicta.org Logical Channel Descriptor");

	b += 2;

	indent(+1);

	for (i = 0; i < len; i += 4) {
		unsigned int service_id = (b[i] << 8) | b[i + 1];
		unsigned int visible_service_flag = (b[i + 2] >> 7) & 1;
		unsigned int reserved = (b[i + 2] >> 2) & 0x1f;
		unsigned int logical_channel_number = ((b[i + 2] << 8) | b[i + 3]) & 0x3ff;

		out_NL(5);
		out_SW_NL(5, "service_id: ", service_id);
		out_SB_NL(5, "visible_service_flag: ", visible_service_flag);
		out_SB_NL(5, "reserved: ", reserved);
		out_SW_NL(5, "logical_channel_number: ", logical_channel_number);
	}

	indent(-1);
	out_NL(4);
}
Exemplo n.º 16
0
void section_DIT (u_char *b, int len)
{

 typedef struct  _DIT {
    u_int      table_id;
    u_int      section_syntax_indicator;		
    u_int      reserved_1;
    u_int      reserved_2;
    u_int      section_length;
    u_int      transition_flag;
    u_int      reserved_3;

 } DIT;



 DIT        d;

 
 d.table_id 			 = b[0];
 d.section_syntax_indicator	 = getBits (b, 0, 8, 1);
 d.reserved_1 			 = getBits (b, 0, 9, 1);
 d.reserved_2 			 = getBits (b, 0, 10, 2);
 d.section_length		 = getBits (b, 0, 12, 12);
 d.transition_flag		 = getBits (b, 0, 24, 1);
 d.reserved_3 			 = getBits (b, 0, 25, 7);


 out_nl (3,"DIT-decoding....");
 out_S2B_NL (3,"Table_ID: ",d.table_id, dvbstrTableID (d.table_id));
 if (d.table_id != 0x7E) {
   out_nl (3,"wrong Table ID");
   return;
 }

 out_SB_NL (3,"section_syntax_indicator: ",d.section_syntax_indicator);
 out_SB_NL (6,"reserved_1: ",d.reserved_1);
 out_SB_NL (6,"reserved_2: ",d.reserved_2);
 out_SW_NL (5,"Section_length: ",d.section_length);

 out_S2B_NL (3,"transition_flag: ",d.transition_flag,
        (d.transition_flag) ? "due to change of the originating source"
                            : "due to change selection only"); 
 out_SB_NL (6,"reserved_3: ",d.reserved_3);

}
Exemplo n.º 17
0
int BIOP_ModuleInfo (int v, u_char *b, u_int len_org)
{
   int   	len = len_org;
   int 		n1, i;


   	// -- due to some misbehavior of some service providers
   	// -- we do a simple plausi check for tap_counts_min_bytes > len
	i = getBits (b, 0, 96, 8);	// tap_counts
	i = i * 7;

	if (i > len_org) {	// this is no ModuleInfo
		print_databytes (v,"Data Bytes (non-standard):", b, len_org);
		return len_org;
	}




	out_nl (v, "BIOP::ModuleInfo:");

	indent (+1);
	outBit_S2Tx_NL (v,"ModuleTimeOut: ",	b,  0, 32, "(ms)");
	outBit_S2Tx_NL (v,"BlockTimeOut: ",	b, 32, 32, "(ms)");
	outBit_S2Tx_NL (v,"MinBlockTime: ",	b, 64, 32, "(ms)");
	n1 = outBit_Sx_NL (v,"taps_count: ",	b, 96,  8);

	b += 13,
	len -= 13;


	indent (+1);
	while (n1-- > 0) {
		int n2;

		// BIOP_OBJECT_USE
		n2 = BIOP_TAP (v, "DSM", b);
		b += n2;
		len -= n2;

	}
	indent (-1);
	out_NL (v);


	n1 = outBit_Sx_NL (v,"userInfoLength: ",	b,   0,  8);
	// print_databytes (v,"UserInfoData:", b, n1); 

	dsmcc_CarouselDescriptor_Loop ("userInfo", b+1, n1);
	b   += 1+n1;
	len -= 1+n1;


	indent (-1);

	return len_org;
}
Exemplo n.º 18
0
void PES_decodeDATA_EBU_etc (u_char *b, int len)
{
	
   // -- PES_DATA_bytes EBU
   // -- Data Buffer starts at PES_DATA_BYTES...
   // --> see parent

   int  data_identifier;

   out_nl (4,"EBU data:");
   indent (+1);

   data_identifier = outBit_S2x_NL (4,"data_identifier: ",	b, 0, 8,
			(char *(*)(u_long)) dvbstrPESDataIdentifier);
   b++;
   len--;

   while (len > 0) {
	int len2;
	int dui;
	int n=0;


	out_NL (4);
   	dui  = outBit_S2x_NL (4,"data_unit_id: ",	b, 0, 8,
			(char *(*)(u_long)) dvbstrPES_EBUDataUnitID);

   	len2 = outBit_Sx_NL (4,"data_unit_length: ",	b, 8, 8);
	b += 2;
	len -= 2;

	if (dui==0x02 || dui==0x03 || dui==0xC0 || dui==0xC1) {
		n = teletext_data_field (4, b, len2);
	} else if (dui==0xC3) {
		n = vps_data_field(4, b,len2);
	} else if (dui==0xC4) {
		n = wss_data_field (4, b,len2);
	} else if (dui==0xC5) {
		n = closed_caption_data_field (4, b,len2);
	} else if (dui==0xC6) {
		n = monochrome_data_field (4, b,len2);
	} else if (dui==0xFF) {
		/* No data field */
		n = 0;
	}

	if ( (len2-n) > 0 ) {
		print_databytes (4,"stuffing bytes:", b+n, len2-n);
	}

	b += len2;
	len -= len2;
   }


   indent (-1);
}
Exemplo n.º 19
0
int  descriptorMHP_AIT (u_char *b)

{
 int len;
 int tag;



  out_NL (4);
  tag = outBit_S2x_NL (4,"MHP_AIT-DescriptorTag: ",		b,   0,  8,
		(char *(*)(u_long))dsmccStrMHP_AIT_DescriptorTAG); 
  len = outBit_Sx_NL  (4,"descriptor_length: ",	 	b,   8,  8);


  // empty ??
  if (len == 0) return len;

  // print hex buf of descriptor
  printhex_buf (9, b,len+2);



  switch (tag) {

     case 0x00:  descriptorMHP_AIT_application (b); break;
     case 0x01:  descriptorMHP_AIT_application_name (b); break;
     case 0x02:  descriptorMHP_AIT_transport_protocol (b); break;
     case 0x03:  descriptorMHP_AIT_dvb_j_application (b); break;
     case 0x04:  descriptorMHP_AIT_dvb_j_application_location (b); break;
     case 0x05:  descriptorMHP_AIT_external_application_authorisation (b); break;
     // case 0x06: reserved
     // case 0x07: reserved
     case 0x08:  descriptorMHP_AIT_dvb_html_application (b); break;
     case 0x09:  descriptorMHP_AIT_dvb_html_application_location (b); break;
     case 0x0A:  descriptorMHP_AIT_dvb_html_application_boundary (b); break;
     case 0x0B:  descriptorMHP_AIT_application_icons (b); break;
     case 0x0C:  descriptorMHP_AIT_pre_fetch (b); break;
     case 0x0D:  descriptorMHP_AIT_DII_location (b); break;
     case 0x0E:  descriptorMHP_AIT_delegated_application (b); break;
     case 0x0F:  descriptorMHP_AIT_plug_in (b); break;
     case 0x10:  descriptorMHP_AIT_application_storage (b); break;
     case 0x11:  descriptorMHP_AIT_ip_signalling (b); break;

     case 0x5F:  descriptorDVB_PrivateDataSpecifier (b); break;

     default: 
	if (tag < 0x80) {
	    out_nl (0,"  ----> ERROR: unimplemented descriptor (MHP_AIT context), Report!");
	}
	descriptor_PRIVATE (b,MHP_AIT);
	break;
  } 


  return len+2;   // (descriptor total length)
}
void descriptor_PRIVATE_PremiereDE_ParentalInformation (u_char *b)
{
  int  tag, len;
 
  tag		 = b[0];
  len       	 = b[1];
 
  out_nl (4,"--> Premiere Parental Information descriptor ");

  b += 2;
  out_SB_NL (5,"rating: ", *b);
  out_nl    (4,"Controll_time_t1: %02x:%02x:%02x", b[1], b[2], b[3]);
  out_nl    (4,"Controll_time_t2: %02x:%02x:%02x", b[4], b[5], b[6]);
 
  b += 7;
  out_SB_NL (5,"Parental_information_length: ", *b);
  print_text_468A (4, "Parental_information: ", b+1, *b);
 
}
Exemplo n.º 21
0
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);
}
Exemplo n.º 22
0
/*
 * 0x84: Preferred Name List Descriptor
 * e-book_ed_2.02 corr-acro.doc
 */
void descriptor_PRIVATE_EictaORG_PreferredNameListDescriptor (u_char *b)
{
	unsigned int len = b[1];
	unsigned int i, j;

	out_nl(4, "--> eicta.org Preferred Name List Descriptor");

	b += 2;

	indent(+1);

	for (i = 0; i < len; i += 4) {
		unsigned int ISO_639_language_code = (b[i] << 16) | (b[i + 1] << 8) | b[i + 2];
		unsigned int name_count = b[i + 3];

		out_NL(4);
		out_SL_NL(4, "ISO_639_language_code: ", ISO_639_language_code);
		out_SB_NL(4, "name_count: ", name_count);

		indent(+1);

		for (j = 0; j < name_count; j++) {
			unsigned int name_id = b[i + 4];
			unsigned int name_length = b[i + 5];
			const char *name = &b[i + 6];

			out_NL(4);
			out_SB_NL(4, "name_id: ", name_id);
			out_SB_NL(4, "name_length: ", name_length);

			if (name_length > 0)
				out_nl(4, "name: %.s", name_length, name);

			i += name_length + 2;
		}

		indent(-1);
	}

	indent(-1);
	out_NL(4);
}
Exemplo n.º 23
0
void section_ST (u_char *b, int len)
{

 typedef struct  _ST {
    u_int      table_id;
    u_int      section_syntax_indicator;		
    u_int      reserved_1;
    u_int      reserved_2;
    u_int      section_length;

    // N  databytes

 } ST;


 ST s;


 
 s.table_id 			 = b[0];
 s.section_syntax_indicator	 = getBits (b, 0, 8, 1);
 s.reserved_1 			 = getBits (b, 0, 9, 1);
 s.reserved_2 			 = getBits (b, 0, 10, 2);
 s.section_length		 = getBits (b, 0, 12, 12);


 out_nl (3,"ST-decoding....");
 out_S2B_NL (3,"Table_ID: ",s.table_id, dvbstrTableID (s.table_id));
 if (s.table_id != 0x72) {
   out_nl (3,"wrong Table ID");
   return;
 }

 out_SB_NL (3,"section_syntax_indicator: ",s.section_syntax_indicator);
 out_SB_NL (6,"reserved_1: ",s.reserved_1);
 out_SB_NL (6,"reserved_2: ",s.reserved_2);
 out_SW_NL (5,"Section_length: ",s.section_length);

 b += 3;
 print_databytes (3,"Section data:", b, s.section_length);

}
Exemplo n.º 24
0
unsigned long getBits (u_char *buf, int byte_offset, int startbit, int bitlen)
{
 u_char *b;
 unsigned long  v;
 unsigned long mask;
 unsigned long tmp_long;
 int           bitHigh;


 b = &buf[byte_offset + (startbit >> 3)];
 startbit %= 8;

 switch ((bitlen-1) >> 3) {
	 case -1:	// -- <=0 bits: always 0
		return 0L;
		break;

	case 0:		// -- 1..8 bit
 		tmp_long = (unsigned long)(
			(*(b  )<< 8) +  *(b+1) );
		bitHigh = 16;
		break;

	case 1:		// -- 9..16 bit
 		tmp_long = (unsigned long)(
		 	(*(b  )<<16) + (*(b+1)<< 8) +  *(b+2) );
		bitHigh = 24;
		break;

	case 2:		// -- 17..24 bit
 		tmp_long = (unsigned long)(
		 	(*(b  )<<24) + (*(b+1)<<16) +
			(*(b+2)<< 8) +  *(b+3) );
		bitHigh = 32;
		break;

	case 3:		// -- 25..32 bit
			// -- to be safe, we need 32+8 bit as shift range 
		return (unsigned long) getBits48 (b, 0, startbit, bitlen);
		break;

	default:	// -- 33.. bits: fail, deliver constant fail value
		out_nl (1," Error: getBits() request out of bound!!!! (report!!) \n");
		return (unsigned long) 0xFEFEFEFE;
		break;
 }

 startbit = bitHigh - startbit - bitlen;
 tmp_long = tmp_long >> startbit;
 mask     = (1ULL << bitlen) - 1;  // 1ULL !!!
 v        = tmp_long & mask;

 return v;
}
Exemplo n.º 25
0
/*
 * 0x85: Preferred Name Identifier Descriptor
 * e-book_ed_2.02 corr-acro.doc
 */
void descriptor_PRIVATE_EictaORG_PreferredNameIdentifierDescriptor (u_char *b)
{
	out_nl(4, "--> eicta.org Preferred Name Identifier Descriptor");

	indent(+1);

	out_SB_NL(4, "name_id: ", b[2]);

	indent(-1);
	out_NL(4);
}
Exemplo n.º 26
0
/*
 * 0x86: Eacem Stream Identifier Descriptor
 * e-book_ed_2.02 corr-acro.doc
 */
void descriptor_PRIVATE_EictaORG_EacemStreamIdentifierDescriptor (u_char *b)
{
	out_nl(4, "--> eicta.org Eacem Stream Identifier Descriptor");

	indent(+1);

	out_SB_NL(4, "version_byte: ", b[2]);

	indent(-1);
	out_NL(4);
}
Exemplo n.º 27
0
/*-------------------------------------------------------------------------
 * Function:    out_error
 *
 * Purpose:     Prints an error message followed by an object.
 *
 * Return:      void
 *
 * Programmer:  Robb Matzke
 *              [email protected]
 *              Dec 11 1996
 *
 * Modifications:
 *
 *      Robb Matzke, 3 Feb 1997
 *      Changed prefix name from `error' to `***ERROR***' to make it
 *      stand out more.
 *
 *-------------------------------------------------------------------------
 */
void
out_error (const char *mesg, obj_t obj) {

   if (!ErrorDisable) {
      out_reset (OUT_STDERR);
      out_push (OUT_STDERR, "***ERROR***");
      out_putw (OUT_STDERR, mesg);
      obj_print (obj, OUT_STDERR);
      out_pop (OUT_STDERR);
      out_nl (OUT_STDERR);
   }
}
Exemplo n.º 28
0
/*-------------------------------------------------------------------------
 * Function:    out_line
 *
 * Purpose:     Prints S on a line by itself.
 *
 * Return:      Success:        
 *
 *              Failure:        
 *
 * Programmer:  Robb Matzke
 *              [email protected]
 *              Jan 21 1997
 *
 * Modifications:
 *              Robb Matzke, 2000-06-28
 *              Handles embedded linefeeds.
 *-------------------------------------------------------------------------
 */
void
out_line (out_t *f, const char *string)
{
    int         oldlit;
    const char  *s;

    if (out_brokenpipe(f)) return;
    if (isatty (fileno (f->f))) out_progress (NULL);
    oldlit = out_literal (f, true);
    if (f->col) out_nl (f);

    /* The header */
    if (f->header) {
        for (s=f->header; *s; s++) {
            if ('\n'==*s) {
                out_nl(f);
            } else {
                putc(*s, f->f);
                f->col++;
            }
        }
        out_nl(f);
        free(f->header);
        f->header = NULL;
    }
    
    /* The output */
    for (s=string; *s; s++) {
        if ('\n'==*s) {
            out_nl(f);
        } else {
            fputc(*s, f->f);
            f->col++;
        }
    }

    /* The trailing line-feed */
    out_nl(f);
    out_literal (f, oldlit);
}
Exemplo n.º 29
0
void  print_packet_header (OPTION *opt, char *packetTyp, u_int pid, int count, int length)

{
   char  str[50];
   char  *s;


   if (pid != DUMMY_PID) {
   	sprintf (str,"%u (0x%04x)",pid,pid);
	s = str;
   } else {
	s = "(Unkown PID)";
   }

   // Full Transport Stream Read?
   if (opt->ts_raw_mode && (opt->packet_mode == TS)) {
	s = "(Full TS read)";
   }


   out_nl (1,"\n------------------------------------------------------------");
   out_nl (1,"%s-Packet: %08ld   PID: %s, Length: %d (0x%04x)",
		packetTyp, count, s, length,length);

   if (opt->inpPidFile) {
   	out_nl (1,"from file: %s",opt->inpPidFile);
   } else {
   	out_receive_time (1, opt);
   }

//   if (skipped_bytes) {
//       out_nl (1,"Syncing %s... (%ld bytes skipped)",
//		packetTyp,skipped_bytes);
//   }

   out_nl (1,"------------------------------------------------------------");


}
Exemplo n.º 30
0
static int vps_data_field (int v, u_char *b, int len)
{
   int  v1 = v+1;

   out_nl (v,"VPS (Video Programming System) data:");
   indent (+1);

   	ebu_rfl_out (v1,b);
	print_vps_decode (v1, b+1, 13);

   indent (-1);
   return 14;
}