Ejemplo n.º 1
0
VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop, byte volume) {
	// First, check to see if that video is already playing
	for (uint32 i = 0; i < _videoStreams.size(); i++)
		if (_videoStreams[i].id == id)
			return i;

	// Otherwise, create a new entry
	Video::QuickTimeDecoder *decoder = new Video::QuickTimeDecoder();
	decoder->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, id));
	decoder->loadStream(_vm->getResource(ID_TMOV, id));
	decoder->setVolume(volume);

	VideoEntry entry;
	entry.clear();
	entry.video = decoder;
	entry.x = x;
	entry.y = y;
	entry.id = id;
	entry.loop = loop;
	entry.volume = volume;
	entry.enabled = true;

	// Search for any deleted videos so we can take a formerly used slot
	for (uint32 i = 0; i < _videoStreams.size(); i++)
		if (!_videoStreams[i].video) {
			_videoStreams[i] = entry;
			return i;
		}

	// Otherwise, just add it to the list
	_videoStreams.push_back(entry);
	return _videoStreams.size() - 1;
}
Ejemplo n.º 2
0
VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop, byte volume) {
	// First, check to see if that video is already playing
	for (uint32 i = 0; i < _videoStreams.size(); i++)
		if (_videoStreams[i].filename == filename)
			return i;

	Video::QuickTimeDecoder* decoder = new Video::QuickTimeDecoder();
	decoder->setVolume(volume);

	// Otherwise, create a new entry
	VideoEntry entry;
	entry.clear();
	entry.video = decoder;
	entry.x = x;
	entry.y = y;
	entry.filename = filename;
	entry.loop = loop;
	entry.enabled = true;
	entry.volume = volume;

	Common::File *file = new Common::File();
	if (!file->open(filename)) {
		delete file;
		return NULL_VID_HANDLE;
	}

	entry->loadStream(file);

	// Search for any deleted videos so we can take a formerly used slot
	for (uint32 i = 0; i < _videoStreams.size(); i++)
		if (!_videoStreams[i].video) {
			_videoStreams[i] = entry;
			return i;
		}

	// Otherwise, just add it to the list
	_videoStreams.push_back(entry);
	return _videoStreams.size() - 1;
}
Ejemplo n.º 3
0
VideoEntryPtr VideoManager::open(uint16 id) {
	// If this video is already playing, return that handle
	VideoEntryPtr oldVideo = findVideo(id);
	if (oldVideo)
		return oldVideo;

	// Otherwise, create a new entry
	Video::QuickTimeDecoder *video = new Video::QuickTimeDecoder();
	video->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, id));
	video->loadStream(_vm->getResource(ID_TMOV, id));

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

	// Enable dither if necessary
	checkEnableDither(entry);

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

	return entry;
}