本文整理汇总了C++中VideoEntryPtr::seek方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoEntryPtr::seek方法的具体用法?C++ VideoEntryPtr::seek怎么用?C++ VideoEntryPtr::seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoEntryPtr
的用法示例。
在下文中一共展示了VideoEntryPtr::seek方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: o_fortressRotation_init
void Mechanical::o_fortressRotation_init(uint16 var, const ArgumentsArray &args) {
_fortressRotationGears = getInvokingResource<MystAreaVideo>();
VideoEntryPtr gears = _fortressRotationGears->playMovie();
gears->setLooping(true);
gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600));
gears->setRate(0);
_fortressRotationSounds[0] = args[0];
_fortressRotationSounds[1] = args[1];
_fortressRotationSounds[2] = args[2];
_fortressRotationSounds[3] = args[3];
_fortressRotationBrake = 0;
// WORKAROUND for the tower rotation bug in Myst ME.
// The original engine only allowed to visit two out of the three small islands,
// preventing the game from being fully completable.
// The fortress rotation is computed from the current position in the movie
// hcgears.mov. The version of this movie that shipped with the ME edition is
// too short to allow to visit all the islands.
// ScummVM simulates a longer movie by counting the number of times the movie
// looped and adding that time to the current movie position.
// Hence allowing the fortress position to be properly computed.
uint32 movieDuration = gears->getDuration().convertToFramerate(600).totalNumberOfFrames();
if (movieDuration == 3680) {
_fortressRotationShortMovieWorkaround = true;
_fortressRotationShortMovieCount = 0;
_fortressRotationShortMovieLast = 0;
}
_fortressRotationRunning = true;
_gearsWereRunning = false;
}
示例2: playMovie
VideoEntryPtr MystAreaVideo::playMovie() {
// Check if the video is already running
VideoEntryPtr handle = _vm->_video->findVideo(_videoFile);
// If the video is not running, play it
if (!handle) {
handle = _vm->_video->playMovie(_videoFile, Audio::Mixer::kSFXSoundType);
if (!handle)
error("Failed to open '%s'", _videoFile.c_str());
handle->moveTo(_left, _top);
handle->setLooping(_loop != 0);
Common::Rational rate;
if (_playRate != 0) {
rate = Common::Rational(_playRate, 100);
} else {
rate = 1;
}
if (_direction == -1) {
rate = -rate;
handle->seek(handle->getDuration());
}
handle->setRate(rate);
} else {
// Resume the video
handle->pause(false);
handle->start();
}
if (_playBlocking) {
_vm->waitUntilMovieEnds(handle);
return VideoEntryPtr();
}
return handle;
}
示例3: drawVideoFrame
void VideoManager::drawVideoFrame(const VideoEntryPtr &video, const Audio::Timestamp &time) {
assert(video);
video->seek(time);
drawNextFrame(video);
video->stop();
}
示例4: fortressSimulation_run
void Mechanical::fortressSimulation_run() {
if (_fortressSimulationInit) {
// Init sequence
_vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->wait(5000, true);
VideoEntryPtr startup = _fortressSimulationStartup->playMovie();
_vm->playSoundBlocking(_fortressSimulationStartSound2);
_vm->_sound->playBackground(_fortressSimulationStartSound1, 65535);
_vm->waitUntilMovieEnds(startup);
_vm->_sound->stopBackground();
_vm->_sound->playEffect(_fortressSimulationStartSound2);
Common::Rect src = Common::Rect(0, 0, 176, 176);
Common::Rect dst = Common::Rect(187, 3, 363, 179);
_vm->_gfx->copyImageSectionToBackBuffer(6046, src, dst);
_vm->_gfx->copyBackBufferToScreen(dst);
_fortressSimulationStartup->pauseMovie(true);
VideoEntryPtr holo = _fortressSimulationHolo->playMovie();
holo->setLooping(true);
holo->setRate(0);
// HACK: Support negative rates with edit lists
_fortressSimulationHoloRate = 0;
// END HACK
_vm->_cursor->showCursor();
_fortressSimulationInit = false;
} else {
VideoEntryPtr holo = _fortressSimulationHolo->getVideo();
double oldRate = holo->getRate().toDouble();
// HACK: Support negative rates with edit lists
oldRate = _fortressSimulationHoloRate;
// END HACK
uint32 moviePosition = Audio::Timestamp(holo->getTime(), 600).totalNumberOfFrames();
int32 positionInQuarter = 900 - (moviePosition + 900) % 1800;
// Are the gears moving?
if (oldRate >= 0.1 || ABS<int32>(positionInQuarter) >= 30 || _fortressSimulationBrake) {
double newRate = oldRate;
if (_fortressSimulationBrake && (double)_fortressSimulationBrake * 0.2 > oldRate) {
newRate += 0.1;
}
// Don't let the gears get stuck between two fortress positions
if (ABS<double>(oldRate) <= 0.05) {
if (oldRate <= 0.0) {
newRate += oldRate;
} else {
newRate -= oldRate;
}
} else {
if (oldRate <= 0.0) {
newRate += 0.05;
} else {
newRate -= 0.05;
}
}
// Adjust speed accordingly to acceleration lever
newRate += (double) (positionInQuarter / 1500.0)
* (double) (9 - _fortressSimulationSpeed) / 9.0;
newRate = CLIP<double>(newRate, -2.5, 2.5);
// HACK: Support negative rates with edit lists
// Our current QuickTime implementation does not support negative
// playback rates for movies using edit lists.
// The fortress rotation simulator movie this code handles is the
// only movie in the game requiring that feature.
// This hack approximates the next frame to display when the rate
// is negative, and seeks to it. It's not intended to be precise.
_fortressSimulationHoloRate = newRate;
if (_fortressSimulationHoloRate < 0) {
double newMoviePosition = moviePosition + _fortressSimulationHoloRate * 10;
holo->setRate(0);
holo->seek(Audio::Timestamp(0, (uint)newMoviePosition, 600));
} else {
holo->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
}
// END HACK
_gearsWereRunning = true;
} else if (_gearsWereRunning) {
// The fortress has stopped. Set its new position
uint16 simulationPosition = (moviePosition + 900) / 1800 % 4;
holo->setRate(0);
//.........这里部分代码省略.........
示例5: fortressRotation_run
void Mechanical::fortressRotation_run() {
VideoEntryPtr gears = _fortressRotationGears->getVideo();
double oldRate = gears->getRate().toDouble();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
// Myst ME short movie workaround, explained in o_fortressRotation_init
if (_fortressRotationShortMovieWorkaround) {
// Detect if we just looped
if (ABS<int32>(_fortressRotationShortMovieLast - 3680) < 50
&& ABS<int32>(moviePosition) < 50) {
_fortressRotationShortMovieCount++;
}
_fortressRotationShortMovieLast = moviePosition;
// Simulate longer movie
moviePosition += 3600 * _fortressRotationShortMovieCount;
}
int32 positionInQuarter = 900 - (moviePosition + 900) % 1800;
// Are the gears moving?
if (oldRate >= 0.1 || ABS<int32>(positionInQuarter) >= 30 || _fortressRotationBrake) {
double newRate = oldRate;
if (_fortressRotationBrake && (double)_fortressRotationBrake * 0.2 > oldRate) {
newRate += 0.1;
}
// Don't let the gears get stuck between two fortress positions
if (ABS<double>(oldRate) <= 0.05) {
if (oldRate <= 0.0) {
newRate += oldRate;
} else {
newRate -= oldRate;
}
} else {
if (oldRate <= 0.0) {
newRate += 0.05;
} else {
newRate -= 0.05;
}
}
// Adjust speed accordingly to acceleration lever
newRate += (double) (positionInQuarter / 1500.0)
* (double) (9 - _fortressRotationSpeed) / 9.0;
newRate = CLIP<double>(newRate, -2.5, 2.5);
gears->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
_gearsWereRunning = true;
} else if (_gearsWereRunning) {
// The fortress has stopped. Set its new position
_fortressPosition = (moviePosition + 900) / 1800 % 4;
gears->setRate(0);
if (!_fortressRotationShortMovieWorkaround) {
gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600));
} else {
gears->seek(Audio::Timestamp(0, 1800 * (_fortressPosition % 2), 600));
}
_vm->playSoundBlocking(_fortressRotationSounds[_fortressPosition]);
_gearsWereRunning = false;
}
}