RefPtr<ReaderProxy::VideoDataPromise> ReaderProxy::RequestVideoData(const media::TimeUnit& aTimeThreshold) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); MOZ_ASSERT(!mShutdown); mSeamlessLoopingBlocked = false; const auto threshold = aTimeThreshold > media::TimeUnit::Zero() ? aTimeThreshold + StartTime() : aTimeThreshold; int64_t startTime = StartTime().ToMicroseconds(); return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaFormatReader::RequestVideoData, threshold) ->Then(mOwnerThread, __func__, [startTime](RefPtr<VideoData> aVideo) { aVideo->AdjustForStartTime(startTime); return aVideo->mTime.IsValid() ? VideoDataPromise::CreateAndResolve(aVideo.forget(), __func__) : VideoDataPromise::CreateAndReject( NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, __func__); }, [](const MediaResult& aError) { return VideoDataPromise::CreateAndReject(aError, __func__); }); }
BBitmap *TWipeTopLeftToBottomRightIn::TransformBitmap(uint32 time, const BBitmap *source, const TCuePosition ®istration, DisplayQuality quality) { // Only create offscreen at first pass if (!m_Inited) { BRect offRect = registration.Enclosure(); offRect.OffsetTo(0, 0); InitOffscreen(offRect); } // Calculate times const uint32 taskTime = time - StartTime(); const uint32 endTime = StartTime() + Duration(); // percentDone is on a scale of 0 to 1000. Check for overflow... int32 percentDone; if ( time < endTime) percentDone = taskTime * 1000L / Duration(); else percentDone = 1001; if (percentDone > 1000) percentDone = 1000; // Set up source rectangle BRect srcRect = registration.Enclosure(); srcRect.OffsetTo(0, 0); srcRect.right = srcRect.left + srcRect.Width() * percentDone / 1000; srcRect.bottom = srcRect.top + srcRect.Height() * percentDone / 1000; // Set up destination rectangle BRect dstRect = registration.Enclosure(); dstRect.OffsetTo(0, 0); dstRect.right = dstRect.left + srcRect.Width(); dstRect.bottom = dstRect.top + srcRect.Height(); // Draw bitmap if (m_OffscreenView->LockLooper()) { // Clear offscreen m_OffscreenView->SetHighColor(B_TRANSPARENT_32_BIT); m_OffscreenView->FillRect(m_OffscreenView->Bounds()); // Do transitioned data m_OffscreenView->DrawBitmap(source, srcRect, dstRect); m_OffscreenView->Sync(); m_OffscreenView->UnlockLooper(); } // Clone offscreen BBitmap *newBitmap = CloneBitmap(*m_OffscreenBitmap); ASSERT(newBitmap); return newBitmap; }
CARingBufferError CARingBuffer::Store(const AudioBufferList *abl, UInt32 framesToWrite, SampleTime startWrite) { if (framesToWrite > mCapacityFrames) return kCARingBufferError_TooMuch; // too big! SampleTime endWrite = startWrite + framesToWrite; if (startWrite < EndTime()) { // going backwards, throw everything out SetTimeBounds(startWrite, startWrite); } else if (endWrite - StartTime() <= mCapacityFrames) { // the buffer has not yet wrapped and will not need to } else { // advance the start time past the region we are about to overwrite SampleTime newStart = endWrite - mCapacityFrames; // one buffer of time behind where we're writing SampleTime newEnd = std::max(newStart, EndTime()); SetTimeBounds(newStart, newEnd); } // write the new frames Byte **buffers = mBuffers; int nchannels = mNumberChannels; int offset0, offset1, nbytes; SampleTime curEnd = EndTime(); if (startWrite > curEnd) { // we are skipping some samples, so zero the range we are skipping offset0 = FrameOffset(curEnd); offset1 = FrameOffset(startWrite); if (offset0 < offset1) ZeroRange(buffers, nchannels, offset0, offset1 - offset0); else { ZeroRange(buffers, nchannels, offset0, mCapacityBytes - offset0); ZeroRange(buffers, nchannels, 0, offset1); } offset0 = offset1; } else { offset0 = FrameOffset(startWrite); } offset1 = FrameOffset(endWrite); if (offset0 < offset1) StoreABL(buffers, offset0, abl, 0, offset1 - offset0); else { nbytes = mCapacityBytes - offset0; StoreABL(buffers, offset0, abl, 0, nbytes); StoreABL(buffers, 0, abl, nbytes, offset1); } // now update the end time SetTimeBounds(StartTime(), endWrite); return kCARingBufferError_OK; // success }
// Returns 1 if OK to trash current mine. int SafetyCheck() { int x; if (mine_changed) { StopTime(); x = ExecMessageBox( "Warning!", 2, "Cancel", "OK", "You are about to lose work." ); if (x<1) { StartTime(); return 0; } StartTime(); } return 1; }
//this should be called regularly to check for redbook restart void songs_check_redbook_repeat() { static fix last_check_time; fix current_time; if (!gameStates.sound.bRedbookPlaying || gameConfig.nRedbookVolume==0) return; current_time = TimerGetFixedSeconds(); if (current_time < last_check_time || (current_time - last_check_time) >= F2_0) { if (!RBAPeekPlayStatus()) { StopTime(); // if title ends, start credit music // if credits music ends, restart it if (gameStates.sound.bRedbookPlaying == REDBOOK_TITLE_TRACK || gameStates.sound.bRedbookPlaying == REDBOOK_CREDITS_TRACK) play_redbook_track(REDBOOK_CREDITS_TRACK,0); else { //songs_goto_next_song(); //new code plays all tracks to end of disk, so if disk has //stopped we must be at end. So start again with level 1 song. PlayLevelSong(1); } StartTime(); } last_check_time = current_time; } }
int GotoGameCommon(int mode) { StopTime(); //@@ init_player_stats(); //@@ //@@ gameData.multiplayer.playerInit.position.vPos = Player->position.vPos; //@@ gameData.multiplayer.playerInit.position.mOrient = Player->position.mOrient; //@@ gameData.multiplayer.playerInit.nSegment = Player->nSegment; // -- must always save gamesave.sav because the restore-gameData.objs.objects code relies on it // -- that code could be made smarter and use the original file, if appropriate. // if (mine_changed) if (gamestate_not_restored == 0) { gamestate_not_restored = 1; SaveLevel("GAMESAVE.LVL"); editor_status("Gamestate saved.\n"); } AIResetAllPaths(); StartTime(); ModeFlag = mode; return 1; }
BOOL CDlgHistoryLogUser::InitControl() { // 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、 DWORD dwStyle; dwStyle = m_ListCtrl_UserLog.GetStyle(); dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT; m_ListCtrl_UserLog.SetExtendedStyle(dwStyle); InitControlList(); m_strNodeName = "全部用户"; // m_ComboType.InsertString(0, "所有类型"); m_ComboType.InsertString(0,"管理端操作"); m_ComboType.InsertString(1,"客户端操作"); m_ComboType.InsertString(2,"辅助管理端操作"); m_ComboType.SetCurSel(0); m_ComboSubType.InsertString(0, "所有分类型"); m_ComboSubType.SetCurSel(0); CTime nowtime = CTime::GetCurrentTime(); CTime StartTime(nowtime.GetYear(), nowtime.GetMonth(),nowtime.GetDay(), 0, 0, 0); CTime StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59); //开始时间初始化 m_StartDay = StartTime; m_StartTime = StartTime; m_StopDay = StopTime; m_StopTime = StopTime; UpdateData(FALSE); return TRUE; }
void LoadAllTextures (void) { int bBlackScreen; StopTime (); bBlackScreen = paletteManager.EffectDisabled (); if (paletteManager.EffectDisabled ()) { CCanvas::Current ()->Clear (BLACK_RGBA); paletteManager.LoadEffect (); } // messageBox.Show (TXT_LOADING); LoadSegmentTextures (); LoadWallTextures (); LoadPowerupTextures (); LoadWeaponTextures (); LoadPowerupTextures (); LoadGaugeTextures (); LoadVClipTextures (&gameData.eff.vClips [0][VCLIP_PLAYER_APPEARANCE], 0); LoadVClipTextures (&gameData.eff.vClips [0][VCLIP_POWERUP_DISAPPEARANCE], 0); LoadAddonTextures (); if (bBlackScreen) { paletteManager.ClearEffect (); CCanvas::Current ()->Clear (BLACK_RGBA); } StartTime (0); }
void TExportZone::TrackOutMarker(BPoint mousePt) { // Constrain to out time of cue sheet uint32 outPixels = TimeToPixels( Duration() - StartTime(), GetCurrentTimeFormat(), GetCurrentResolution()); if (mousePt.x > outPixels) mousePt.x = outPixels; // Don't allow overlap with m_InRect if ( (mousePt.x-kExportSliderWidth) < m_InRect.right) mousePt.x = m_InRect.right + kExportSliderWidth; // Save oldRect for redraw BRect oldRect = m_OutRect; m_OutRect.right = mousePt.x; m_OutRect.left = m_OutRect.right - kExportSliderWidth; // Exit if there is no change in position if (oldRect == m_OutRect) return; // Update m_ExportChannel m_ExportChannel.right = m_OutRect.left; // Clean up old position BRect updateRect = oldRect; if (m_OutRect.left <= oldRect.left) { updateRect.left = m_OutRect.left; } else { updateRect.right = m_OutRect.right; } Draw(updateRect); // Update CueSheet variable uint32 newOutTime = StartTime() + PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution()); m_CueSheetWindow->GetCueSheetView()->SetExportStopTime(newOutTime); // Update text m_CueSheetWindow->GetExportTimeView()->DrawOutText(); }
AmNode* AmNode::NodeBefore(AmTime time) { if( StartTime() >= time ) return 0; AmNode* pos = this; while (pos && pos->next && pos->StartTime() < time) pos = pos->next; return pos; }
RefPtr<MediaDecoderReader::SeekPromise> MediaDecoderReaderWrapper::Seek(SeekTarget aTarget, media::TimeUnit aEndTime) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); aTarget.SetTime(aTarget.GetTime() + StartTime()); return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaDecoderReader::Seek, aTarget, aEndTime.ToMicroseconds()); }
CStdString MythProgramInfo::StrUID() { // Creates unique IDs from ChannelID, RecordID and StartTime like "100_200_2011-12-10T12:00:00" char buf[40] = ""; sprintf(buf, "%d_%ld_", ChannelID(), RecordID()); time_t starttime = StartTime(); strftime(buf + strlen(buf), 20, "%Y-%m-%dT%H:%M:%S", localtime(&starttime)); return CStdString(buf); }
void joy_delay() { StopTime(); timer_delay(.25); //delay(250); // changed by allender because 1) more portable // 2) was totally broken on PC joy_flush(); StartTime(); }
int CPVRTimerInfoTag::Compare(const CPVRTimerInfoTag &timer) const { int iTimerDelta = StartTime() - timer.StartTime(); /* if the start times are equal, compare the priority of the timers */ return iTimerDelta == 0 ? timer.m_iPriority - m_iPriority : iTimerDelta; }
void ResumeGame (void) { GameFlushInputs (); paletteManager.LoadEffect (); StartTime (0); if (redbook.Playing ()) RBAResume (); audio.ResumeAll (); gameData.app.bGamePaused = 0; }
void MediaDecoderReaderWrapper::OnSampleDecoded(CallbackBase* aCallback, MediaData* aSample, TimeStamp aDecodeStartTime) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); MOZ_ASSERT(!mShutdown); aSample->AdjustForStartTime(StartTime().ToMicroseconds()); aCallback->OnResolved(aSample, aDecodeStartTime); }
void LogicClient::Login() { StartTime(C2S_Login::msgid); C2S_Login msg; ostringstream ss; ss << "robot" << _id; msg.owner = ss.str(); msg.pwd = "iamrobot"; SendMsg(msg); }
void CCount::UpdateMoneyDataCount(int nTime) { if((m_dwCountMoneyTime + 1000 * 60 * nTime) <= GetTickCount()) { m_dwCountMoneyTime = 0; StartTime(CCT_MONEYDATA); PrintMoneyDataCount(); ResetCount(CCT_MONEYDATA); } }
RefPtr<ReaderProxy::SeekPromise> ReaderProxy::SeekInternal(const SeekTarget& aTarget) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); SeekTarget adjustedTarget = aTarget; adjustedTarget.SetTime(adjustedTarget.GetTime() + StartTime()); return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaFormatReader::Seek, std::move(adjustedTarget)); }
void *SingleHandlerSub(void *args) { struct TestObj *obj = (struct TestObj *)args; struct Handler *handler = obj->handler; int i = 0; StartTime(); for (i = 0; i < 0xFFFFF; i ++) { struct Message *m = ObtainMessage(handler); m->what = i; m->obj = (void *)obj->context; SendMessage(handler, m); } LoopStop(handler->loop); }
ALERROR CUniverse::InitImages (SDesignLoadCtx &Ctx, CXMLElement *pImages, CResourceDb &Resources) // InitImages // // Loads all images { ALERROR error; // Nothing to do if we don't want to load resources if (Ctx.bNoResources) return NOERROR; // Figure out if we've got a special folder for the images CString sRoot = pImages->GetAttribute(FOLDER_ATTRIB); Ctx.sFolder = sRoot; #ifdef DEBUG_TIME_IMAGE_LOAD CTimeDate StartTime(CTimeDate::Now); #endif // Load all images for (int i = 0; i < pImages->GetContentElementCount(); i++) { CXMLElement *pItem = pImages->GetContentElement(i); if (error = LoadImage(Ctx, pItem)) return error; } // Restore folder Ctx.sFolder = NULL_STR; #ifdef DEBUG_TIME_IMAGE_LOAD { CTimeDate StopTime(CTimeDate::Now); CTimeSpan Timing = timeSpan(StartTime, StopTime); CString sTime = Timing.Format(CString()); kernelSetDebugLog("Time to load images: "); kernelSetDebugLog(sTime.GetASCIIZPointer()); kernelSetDebugLog("\n"); } #endif return NOERROR; }
void *OldThreadMessageSub(void *args) { int id = *((int *)args); int i; printf("old\n"); StartTime(); for (i = 0; i < 0xFFFFF; i ++) { struct msgbuf *msg = (struct msgbuf *)malloc(sizeof(long) +sizeof(int)); msg->mtype = 0x100; msg->mtext = i; msgsnd(id, msg, sizeof(int), 0); } }
void CCount::UpdatePlayerDataCount(_PLAYERDATA *pData, const char*filename, int nTime, int nSaveType) { if (!pData || !filename) { rfalse(4, 1, "Count.cpp - UpdatePlayerDataCount() - !pData || !filename"); return; } if((m_dwCountPlayerTime + 1000 * 60 * nTime) <= GetTickCount()) { m_dwCountPlayerTime = 0; StartTime(CCT_PLAYERDATA); PrintPlayerDataCount(pData, filename, nSaveType); ResetCount(CCT_PLAYERDATA); } }
RefPtr<ReaderProxy::AudioDataPromise> ReaderProxy::OnAudioDataRequestCompleted(RefPtr<AudioData> aAudio) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); // Subtract the start time and add the looping-offset time. int64_t offset = StartTime().ToMicroseconds() - mLoopingOffset.ToMicroseconds(); aAudio->AdjustForStartTime(offset); if (aAudio->mTime.IsValid()) { mLastAudioEndTime = aAudio->mTime; return AudioDataPromise::CreateAndResolve(aAudio.forget(), __func__); } return AudioDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, __func__); }
void TExportZone::TrackInMarker(BPoint mousePt) { const BRect bounds = Bounds(); // Constrain to left side view area if (mousePt.x < 0) mousePt.x = 0; // Don't allow overlap with left side tracker if ( (mousePt.x + kExportSliderWidth) >= m_OutRect.left) mousePt.x = m_OutRect.left - kExportSliderWidth; // Save oldRect for redraw BRect oldRect = m_InRect; m_InRect.left = mousePt.x; m_InRect.right = m_InRect.left + kExportSliderWidth; // Exit if there is no change in position if (oldRect == m_InRect) return; // Update m_ExportChannel m_ExportChannel.left = m_InRect.right; // Clean up old position BRect updateRect = oldRect; if (oldRect.left <= m_InRect.left) { updateRect.right = m_InRect.right; } else { updateRect.left = m_InRect.left; } Draw(updateRect); // Update CueSheet variable uint32 newInTime = StartTime() + PixelsToTime(m_InRect.left, GetCurrentTimeFormat(), GetCurrentResolution()); m_CueSheetWindow->GetCueSheetView()->SetExportStartTime(newInTime); // Update text m_CueSheetWindow->GetExportTimeView()->DrawInText(); }
BOOL CDlgHistoryLogSystem::InitControl() { // 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、 DWORD dwStyle; dwStyle = m_ListCtrl_SystemLog.GetStyle(); dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT; m_ListCtrl_SystemLog.SetExtendedStyle(dwStyle); m_ListCtrl_SystemLog.InsertColumn(0,"服务器名称"); m_ListCtrl_SystemLog.SetColumnWidth(0,120); m_ListCtrl_SystemLog.InsertColumn(1,"服务器类型"); m_ListCtrl_SystemLog.SetColumnWidth(1,120); m_ListCtrl_SystemLog.InsertColumn(2,"服务器状态"); m_ListCtrl_SystemLog.SetColumnWidth(2,120); m_ListCtrl_SystemLog.InsertColumn(3,"CPU使用率"); m_ListCtrl_SystemLog.SetColumnWidth(3,120); m_ListCtrl_SystemLog.InsertColumn(4,"内存使用率"); m_ListCtrl_SystemLog.SetColumnWidth(4,120); m_ListCtrl_SystemLog.InsertColumn(5,"内存使用量"); m_ListCtrl_SystemLog.SetColumnWidth(5,120); m_ListCtrl_SystemLog.InsertColumn(6,"磁盘使用量"); m_ListCtrl_SystemLog.SetColumnWidth(6,120); m_ListCtrl_SystemLog.InsertColumn(7,"更新时间"); m_ListCtrl_SystemLog.SetColumnWidth(7,120); m_ComboType.InsertString(0, "所有类型"); m_ComboType.SetCurSel(0); m_ComboSubType.InsertString(0, "所有分类型"); m_ComboSubType.SetCurSel(0); CTime nowtime = CTime::GetCurrentTime(); CTime StartTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 0, 0, 0); CTime StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59); //开始时间初始化 m_StartDay = StartTime; m_StartTime = StartTime; m_StopDay = StopTime; m_StopTime = StopTime; UpdateData(FALSE); return TRUE; }
void CDlgHistoryLogUser::OnDtnDatetimechangeDatetimepickerHlStartday(NMHDR *pNMHDR, LRESULT *pResult) { LPNMDATETIMECHANGE pDTChange = reinterpret_cast<LPNMDATETIMECHANGE>(pNMHDR); char str[64]; CTime nowtime; GetDlgItemText(IDC_DATETIMEPICKER_HL_STARTDAY,str,64); if ((memcmp(str,"1971-",5) < 0)||(memcmp(str,"2037-",5) > 0)) { nowtime = CTime::GetCurrentTime(); CTime StartTime(nowtime.GetYear(), nowtime.GetMonth(), 1, 0, 0, 0); m_StartDay = StartTime; m_StartTime = StartTime; UpdateData(false); } *pResult = 0; }
void Message_Service::Banner (FILE *file) { time_t ltime; int pad1, pad2; char buffer [FIELD_BUFFER]; char blank = ' '; char *bar = "********************************************"; if (file == NULL) file = stdout; fprintf (file, "\n\t%s", bar); fprintf (file, "\n\t|%42c|", blank); str_fmt (buffer, sizeof (buffer), "%s - Version %s", Program (), Version ()); pad1 = (int) (42 - strlen (buffer)); pad2 = pad1 - pad1 / 2; pad1 = pad1 / 2; fprintf (file, "\n\t|%*c%s%*c|", pad1, blank, buffer, pad2, blank); str_fmt (buffer, sizeof (buffer), "Copyright (c) %s", CopyRight ()); pad1 = (int) (42 - strlen (buffer)); pad2 = pad1 - pad1 / 2; pad1 = pad1 / 2; fprintf (file, "\n\t|%*c%s%*c|", pad1, blank, buffer, pad2, blank); ltime = StartTime (); str_cpy (buffer, sizeof (buffer), c_time (<ime)); pad1 = (int) (42 - strlen (buffer)); pad2 = pad1 - pad1 / 2; pad1 = pad1 / 2; fprintf (file, "\n\t|%*c%s%*c|", pad1, blank, buffer, pad2, blank); fprintf (file, "\n\t|%42c|", blank); fprintf (file, "\n\t%s\n", bar); fflush (file); }
bool DataChart::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError) { std::string strType = Std_CheckString(strDataType); if(ActivatedItem::SetData(strDataType, strValue, false)) return true; if(strType == "STARTTIME") { StartTime((float) atof(strValue.c_str())); return true; } if(strType == "ENDTIME") { EndTime((float) atof(strValue.c_str())); return true; } if(strType == "SETSTARTENDTIME") { SetStartEndTime(Std_ToBool(strValue)); return true; } if(strType == "COLLECTTIMEWINDOW") { CollectTimeWindow((float) atof(strValue.c_str())); return true; } if(strType == "COLLECTINTERVAL") { CollectInterval((float) atof(strValue.c_str())); return true; } //If it was not one of those above then we have a problem. if(bThrowError) THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType); return false; }
void MediaDecoderReaderWrapper::RequestVideoData(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); MOZ_ASSERT(!mShutdown); MOZ_ASSERT(mRequestVideoDataCB, "Request video data without callback!"); // Time the video decode and send this value back to callbacks who accept // a TimeStamp as its second parameter. TimeStamp videoDecodeStartTime = TimeStamp::Now(); if (aTimeThreshold.ToMicroseconds() > 0 && mStartTimeRendezvous->HaveStartTime()) { aTimeThreshold += StartTime(); } auto p = InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaDecoderReader::RequestVideoData, aSkipToNextKeyframe, aTimeThreshold.ToMicroseconds()); if (!mStartTimeRendezvous->HaveStartTime()) { p = p->Then(mOwnerThread, __func__, mStartTimeRendezvous.get(), &StartTimeRendezvous::ProcessFirstSample<MediaData::VIDEO_DATA>, &StartTimeRendezvous::FirstSampleRejected<MediaData::VIDEO_DATA>) ->CompletionPromise(); } RefPtr<MediaDecoderReaderWrapper> self = this; mVideoDataRequest.Begin(p->Then(mOwnerThread, __func__, [self, videoDecodeStartTime] (MediaData* aVideoSample) { MOZ_ASSERT(self->mRequestVideoDataCB); self->mVideoDataRequest.Complete(); self->OnSampleDecoded(self->mRequestVideoDataCB.get(), aVideoSample, videoDecodeStartTime); }, [self] (MediaDecoderReader::NotDecodedReason aReason) { MOZ_ASSERT(self->mRequestVideoDataCB); self->mVideoDataRequest.Complete(); self->OnNotDecoded(self->mRequestVideoDataCB.get(), aReason); })); }