您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CurrentHostFrequency函数代码示例

51自学网 2021-06-01 20:16:23
  C++
这篇教程C++ CurrentHostFrequency函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例16: CThread

OMXPlayerAudio::OMXPlayerAudio(OMXClock *av_clock, CDVDMessageQueue& parent): CThread("OMXPlayerAudio"), m_messageQueue("audio"), m_messageParent(parent){  m_av_clock      = av_clock;  m_pAudioCodec   = NULL;  m_speed         = DVD_PLAYSPEED_NORMAL;  m_started       = false;  m_stalled       = false;  m_audioClock    = 0;  m_buffer_empty  = false;  m_nChannels     = 0;  m_DecoderOpen   = false;  m_freq          = CurrentHostFrequency();  m_send_eos      = false;  m_bad_state     = false;  m_hints_current.Clear();  m_av_clock->SetMasterClock(false);  m_messageQueue.SetMaxDataSize(3 * 1024 * 1024);  m_messageQueue.SetMaxTimeSize(8.0);  m_use_passthrough = false;  m_passthrough = false;  m_use_hw_decode = false;  m_hw_decode = false;  m_silence = false;  m_error = 0.0;  m_errorbuff = 0.0;  m_errorcount = 0;  m_syncclock = false;  m_integral = 0.0;  m_skipdupcount = 0;  m_prevskipped = false;  m_flush = false;    m_synctype = 0;}
开发者ID:ojp5,项目名称:xbmc,代码行数:39,


示例17: lock

//.........这里部分代码省略.........#ifdef _DEBUG_TEXTURES  int64_t start;  start = CurrentHostCounter();#endif  if (StringUtils::EndsWithNoCase(strPath, ".gif"))  {    CTextureMap* pMap = nullptr;    if (bundle >= 0)    {      CBaseTexture **pTextures;      int nLoops = 0, width = 0, height = 0;      int* Delay;      int nImages = m_TexBundle[bundle].LoadAnim(strTextureName, &pTextures, width, height, nLoops, &Delay);      if (!nImages)      {        CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());        delete [] pTextures;        delete [] Delay;        return emptyTexture;      }      pMap = new CTextureMap(strTextureName, width, height, nLoops);      for (int iImage = 0; iImage < nImages; ++iImage)      {        pMap->Add(pTextures[iImage], Delay[iImage]);      }      delete [] pTextures;      delete [] Delay;    }    else    {#if defined(HAS_GIFLIB)      Gif gif;      if(!gif.LoadGif(strPath.c_str()))      {        if (StringUtils::StartsWith(strPath, g_SkinInfo->Path()))          CLog::Log(LOGERROR, "Texture manager unable to load file: %s", strPath.c_str());        return emptyTexture;      }      pMap = new CTextureMap(strTextureName, gif.Width(), gif.Height(), gif.GetNumLoops());      for (auto frame : gif.GetFrames())      {        CTexture *glTexture = new CTexture();        if (glTexture)        {          glTexture->LoadFromMemory(gif.Width(), gif.Height(), gif.GetPitch(), XB_FMT_A8R8G8B8, false, frame->m_pImage);          pMap->Add(glTexture, frame->m_delay);        }      }#endif//HAS_GIFLIB    }    if (pMap)    {      m_vecTextures.push_back(pMap);      return pMap->GetTexture();    }  } // of if (strPath.Right(4).ToLower()==".gif")  CBaseTexture *pTexture = NULL;  int width = 0, height = 0;  if (bundle >= 0)  {    if (!m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height))    {      CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());      return emptyTexture;    }  }  else  {    pTexture = CBaseTexture::LoadFromFile(strPath);    if (!pTexture)      return emptyTexture;    width = pTexture->GetWidth();    height = pTexture->GetHeight();  }  if (!pTexture) return emptyTexture;  CTextureMap* pMap = new CTextureMap(strTextureName, width, height, 0);  pMap->Add(pTexture, 100);  m_vecTextures.push_back(pMap);#ifdef _DEBUG_TEXTURES  int64_t end, freq;  end = CurrentHostCounter();  freq = CurrentHostFrequency();  char temp[200];  sprintf(temp, "Load %s: %.1fms%s/n", strPath.c_str(), 1000.f * (end - start) / freq, (bundle >= 0) ? " (bundled)" : "");  OutputDebugString(temp);#endif  return pMap->GetTexture();}
开发者ID:Karlson2k,项目名称:xbmc,代码行数:101,


示例18: switch

