Esempio n. 1
0
void AVIDecoder::checkTruemotion1() {
	// If we got here from loadStream(), we know the track is valid
	assert(!_videoTracks.empty());

	TrackStatus &status = _videoTracks[0];
	AVIVideoTrack *track = (AVIVideoTrack *)status.track;

	// Ignore non-truemotion tracks
	if (!track->isTruemotion1())
		return;

	// Read the next video packet
	handleNextPacket(status);

	const Graphics::Surface *frame = track->decodeNextFrame();
	if (!frame) {
		rewind();
		return;
	}

	// Fill in the width/height based on the frame's width/height
	_header.width = frame->w;
	_header.height = frame->h;
	track->forceDimensions(frame->w, frame->h);

	// Rewind us back to the beginning
	rewind();
}
Esempio n. 2
0
void AVIDecoder::checkTruemotion1() {
	AVIVideoTrack *track = 0;

	for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) {
		if ((*it)->getTrackType() == Track::kTrackTypeVideo) {
			if (track) {
				// Multiple tracks; isn't going to be truemotion 1
				return;
			}

			track = (AVIVideoTrack *)*it;
		}
	}

	// No track found?
	if (!track)
		return;

	// Ignore non-truemotion tracks
	if (!track->isTruemotion1())
		return;

	// Search for a non-empty frame
	const Graphics::Surface *frame = 0;
	for (int i = 0; i < 10 && !frame; i++)
		frame = decodeNextFrame();

	if (!frame) {
		// Probably shouldn't happen
		rewind();
		return;
	}

	// Fill in the width/height based on the frame's width/height
	_header.width = frame->w;
	_header.height = frame->h;
	track->forceDimensions(frame->w, frame->h);

	// Rewind us back to the beginning
	rewind();
}