Esempio n. 1
0
void parse_nit_ts_descriptor(unsigned char* buf, int ts_descriptors_loop_len, mumudvb_channel_t* channels, int number_of_channels)
{
  int descriptors_loop_len;
  nit_ts_t *descr_header;
  int ts_id;
  while (ts_descriptors_loop_len > 0)
  {
    descr_header=(nit_ts_t *)(buf);
    descriptors_loop_len=HILO(descr_header->transport_descriptors_length);
    log_message( log_module, MSG_FLOOD, " --- NIT ts_descriptors_loop_len %d descriptors_loop_len %d\n", ts_descriptors_loop_len, descriptors_loop_len);
    ts_id=HILO(descr_header->transport_stream_id);
    log_message( log_module, MSG_DEBUG, " --- NIT descriptor concerning the multiplex %d\n", ts_id);
    buf +=NIT_TS_LEN;
    ts_descriptors_loop_len -= (descriptors_loop_len+NIT_TS_LEN);
    while (descriptors_loop_len > 0)
    {
      unsigned char descriptor_tag = buf[0];
      unsigned char descriptor_len = buf[1] + 2;

      if (!descriptor_len)
      {
        log_message( log_module, MSG_DEBUG, " --- NIT descriptor --- descriptor_tag == 0x%02x, len is 0\n", descriptor_tag);
        break;
      }
      if(descriptor_tag==0x83)
	parse_lcn_descriptor(buf, channels, number_of_channels);
      else if(descriptor_tag==0x41)
        parse_service_list_descriptor_descriptor(buf);
      else if(descriptor_tag==0x43)
        parse_satellite_delivery_system_descriptor(buf);
      else if(descriptor_tag==0x44)
        parse_cable_delivery_system_descriptor(buf);
      else if(descriptor_tag==0x4a)
        parse_linkage_descriptor(buf);
      else if(descriptor_tag==0x5A)
        parse_terrestrial_delivery_system_descriptor(buf);
      else if(descriptor_tag==0x62)
        parse_frequency_list_descriptor(buf);
      /*else if(descriptor_tag==0x79)
        parse_S2_satellite_delivery_system_descriptor(buf); */
      else if(descriptor_tag==0x88)
        parse_HD_simulcast_lcn_descriptor(buf, channels, number_of_channels);
      else
        log_message( log_module, MSG_FLOOD, " --- NIT descriptor --- descriptor_tag == 0x%02x len %d descriptors_loop_len %d ------------\n", descriptor_tag, descriptor_len, descriptors_loop_len);
      buf += descriptor_len;
      descriptors_loop_len -= descriptor_len;
    }

  }
}
static BOOL parse_tfcas_codedownload_descriptor( u8* pBuf, u8  DescLength,
                                                update_t *p_up_info )
{
  BOOL    bErr = FALSE;
  u8*     pData = pBuf;
  s32     Length = DescLength;
  u16     ManufactureID = 0;
  u8      private_data_len = 0;
  cable_tp_info_t cable_tp_info = {0,};
  
#ifndef WIN32
#ifdef CAS_CONFIG_CDCAS
    extern RET_CODE cas_get_platformid(cas_module_id_t cam_id, u16 *platformid);
#endif
#endif

  if( pData != NULL && p_up_info != NULL )
  {
    ManufactureID = ( ( ( u16 ) pData[0] ) << 8 ) | pData[1];
#ifndef WIN32
#ifdef CAS_CONFIG_CDCAS
      cas_get_platformid(CAS_ID_TF, &plat_id);
#endif
#endif
    OS_PRINTF("[Update] ManufactureID=0x%x;ManufactureID=0x%x, PlatID=0x%x\n",ManufactureID, ManufactureID_KINGVON, plat_id);
    if(ManufactureID_KINGVON == ManufactureID)
    {
      //skip manufacture id
      Length -= 2;
      pData += 2;

      while( Length > 0 )
      {
        //skip cable delivery tag and len
        pData +=2;
        Length -=2;
        
        parse_cable_delivery_system_descriptor( pData, &cable_tp_info );
        OS_PRINTF("[Update] Down freq=%d,Qam=%d,Sym=%d\n", 
                      cable_tp_info.frequency,
                      cable_tp_info.modulation,
                      cable_tp_info.symbol_rate );
        
        //p_up_info->oui = ManufactureID;
        p_up_info->symbol = cable_tp_info.symbol_rate;
        p_up_info->freq = cable_tp_info.frequency;
        p_up_info->qam_mode = cable_tp_info.modulation;
        //skip cable delivery body
        pData += 11;
        Length -= 11;

        p_up_info->data_pid = (u16)(((pData[0]<<8)|(pData[1]&0xF8))>>3);
        OS_PRINTF("[Update] data_pid=0x%x\n",p_up_info->data_pid);
        p_up_info->ota_type = pData[1] & 0x7;
        OS_PRINTF("[Update] ota_type=0x%x\n",p_up_info->ota_type);
        private_data_len = pData[2];
        /*skip the Private_data_Len and pid */
        pData += 3;
        Length -= 3;

        /*Next is private data*/
        //Hardware_version
        p_up_info->hwVersion = make32(&pData[0]);
        OS_PRINTF("[Update] hwVersion=0x%x\n",p_up_info->hwVersion);
        Length -= 4;
        pData += 4;

        //Software_version
        p_up_info->swVersion = make32(&pData[0]);
        OS_PRINTF("[Update] swVersion=0x%x\n",p_up_info->swVersion);
        Length -= 4;
        pData += 4;
        
        //platform id
        p_up_info->plat_id = make32(&pData[0]);
        OS_PRINTF("[Update] plat_id=0x%x\n",p_up_info->plat_id);
        Length -= 4;
        pData += 4;

        return TRUE;
      }
    }