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

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

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

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

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

示例1: lock

double OMXPlayerVideo::NextOverlay(double pts){  double delta_start, delta_stop, min_delta = DVD_NOPTS_VALUE;  CSingleLock lock(*m_pOverlayContainer);  VecOverlays* pVecOverlays = m_pOverlayContainer->GetOverlays();  VecOverlaysIter it = pVecOverlays->begin();  //Find the minimum time before a subtitle is added or removed  while (it != pVecOverlays->end())  {    CDVDOverlay* pOverlay = *it++;    if(!pOverlay->bForced && !m_bRenderSubs)      continue;    double pts2 = pOverlay->bForced ? pts : pts - m_iSubtitleDelay;    delta_start = pOverlay->iPTSStartTime - pts2;    delta_stop = pOverlay->iPTSStopTime - pts2;    // when currently on screen, we periodically update to allow (limited rate) ASS animation    if (delta_start <= 0.0 && delta_stop > 0.0 && (min_delta == DVD_NOPTS_VALUE || DVD_MSEC_TO_TIME(100) < min_delta))      min_delta = DVD_MSEC_TO_TIME(100);    else if (delta_start > 0.0 && (min_delta == DVD_NOPTS_VALUE || delta_start < min_delta))      min_delta = delta_start;    else if (delta_stop > 0.0 && (min_delta == DVD_NOPTS_VALUE || delta_stop < min_delta))      min_delta = delta_stop;  }  return min_delta == DVD_NOPTS_VALUE ? pts+DVD_MSEC_TO_TIME(500) : pts+min_delta;}
开发者ID:cpaowner,项目名称:xbmc,代码行数:32,


示例2: FreeSubtitle

int CDVDOverlayCodecFFmpeg::Decode(DemuxPacket *pPacket){  if (!m_pCodecContext || !pPacket)    return 1;  int gotsub = 0, len = 0;  FreeSubtitle(m_Subtitle);  AVPacket avpkt;  av_init_packet(&avpkt);  avpkt.data = pPacket->pData;  avpkt.size = pPacket->iSize;  avpkt.pts = pPacket->pts == DVD_NOPTS_VALUE ? AV_NOPTS_VALUE : (int64_t)pPacket->pts;  avpkt.dts = pPacket->dts == DVD_NOPTS_VALUE ? AV_NOPTS_VALUE : (int64_t)pPacket->dts;  len = avcodec_decode_subtitle2(m_pCodecContext, &m_Subtitle, &gotsub, &avpkt);  if (len < 0)  {    CLog::Log(LOGERROR, "%s - avcodec_decode_subtitle returned failure", __FUNCTION__);    Flush();    return OC_ERROR;  }  if (len != avpkt.size)    CLog::Log(LOGWARNING, "%s - avcodec_decode_subtitle didn't consume the full packet", __FUNCTION__);  if (!gotsub)    return OC_BUFFER;  double pts_offset = 0.0;   if (m_pCodecContext->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE && m_Subtitle.format == 0)  {    // for pgs subtitles the packet pts of the end_segments are wrong    // instead use the subtitle pts to calc the offset here    // see http://git.videolan.org/?p=ffmpeg.git;a=commit;h=2939e258f9d1fff89b3b68536beb931b54611585    if (m_Subtitle.pts != AV_NOPTS_VALUE && pPacket->pts != DVD_NOPTS_VALUE)    {      pts_offset = m_Subtitle.pts - pPacket->pts ;    }  }  m_StartTime   = DVD_MSEC_TO_TIME(m_Subtitle.start_display_time);  m_StopTime    = DVD_MSEC_TO_TIME(m_Subtitle.end_display_time);  //adapt start and stop time to our packet pts  bool dummy = false;  CDVDOverlayCodec::GetAbsoluteTimes(m_StartTime, m_StopTime, pPacket, dummy, pts_offset);  m_SubtitleIndex = 0;  return OC_OVERLAY;}
开发者ID:Avbrella,项目名称:xbmc,代码行数:55,


示例3: lock

bool CDVDClock::Update(double clock, double absolute, double limit, const char* log){  CExclusiveLock lock(m_critSection);  double was_absolute = SystemToAbsolute(m_startClock);  double was_clock    = m_iDisc + absolute - was_absolute;  lock.Leave();  double error = std::abs(clock - was_clock);  // skip minor updates while speed adjust is active  // -> adjusting buffer levels  if (m_speedAdjust != 0 && error < DVD_MSEC_TO_TIME(100))  {    return false;  }  else if (error > limit)  {    Discontinuity(clock, absolute);    CLog::Log(LOGDEBUG, "CDVDClock::Discontinuity - %s - was:%f, should be:%f, error:%f"                      , log                      , was_clock                      , clock                      , clock - was_clock);    return true;  }  else    return false;}
开发者ID:sebastian125,项目名称:xbmc,代码行数:29,


示例4: fabs

double OMXReader::NormalizeFrameduration(double frameduration){	//if the duration is within 20 microseconds of a common duration, use that	const double durations[] = {DVD_TIME_BASE * 1.001 / 24.0, DVD_TIME_BASE / 24.0, DVD_TIME_BASE / 25.0,	                            DVD_TIME_BASE * 1.001 / 30.0, DVD_TIME_BASE / 30.0, DVD_TIME_BASE / 50.0,	                            DVD_TIME_BASE * 1.001 / 60.0, DVD_TIME_BASE / 60.0	                           };	double lowestdiff = DVD_TIME_BASE;	int    selected   = -1;	for (size_t i = 0; i < sizeof(durations) / sizeof(durations[0]); i++)	{		double diff = fabs(frameduration - durations[i]);		if (diff < DVD_MSEC_TO_TIME(0.02) && diff < lowestdiff)		{			selected = i;			lowestdiff = diff;		}	}	if (selected != -1)	{		return durations[selected];	}	else	{		return frameduration;	}}
开发者ID:Maigre,项目名称:ofxOMXPlayer,代码行数:29,


示例5: DVD_MSEC_TO_TIME

void OMXPlayerVideo::Output(double pts, bool bDropPacket){  if (!g_renderManager.IsStarted()) {    CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__);    return;  }  if (CThread::m_bStop)    return;  // we aim to submit subtitles 100ms early  const double preroll = DVD_MSEC_TO_TIME(100);  double media_pts = m_av_clock->OMXMediaTime();  if (m_nextOverlay != DVD_NOPTS_VALUE && media_pts + preroll <= m_nextOverlay)    return;  int buffer = g_renderManager.WaitForBuffer(CThread::m_bStop);  if (buffer < 0)    return;  double subtitle_pts = m_nextOverlay;  double time = subtitle_pts != DVD_NOPTS_VALUE ? subtitle_pts - media_pts : 0.0;  if (m_nextOverlay != DVD_NOPTS_VALUE)    media_pts = m_nextOverlay;  m_nextOverlay = NextOverlay(media_pts);  ProcessOverlays(media_pts);  time += m_av_clock->GetAbsoluteClock();  g_renderManager.FlipPage(CThread::m_bStop, time/DVD_TIME_BASE);}
开发者ID:cpaowner,项目名称:xbmc,代码行数:34,


示例6: fabs

double CDVDCodecUtils::NormalizeFrameduration(double frameduration, bool *match){  //if the duration is within 20 microseconds of a common duration, use that  const double durations[] = {DVD_TIME_BASE * 1.001 / 24.0, DVD_TIME_BASE / 24.0, DVD_TIME_BASE / 25.0,                              DVD_TIME_BASE * 1.001 / 30.0, DVD_TIME_BASE / 30.0, DVD_TIME_BASE / 50.0,                              DVD_TIME_BASE * 1.001 / 60.0, DVD_TIME_BASE / 60.0};  double lowestdiff = DVD_TIME_BASE;  int    selected   = -1;  for (size_t i = 0; i < ARRAY_SIZE(durations); i++)  {    double diff = fabs(frameduration - durations[i]);    if (diff < DVD_MSEC_TO_TIME(0.02) && diff < lowestdiff)    {      selected = i;      lowestdiff = diff;    }  }  if (selected != -1)  {    if (match)      *match = true;    return durations[selected];  }  else  {    if (match)      *match = false;    return frameduration;  }}
开发者ID:Adeelb,项目名称:xbmc,代码行数:32,


示例7: lock

double CDVDClock::ErrorAdjust(double error, const char* log){  CSingleLock lock(m_critSection);  double clock, absolute, adjustment;  clock = GetClock(absolute);  // skip minor updates while speed adjust is active  // -> adjusting buffer levels  if (m_speedAdjust != 0 && error < DVD_MSEC_TO_TIME(100))  {    return 0;  }  adjustment = error;  if (m_vSyncAdjust != 0)  {    if (error > 0.5 * m_frameTime)      adjustment = m_frameTime;    else if (error < -0.5 * m_frameTime)      adjustment = -m_frameTime;    else      adjustment = 0;  }  if (adjustment == 0)    return 0;  Discontinuity(clock+adjustment, absolute);  CLog::Log(LOGDEBUG, "CDVDClock::ErrorAdjust - %s - error:%f, adjusted:%f",                      log, error, adjustment);  return adjustment;}
开发者ID:Kahlzarg,项目名称:xbmc,代码行数:35,


示例8: ofLog

bool OMXReader::SeekTime(int time, bool backwords, double *startpts, bool doLoopOnFail){    if(time < 0)        time = 0;        if(!avFormatContext)        return false;        if(fileObject && !fileObject->IoControl(IOCTRL_SEEK_POSSIBLE, NULL))    {        ofLog(OF_LOG_VERBOSE, "%s - input stream reports it is not seekable", __FUNCTION__);        return false;    }        lock();        //FlushRead();        if(avioContext)    {        avioContext->buf_ptr = avioContext->buf_end;    }        int64_t seek_pts = (int64_t)time * (AV_TIME_BASE / 1000);    if (avFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)    {        seek_pts += avFormatContext->start_time;    };            int ret = av_seek_frame(avFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0);        if(ret >= 0)    {        updateCurrentPTS();    }else {        //ofLogVerbose(__func__) << "av_seek_frame returned >= 0, no updateCurrentPTS" << ret;        fileObject->rewindFile();    }            // in this case the start time is requested time    if(startpts)    {        *startpts = DVD_MSEC_TO_TIME(time);    }        isEOF = false;    if (fileObject && fileObject->getIsEOF() && ret <= 0)    {        isEOF = true;        ret = 0;    }            unlock();        return (ret >= 0);}
开发者ID:freesnail,项目名称:ofxOMXPlayer,代码行数:59,


示例9: Lock

bool OMXReader::SeekTime(int time, bool backwords, double *startpts){  if(time < 0)    time = 0;  if(!m_pFormatContext)    return false;  if(m_pFile && !m_pFile->IoControl(IOCTRL_SEEK_POSSIBLE, NULL))  {    CLog::Log(LOGDEBUG, "%s - input stream reports it is not seekable", __FUNCTION__);    return false;  }  Lock();  //FlushRead();  if(m_ioContext)    m_ioContext->buf_ptr = m_ioContext->buf_end;  int64_t seek_pts = (int64_t)time * (AV_TIME_BASE / 1000);  if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)    seek_pts += m_pFormatContext->start_time;  int ret = m_dllAvFormat.av_seek_frame(m_pFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0);  if(ret >= 0)  {    UpdateCurrentPTS();  }  else {    //m_pFile->rewindFile();    m_pFile->Seek(0);    UpdateCurrentPTS();    wasFileRewound = true;  }  // in this case the start time is requested time  if(startpts)    *startpts = DVD_MSEC_TO_TIME(time);  // demuxer will return failure, if you seek to eof  m_eof = false;  if (m_pFile && m_pFile->IsEOF() && ret <= 0)  {    m_eof = true;    ret = 0;  }  CLog::Log(LOGDEBUG, "OMXReader::SeekTime(%d) - seek ended up on time %d",time,(int)(m_iCurrentPts / DVD_TIME_BASE * 1000));  UnLock();  return (ret >= 0);}
开发者ID:paulreimer,项目名称:ofxOMXPlayer,代码行数:57,


示例10: Lock

bool OMXReader::SeekTime(int64_t seek_ms, int seek_flags, double *startpts){  if(seek_ms < 0)    seek_ms = 0;  if(!m_pFile || !m_pFormatContext)    return false;  if(!m_pFile->IoControl(IOCTRL_SEEK_POSSIBLE, NULL))    return false;  Lock();  //FlushRead();  if(m_ioContext)    m_ioContext->buf_ptr = m_ioContext->buf_end;  int64_t seek_pts = (int64_t)seek_ms * (AV_TIME_BASE / 1000);  if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)    seek_pts += m_pFormatContext->start_time;  /* seek behind eof */  if((seek_pts / AV_TIME_BASE) > (GetStreamLength()  / 1000))  {    m_eof = true;    UnLock();    return true;  }  int ret = m_dllAvFormat.av_seek_frame(m_pFormatContext, -1, seek_pts, seek_flags ? AVSEEK_FLAG_BACKWARD : 0);  if(ret >= 0)  {    UpdateCurrentPTS();    m_eof = false;  }  if(m_iCurrentPts == DVD_NOPTS_VALUE)  {    CLog::Log(LOGDEBUG, "OMXReader::SeekTime - unknown position after seek");  }  else  {    CLog::Log(LOGDEBUG, "OMXReader::SeekTime - seek ended up on time %d",(int)(m_iCurrentPts / DVD_TIME_BASE * 1000));  }  if(startpts)    *startpts = DVD_MSEC_TO_TIME(seek_ms);  UnLock();  return (ret >= 0);}
开发者ID:hackedd,项目名称:omxplayer,代码行数:54,


示例11: Reset

bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts){  if(time < 0)    time = 0;  if (m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD))  {    CLog::Log(LOGDEBUG, "%s - seeking using navigator", __FUNCTION__);    if (((CDVDInputStreamNavigator*)m_pInput)->SeekTime(time))    {      // since seek happens behind demuxers back, we have to reset it      // this won't be a problem if we setup ffmpeg properly later      Reset();      // todo, calculate starting pts in this case      return true;    }    return false;  }  if(!m_pInput->Seek(0, SEEK_POSSIBLE)   && !m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG))  {    CLog::Log(LOGDEBUG, "%s - input stream reports it is not seekable", __FUNCTION__);    return false;  }  __int64 seek_pts = (__int64)time * (AV_TIME_BASE / 1000);  if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)    seek_pts += m_pFormatContext->start_time;  Lock();  int ret = m_dllAvFormat.av_seek_frame(m_pFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0);  if(ret >= 0)    UpdateCurrentPTS();  Unlock();  if(m_iCurrentPts == DVD_NOPTS_VALUE)    CLog::Log(LOGDEBUG, "%s - unknown position after seek", __FUNCTION__);  else    CLog::Log(LOGDEBUG, "%s - seek ended up on time %d", __FUNCTION__, (int)(m_iCurrentPts / DVD_TIME_BASE * 1000));  // in this case the start time is requested time  if(startpts)    *startpts = DVD_MSEC_TO_TIME(time);  // demuxer will return failure, if you seek to eof  if (m_pInput->IsEOF() && ret <= 0)    return true;  return (ret >= 0);}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:53,


示例12: DVD_MSEC_TO_TIME

bool CDVDDemuxVobsub::SeekTime(int time, bool backwords, double* startpts){  double pts = DVD_MSEC_TO_TIME(time);  m_Timestamp = m_Timestamps.begin();  for (;m_Timestamp != m_Timestamps.end();++m_Timestamp)  {    if(m_Timestamp->pts > pts)      break;  }  for (unsigned i=0;i<m_Streams.size() && m_Timestamps.begin() != m_Timestamp;i++)  {    --m_Timestamp;  }  return true;}
开发者ID:0xheart0,项目名称:xbmc,代码行数:15,


示例13: OutputPacket

bool CDVDPlayerAudio::OutputPacket(DVDAudioFrame &audioframe){  double syncerror = m_dvdAudio.GetSyncError();  if (m_synctype == SYNC_DISCON && fabs(syncerror) > DVD_MSEC_TO_TIME(10))  {    double correction = m_pClock->ErrorAdjust(syncerror, "CDVDPlayerAudio::OutputPacket");    if (correction != 0)    {      m_dvdAudio.SetSyncErrorCorrection(-correction);    }  }  m_dvdAudio.AddPackets(audioframe);  return true;}
开发者ID:MrMC,项目名称:mrmc,代码行数:16,


示例14: GetAbsoluteClock

double OMXClock::OMXMediaTime(bool lock /* = true */){  double pts = 0.0;  if(m_omx_clock.GetComponent() == NULL)    return 0;  double now = GetAbsoluteClock();  if (now - m_last_media_time_read > DVD_MSEC_TO_TIME(100) || m_last_media_time == 0.0)  {    if(lock)      Lock();    OMX_ERRORTYPE omx_err = OMX_ErrorNone;    OMX_TIME_CONFIG_TIMESTAMPTYPE timeStamp;    OMX_INIT_STRUCTURE(timeStamp);    timeStamp.nPortIndex = m_omx_clock.GetInputPort();    omx_err = m_omx_clock.GetConfig(OMX_IndexConfigTimeCurrentMediaTime, &timeStamp);    if(omx_err != OMX_ErrorNone)    {      LOG_ERROR << "OMXClock::MediaTime error getting OMX_IndexConfigTimeCurrentMediaTime";      if(lock)        UnLock();      return 0;    }    pts = FromOMXTime(timeStamp.nTimestamp);    //CLog::Log(LOGINFO, "OMXClock::MediaTime %.2f (%.2f, %.2f)", pts, m_last_media_time, now - m_last_media_time_read);    m_last_media_time = pts;    m_last_media_time_read = now;    if(lock)      UnLock();  }  else  {    double speed = m_pause ? 0.0 : (double)m_omx_speed / DVD_PLAYSPEED_NORMAL;    pts = m_last_media_time + (now - m_last_media_time_read) * speed;    //CLog::Log(LOGINFO, "OMXClock::MediaTime cached %.2f (%.2f, %.2f)", pts, m_last_media_time, now - m_last_media_time_read);  }  return pts;}
开发者ID:crocdialer,项目名称:KinskiGL,代码行数:43,


示例15: DVD_MSEC_TO_TIME

bool CVideoPlayerAudio::OutputPacket(DVDAudioFrame &audioframe){  double syncerror = m_dvdAudio.GetSyncError();  if (m_synctype == SYNC_DISCON)  {    double limit, error;    limit = DVD_MSEC_TO_TIME(10);    error = syncerror;    double absolute;    double clock = m_pClock->GetClock(absolute);    if (m_pClock->Update(clock + error, absolute, limit - 0.001, "CVideoPlayerAudio::OutputPacket"))    {      m_dvdAudio.SetSyncErrorCorrection(-error);    }  }  m_dvdAudio.AddPackets(audioframe);  return true;}
开发者ID:Adeelb,项目名称:xbmc,代码行数:21,


示例16: lock

double CDVDClock::ErrorAdjust(double error, const char* log){  CSingleLock lock(m_critSection);  double clock, absolute, adjustment;  clock = GetClock(absolute);  // skip minor updates while speed adjust is active  // -> adjusting buffer levels  if (m_speedAdjust != 0 && error < DVD_MSEC_TO_TIME(100))  {    return 0;  }  adjustment = error;  if (m_vSyncAdjust != 0)  {    // Audio ahead is more noticeable then audio behind video.    // Correct if aufio is more than 20ms ahead or more then    // 27ms behind. In a worst case scenario we switch from    // 20ms ahead to 21ms behind (for fps of 23.976)    if (error > 0.02 * DVD_TIME_BASE)      adjustment = m_frameTime;    else if (error < -0.027 * DVD_TIME_BASE)      adjustment = -m_frameTime;    else      adjustment = 0;  }  if (adjustment == 0)    return 0;  Discontinuity(clock+adjustment, absolute);  CLog::Log(LOGDEBUG, "CDVDClock::ErrorAdjust - %s - error:%f, adjusted:%f",                      log, error, adjustment);  return adjustment;}
开发者ID:aasoror,项目名称:xbmc,代码行数:39,


示例17: abs

void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket){  if (!g_renderManager.IsStarted()) {    CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__);    return;  }  // calculate the time we need to delay this picture before displaying  double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock, iFrameDuration;  iPlayingClock = m_av_clock->GetClock(iCurrentClock, false); // snapshot current clock  iClockSleep = pts - iPlayingClock; //sleep calculated by pts to clock comparison  iFrameSleep = m_FlipTimeStamp - iCurrentClock; // sleep calculated by duration of frame  iFrameDuration = (double)DVD_TIME_BASE / m_fFrameRate; //pPacket->duration;  // correct sleep times based on speed  if(m_speed)  {    iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed;    iFrameSleep = iFrameSleep * DVD_PLAYSPEED_NORMAL / abs(m_speed);    iFrameDuration = iFrameDuration * DVD_PLAYSPEED_NORMAL / abs(m_speed);  }  else  {    iClockSleep = 0;    iFrameSleep = 0;  }  // dropping to a very low framerate is not correct (it should not happen at all)  iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));  iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));  if( m_stalled )    iSleepTime = iFrameSleep;  else    iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;  // present the current pts of this frame to user, and include the actual  // presentation delay, to allow him to adjust for it  if( m_stalled )    m_iCurrentPts = DVD_NOPTS_VALUE;  else    m_iCurrentPts = pts - max(0.0, iSleepTime);  // timestamp when we think next picture should be displayed based on current duration  m_FlipTimeStamp  = iCurrentClock;  m_FlipTimeStamp += max(0.0, iSleepTime);  m_FlipTimeStamp += iFrameDuration;  if( m_speed < 0 )  {    if( iClockSleep < -DVD_MSEC_TO_TIME(200))      return;  }  if(bDropPacket)    return;#if 0  if( m_speed != DVD_PLAYSPEED_NORMAL)  {    // calculate frame dropping pattern to render at this speed    // we do that by deciding if this or next frame is closest    // to the flip timestamp    double current   = fabs(m_dropbase -  m_droptime);    double next      = fabs(m_dropbase - (m_droptime + iFrameDuration));    double frametime = (double)DVD_TIME_BASE / m_fFrameRate;    m_droptime += iFrameDuration;#ifndef PROFILE    if( next < current /*&& !(pPicture->iFlags & DVP_FLAG_NOSKIP) */)      return /*result | EOS_DROPPED*/;#endif    while(!m_bStop && m_dropbase < m_droptime)             m_dropbase += frametime;    while(!m_bStop && m_dropbase - frametime > m_droptime) m_dropbase -= frametime;  }  else  {    m_droptime = 0.0f;    m_dropbase = 0.0f;  }#else  m_droptime = 0.0f;  m_dropbase = 0.0f;#endif  // DVDPlayer sleeps until m_iSleepEndTime here before calling FlipPage.  // Video playback in asynchronous in OMXPlayer, so we don't want to do that here, as it prevents the video fifo from being kept full.  // So, we keep track of when FlipPage would have been called on DVDPlayer and return early if it is not time.  // m_iSleepEndTime == DVD_NOPTS_VALUE means we are not waiting to call FlipPage, otherwise it is the time we want to call FlipPage  if (m_iSleepEndTime == DVD_NOPTS_VALUE) {    m_iSleepEndTime = iCurrentClock + iSleepTime;  }  if (!CThread::m_bStop && m_av_clock->GetAbsoluteClock(false) < m_iSleepEndTime + DVD_MSEC_TO_TIME(500))    return;  double pts_media = m_av_clock->OMXMediaTime(false, false);  ProcessOverlays(iGroupId, pts_media);//.........这里部分代码省略.........
开发者ID:abschicken,项目名称:xbmc,代码行数:101,


示例18: CDVDOverlay

CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay(){  if(m_SubtitleIndex<0)    return NULL;  if(m_Subtitle.num_rects == 0 && m_SubtitleIndex == 0)  {    // we must add an empty overlay to replace the previous one    CDVDOverlay* o = new CDVDOverlay(DVDOVERLAY_TYPE_NONE);    o->iPTSStartTime = 0;    o->iPTSStopTime  = 0;    o->replace  = true;    m_SubtitleIndex++;    return o;  }  if(m_Subtitle.format == 0)  {    if(m_SubtitleIndex >= (int)m_Subtitle.num_rects)      return NULL;#if LIBAVCODEC_VERSION_INT >= (52<<10)    if(m_Subtitle.rects[m_SubtitleIndex] == NULL)      return NULL;    AVSubtitleRect& rect = *m_Subtitle.rects[m_SubtitleIndex];#else    AVSubtitleRect& rect = m_Subtitle.rects[m_SubtitleIndex];#endif    CDVDOverlayImage* overlay = new CDVDOverlayImage();    overlay->iPTSStartTime = DVD_MSEC_TO_TIME(m_Subtitle.start_display_time);    overlay->iPTSStopTime  = DVD_MSEC_TO_TIME(m_Subtitle.end_display_time);    overlay->replace  = true;    overlay->linesize = rect.w;    overlay->data     = (BYTE*)malloc(rect.w * rect.h);    overlay->palette  = (uint32_t*)malloc(rect.nb_colors*4);    overlay->palette_colors = rect.nb_colors;    overlay->x        = rect.x;    overlay->y        = rect.y;    overlay->width    = rect.w;    overlay->height   = rect.h;    int right  = overlay->x + overlay->width;    int bottom = overlay->y + overlay->height;    if(m_height == 0 && m_pCodecContext->height)      m_height = m_pCodecContext->height;    if(m_width  == 0 && m_pCodecContext->width)      m_width  = m_pCodecContext->width;    if(bottom > m_height)    {      if     (bottom <= 480)        m_height      = 480;      else if(bottom <= 576)        m_height      = 576;      else if(bottom <= 720)        m_height      = 720;      else if(bottom <= 1080)        m_height      = 1080;      else        m_height      = bottom;    }    if(right > m_width)    {      if     (right <= 720)        m_width      = 720;      else if(right <= 1024)        m_width      = 1024;      else if(right <= 1280)        m_width      = 1280;      else if(right <= 1920)        m_width      = 1920;      else        m_width      = right;    }    overlay->source_width  = m_width;    overlay->source_height = m_height;#if LIBAVCODEC_VERSION_INT >= (52<<10)    BYTE* s = rect.pict.data[0];    BYTE* t = overlay->data;    for(int i=0;i<rect.h;i++)    {      memcpy(t, s, rect.w);      s += rect.pict.linesize[0];      t += overlay->linesize;    }    for(int i=0;i<rect.nb_colors;i++)      overlay->palette[i] = Endian_SwapLE32(((uint32_t *)rect.pict.data[1])[i]);    m_dllAvUtil.av_free(rect.pict.data[0]);    m_dllAvUtil.av_free(rect.pict.data[1]);    m_dllAvUtil.av_freep(&m_Subtitle.rects[m_SubtitleIndex]);#else    BYTE* s = rect.bitmap;    BYTE* t = overlay->data;//.........这里部分代码省略.........
开发者ID:mbolhuis,项目名称:xbmc,代码行数:101,


示例19: OMXDoProcessing

bool OMXDoProcessing(struct SOmxPlayerState &m_OmxPlayerState, int m_playSpeed, IDVDStreamPlayerVideo *m_dvdPlayerVideo, IDVDStreamPlayerAudio *m_dvdPlayerAudio,                     CCurrentStream m_CurrentAudio, CCurrentStream m_CurrentVideo, bool m_HasVideo, bool m_HasAudio){  bool reopen_stream = false;  double now = CDVDClock::GetAbsoluteClock();  if (m_OmxPlayerState.last_check_time == 0.0 || m_OmxPlayerState.last_check_time + DVD_MSEC_TO_TIME(20) <= now)  {    m_OmxPlayerState.last_check_time = now;    m_OmxPlayerState.stamp = m_OmxPlayerState.av_clock.OMXMediaTime();    const bool m_Pause = m_playSpeed == DVD_PLAYSPEED_PAUSE;    const bool not_accepts_data = (!m_dvdPlayerAudio->AcceptsData() && m_HasAudio) ||        (!m_dvdPlayerVideo->AcceptsData() && m_HasVideo >= 0);    /* when the video/audio fifos are low, we pause clock, when high we resume */    double audio_pts = floor(m_dvdPlayerAudio->GetCurrentPts());    double video_pts = floor(m_dvdPlayerVideo->GetCurrentPts());    float audio_fifo = audio_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6;    float video_fifo = video_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6;    float threshold = 0.1f;    bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false;    if (m_OmxPlayerState.interlace_method == VS_INTERLACEMETHOD_MAX)      m_OmxPlayerState.interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod);    // if deinterlace setting has changed, we should close and open video    if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode ||       (m_OmxPlayerState.current_deinterlace != VS_DEINTERLACEMODE_OFF &&        m_OmxPlayerState.interlace_method != g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod)))    {      CLog::Log(LOGNOTICE, "%s - Reopen stream due to interlace change (%d,%d,%d,%d)", __FUNCTION__,        m_OmxPlayerState.current_deinterlace, CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode,        m_OmxPlayerState.interlace_method, g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod));      m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode;      m_OmxPlayerState.interlace_method    = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod);      reopen_stream = true;    }    m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize());    m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal());    #ifdef _DEBUG    static unsigned count;    if ((count++ & 7) == 0)    {      char response[80];      if (m_dvdPlayerVideo->GetDecoderBufferSize() && m_dvdPlayerAudio->GetCacheTotal())        vc_gencmd(response, sizeof response, "render_bar 4 video_fifo %d %d %d %d",            m_OmxPlayerState.video_fifo,            (int)(100.0*video_fifo/m_dvdPlayerAudio->GetCacheTotal()),            0, 100);      if (m_dvdPlayerAudio->GetCacheTotal())        vc_gencmd(response, sizeof response, "render_bar 5 audio_fifo %d %d %d %d",            m_OmxPlayerState.audio_fifo,            (int)(100.0*m_dvdPlayerAudio->GetDelay()/m_dvdPlayerAudio->GetCacheTotal()),            0, 100);      vc_gencmd(response, sizeof response, "render_bar 6 video_queue %d %d %d %d",            m_dvdPlayerVideo->GetLevel(), 0, 0, 100);      vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d",            m_dvdPlayerAudio->GetLevel(), 0, 0, 100);    }    #endif    if (audio_pts != DVD_NOPTS_VALUE)    {      audio_fifo_low = m_HasAudio && audio_fifo < threshold;      audio_fifo_high = audio_pts != DVD_NOPTS_VALUE && audio_fifo >= m_OmxPlayerState.threshold;    }    if (video_pts != DVD_NOPTS_VALUE)    {      video_fifo_low = m_HasVideo && video_fifo < threshold;      video_fifo_high = video_pts != DVD_NOPTS_VALUE && video_fifo >= m_OmxPlayerState.threshold;    }    if (!m_HasAudio && m_HasVideo)      audio_fifo_high = true;    if (!m_HasVideo && m_HasAudio)      video_fifo_high = true;    #ifdef _DEBUG    CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__,      m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6,      m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL),      audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold,      audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high,      m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal());    #endif    if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL))    {      if (m_OmxPlayerState.av_clock.OMXIsPaused())      {        CLog::Log(LOGDEBUG, "%s::%s Resume %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo,          audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold);        m_OmxPlayerState.av_clock.OMXResume();      }    }    else if ((m_Pause || audio_fifo_low || video_fifo_low) && m_playSpeed == DVD_PLAYSPEED_NORMAL)    {      if (!m_OmxPlayerState.av_clock.OMXIsPaused())      {        if (!m_Pause)//.........这里部分代码省略.........
开发者ID:Phaeodaria,项目名称:xbmc,代码行数:101,


示例20: if

void OMXPlayerVideo::Output(double pts){  if(m_syncclock)  {    double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock();    if( delay > m_frametime ) delay = m_frametime;    else if( delay < 0 )    delay = 0;    //printf("OMXPlayerVideo - GENERAL_RESYNC(%f, 1) delay %f/n", pts, m_FlipTimeStamp);    m_av_clock->Discontinuity(pts - delay);    m_syncclock = false;  }  double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock, iFrameDuration;  iPlayingClock = m_av_clock->GetClock(iCurrentClock, false); // snapshot current clock  iClockSleep = pts - iPlayingClock; //sleep calculated by pts to clock comparison  iFrameSleep = m_FlipTimeStamp - iCurrentClock; // sleep calculated by duration of frame  iFrameDuration = m_frametime;  // correct sleep times based on speed  if(m_speed)  {    iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed;    iFrameSleep = iFrameSleep * DVD_PLAYSPEED_NORMAL / abs(m_speed);    iFrameDuration = iFrameDuration * DVD_PLAYSPEED_NORMAL / abs(m_speed);  }  else  {    iClockSleep = 0;    iFrameSleep = 0;  }  // dropping to a very low framerate is not correct (it should not happen at all)  iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));  iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));  bool m_stalled = false;  int m_autosync = 1;  if( m_stalled )    iSleepTime = iFrameSleep;  else    iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;  // present the current pts of this frame to user, and include the actual  // presentation delay, to allow him to adjust for it  if( m_stalled )    m_iCurrentPts = DVD_NOPTS_VALUE;  else    m_iCurrentPts = pts - max(0.0, iSleepTime);  m_av_clock->SetPTS(m_iCurrentPts);  // timestamp when we think next picture should be displayed based on current duration  m_FlipTimeStamp  = iCurrentClock;  m_FlipTimeStamp += max(0.0, iSleepTime);  m_FlipTimeStamp += iFrameDuration;  while(m_av_clock->GetAbsoluteClock(false) < (iCurrentClock + iSleepTime + DVD_MSEC_TO_TIME(500)) )  {    OMXClock::OMXSleep(10);  }  /*  printf("iPlayingClock %f iCurrentClock %f iClockSleep %f iFrameSleep %f iFrameDuration %f WaitAbsolut %f m_FlipTimeStamp %f pts %f/n",       iPlayingClock / DVD_TIME_BASE, iCurrentClock  / DVD_TIME_BASE,      iClockSleep / DVD_TIME_BASE, iFrameSleep / DVD_TIME_BASE,      iFrameDuration / DVD_TIME_BASE, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, m_FlipTimeStamp / DVD_TIME_BASE,       pts / DVD_TIME_BASE);  */  //g_renderManager.FlipPage(CThread::m_bStop, (iCurrentClock + iSleepTime) / DVD_TIME_BASE, -1, mDisplayField);  m_av_clock->WaitAbsoluteClock((iCurrentClock + iSleepTime));  // guess next frame pts. iDuration is always valid  if (m_speed != 0)    m_pts += m_frametime * m_speed / abs(m_speed);}
开发者ID:Isaac702,项目名称:omxplayer,代码行数:77,


示例21: ofLog

bool OMXReader::SeekTime(int time, bool backwords, double *startpts, bool doLoopOnFail)//doLoopOnFail = true{	if(time < 0)	{		time = 0;	}	if(!m_pFormatContext)	{		return false;	}	if(m_pFile && !m_pFile->IoControl(IOCTRL_SEEK_POSSIBLE, NULL))	{		ofLog(OF_LOG_VERBOSE, "%s - input stream reports it is not seekable", __FUNCTION__);		return false;	}	Lock();	//FlushRead();	if(m_ioContext)	{		m_ioContext->buf_ptr = m_ioContext->buf_end;	}	int64_t seek_pts = (int64_t)time * (AV_TIME_BASE / 1000);	if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE)	{		seek_pts += m_pFormatContext->start_time;	}	//  virtual int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { return ::av_seek_frame(s, stream_index, timestamp, flags); }	int ret = m_dllAvFormat.av_seek_frame(m_pFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0);	//int ret =avformat_seek_file(m_pFormatContext, -1, 0, seek_pts, m_pFormatContext->duration*1000, AVSEEK_FLAG_ANY);	if(ret >= 0)	{		ofLogVerbose(__func__) << "av_seek_frame PASS: - returned: " << ret;		UpdateCurrentPTS();	}	else	{		ofLogVerbose(__func__) << "av_seek_frame returned >= 0, - rewinding file" << ret;		if (doLoopOnFail)		{			m_pFile->rewindFile();			wasFileRewound = true;		}		UpdateCurrentPTS();	}	// in this case the start time is requested time	if(startpts)	{		*startpts = DVD_MSEC_TO_TIME(time);	}	// demuxer will return failure, if you seek to eof	m_eof = false;	if (m_pFile && m_pFile->IsEOF() && ret <= 0)	{		m_eof = true;		ret = 0;	}	//int landedTime = (int)(m_iCurrentPts / DVD_TIME_BASE * 1000);	//ofLogVerbose(__func__) << "Seek ended up on time: " << landedTime;	UnLock();	return (ret >= 0);}
开发者ID:Maigre,项目名称:ofxOMXPlayer,代码行数:76,


示例22: LOG_VERBOSE

/*------------------------------------------------------------------------------|    OMX_MediaProcessor::mediaDecoding+-----------------------------------------------------------------------------*/void OMX_MediaProcessor::mediaDecoding(){   // See description in the qmakefile.//#define ENABLE_PROFILE_MAIN_LOOP//#define ENABLE_PAUSE_FOR_BUFFERING   LOG_VERBOSE(LOG_TAG, "Decoding thread started.");   emit playbackStarted();   // Prealloc.#ifdef ENABLE_PAUSE_FOR_BUFFERING   float stamp     = 0;   float audio_pts = 0;   float video_pts = 0;   float audio_fifo = 0;   float video_fifo = 0;   float threshold = 0;   bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false;   float m_threshold = 1.0f; //std::min(0.1f, audio_fifo_size * 0.1f);#endif // ENABLE_PAUSE_FOR_BUFFERING   bool sentStarted = false;   double last_seek_pos = 0;   bool sendEos = false;   double m_last_check_time = 0.0;   m_av_clock->OMXReset(m_has_video, m_has_audio);   m_av_clock->OMXStateExecute();   sentStarted = true;   while (!m_pendingStop) {#ifdef ENABLE_PROFILE_MAIN_LOOP      static qint64 tot    = 0;      static qint64 totNum = 0;      static QElapsedTimer timer;      static int count = 0;      if (tot == 0) {         timer.start();         tot++;      }      else         tot += timer.restart();      totNum++;      if ((count++)%30 == 0) {         //LOG_VERBOSE(LOG_TAG, "Elapsed: %lld", timer.restart());         LOG_VERBOSE(LOG_TAG, "Average: %f.", (double)tot/totNum);      }#endif      double now = m_av_clock->GetAbsoluteClock();      bool update = false;      if (m_last_check_time == 0.0 || m_last_check_time + DVD_MSEC_TO_TIME(20) <= now) {         update = true;         m_last_check_time = now;      }      // If a request is pending then consider done here.      m_mutexPending.lock();      if (m_pendingPause) {         m_waitPendingCommand.wakeAll();         m_pendingPause = false;      }      m_mutexPending.unlock();      // TODO: Use a semaphore instead.      if (m_state == STATE_PAUSED) {         OMXClock::OMXSleep(2);         continue;      }      if (m_seekFlush || m_incr != 0) {         double seek_pos = 0;         double pts      = m_av_clock->OMXMediaTime();         //seek_pos        = (pts / DVD_TIME_BASE) + m_incr;         seek_pos = (pts ? pts / DVD_TIME_BASE : last_seek_pos) + m_incr;         last_seek_pos = seek_pos;         seek_pos        *= 1000.0;         if(m_omx_reader->SeekTime((int)seek_pos, m_incr < 0.0f, &startpts))         {            unsigned t = (unsigned)(startpts*1e-6);            auto dur = m_omx_reader->GetStreamLength() / 1000;            log_info("Seek to: %02d:%02d:%02d/n", (t/3600), (t/60)%60, t%60);            flushStreams(startpts);         }         m_player_video->Close();         sentStarted = false;         if (m_omx_reader->IsEof())            break;         if (m_has_video && !m_player_video->Open(//.........这里部分代码省略.........
开发者ID:ekapujiw2002,项目名称:pi,代码行数:101,


示例23: abs

void OMXEGLImagePlayer::Output(double pts){		if(m_syncclock)	{		double delay = m_FlipTimeStamp - m_av_clock->GetAbsoluteClock();		if( delay > m_frametime )		{			delay = m_frametime;		}else 		{			if( delay < 0 )			{				delay = 0;			}		}		//printf("OMXEGLImagePlayer - GENERAL_RESYNC(%f, 1) delay %f/n", pts, m_FlipTimeStamp);		m_av_clock->Discontinuity(pts - delay);		m_syncclock = false;	}	double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock, iFrameDuration;	iPlayingClock = m_av_clock->GetClock(iCurrentClock, false); // snapshot current clock	iClockSleep = pts - iPlayingClock; //sleep calculated by pts to clock comparison	iFrameSleep = m_FlipTimeStamp - iCurrentClock; // sleep calculated by duration of frame	iFrameDuration = m_frametime;	// correct sleep times based on speed	if(m_speed)	{		iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed;		iFrameSleep = iFrameSleep * DVD_PLAYSPEED_NORMAL / abs(m_speed);		iFrameDuration = iFrameDuration * DVD_PLAYSPEED_NORMAL / abs(m_speed);	}	else	{		iClockSleep = 0;		iFrameSleep = 0;	}		// dropping to a very low framerate is not correct (it should not happen at all)	iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));	iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));	bool m_stalled = false;	int m_autosync = 1;	if( m_stalled )	{		iSleepTime = iFrameSleep;	}	else	{		iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;	}	// present the current pts of this frame to user, and include the actual	// presentation delay, to allow him to adjust for it	if( m_stalled )	{		m_iCurrentPts = DVD_NOPTS_VALUE;	}	else	{		m_iCurrentPts = pts - max(0.0, iSleepTime);	}	m_av_clock->SetPTS(m_iCurrentPts);	// timestamp when we think next picture should be displayed based on current duration	m_FlipTimeStamp  = iCurrentClock;	m_FlipTimeStamp += max(0.0, iSleepTime);	m_FlipTimeStamp += iFrameDuration;		if(doDebugging)	{		sprintf(debugInfoBuffer, 				"iPlayingClock		 %f	/n/				iCurrentClock		 %f	/n/				iClockSleep			 %f	/n/				iFrameSleep			 %f	/n/				iFrameDuration		 %f	/n/				WaitAbsolut			 %f	/n/				m_FlipTimeStamp		 %f	/n/				pts					 %f	/n/				currentFrame		 %d	/n/				Cached Video		 %8d", 				iPlayingClock / DVD_TIME_BASE, 				iCurrentClock  / DVD_TIME_BASE,				iClockSleep / DVD_TIME_BASE, 				iFrameSleep / DVD_TIME_BASE,				iFrameDuration / DVD_TIME_BASE, 				(iCurrentClock + iSleepTime) / DVD_TIME_BASE, 				m_FlipTimeStamp / DVD_TIME_BASE, 				pts / DVD_TIME_BASE,				(int)((m_FlipTimeStamp / DVD_TIME_BASE)*m_fps),				m_cached_size);				debugInfo = (string) debugInfoBuffer;	}//.........这里部分代码省略.........
开发者ID:andreasmuller,项目名称:RaspberryPiWorkshop,代码行数:101,


示例24: abs

void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket){  if (!g_renderManager.IsStarted()) {    CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__);    return;  }  // calculate the time we need to delay this picture before displaying  double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock, iFrameDuration;  iPlayingClock = m_av_clock->GetClock(iCurrentClock, false); // snapshot current clock  iClockSleep = pts - iPlayingClock; //sleep calculated by pts to clock comparison  iFrameSleep = m_FlipTimeStamp - iCurrentClock; // sleep calculated by duration of frame  iFrameDuration = (double)DVD_TIME_BASE / m_fFrameRate; //pPacket->duration;  // correct sleep times based on speed  if(m_speed)  {    iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed;    iFrameSleep = iFrameSleep * DVD_PLAYSPEED_NORMAL / abs(m_speed);    iFrameDuration = iFrameDuration * DVD_PLAYSPEED_NORMAL / abs(m_speed);  }  else  {    iClockSleep = 0;    iFrameSleep = 0;  }  // dropping to a very low framerate is not correct (it should not happen at all)  iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));  iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));  if( m_stalled )    iSleepTime = iFrameSleep;  else    iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;  // present the current pts of this frame to user, and include the actual  // presentation delay, to allow him to adjust for it  if( m_stalled )    m_iCurrentPts = DVD_NOPTS_VALUE;  else    m_iCurrentPts = pts - max(0.0, iSleepTime);  // timestamp when we think next picture should be displayed based on current duration  m_FlipTimeStamp  = iCurrentClock;  m_FlipTimeStamp += max(0.0, iSleepTime);  m_FlipTimeStamp += iFrameDuration;  if( m_speed < 0 )  {    if( iClockSleep < -DVD_MSEC_TO_TIME(200))      return;  }  if(bDropPacket)    return;#if 0  if( m_speed != DVD_PLAYSPEED_NORMAL)  {    // calculate frame dropping pattern to render at this speed    // we do that by deciding if this or next frame is closest    // to the flip timestamp    double current   = fabs(m_dropbase -  m_droptime);    double next      = fabs(m_dropbase - (m_droptime + iFrameDuration));    double frametime = (double)DVD_TIME_BASE / m_fFrameRate;    m_droptime += iFrameDuration;#ifndef PROFILE    if( next < current /*&& !(pPicture->iFlags & DVP_FLAG_NOSKIP) */)      return /*result | EOS_DROPPED*/;#endif    while(!m_bStop && m_dropbase < m_droptime)             m_dropbase += frametime;    while(!m_bStop && m_dropbase - frametime > m_droptime) m_dropbase -= frametime;  }  else  {    m_droptime = 0.0f;    m_dropbase = 0.0f;  }#else  m_droptime = 0.0f;  m_dropbase = 0.0f;#endif  int buffer = g_renderManager.WaitForBuffer(m_bStop, 0);  if (buffer < 0)    return;  double pts_overlay = m_av_clock->OMXMediaTime(false, false)                     + 2* (double)DVD_TIME_BASE / g_graphicsContext.GetFPS();  ProcessOverlays(iGroupId, pts_overlay);  double timestamp = CDVDClock::GetAbsoluteClock(false) + 2 / g_graphicsContext.GetFPS();  g_renderManager.FlipPage(CThread::m_bStop, timestamp, -1, FS_NONE);}
开发者ID:fldc,项目名称:spotyxbmc2,代码行数:98,


示例25: abs

void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket){  if (!g_renderManager.IsConfigured()    || m_video_width != m_width    || m_video_height != m_height    || m_fps != m_fFrameRate)  {    m_width   = m_video_width;    m_height  = m_video_height;    m_fps     = m_fFrameRate;    unsigned flags = 0;    ERenderFormat format = RENDER_FMT_BYPASS;    if(m_bAllowFullscreen)    {      flags |= CONF_FLAGS_FULLSCREEN;      m_bAllowFullscreen = false; // only allow on first configure    }    if(m_flags & CONF_FLAGS_FORMAT_SBS)    {      if(g_Windowing.Support3D(m_video_width, m_video_height, D3DPRESENTFLAG_MODE3DSBS))      {        CLog::Log(LOGNOTICE, "3DSBS movie found");        flags |= CONF_FLAGS_FORMAT_SBS;      }    }    CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. format: BYPASS",        __FUNCTION__, m_width, m_height, m_fps);    if(!g_renderManager.Configure(m_video_width, m_video_height,           m_video_width, m_video_height, m_fps, flags, format, 0,          m_hints.orientation))    {      CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);      return;    }  }  if (!g_renderManager.IsStarted()) {    CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__);    return;  }  // calculate the time we need to delay this picture before displaying  double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock, iFrameDuration;  iPlayingClock = m_av_clock->GetClock(iCurrentClock, false); // snapshot current clock  iClockSleep = pts - iPlayingClock; //sleep calculated by pts to clock comparison  iFrameSleep = m_FlipTimeStamp - iCurrentClock; // sleep calculated by duration of frame  iFrameDuration = (double)DVD_TIME_BASE / m_fFrameRate; //pPacket->duration;  // correct sleep times based on speed  if(m_speed)  {    iClockSleep = iClockSleep * DVD_PLAYSPEED_NORMAL / m_speed;    iFrameSleep = iFrameSleep * DVD_PLAYSPEED_NORMAL / abs(m_speed);    iFrameDuration = iFrameDuration * DVD_PLAYSPEED_NORMAL / abs(m_speed);  }  else  {    iClockSleep = 0;    iFrameSleep = 0;  }  // dropping to a very low framerate is not correct (it should not happen at all)  iClockSleep = min(iClockSleep, DVD_MSEC_TO_TIME(500));  iFrameSleep = min(iFrameSleep, DVD_MSEC_TO_TIME(500));  if( m_stalled )    iSleepTime = iFrameSleep;  else    iSleepTime = iFrameSleep + (iClockSleep - iFrameSleep) / m_autosync;  // present the current pts of this frame to user, and include the actual  // presentation delay, to allow him to adjust for it  if( m_stalled )    m_iCurrentPts = DVD_NOPTS_VALUE;  else    m_iCurrentPts = pts - max(0.0, iSleepTime);  // timestamp when we think next picture should be displayed based on current duration  m_FlipTimeStamp  = iCurrentClock;  m_FlipTimeStamp += max(0.0, iSleepTime);  m_FlipTimeStamp += iFrameDuration;  if( m_speed < 0 )  {    if( iClockSleep < -DVD_MSEC_TO_TIME(200))      return;  }  if(bDropPacket)    return;#if 0  if( m_speed != DVD_PLAYSPEED_NORMAL)//.........这里部分代码省略.........
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:101,


示例26: while

bool CVideoPlayerVideo::ProcessDecoderOutput(double &frametime, double &pts){  CDVDVideoCodec::VCReturn decoderState = m_pVideoCodec->GetPicture(&m_picture);  if (decoderState == CDVDVideoCodec::VC_BUFFER)  {    return false;  }  // if decoder was flushed, we need to seek back again to resume rendering  if (decoderState == CDVDVideoCodec::VC_FLUSHED)  {    CLog::Log(LOGDEBUG, "CVideoPlayerVideo - video decoder was flushed");    while (!m_packets.empty())    {      CDVDMsgDemuxerPacket* msg = static_cast<CDVDMsgDemuxerPacket*>(m_packets.front().message->Acquire());      m_packets.pop_front();      SendMessage(msg, 10);    }    m_pVideoCodec->Reset();    m_packets.clear();    //picture.iFlags &= ~DVP_FLAG_ALLOCATED;    m_renderManager.DiscardBuffer();    return false;  }  if (decoderState == CDVDVideoCodec::VC_REOPEN)  {    while (!m_packets.empty())    {      CDVDMsgDemuxerPacket* msg = static_cast<CDVDMsgDemuxerPacket*>(m_packets.front().message->Acquire());      m_packets.pop_front();      SendMessage(msg, 10);    }    m_pVideoCodec->Reopen();    m_packets.clear();    m_renderManager.DiscardBuffer();    return false;  }  // if decoder had an error, tell it to reset to avoid more problems  if (decoderState == CDVDVideoCodec::VC_ERROR)  {    CLog::Log(LOGDEBUG, "CVideoPlayerVideo - video decoder returned error");    return false;  }  if (decoderState == CDVDVideoCodec::VC_EOF)  {    if (m_syncState == IDVDStreamPlayer::SYNC_STARTING)    {      SStartMsg msg;      msg.player = VideoPlayer_VIDEO;      msg.cachetime = DVD_MSEC_TO_TIME(50);      msg.cachetotal = DVD_MSEC_TO_TIME(100);      msg.timestamp = DVD_NOPTS_VALUE;      m_messageParent.Put(new CDVDMsgType<SStartMsg>(CDVDMsg::PLAYER_STARTED, msg));    }    return false;  }  // check for a new picture  if (decoderState == CDVDVideoCodec::VC_PICTURE)  {    bool hasTimestamp = true;    m_picture.iDuration = frametime;    // validate picture timing,    // if both dts/pts invalid, use pts calulated from picture.iDuration    // if pts invalid use dts, else use picture.pts as passed    if (m_picture.dts == DVD_NOPTS_VALUE && m_picture.pts == DVD_NOPTS_VALUE)    {      m_picture.pts = pts;      hasTimestamp = false;    }    else if (m_picture.pts == DVD_NOPTS_VALUE)      m_picture.pts = m_picture.dts;    // use forced aspect if any    if (m_fForcedAspectRatio != 0.0f)    {      m_picture.iDisplayWidth = (int) (m_picture.iDisplayHeight * m_fForcedAspectRatio);      if (m_picture.iDisplayWidth > m_picture.iWidth)      {        m_picture.iDisplayWidth =  m_picture.iWidth;        m_picture.iDisplayHeight = (int) (m_picture.iDisplayWidth / m_fForcedAspectRatio);      }    }    // set stereo mode if not set by decoder    if (m_picture.stereoMode.empty())    {      std::string stereoMode;      switch(m_processInfo.GetVideoSettings().m_StereoMode)      {        case RENDER_STEREO_MODE_SPLIT_VERTICAL://.........这里部分代码省略.........
开发者ID:Owersun,项目名称:xbmc,代码行数:101,



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


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