当前位置: 首页>>代码示例>>C++>>正文


C++ CurrentHostFrequency函数代码示例

本文整理汇总了C++中CurrentHostFrequency函数的典型用法代码示例。如果您正苦于以下问题:C++ CurrentHostFrequency函数的具体用法?C++ CurrentHostFrequency怎么用?C++ CurrentHostFrequency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CurrentHostFrequency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CurrentHostFrequency

OMXClock::OMXClock()
{
  m_dllAvFormat.Load();

  m_video_clock = DVD_NOPTS_VALUE;
  m_audio_clock = DVD_NOPTS_VALUE;
  m_has_video   = false;
  m_has_audio   = false;
  m_play_speed  = 1;
  m_pause       = false;
  m_iCurrentPts = DVD_NOPTS_VALUE;

  m_systemFrequency = CurrentHostFrequency();
  m_systemUsed = m_systemFrequency;
  m_pauseClock = 0;
  m_bReset = true;
  m_iDisc = 0;
  m_maxspeedadjust = 0.0;
  m_speedadjust = false;
  m_ismasterclock = true;
  m_ClockOffset = 0;
  m_fps = 25.0f;

  pthread_mutex_init(&m_lock, NULL);

  CheckSystemClock();

  OMXReset();
}
开发者ID:Bengt,项目名称:omxplayer,代码行数:29,代码来源:OMXClock.cpp

示例2: if

void CVideoSyncDRM::EventHandler(int fd, unsigned int frame, unsigned int sec,
                                 unsigned int usec, void *data)
{
  drmVBlank vbl;
  VblInfo *info = (VblInfo*)data;
  int crtc = g_Windowing.GetCrtc();

  vbl.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
  if (crtc == 1)
  {
    vbl.request.type = (drmVBlankSeqType)(vbl.request.type | DRM_VBLANK_SECONDARY);
  }
  else if (crtc > 1)
  {
    vbl.request.type = (drmVBlankSeqType)(vbl.request.type |
                       ((crtc << DRM_VBLANK_HIGH_CRTC_SHIFT) & DRM_VBLANK_HIGH_CRTC_MASK));
  }
  vbl.request.sequence = 1;
  vbl.request.signal = (unsigned long)data;

  drmWaitVBlank(info->videoSync->m_fd, &vbl);

  uint64_t now = CurrentHostCounter();
  float diff = (float)(now - info->start)/CurrentHostFrequency();
  int vblanks = MathUtils::round_int(diff * info->videoSync->m_fps);
  info->start = now;

  info->videoSync->UpdateClock(vblanks, now);
}
开发者ID:Jmend25,项目名称:boxeebox-xbmc,代码行数:29,代码来源:VideoSyncDRM.cpp

示例3: CurrentHostFrequency

OMXClock::OMXClock()
{
  m_dllAvFormat.Load();

  m_video_clock = DVD_NOPTS_VALUE;
  m_audio_clock = DVD_NOPTS_VALUE;
  m_has_video   = false;
  m_has_audio   = false;
  m_play_speed  = 1 * OMX_SLOMO_MULTIPLIER;     // Adjusting initial speed for normal video playback, so it can accomodate the new slow motion range
  m_pause       = false;
  m_iCurrentPts = DVD_NOPTS_VALUE;

  m_systemFrequency = CurrentHostFrequency();
  m_systemUsed = m_systemFrequency;
  m_pauseClock = 0;
  m_bReset = true;
  m_iDisc = 0;
  m_maxspeedadjust = 0.0;
  m_speedadjust = false;
  m_ismasterclock = true;
  m_ClockOffset = 0;
  m_fps = 25.0f;

  pthread_mutex_init(&m_lock, NULL);

  CheckSystemClock();

  OMXReset();
}
开发者ID:mikecernio,项目名称:omxplayer,代码行数:29,代码来源:OMXClock.cpp

示例4: avc_parse_nal_units

