コード例 #1
0
ファイル: video.cpp プロジェクト: project-cabal/cabal
Video::VideoDecoder *ZVision::loadAnimation(const Common::String &fileName) {
	Common::String tmpFileName = fileName;
	tmpFileName.toLowercase();
	Video::VideoDecoder *animation = NULL;

	if (tmpFileName.hasSuffix(".rlf"))
		animation = new RLFDecoder();
	else if (tmpFileName.hasSuffix(".avi"))
		animation = new ZorkAVIDecoder();
#ifdef USE_MPEG2
	else if (tmpFileName.hasSuffix(".vob"))
		animation = new Video::MPEGPSDecoder();
#endif
	else
		error("Unknown suffix for animation %s", fileName.c_str());

	Common::File *_file = getSearchManager()->openFile(tmpFileName);
	if (!_file)
		error("Error opening %s", tmpFileName.c_str());

	bool loaded = animation->loadStream(_file);
	if (!loaded)
		error("Error loading animation %s", tmpFileName.c_str());

	return animation;
}
コード例 #2
0
ファイル: video.cpp プロジェクト: BenCastricum/scummvm
VideoEntryPtr VideoManager::open(const Common::String &fileName, Audio::Mixer::SoundType soundType) {
	// If this video is already playing, return that entry
	VideoEntryPtr oldVideo = findVideo(fileName);
	if (oldVideo)
		return oldVideo;

	// Otherwise, create a new entry
	Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(fileName);
	if (!stream)
		return VideoEntryPtr();

	Video::VideoDecoder *video = new Video::QuickTimeDecoder();
	video->setSoundType(soundType);
	if (!video->loadStream(stream)) {
		// FIXME: Better error handling
		delete video;
		return VideoEntryPtr();
	}

	// Create the entry
	VideoEntryPtr entry(new VideoEntry(video, fileName));

	// Enable dither if necessary
	checkEnableDither(entry);

	// Add it to the video list
	_videos.push_back(entry);

	return entry;
}