• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VideoEntryPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了VideoEntryPtr类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:34,代码来源:mechanical.cpp


示例2: open

VideoEntryPtr VideoManager::playMovie(const Common::String &fileName, Audio::Mixer::SoundType soundType) {
	VideoEntryPtr ptr = open(fileName, soundType);
	if (!ptr)
		return VideoEntryPtr();

	ptr->start();
	return ptr;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:8,代码来源:video.cpp


示例3: open

VideoHandle VideoManager::playMovie(const Common::String &fileName) {
	VideoEntryPtr ptr = open(fileName);
	if (!ptr)
		return VideoHandle();

	ptr->start();
	return ptr;
}
开发者ID:mdtrooper,项目名称:scummvm,代码行数:8,代码来源:video.cpp


示例4: o_elevatorTopMovie

void Mechanical::o_elevatorTopMovie(uint16 var, const ArgumentsArray &args) {
	uint16 startTime = args[0];
	uint16 endTime = args[1];

	VideoEntryPtr window = _vm->playMovie("hcelev", kMechanicalStack);
	window->moveTo(206, 38);
	window->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));

	_vm->waitUntilMovieEnds(window);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:10,代码来源:mechanical.cpp


示例5: o_fortressStaircaseMovie

void Mechanical::o_fortressStaircaseMovie(uint16 var, const ArgumentsArray &args) {
	VideoEntryPtr staircase = _vm->playMovie("hhstairs", kMechanicalStack);
	staircase->moveTo(174, 222);

	if (_state.staircaseState) {
		staircase->setBounds(Audio::Timestamp(0, 840, 600), Audio::Timestamp(0, 1680, 600));
	} else {
		staircase->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 840, 600));
	}

	_vm->waitUntilMovieEnds(staircase);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:12,代码来源:mechanical.cpp


示例6: getVideo

VideoEntryPtr MystAreaVideo::getVideo() {
	// If the video is already in the manager, just return the handle
	VideoEntryPtr handle = _vm->_video->findVideo(_videoFile);
	if (!handle) {
		// If the video has not been loaded yet, do it but don't start playing it
		handle = _vm->_video->playMovie(_videoFile, Audio::Mixer::kSFXSoundType);
		if (!handle)
			error("Failed to open '%s'", _videoFile.c_str());
		handle->stop();
	}

	return handle;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:13,代码来源:myst_areas.cpp


示例7: debug

void VideoManager::playMovieBlockingRiven(uint16 id) {
	for (uint16 i = 0; i < _mlstRecords.size(); i++) {
		if (_mlstRecords[i].code == id) {
			debug(1, "Play tMOV %d (blocking) at (%d, %d), Volume = %d", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].volume);
			VideoEntryPtr ptr = open(_mlstRecords[i].movieID);
			ptr->moveTo(_mlstRecords[i].left, _mlstRecords[i].top);
			ptr->setVolume(_mlstRecords[i].volume);
			ptr->start();
			waitUntilMovieEnds(ptr);
			return;
		}
	}
}
开发者ID:mdtrooper,项目名称:scummvm,代码行数:13,代码来源:video.cpp


示例8: o_fortressRotationSetPosition

