bool Responder::Configure( const Configuration * inputJson )
    {
        initConfig( "Threshold_Type", m_ThresholdType, inputJson, MetadataDescriptor::Enum( "ThresholdType", ICE_Threshold_Type_DESC_TEXT, MDD_ENUM_ARGS( ThresholdType ) ) );

        initConfigComplexType( "Action_List", &m_ActionList, ICE_Action_List_DESC_TEXT );

        bool ret = JsonConfigurable::Configure( inputJson );
        if( ret && !JsonConfigurable::_dryrun )
        {
            CheckConfiguration( inputJson );
            m_ActionList.CheckConfiguration();
        }
        return ret;
    }
Example #2
0
EHCIDevice::EHCIDevice(EHCIController& controller) 
  : _controller(controller),
    _pControlQH(controller.CreateDeviceQueueHead(64, 0, 0)),
    _bFirstBulkRead(true), _bFirstBulkWrite(true)
{
  if(!SetAddress())
    throw upan::exception(XLOC, "SetAddress Failed");

	USBStandardDeviceDesc devDesc;
  if(!GetDeviceDescriptor(&devDesc))
    throw upan::exception(XLOC, "GetDevDesc Failed");
  devDesc.DebugPrint();

	char bConfigValue = 0;
  if(!GetConfigValue(bConfigValue))
    throw upan::exception(XLOC, "GetConfigVal Failed") ;
	printf("\n ConfifValue: %d", bConfigValue) ;

  if(!CheckConfiguration(bConfigValue, devDesc.bNumConfigs))
    throw upan::exception(XLOC, "CheckConfig Failed");

  if(!GetConfigDescriptor(devDesc.bNumConfigs, &_pArrConfigDesc))
    throw upan::exception(XLOC, "GeConfigDesc Failed");

	USBDataHandler_CopyDevDesc(&_deviceDesc, &devDesc, sizeof(USBStandardDeviceDesc)) ;

  if(GetStringDescriptorZero())
	  SetLangId();
  else
//    throw upan::exception(XLOC, "GetStringDescZero Failed");
    printf("\n String DESC not supported!");
	_iConfigIndex = 0 ;

	for(int i = 0; i < devDesc.bNumConfigs; i++)
	{
		if(_pArrConfigDesc[ i ].bConfigurationValue == bConfigValue)
		{
			_iConfigIndex = i;
			break ;
		}
	}
	
  GetDeviceStringDesc(_manufacturer, _deviceDesc.indexManufacturer);
  GetDeviceStringDesc(_product, _deviceDesc.indexProduct);
  GetDeviceStringDesc(_serialNum, _deviceDesc.indexSerialNum);
  PrintDeviceStringDetails();
}
Example #3
0
bool CRetroPlayerVideo::ProcessFrame(const VideoFrame &frame)
{
  DVDVideoPicture *pPicture = CDVDCodecUtils::AllocatePicture(frame.meta.width, frame.meta.height);
  try
  {
    if (!pPicture)
    {
      CLog::Log(LOGERROR, "RetroPlayerVideo: Failed to allocate picture");
      throw false;
    }

    pPicture->dts            = DVD_NOPTS_VALUE;
    pPicture->pts            = DVD_NOPTS_VALUE;
    pPicture->format         = RENDER_FMT_YUV420P; // PIX_FMT_YUV420P
    pPicture->color_range    = 0; // *not* CONF_FLAGS_YUV_FULLRANGE
    pPicture->color_matrix   = 4; // CONF_FLAGS_YUVCOEF_BT601
    pPicture->iFlags         = DVP_FLAG_ALLOCATED;
    pPicture->iDisplayWidth  = frame.meta.width; // iWidth was set in AllocatePicture()
    pPicture->iDisplayHeight = frame.meta.height; // iHeight was set in AllocatePicture()
    pPicture->iDuration      = 1.0 / m_framerate;

    // Got the picture, now make sure we're ready to render it
    if (!CheckConfiguration(*pPicture))
      throw false;

    // CheckConfiguration() should have set up our SWScale context
    if (!m_swsContext)
    {
      CLog::Log(LOGERROR, "RetroPlayerVideo: Failed to grab SWScale context, bailing");
      throw false;
    }

    ColorspaceConversion(frame, *pPicture);

    // Get ready to drop the picture off on RenderManger's doorstep
    if (!g_renderManager.IsStarted())
    {
      CLog::Log(LOGERROR, "RetroPlayerVideo: Renderer not started, bailing");
      throw false;
    }

    const double sleepTime = 0; // TODO: How is this calculated in DVDPlayer?
    int buffer = g_renderManager.WaitForBuffer(m_bStop, std::max(DVD_TIME_TO_MSEC(sleepTime) + 500, 0));
    // If buffer < 0, there was a timeout waiting for buffer, drop the frame
    if (buffer >= 0)
    {
      int index = g_renderManager.AddVideoPicture(*pPicture);
      // If index < 0, video device might not be done yet, drop the frame
      if (index >= 0)
        g_renderManager.FlipPage(CThread::m_bStop);
    }
  }
  catch (bool result)
  {
    if (pPicture)
      CDVDCodecUtils::FreePicture(pPicture);
    return result;
  }

  CDVDCodecUtils::FreePicture(pPicture);
  return true;
}