コード例 #1
0
ファイル: 708.cpp プロジェクト: MrMdR/julapy
void cc708_reset()
{
    printf (">>> Entry in cc708_reset()\n");
    // Clear states of decoders
    cc708_service_reset(&decoders[0]);
    cc708_service_reset(&decoders[1]);
    // Empty packet buffer
    clear_packet();
    last_seq=-1; 
    resets_708++;
}
コード例 #2
0
ファイル: cc_decoder708.cpp プロジェクト: Arcko/xbmc
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);
  }
}
コード例 #3
0
ファイル: cc_decoder708.cpp プロジェクト: Arcko/xbmc
void cc708_reset(cc708_service_decoder *decoders)
{
  for (int i = 0; i<CCX_DECODERS_708_MAX_SERVICES; i++)
  {
    cc708_service_reset (&decoders[i]);
  }
  // Empty packet buffer
  clear_packet(&decoders[0]);
  decoders[0].parent->m_last_seq = -1;
}
コード例 #4
0
ファイル: cc_decoder708.cpp プロジェクト: Arcko/xbmc
void ccx_decoders_708_init(cc708_service_decoder *decoders, void (*handler)(int service, void *userdata), void *userdata, CDecoderCC708 *parent)
{
  for (int i = 0; i<CCX_DECODERS_708_MAX_SERVICES; i++)
  {
    cc708_service_reset (&decoders[i]);
    decoders[i].srt_counter=0;
    decoders[i].service = i;
    decoders[i].callback = handler;
    decoders[i].userdata = userdata;
    decoders[i].parent = parent;
  }
  decoders[0].parent->m_cc608decoder->callback = handler;
  decoders[0].parent->m_cc608decoder->userdata = userdata;

  decoders[0].parent->m_current_packet_length = 0;
  decoders[0].parent->m_last_seq = -1;
  decoders[0].parent->m_seen708 = false;
  decoders[0].parent->m_seen608 = false;
}
コード例 #5
0
ファイル: 708.cpp プロジェクト: 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; 
    }
}
コード例 #6
0
ファイル: cc_decoder708.cpp プロジェクト: Arcko/xbmc
// C1 Code Set - Captioning Commands Control Codes
int handle_708_C1 (cc708_service_decoder *decoder, unsigned char *data, int data_length)
{
  struct S_COMMANDS_C1 com=COMMANDS_C1[data[0]-0x80];
  if (com.length>data_length)
  {
    return -1;
  }
  switch (com.code)
  {
  case CW0: /* SetCurrentWindow */
  case CW1:
  case CW2:
  case CW3:
  case CW4:
  case CW5:
  case CW6:
  case CW7:
    handle_708_CWx_SetCurrentWindow (decoder, com.code-CW0); /* Window 0 to 7 */
    break;
  case CLW:
    handle_708_CLW_ClearWindows (decoder, data[1]);
    break;
  case DSW:
    handle_708_DSW_DisplayWindows (decoder, data[1]);
    break;
  case HDW:
    handle_708_HDW_HideWindows (decoder, data[1]);
    break;
  case TGW:
    handle_708_TGW_ToggleWindows (decoder, data[1]);
    break;
  case DLW:
    handle_708_DLW_DeleteWindows (decoder, data[1]);
    break;
  case DLY:
    handle_708_DLY_Delay (decoder, data[1]);
    break;
  case DLC:
    handle_708_DLC_DelayCancel (decoder);
    break;
  case RST:
    cc708_service_reset(decoder);
    break;
  case SPA:
    handle_708_SPA_SetPenAttributes (decoder, data);
    break;
  case SPC:
    handle_708_SPC_SetPenColor (decoder, data);
    break;
  case SPL:
    handle_708_SPL_SetPenLocation (decoder, data);
    break;
  case RSV93:
  case RSV94:
  case RSV95:
  case RSV96:
    break;
  case SWA:
    handle_708_SWA_SetWindowAttributes (decoder, data);
    break;
  case DF0:
  case DF1:
  case DF2:
  case DF3:
  case DF4:
  case DF5:
  case DF6:
  case DF7:
    handle_708_DFx_DefineWindow (decoder, com.code-DF0, data); /* Window 0 to 7 */
    break;
  default:
    break;
  }

  return com.length;
}
コード例 #7
0
ファイル: 708.cpp プロジェクト: MrMdR/julapy
int handle_708_C1 (cc708_service_decoder *decoder, unsigned char *data, int data_length)
{
    S_COMMANDS_C1 com=COMMANDS_C1[data[0]-0x80];
    printf ("%s | C1: [%02X]  [%s] [%s] (%d)\n",
        print_mstime(get_fts()),
        data[0],com.name,com.description, com.length);    
    if (com.length>data_length)
    {
        printf ("C1: Warning: Not enough bytes for command.\n");
        return -1;
    }
    switch (com.code)
    {
        case CW0: /* SetCurrentWindow */
        case CW1:
        case CW2:
        case CW3:
        case CW4:
        case CW5:
        case CW6:
        case CW7:
            handle_708_CWx_SetCurrentWindow (decoder, com.code-CW0); /* Window 0 to 7 */
            break;
        case CLW:
            handle_708_CLW_ClearWindows (decoder, data[1]); 
            break;
        case DSW:
            handle_708_DSW_DisplayWindows (decoder, data[1]);
            break;
        case HDW:
            handle_708_HDW_HideWindows (decoder, data[1]);
            break;
        case TGW:
            handle_708_TGW_ToggleWindows (decoder, data[1]);
            break;
        case DLW:
            handle_708_DLW_DeleteWindows (decoder, data[1]);
            break;
        case DLY:
            handle_708_DLY_Delay (decoder, data[1]);
            break;
        case DLC:
            handle_708_DLC_DelayCancel (decoder);
            break;
        case RST:
            cc708_service_reset(decoder);
            break;
        case SPA:
            handle_708_SPA_SetPenAttributes (decoder, data);
            break;
        case SPC:
            handle_708_SPC_SetPenColor (decoder, data);
            break;
        case SPL:
            handle_708_SPL_SetPenLocation (decoder, data);
            break;            
        case RSV93:
        case RSV94:
        case RSV95:
        case RSV96:
            printf ("Warning, found Reserved codes, ignored.\n");
            break;
        case SWA:
            handle_708_SWA_SetWindowAttributes (decoder, data);
            break;            
        case DF0:
        case DF1:
        case DF2:
        case DF3:
        case DF4:
        case DF5:
        case DF6:
        case DF7:
            handle_708_DFx_DefineWindow (decoder, com.code-DF0, data); /* Window 0 to 7 */
            break;            
        default:
            printf ("BUG: Unhandled code in handle_708_C1.\n");
            break;            
    }
    
    return com.length;
}