コード例 #1
0
ファイル: avi_decoder.cpp プロジェクト: MaddTheSane/scummvm
void AVIDecoder::handleList(uint32 listSize) {
	uint32 listType = _fileStream->readUint32BE();
	listSize -= 4; // Subtract away listType's 4 bytes
	uint32 curPos = _fileStream->pos();

	debug(0, "Found LIST of type %s", tag2str(listType));

	switch (listType) {
	case ID_MOVI: // Movie List
		// We found the movie block
		_foundMovieList = true;
		_movieListStart = curPos;
		_fileStream->skip(listSize);
		return;
	case ID_HDRL: // Header List
		// Mark the header as decoded
		_decodedHeader = true;
		break;
	case ID_INFO: // Metadata
	case ID_PRMI: // Unknown metadata, should be safe to ignore
		// Ignore metadata
		_fileStream->skip(listSize);
		return;
	case ID_STRL: // Stream list
	default:      // (Just hope we can parse it!)
		break;
	}

	while ((_fileStream->pos() - curPos) < listSize)
		parseNextChunk();
}
コード例 #2
0
ファイル: avi_decoder.cpp プロジェクト: Tkachov/scummvm
bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
	close();

	uint32 riffTag = stream->readUint32BE();
	if (riffTag != ID_RIFF) {
		warning("Failed to find RIFF header");
		return false;
	}

	int32 fileSize = stream->readUint32LE();
	uint32 riffType = stream->readUint32BE();

	if (riffType != ID_AVI) {
		warning("RIFF not an AVI file");
		return false;
	}

	_fileStream = stream;

	// Go through all chunks in the file
	while (_fileStream->pos() < fileSize && parseNextChunk())
		;

	if (!_decodedHeader) {
		warning("Failed to parse AVI header");
		close();
		return false;
	}

	if (!_foundMovieList) {
		warning("Failed to find 'MOVI' list");
		close();
		return false;
	}

	// Create the status entries
	uint32 index = 0;
	for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) {
		TrackStatus status;
		status.track = *it;
		status.index = index;
		status.chunkSearchOffset = _movieListStart;

		if ((*it)->getTrackType() == Track::kTrackTypeVideo)
			_videoTracks.push_back(status);
		else
			_audioTracks.push_back(status);
	}

	if (_videoTracks.size() != 1) {
		close();
		return false;
	}

	// Check if this is a special Duck Truemotion video
	checkTruemotion1();

	return true;
}
コード例 #3
0
ファイル: avi_decoder.cpp プロジェクト: Akz-/residual
bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
	close();

	uint32 riffTag = stream->readUint32BE();
	if (riffTag != ID_RIFF) {
		warning("Failed to find RIFF header");
		return false;
	}

	/* uint32 fileSize = */ stream->readUint32LE();
	uint32 riffType = stream->readUint32BE();

	if (riffType != ID_AVI) {
		warning("RIFF not an AVI file");
		return false;
	}

	_fileStream = stream;

	// Go through all chunks in the file
	while (parseNextChunk())
		;

	if (!_decodedHeader) {
		warning("Failed to parse AVI header");
		close();
		return false;
	}

	if (!_foundMovieList) {
		warning("Failed to find 'MOVI' list");
		close();
		return false;
	}

	// Seek back to the start of the MOVI list
	_fileStream->seek(_movieListStart);

	// Check if this is a special Duck Truemotion video
	checkTruemotion1();

	return true;
}
コード例 #4
0
void AVIDecoder::handleList(uint32 listSize) {
	uint32 listType = _fileStream->readUint32BE();
	listSize -= 4; // Subtract away listType's 4 bytes
	uint32 curPos = _fileStream->pos();

	debug(0, "Found LIST of type %s", tag2str(listType));

	if (listType == ID_MOVI) {
		// If we found the movie block
		_foundMovieList = true;
		_movieListStart = curPos;
		_fileStream->skip(listSize);
		return;
	} else if (listType == ID_HDRL) {
		// Mark the header as decoded
		_decodedHeader = true;
	}

	while ((_fileStream->pos() - curPos) < listSize)
		parseNextChunk();
}
コード例 #5
0
ファイル: avi_decoder.cpp プロジェクト: AReim1982/scummvm
bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) {
	close();

	uint32 riffTag = stream->readUint32BE();
	if (riffTag != ID_RIFF) {
		warning("Failed to find RIFF header");
		return false;
	}

	int32 fileSize = stream->readUint32LE();
	uint32 riffType = stream->readUint32BE();

	if (riffType != ID_AVI) {
		warning("RIFF not an AVI file");
		return false;
	}

	_fileStream = stream;

	// Go through all chunks in the file
	while (_fileStream->pos() < fileSize && parseNextChunk())
		;

	if (!_decodedHeader) {
		warning("Failed to parse AVI header");
		close();
		return false;
	}

	if (!_foundMovieList) {
		warning("Failed to find 'MOVI' list");
		close();
		return false;
	}

	// Create the status entries
	uint32 index = 0;
	for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) {
		TrackStatus status;
		status.track = *it;
		status.index = index;
		status.chunkSearchOffset = _movieListStart;

		if ((*it)->getTrackType() == Track::kTrackTypeAudio) {
			_audioTracks.push_back(status);
		} else if (_videoTracks.empty()) {
			_videoTracks.push_back(status);
		} else {
			// Secondary video track. For now we assume it will always be a
			// transparency information track
			status.chunkSearchOffset = getVideoTrackOffset(index);
			assert(!_transparencyTrack.track);
			assert(status.chunkSearchOffset != 0);

			// Copy the track status information into the transparency track field
			_transparencyTrack = status;
		}
	}

	// If there is a transparency track, remove it from the video decoder's track list.
	// This is to stop it being included in calls like getFrameCount
	if (_transparencyTrack.track)
		eraseTrack(_transparencyTrack.track);

	// Check if this is a special Duck Truemotion video
	checkTruemotion1();

	return true;
}
コード例 #6
0
void MediaParserBase::parserLoop(){
	_parserThreadStartBarrier.wait();
	while(!parserThreadKillRequested()){
		parseNextChunk();
	}
}