//.........这里部分代码省略.........    // input stream is qualified, now we can load dlls.    m_dllSwScale = new DllSwScale;    if (!m_dllSwScale->Load())    {      CFRelease(avcCData);      return false;    }    // setup the decoder configuration dict    CFMutableDictionaryRef decoderConfiguration = CFDictionaryCreateMutable(      kCFAllocatorDefault, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFNumberRef avcWidth  = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &width);    CFNumberRef avcHeight = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &height);    CFNumberRef avcFormat = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &m_format);    CFDictionarySetValue(decoderConfiguration, m_dll->Get_kVDADecoderConfiguration_Height(), avcHeight);    CFDictionarySetValue(decoderConfiguration, m_dll->Get_kVDADecoderConfiguration_Width(),  avcWidth);    CFDictionarySetValue(decoderConfiguration, m_dll->Get_kVDADecoderConfiguration_SourceFormat(), avcFormat);    CFDictionarySetValue(decoderConfiguration, m_dll->Get_kVDADecoderConfiguration_avcCData(), avcCData);    // release the retained object refs, decoderConfiguration owns them now    CFRelease(avcWidth);    CFRelease(avcHeight);    CFRelease(avcFormat);    CFRelease(avcCData);    // setup the destination image buffer dict, vda will output this pict format    CFMutableDictionaryRef destinationImageBufferAttributes = CFDictionaryCreateMutable(      kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    OSType cvPixelFormatType = kCVPixelFormatType_422YpCbCr8;    CFNumberRef pixelFormat  = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &cvPixelFormatType);    CFDictionarySetValue(destinationImageBufferAttributes, kCVPixelBufferPixelFormatTypeKey, pixelFormat);    // create the VDADecoder object    OSStatus status;    try    {      status = m_dll->VDADecoderCreate(decoderConfiguration, destinationImageBufferAttributes,        (VDADecoderOutputCallback *)VDADecoderCallback, this, (VDADecoder*)&m_vda_decoder);    }    catch (...)    {      CLog::Log(LOGERROR, "%s - exception",__FUNCTION__);      status = kVDADecoderDecoderFailedErr;    }    CFRelease(decoderConfiguration);    CFRelease(destinationImageBufferAttributes);    if (status != kVDADecoderNoErr)    {	  if (status == kVDADecoderDecoderFailedErr)        CLog::Log(LOGNOTICE, "%s - VDADecoder Codec failed to open, currently in use by another process",          __FUNCTION__);	  else        CLog::Log(LOGNOTICE, "%s - VDADecoder Codec failed to open, status(%d), profile(%d), level(%d)",          __FUNCTION__, (int)status, profile, level);      return false;    }    // allocate a YV12 DVDVideoPicture buffer.    // first make sure all properties are reset.    memset(&m_videobuffer, 0, sizeof(DVDVideoPicture));    unsigned int iPixels = width * height;    unsigned int iChromaPixels = iPixels/4;    m_videobuffer.pts = DVD_NOPTS_VALUE;    m_videobuffer.iFlags = DVP_FLAG_ALLOCATED;    m_videobuffer.format = DVDVideoPicture::FMT_YUV420P;    m_videobuffer.color_range  = 0;    m_videobuffer.color_matrix = 4;    m_videobuffer.iWidth  = width;    m_videobuffer.iHeight = height;    m_videobuffer.iDisplayWidth  = width;    m_videobuffer.iDisplayHeight = height;    m_videobuffer.iLineSize[0] = width;   //Y    m_videobuffer.iLineSize[1] = width/2; //U    m_videobuffer.iLineSize[2] = width/2; //V    m_videobuffer.iLineSize[3] = 0;    m_videobuffer.data[0] = (BYTE*)malloc(iPixels);       //Y    m_videobuffer.data[1] = (BYTE*)malloc(iChromaPixels); //U    m_videobuffer.data[2] = (BYTE*)malloc(iChromaPixels); //V    m_videobuffer.data[3] = NULL;    // set all data to 0 for less artifacts.. hmm.. what is black in YUV??    memset(m_videobuffer.data[0], 0, iPixels);    memset(m_videobuffer.data[1], 0, iChromaPixels);    memset(m_videobuffer.data[2], 0, iChromaPixels);    m_DropPictures = false;    m_sort_time_offset = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();    return true;  }  return false;}
开发者ID:RoboSK,项目名称:xbmc,代码行数:101,


示例19: pa_threaded_mainloop_lock

void CAESinkPULSE::GetDelay(AEDelayStatus& status){  if (!m_IsAllocated)  {    status.SetDelay(0);    return;  }  pa_threaded_mainloop_lock(m_MainLoop);  const pa_timing_info* pti = pa_stream_get_timing_info(m_Stream);  // only incorporate local sink delay + internal PA transport delay  double sink_delay = (pti->configured_sink_usec / 1000000.0);  double transport_delay = pti->transport_usec / 1000000.0;  uint64_t diff = CurrentHostCounter() - m_lastPackageStamp;  unsigned int bytes_played = (unsigned int) ((double) diff * (double) m_BytesPerSecond  / (double) CurrentHostFrequency() + 0.5);  int buffer_delay = m_filled_bytes - bytes_played;  if (buffer_delay < 0)    buffer_delay = 0;  pa_threaded_mainloop_unlock(m_MainLoop);  double delay = buffer_delay / (double) m_BytesPerSecond + sink_delay + transport_delay;  status.SetDelay(delay);}
开发者ID:krattai,项目名称:sht_tv,代码行数:26,


示例20: main

//.........这里部分代码省略.........      ctx.vcodec.am_sysinfo.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE);    break;    case CODEC_ID_MPEG4:      printf("CODEC_ID_MPEG4/n");      ctx.vcodec.video_type = VFORMAT_MPEG4;    break;    case CODEC_ID_MPEG2VIDEO:      printf("CODEC_ID_MPEG2VIDEO/n");      ctx.vcodec.video_type = VFORMAT_MPEG12;    break;    default:      fprintf(stderr, "ERROR: Invalid FFmpegFileReader Codec Format (not h264/mpeg4) = %d/n",        ctx.codec_context->codec_id);      goto fail;    break;  }	ret = codec_init(&ctx.vcodec);	if(ret != CODEC_ERROR_NONE)	{		printf("codec init failed, ret=-0x%x", -ret);		return -1;	}	printf("video codec ok!/n");	ret = codec_init_cntl(&ctx.vcodec);	if( ret != CODEC_ERROR_NONE )	{		printf("codec_init_cntl error/n");		return -1;	}	codec_set_cntl_avthresh(&ctx.vcodec, AV_SYNC_THRESH);	codec_set_cntl_syncthresh(&ctx.vcodec, ctx.vcodec.has_audio);  {    int frame_count, total = 0;    int64_t bgn_us, end_us;    ctx.am_pkt.codec = &ctx.vcodec;    pre_header_feeding(&ctx, &ctx.am_pkt);    ctx.demuxer->Read(ctx.am_pkt.avpkt);    printf("byte_count(%d), dts(%llu), pts(%llu)/n",      ctx.am_pkt.avpkt->size, ctx.am_pkt.avpkt->dts, ctx.am_pkt.avpkt->pts);    if (!ctx.am_pkt.avpkt->size) {      fprintf(stderr, "ERROR: Zero bytes read from input/n");      //goto fail;    }    ctx.am_pkt.type = CODEC_VIDEO;    ctx.am_pkt.data = ctx.am_pkt.avpkt->data;    ctx.am_pkt.data_size = ctx.am_pkt.avpkt->size;    ctx.am_pkt.avpkt_newflag = 1;    ctx.am_pkt.avpkt_isvalid = 1;    frame_count = 0;    bool done = false;    struct buf_status vbuf;    struct vdec_status vdec;    float  vlevel;    while (!g_signal_abort && !done && (frame_count < 5000)) {      h264_update_frame_header(&ctx.am_pkt);            bgn_us = CurrentHostCounter() * 1000 / CurrentHostFrequency();      log_print("avpts(%lld), avdts(%lld)/n",        ctx.am_pkt.avpkt->pts, ctx.am_pkt.avpkt->dts);      ret = write_av_packet(&ctx, &ctx.am_pkt);      end_us = CurrentHostCounter() * 1000 / CurrentHostFrequency();      frame_count++;      //fprintf(stdout, "decode time(%llu) us/n", end_us-bgn_us);      check_vcodec_state(&ctx.vcodec, &vdec, &vbuf);      vlevel = 100.0 * (float)vbuf.data_len / vbuf.size;      //log_print("buffering_states,vlevel=%d,vsize=%d,level=%f/n", vbuf.data_len, vbuf.size, vlevel);      usleep(vlevel * 5000);      ctx.demuxer->Read(ctx.am_pkt.avpkt);      ctx.am_pkt.type = CODEC_VIDEO;      ctx.am_pkt.data = ctx.am_pkt.avpkt->data;      ctx.am_pkt.data_size = ctx.am_pkt.avpkt->size;      ctx.am_pkt.avpkt_newflag = 1;      ctx.am_pkt.avpkt_isvalid = 1;      if (!ctx.am_pkt.data_size) done = true;      total += ctx.am_pkt.data_size;    }  }fail:	codec_close_cntl(&ctx.vcodec);	codec_close(&ctx.vcodec);  return 0;}
开发者ID:achellies,项目名称:xbmc-android-old,代码行数:101,


示例21: lock

//.........这里部分代码省略.........    }    else if (StringUtils::EndsWithNoCase(strPath, ".gif") ||             StringUtils::EndsWithNoCase(strPath, ".apng"))    {        CTextureMap* pMap = nullptr;        std::string mimeType;        if (StringUtils::EndsWithNoCase(strPath, ".gif"))            mimeType = "image/gif";        else if (StringUtils::EndsWithNoCase(strPath, ".apng"))            mimeType = "image/apng";        XFILE::CFile file;        XFILE::auto_buffer buf;        CFFmpegImage anim(mimeType);        pMap = new CTextureMap(strTextureName, 0, 0, 0);        if (file.LoadFile(strPath, buf) <= 0 ||                !anim.Initialize((uint8_t*)buf.get(), buf.size()) || !pMap)        {            CLog::Log(LOGERROR, "Texture manager unable to load file: %s", CURL::GetRedacted(strPath).c_str());            file.Close();            return emptyTexture;        }        unsigned int maxWidth = 0;        unsigned int maxHeight = 0;        uint64_t maxMemoryUsage = 91238400;// 1920*1080*4*11 bytes, i.e, a total of approx. 12 full hd frames        auto frame = anim.ReadFrame();        while (frame)        {            CTexture *glTexture = new CTexture();            if (glTexture)            {                glTexture->LoadFromMemory(anim.Width(), anim.Height(), frame->GetPitch(), XB_FMT_A8R8G8B8, true, frame->m_pImage);                pMap->Add(glTexture, frame->m_delay);                maxWidth = std::max(maxWidth, glTexture->GetWidth());                maxHeight = std::max(maxHeight, glTexture->GetHeight());            }            if (pMap->GetMemoryUsage() <= maxMemoryUsage)            {                frame = anim.ReadFrame();            }            else            {                CLog::Log(LOGDEBUG, "Memory limit (%" PRIu64 " bytes) exceeded, %i frames extracted from file : %s", (maxMemoryUsage/11)*12,pMap->GetTexture().size(), CURL::GetRedacted(strPath).c_str());                break;            }        }        pMap->SetWidth((int)maxWidth);        pMap->SetHeight((int)maxHeight);        file.Close();        if (pMap)        {            m_vecTextures.push_back(pMap);            return pMap->GetTexture();        }    }    CBaseTexture *pTexture = NULL;    int width = 0, height = 0;    if (bundle >= 0)    {        if (!m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height))        {            CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());            return emptyTexture;        }    }    else    {        pTexture = CBaseTexture::LoadFromFile(strPath);        if (!pTexture)            return emptyTexture;        width = pTexture->GetWidth();        height = pTexture->GetHeight();    }    if (!pTexture) return emptyTexture;    CTextureMap* pMap = new CTextureMap(strTextureName, width, height, 0);    pMap->Add(pTexture, 100);    m_vecTextures.push_back(pMap);#ifdef _DEBUG_TEXTURES    int64_t end, freq;    end = CurrentHostCounter();    freq = CurrentHostFrequency();    char temp[200];    sprintf(temp, "Load %s: %.1fms%s/n", strPath.c_str(), 1000.f * (end - start) / freq, (bundle >= 0) ? " (bundled)" : "");    OutputDebugString(temp);#endif    return pMap->GetTexture();}
开发者ID:deniscostadsc,项目名称:xbmc,代码行数:101,


示例22: TEST

TEST(TestTimeUtils, CurrentHostFrequency){  std::cout << "CurrentHostFrequency(): " <<    testing::PrintToString(CurrentHostFrequency()) << std::endl;}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:5,


示例23: m_ItemHead

CGUIControlProfiler::CGUIControlProfiler(void): m_ItemHead(NULL, NULL, NULL), m_pLastItem(NULL), m_iMaxFrameCount(200), m_iFrameCount(0)// m_bIsRunning(false), no isRunning because it is static{  m_fPerfScale = 100000.0f / CurrentHostFrequency();}
开发者ID:A600,项目名称:xbmc,代码行数:6,



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


C++ CurrentSelection函数代码示例
C++ CurrentDir函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。