void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray &args) {
	VideoEntryPtr gears = _fortressRotationGears->getVideo();
	uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();

	// Myst ME short movie workaround, explained in o_fortressRotation_init
	if (_fortressRotationShortMovieWorkaround) {
		moviePosition += 3600 * _fortressRotationShortMovieCount;
	}

	_fortressPosition = (moviePosition + 900) / 1800 % 4;

	// Stop the gears video so that it does not play while the elevator is going up
	_fortressRotationGears->getVideo()->stop();
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:14,代码来源:mechanical.cpp


示例9: checkEnableDither

void VideoManager::checkEnableDither(VideoEntryPtr &entry) {
	// If we're not dithering, bail out
	if (!_enableDither)
		return;

	// Set the palette
	byte palette[256 * 3];
	g_system->getPaletteManager()->grabPalette(palette, 0, 256);
	entry->_video->setDitheringPalette(palette);

	if (entry->_video->getPixelFormat().bytesPerPixel != 1) {
		if (entry->getFileName().empty())
			error("Failed to set dither for video tMOV %d", entry->getID());
		else
			error("Failed to set dither for video %s", entry->getFileName().c_str());
	}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:17,代码来源:video.cpp


示例10: debugPrintf

bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
	if (argc < 3) {
		debugPrintf("Usage: playMovie <name> <stack> [<left> <top>]\n");
		debugPrintf("NOTE: The movie will play *once* in the background.\n");
		return true;
	}

	Common::String fileName = argv[1];
	int8 stackNum = -1;
	for (byte i = 0; i < ARRAYSIZE(mystStackNames); i++)
		if (!scumm_stricmp(argv[2], mystStackNames[i])) {
			stackNum = i;
			break;
		}

	if (stackNum < 0) {
		debugPrintf("\'%s\' is not a stack name!\n", argv[2]);
		return true;
	}

	VideoEntryPtr video = _vm->playMovie(fileName, static_cast<MystStack>(stackNum));

	if (argc == 4) {
		video->setX(atoi(argv[2]));
		video->setY(atoi(argv[3]));
	} else if (argc > 4) {
		video->setX(atoi(argv[3]));
		video->setY(atoi(argv[4]));
	} else {
		video->center();
	}

	return false;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:34,代码来源:console.cpp


示例11: error

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;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:39,代码来源:myst_areas.cpp


示例12: pauseMovie

void MystAreaVideo::pauseMovie(bool pause) {
	VideoEntryPtr handle = _vm->_video->findVideo(_videoFile);
	if (handle && !handle->endOfVideo())
		handle->pause(pause);
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:5,代码来源:myst_areas.cpp


示例13: isPlaying

bool MystAreaVideo::isPlaying() {
	VideoEntryPtr handle = _vm->_video->findVideo(_videoFile);
	return handle && !handle->endOfVideo();
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:4,代码来源:myst_areas.cpp


示例14: 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;
	}
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:71,代码来源:mechanical.cpp


示例15: 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);
//.........这里部分代码省略.........
开发者ID:AReim1982,项目名称:scummvm,代码行数:101,代码来源:mechanical.cpp


示例16: drawVideoFrame

void VideoManager::drawVideoFrame(const VideoEntryPtr &video, const Audio::Timestamp &time) {
	assert(video);
	video->seek(time);
	drawNextFrame(video);
	video->stop();
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:6,代码来源:video.cpp


示例17: drawNextFrame

bool VideoManager::drawNextFrame(VideoEntryPtr videoEntry) {
	Video::VideoDecoder *video = videoEntry->_video;
	const Graphics::Surface *frame = video->decodeNextFrame();

	if (!frame || !videoEntry->isEnabled()) {
		return false;
	}

	Graphics::Surface *convertedFrame = nullptr;
	Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();

	if (frame->format != pixelFormat) {
		// We don't support downconverting to 8bpp without having
		// support in the codec. Set _enableDither if shows up.
		if (pixelFormat.bytesPerPixel == 1) {
			warning("Cannot convert high color video frame to 8bpp");
			return false;
		}

		// Convert to the current screen format
		convertedFrame = frame->convertTo(pixelFormat, video->getPalette());
		frame = convertedFrame;
	} else if (pixelFormat.bytesPerPixel == 1 && video->hasDirtyPalette()) {
		// Set the palette when running in 8bpp mode only
		// Don't do this for Myst, which has its own per-stack handling
		if (_vm->getGameType() != GType_MYST)
			_vm->_system->getPaletteManager()->setPalette(video->getPalette(), 0, 256);
	}

	// Clip the video to make sure it stays on the screen (Myst does this a few times)
	Common::Rect targetRect = Common::Rect(video->getWidth(), video->getHeight());
	targetRect.translate(videoEntry->getX(), videoEntry->getY());

	Common::Rect frameRect = Common::Rect(video->getWidth(), video->getHeight());

	if (targetRect.left < 0) {
		frameRect.left -= targetRect.left;
		targetRect.left = 0;
	}

	if (targetRect.top < 0) {
		frameRect.top -= targetRect.top;
		targetRect.top = 0;
	}

	if (targetRect.right > _vm->_system->getWidth()) {
		frameRect.right -= targetRect.right - _vm->_system->getWidth();
		targetRect.right = _vm->_system->getWidth();
	}

	if (targetRect.bottom > _vm->_system->getHeight()) {
		frameRect.bottom -= targetRect.bottom - _vm->_system->getHeight();
		targetRect.bottom = _vm->_system->getHeight();
	}

	_vm->_system->copyRectToScreen(frame->getBasePtr(frameRect.left, frameRect.top), frame->pitch,
	                               targetRect.left, targetRect.top, targetRect.width(), targetRect.height());

	// Delete 8bpp conversion surface
	if (convertedFrame) {
		convertedFrame->free();
		delete convertedFrame;
	}

	// We've drawn something to the screen, make sure we update it
	return true;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:67,代码来源:video.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VideoFormat类代码示例发布时间:2022-05-31
下一篇:
C++ VideoDecoder类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap