void Player::loopRecording() { cleanupAudioThread(); setupAudioThread(); _currentFrame = 0; _timerOffset = 0; _timer.restart(); }
bool AVPlayer::load() { loaded = false; if (path.isEmpty()) { qDebug("No file to play..."); return loaded; } qDebug("loading: %s ...", path.toUtf8().constData()); if (!demuxer.loadFile(path)) { return loaded; } loaded = true; demuxer.dump(); formatCtx = demuxer.formatContext(); aCodecCtx = demuxer.audioCodecContext(); vCodecCtx = demuxer.videoCodecContext(); setupAudioThread(); setupVideoThread(); return loaded; }
void Player::startPlaying() { if (!_recording || _recording->getFrameNumber() <= 1) { return; } if (!isPaused()) { _currentContext.globalTimestamp = usecTimestampNow(); _currentContext.domain = DependencyManager::get<NodeList>()->getDomainHandler().getHostname(); _currentContext.position = _avatar->getPosition(); _currentContext.orientation = _avatar->getOrientation(); _currentContext.scale = _avatar->getTargetScale(); _currentContext.headModel = _avatar->getFaceModelURL().toString(); _currentContext.skeletonModel = _avatar->getSkeletonModelURL().toString(); _currentContext.displayName = _avatar->getDisplayName(); _currentContext.attachments = _avatar->getAttachmentData(); _currentContext.orientationInv = glm::inverse(_currentContext.orientation); RecordingContext& context = _recording->getContext(); if (_useAttachments) { _avatar->setAttachmentData(context.attachments); } if (_useDisplayName) { _avatar->setDisplayName(context.displayName); } if (_useHeadURL) { _avatar->setFaceModelURL(context.headModel); } if (_useSkeletonURL) { _avatar->setSkeletonModelURL(context.skeletonModel); } bool wantDebug = false; if (wantDebug) { qCDebug(avatars) << "Player::startPlaying(): Recording Context"; qCDebug(avatars) << "Domain:" << _currentContext.domain; qCDebug(avatars) << "Position:" << _currentContext.position; qCDebug(avatars) << "Orientation:" << _currentContext.orientation; qCDebug(avatars) << "Scale:" << _currentContext.scale; qCDebug(avatars) << "Head URL:" << _currentContext.headModel; qCDebug(avatars) << "Skeleton URL:" << _currentContext.skeletonModel; qCDebug(avatars) << "Display Name:" << _currentContext.displayName; qCDebug(avatars) << "Num Attachments:" << _currentContext.attachments.size(); for (int i = 0; i < _currentContext.attachments.size(); ++i) { qCDebug(avatars) << "Model URL:" << _currentContext.attachments[i].modelURL; qCDebug(avatars) << "Joint Name:" << _currentContext.attachments[i].jointName; qCDebug(avatars) << "Translation:" << _currentContext.attachments[i].translation; qCDebug(avatars) << "Rotation:" << _currentContext.attachments[i].rotation; qCDebug(avatars) << "Scale:" << _currentContext.attachments[i].scale; } } // Fake faceshift connection _avatar->setForceFaceTrackerConnected(true); qCDebug(avatars) << "Recorder::startPlaying()"; setupAudioThread(); _currentFrame = 0; _timerOffset = 0; _timer.start(); } else { qCDebug(avatars) << "Recorder::startPlaying(): Unpause"; setupAudioThread(); _timer.start(); setCurrentFrame(_pausedFrame); _pausedFrame = INVALID_FRAME; } }