예제 #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;
}
예제 #2
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;
}