示例#1
0
// 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;
}
示例#2
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;
}