int CDVDVideoCodecVDA::Decode(BYTE* pData, int iSize, double dts, double pts)
{
  CCocoaAutoPool pool;
  //
  if (pData)
  {
    OSStatus status;
    double sort_time;
    uint32_t avc_flags = 0;
    CFDataRef avc_demux;
    CFDictionaryRef avc_time;

    if (m_convert_bytestream)
    {
      // convert demuxer packet from bytestream (AnnexB) to bitstream
      ByteIOContext *pb;
      int demuxer_bytes;
      uint8_t *demuxer_content;

      if(m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
      {
        return VC_ERROR;
      }
      demuxer_bytes = avc_parse_nal_units(m_dllAvFormat, pb, pData, iSize);
      demuxer_bytes = m_dllAvFormat->url_close_dyn_buf(pb, &demuxer_content);
      avc_demux = CFDataCreate(kCFAllocatorDefault, demuxer_content, demuxer_bytes);
      m_dllAvUtil->av_free(demuxer_content);
    }
    else
    {
      avc_demux = CFDataCreate(kCFAllocatorDefault, pData, iSize);
    }
    sort_time = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();
    avc_time = CreateDictionaryWithDisplayTime(sort_time - m_sort_time_offset, dts, pts);

    if (m_DropPictures)
      avc_flags = kVDADecoderDecodeFlags_DontEmitFrame;

    status = m_dll->VDADecoderDecode((VDADecoder)m_vda_decoder, avc_flags, avc_demux, avc_time);
    CFRelease(avc_time);
    CFRelease(avc_demux);
    if (status != kVDADecoderNoErr)
    {
      CLog::Log(LOGNOTICE, "%s - VDADecoderDecode failed, status(%d)", __FUNCTION__, (int)status);
      return VC_ERROR;
    }
  }

  // TODO: queue depth is related to the number of reference frames in encoded h.264.
  // so we need to buffer until we get N ref frames + 1.
  if (m_queue_depth < 4)
  {
    return VC_BUFFER;
  }

  return VC_PICTURE | VC_BUFFER;
}
开发者ID:bobo1on1,项目名称:xbmc,代码行数:57,代码来源:DVDVideoCodecVDA.cpp

示例5: while

void CDVDVideoCodecVDA::Reset(void)
{
  CCocoaAutoPool pool;
  m_dll->VDADecoderFlush((VDADecoder)m_vda_decoder, 0);

  while (m_queue_depth)
    DisplayQueuePop();

  m_sort_time_offset = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();
}
开发者ID:RoboSK,项目名称:xbmc,代码行数:10,代码来源:DVDVideoCodecVDA.cpp

示例6: CurrentHostFrequency

double AEDelayStatus::GetDelay()
{
  double d = 0;
  if (tick)
    d = (double)(CurrentHostCounter() - tick) / CurrentHostFrequency();
  if (d > maxcorrection)
    d = maxcorrection;

  return delay - d;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:10,代码来源:AEUtil.cpp

示例7: CurrentHostFrequency

void CVideoSyncD3D::Run(CEvent& stopEvent)
{
  int64_t Now;
  int64_t LastVBlankTime;
  int NrVBlanks;
  double VBlankTime;
  int64_t systemFrequency = CurrentHostFrequency();

  // init the vblanktime
  Now = CurrentHostCounter();
  LastVBlankTime = Now;
  m_lastUpdateTime = Now - systemFrequency;
  while (!stopEvent.Signaled() && !m_displayLost && !m_displayReset)
  {
    // sleep until vblank
    Microsoft::WRL::ComPtr<IDXGIOutput> pOutput;
    DX::DeviceResources::Get()->GetOutput(&pOutput);
    HRESULT hr = pOutput->WaitForVBlank();

    // calculate how many vblanks happened
    Now = CurrentHostCounter();
    VBlankTime = (double)(Now - LastVBlankTime) / (double)systemFrequency;
    NrVBlanks = MathUtils::round_int(VBlankTime * m_fps);

    // update the vblank timestamp, update the clock and send a signal that we got a vblank
    UpdateClock(NrVBlanks, Now, m_refClock);

    // save the timestamp of this vblank so we can calculate how many vblanks happened next time
    LastVBlankTime = Now;

    if ((Now - m_lastUpdateTime) >= systemFrequency)
    {
      float fps = m_fps;
      if (fps != GetFps())
        break;
    }

    // because we had a vblank, sleep until half the refreshrate period because i think WaitForVBlank block any rendering stuf
    // without sleeping we have freeze rendering
    int SleepTime = (int)((LastVBlankTime + (systemFrequency / MathUtils::round_int(m_fps) / 2) - Now) * 1000 / systemFrequency);
    if (SleepTime > 50)
      SleepTime = 50; //failsafe
    if (SleepTime > 0)
      ::Sleep(SleepTime);
  }

  m_lostEvent.Set();
  while (!stopEvent.Signaled() && m_displayLost && !m_displayReset)
  {
    Sleep(10);
  }
}
开发者ID:ssfdre38,项目名称:xbmc,代码行数:52,代码来源:VideoSyncD3D.cpp

示例8: SetVSyncImpl

void CRenderSystemGLES::SetVSync(bool enable)
{
  if (m_bVSync==enable && m_bVsyncInit == true)
    return;

  if (!m_bRenderCreated)
    return;
  
  if (enable)
    CLog::Log(LOGINFO, "GLES: Enabling VSYNC");
  else
    CLog::Log(LOGINFO, "GLES: Disabling VSYNC");

  m_iVSyncMode   = 0;
  m_iVSyncErrors = 0;
  m_iSwapRate    = 0;
  m_bVSync       = enable;
  m_bVsyncInit   = true;

  SetVSyncImpl(enable);
  
  if (!enable)
    return;

  if (g_advancedSettings.m_ForcedSwapTime != 0.0)
  {
    /* some hardware busy wait on swap/glfinish, so we must manually sleep to avoid 100% cpu */
    double rate = g_graphicsContext.GetFPS();
    if (rate <= 0.0 || rate > 1000.0)
    {
      CLog::Log(LOGWARNING, "Unable to determine a valid horizontal refresh rate, vsync workaround disabled %.2g", rate);
      m_iSwapRate = 0;
    }
    else
    {
      int64_t freq;
      freq = CurrentHostFrequency();
      m_iSwapRate   = (int64_t)((double)freq / rate);
      m_iSwapTime   = (int64_t)(0.001 * g_advancedSettings.m_ForcedSwapTime * freq);
      m_iSwapStamp  = 0;
      CLog::Log(LOGINFO, "GLES: Using artificial vsync sleep with rate %f", rate);
      if(!m_iVSyncMode)
        m_iVSyncMode = 1;
    }
  }
    
  if (!m_iVSyncMode)
    CLog::Log(LOGERROR, "GLES: Vertical Blank Syncing unsupported");
  else
    CLog::Log(LOGINFO, "GLES: Selected vsync mode %d", m_iVSyncMode);
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:51,代码来源:RenderSystemGLES.cpp

示例9:

CStopWatch::CStopWatch(bool useFrameTime /*=false*/)
{
  m_timerPeriod      = 0.0f;
  m_startTick        = 0;
  m_isRunning        = false;
  m_useFrameTime     = useFrameTime;

#ifdef TARGET_POSIX
  m_timerPeriod = 1.0f / 1000.0f; // we want seconds
#else
  if (m_useFrameTime)
    m_timerPeriod = 1.0f / 1000.0f; //frametime is in milliseconds
  else
    m_timerPeriod = 1.0f / (float)CurrentHostFrequency();
#endif
}
开发者ID:CEikermann,项目名称:xbmc,代码行数:16,代码来源:Stopwatch.cpp

示例10: CurrentHostCounter

void CVideoSyncAndroid::FrameCallback(int64_t frameTimeNanos)
{
  int           NrVBlanks;
  double        VBlankTime;
  int64_t       nowtime = CurrentHostCounter();
  
  //calculate how many vblanks happened
  VBlankTime = (double)(nowtime - m_LastVBlankTime) / (double)CurrentHostFrequency();
  NrVBlanks = MathUtils::round_int(VBlankTime * m_fps);

  //save the timestamp of this vblank so we can calculate how many happened next time
  m_LastVBlankTime = nowtime;
  
  //update the vblank timestamp, update the clock and send a signal that we got a vblank
  UpdateClock(NrVBlanks, nowtime, m_refClock);
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:16,代码来源:VideoSyncAndroid.cpp

示例11: CThread

CVideoReferenceClock::CVideoReferenceClock() : CThread("RefClock")
{
  m_SystemFrequency = CurrentHostFrequency();
  m_ClockSpeed = 1.0;
  m_TotalMissedVblanks = 0;
  m_UseVblank = false;

  m_CurrTime = 0;
  m_LastIntTime = 0;
  m_CurrTimeFract = 0.0;
  m_RefreshRate = 0.0;
  m_MissedVblanks = 0;
  m_VblankTime = 0;

  Start();
}
开发者ID:adriancuzman,项目名称:xbmc,代码行数:16,代码来源:VideoReferenceClock.cpp

示例12: CThread

CVideoReferenceClock::CVideoReferenceClock() : CThread("RefClock")
{
  m_SystemFrequency = CurrentHostFrequency();
  m_ClockSpeed = 1.0;
  m_ClockOffset = 0;
  m_TotalMissedVblanks = 0;
  m_UseVblank = false;

  m_CurrTime = 0;
  m_LastIntTime = 0;
  m_CurrTimeFract = 0.0;
  m_fineadjust = 0.0;
  m_RefreshRate = 0.0;
  m_MissedVblanks = 0;
  m_VblankTime = 0;

  m_pVideoSync = nullptr;
}
开发者ID:JamesLinEngineer,项目名称:RKMC,代码行数:18,代码来源:VideoReferenceClock.cpp

示例13: CurrentHostCounter

bool CRenderSystemGL::PresentRender(const CDirtyRegionList& dirty)
{
  if (!m_bRenderCreated)
    return false;

  if (m_iVSyncMode != 0 && m_iSwapRate != 0)
  {
    int64_t curr, diff, freq;
    curr = CurrentHostCounter();
    freq = CurrentHostFrequency();

    if(m_iSwapStamp == 0)
      m_iSwapStamp = curr;

    /* calculate our next swap timestamp */
    diff = curr - m_iSwapStamp;
    diff = m_iSwapRate - diff % m_iSwapRate;
    m_iSwapStamp = curr + diff;

    /* sleep as close as we can before, assume 1ms precision of sleep *
     * this should always awake so that we are guaranteed the given   *
     * m_iSwapTime to do our swap                                     */
    diff = (diff - m_iSwapTime) * 1000 / freq;
    if (diff > 0)
      Sleep((DWORD)diff);
  }

  bool result = PresentRenderImpl(dirty);
  m_latencyCounter++;

  if (m_iVSyncMode && m_iSwapRate != 0)
  {
    int64_t curr, diff;
    curr = CurrentHostCounter();

    diff = curr - m_iSwapStamp;
    m_iSwapStamp = curr;

    if (MathUtils::abs(diff - m_iSwapRate) < MathUtils::abs(diff))
      CLog::Log(LOGDEBUG, "%s - missed requested swap",__FUNCTION__);
  }

  return result;
}
开发者ID:Dukeboys,项目名称:xbmc,代码行数:44,代码来源:RenderSystemGL.cpp

示例14: lock

CDVDClock::CDVDClock()
{
  CSingleLock lock(m_systemsection);

  m_pauseClock = 0;
  m_bReset = true;
  m_iDisc = 0;
  m_maxspeedadjust = 0.0;
  m_systemAdjust = 0;
  m_speedAdjust = 0;
  m_startClock = 0;
  m_vSyncAdjust = 0;
  m_frameTime = DVD_TIME_BASE / 60.0;

  m_videoRefClock.reset(new CVideoReferenceClock());
  m_lastSystemTime = m_videoRefClock->GetTime();
  m_systemOffset = m_videoRefClock->GetTime();
  m_systemFrequency = CurrentHostFrequency();
  m_systemUsed = m_systemFrequency;
}
开发者ID:Kahlzarg,项目名称:xbmc,代码行数:20,代码来源:DVDClock.cpp

示例15: CrtcSel

void CVideoSyncDRM::EventHandler(int fd, unsigned int frame, unsigned int sec,
                                 unsigned int usec, void *data)
{
  drmVBlank vbl;
  VblInfo *info = (VblInfo*)data;
  drmVBlankSeqType crtcSel = CrtcSel();

  vbl.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT | crtcSel);
  vbl.request.sequence = 1;
  vbl.request.signal = (unsigned long)data;

  drmWaitVBlank(info->videoSync->m_fd, &vbl);

  uint64_t now = CurrentHostCounter();
  float diff = (float)(now - info->start)/CurrentHostFrequency();
  int vblanks = MathUtils::round_int(diff * info->videoSync->m_fps);
  info->start = now;

  info->videoSync->UpdateClock(vblanks, now);
}
开发者ID:69thelememt,项目名称:xbmc,代码行数:20,代码来源:VideoSyncDRM.cpp


注:本文中的CurrentHostFrequency函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。