Exemplo n.º 1
0
void process_service_block (cc708_service_decoder *decoder, unsigned char *data, int data_length)
{
  int i=0;
  while (i<data_length)
  {
    int used=-1;
    if (data[i]!=EXT1)
    {
      // Group C0
      if (/* data[i]>=0x00 && */ data[i]<=0x1F) // Comment to silence warning
      {
        used=handle_708_C0 (decoder,data+i,data_length-i);
      }
      // Group G0
      else if (data[i]>=0x20 && data[i]<=0x7F)
      {
        used=handle_708_G0 (decoder,data+i,data_length-i);
      }
      // Group C1
      else if (data[i]>=0x80 && data[i]<=0x9F)
      {
        used=handle_708_C1 (decoder,data+i,data_length-i);
      }
      // Group C2
      else
        used=handle_708_G1 (decoder,data+i,data_length-i);
      if (used==-1)
      {
        //! @todo Not sure if a local reset is going to be helpful here.
        cc708_service_reset (decoder);
        return;
      }
    }
    else // Use extended set
    {
      used=handle_708_extended_char (decoder, data+i+1,data_length-1);
      used++; // Since we had EXT1
    }
    i+=used;
  }

  // update rollup windows
  int update = 0;
  for (int i = 0; i<I708_MAX_WINDOWS; i++)
  {
    if (decoder->windows[i].is_defined && decoder->windows[i].visible &&
      (decoder->windows[i].anchor_point == anchorpoint_bottom_left ||
      decoder->windows[i].anchor_point == anchorpoint_bottom_center))
    {
      update++;
      break;
    }
  }
  if (update)
  {
    updateScreen(decoder);
  }
}
Exemplo n.º 2
0
Arquivo: 708.cpp Projeto: MrMdR/julapy
void process_service_block (cc708_service_decoder *decoder, unsigned char *data, int data_length)
{
    int i=0;    
    while (i<data_length)
    {
        if (data[i]==EXT1) // Use extended set
        {            
            handle_708_extended_char (decoder, data[i+1]);
            i+=2;
            continue;
        } 
        int used=-1;
        // Group C0
        if (/* data[i]>=0x00 && */ data[i]<=0x1F) // Comment to silence warning
        {
            used=handle_708_C0 (decoder,data+i,data_length-i);
        }
        // Group G0
        else if (data[i]>=0x20 && data[i]<=0x7F)
        {
            used=handle_708_G0 (decoder,data+i,data_length-i);
        }
        // Group C1
        else if (data[i]>=0x80 && data[i]<=0x9F)
        {
            used=handle_708_C1 (decoder,data+i,data_length-i);
        }
        // Group C2
        else
            used=handle_708_G1 (decoder,data+i,data_length-i);
        if (used==-1)
        {
            printf ("There was a problem handling the data. Reseting service decoder\n");
            // TODO: Not sure if a local reset is going to be helpful here.
            cc708_service_reset (decoder);
            return;   
        }
        i+=used; 
    }
}