diff options
author | Johannes Schickel | 2010-01-25 01:39:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-25 01:39:44 +0000 |
commit | aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2 (patch) | |
tree | 95f119e687a666f65aad5041910c43bdfd4f2929 /engines/mohawk/video | |
parent | ec14cd6e6add76ce4f719edd7ce508d67ebd9f14 (diff) | |
download | scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.tar.gz scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.tar.bz2 scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.zip |
Strip trailing spaces/tabs.
svn-id: r47541
Diffstat (limited to 'engines/mohawk/video')
-rw-r--r-- | engines/mohawk/video/cinepak.cpp | 6 | ||||
-rw-r--r-- | engines/mohawk/video/cinepak.h | 4 | ||||
-rw-r--r-- | engines/mohawk/video/qdm2.cpp | 22 | ||||
-rw-r--r-- | engines/mohawk/video/qdm2.h | 6 | ||||
-rw-r--r-- | engines/mohawk/video/qt_player.cpp | 152 | ||||
-rw-r--r-- | engines/mohawk/video/qt_player.h | 14 | ||||
-rw-r--r-- | engines/mohawk/video/qtrle.cpp | 12 | ||||
-rw-r--r-- | engines/mohawk/video/qtrle.h | 6 | ||||
-rw-r--r-- | engines/mohawk/video/rpza.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/video/rpza.h | 2 | ||||
-rw-r--r-- | engines/mohawk/video/smc.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/video/smc.h | 2 | ||||
-rw-r--r-- | engines/mohawk/video/video.cpp | 48 |
13 files changed, 141 insertions, 141 deletions
diff --git a/engines/mohawk/video/cinepak.cpp b/engines/mohawk/video/cinepak.cpp index c5289806cf..48883ceab9 100644 --- a/engines/mohawk/video/cinepak.cpp +++ b/engines/mohawk/video/cinepak.cpp @@ -31,7 +31,7 @@ // Code here partially based off of ffmpeg ;) namespace Mohawk { - + #define PUT_PIXEL(offset, lum, u, v) \ Graphics::CPYUV2RGB(lum, u, v, r, g, b); \ if (_pixelFormat.bytesPerPixel == 2) \ @@ -68,7 +68,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea _curFrame.strips = new CinepakStrip[_curFrame.stripCount]; debug (4, "Cinepak Frame: Width = %d, Height = %d, Strip Count = %d", _curFrame.width, _curFrame.height, _curFrame.stripCount); - + #if 0 // Borrowed from FFMPEG. This should cut out the extra data Cinepak for Sega has (which is useless). // The theory behind this is that this is here to confuse standard Cinepak decoders. But, we won't let that happen! ;) @@ -146,7 +146,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea _y = _curFrame.strips[i].rect.bottom; } - + return _curFrame.surface; } diff --git a/engines/mohawk/video/cinepak.h b/engines/mohawk/video/cinepak.h index a94d879bdb..43cc22bfc9 100644 --- a/engines/mohawk/video/cinepak.h +++ b/engines/mohawk/video/cinepak.h @@ -55,7 +55,7 @@ struct CinepakFrame { uint16 height; uint16 stripCount; CinepakStrip *strips; - + Graphics::Surface *surface; }; @@ -70,7 +70,7 @@ private: CinepakFrame _curFrame; int32 _y; Graphics::PixelFormat _pixelFormat; - + void loadCodebook(Common::SeekableReadStream *stream, uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize); void decodeVectors(Common::SeekableReadStream *stream, uint16 strip, byte chunkID, uint32 chunkSize); }; diff --git a/engines/mohawk/video/qdm2.cpp b/engines/mohawk/video/qdm2.cpp index f5d4af8aed..b91440f00d 100644 --- a/engines/mohawk/video/qdm2.cpp +++ b/engines/mohawk/video/qdm2.cpp @@ -147,9 +147,9 @@ static inline void skipBits(GetBitContext *s, int n) { static int splitRadixPermutation(int i, int n, int inverse) { if (n <= 2) return i & 1; - + int m = n >> 1; - + if(!(i & m)) return splitRadixPermutation(i, m, inverse) * 2; @@ -547,10 +547,10 @@ int fftInit(FFTContext *s, int nbits, int inverse) { // compute bit reverse table for (i = 0; i < n; i++) { m = 0; - + for (j = 0; j < nbits; j++) m |= ((i >> j) & 1) << (nbits - j - 1); - + s->revtab[i] = m; } } @@ -616,7 +616,7 @@ void rdftCalc(RDFTContext *s, float *data) { ev.re = data[0]; data[0] = ev.re + data[1]; data[1] = ev.re - data[1]; - + int i; for (i = 1; i < n >> 2; i++) { @@ -843,7 +843,7 @@ static void dct32(int32 *out, int32 *tab) { // pass 1 BF( 7, 24, COS0_7 , 1); BF( 8, 23, COS0_8 , 1); - // pass 2 + // pass 2 BF( 7, 8, COS1_7 , 4); BF(23, 24,-COS1_7 , 4); // pass 3 @@ -854,7 +854,7 @@ static void dct32(int32 *out, int32 *tab) { // pass 1 BF( 3, 28, COS0_3 , 1); BF(12, 19, COS0_12, 2); - // pass 2 + // pass 2 BF( 3, 12, COS1_3 , 1); BF(19, 28,-COS1_3 , 1); // pass 1 @@ -1537,12 +1537,12 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS warning("QDM2Stream::QDM2Stream() extraSize mismatch - Expected %d", (extraData->size() - extraData->pos()) / 4 + 1); if (tmp_s < 12) error("QDM2Stream::QDM2Stream() Insufficient extraData"); - + tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp); if (tmp != MKID_BE('frma')) warning("QDM2Stream::QDM2Stream() extraTag mismatch"); - + tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp); if (tmp == MKID_BE('QDMC')) @@ -2609,7 +2609,7 @@ void QDM2Stream::qdm2_decode_super_block(void) { // **************************************************************** } -void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, +void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, int channel, int exp, int phase) { if (_fftCoefsMinIndex[duration] < 0) _fftCoefsMinIndex[duration] = _fftCoefsIndex; @@ -2904,7 +2904,7 @@ void QDM2Stream::qdm2_calculate_fft(int channel) { //debug(1, "QDM2Stream::qdm2_calculate_fft _fft.complex[channel][0].im: %lf", _fft.complex[channel][0].im); rdftCalc(&_rdftCtx, (float *)_fft.complex[channel]); - + // add samples to output buffer for (i = 0; i < ((_fftFrameSize + 15) & ~15); i++) _outputBuffer[_channels * i + channel] += ((float *) _fft.complex[channel])[i] * gain; diff --git a/engines/mohawk/video/qdm2.h b/engines/mohawk/video/qdm2.h index 1a08064b0b..a2f55a10ac 100644 --- a/engines/mohawk/video/qdm2.h +++ b/engines/mohawk/video/qdm2.h @@ -224,7 +224,7 @@ private: uint8 _subPacket; // 0 to 15 int _noiseIdx; // index for dithering noise table - + byte _emptyBuffer[FF_INPUT_BUFFER_PADDING_SIZE]; VLC _vlcTabLevel; @@ -253,7 +253,7 @@ private: float _noiseSamples[128]; void initNoiseSamples(void); - + RDFTContext _rdftCtx; void average_quantized_coeffs(void); @@ -272,7 +272,7 @@ private: void process_subpacket_12(QDM2SubPNode *node, int length); void process_synthesis_subpackets(QDM2SubPNode *list); void qdm2_decode_super_block(void); - void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, + void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, int channel, int exp, int phase); void qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b); void qdm2_decode_fft_packets(void); diff --git a/engines/mohawk/video/qt_player.cpp b/engines/mohawk/video/qt_player.cpp index b35f43ca2d..cddecbae9e 100644 --- a/engines/mohawk/video/qt_player.cpp +++ b/engines/mohawk/video/qt_player.cpp @@ -52,7 +52,7 @@ namespace Mohawk { //////////////////////////////////////////// -// QTPlayer +// QTPlayer //////////////////////////////////////////// QTPlayer::QTPlayer() { @@ -73,35 +73,35 @@ QTPlayer::~QTPlayer() { uint16 QTPlayer::getWidth() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->width; } uint16 QTPlayer::getHeight() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->height; } uint32 QTPlayer::getFrameCount() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->nb_frames; } byte QTPlayer::getBitsPerPixel() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->bits_per_sample & 0x1F; } uint32 QTPlayer::getCodecTag() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->codec_tag; } @@ -115,7 +115,7 @@ ScaleMode QTPlayer::getScaleMode() { uint32 QTPlayer::getFrameDuration() { if (_videoStreamIndex < 0) return 0; - + uint32 curFrameIndex = 0; for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count; i++) { curFrameIndex += _streams[_videoStreamIndex]->stts_data[i].count; @@ -124,7 +124,7 @@ uint32 QTPlayer::getFrameDuration() { return _streams[_videoStreamIndex]->stts_data[i].duration * 1000 * 100 / _streams[_videoStreamIndex]->time_scale; } } - + // This should never occur error ("Cannot find duration for frame %d", _curFrame); return 0; @@ -132,10 +132,10 @@ uint32 QTPlayer::getFrameDuration() { void QTPlayer::stop() { stopAudio(); - + if (!_noCodecFound) delete _videoCodec; - + closeFile(); } @@ -182,14 +182,14 @@ Graphics::Codec *QTPlayer::createCodec(uint32 codecTag, byte bitsPerPixel) { } else { warning ("Unsupported codec \'%s\'", tag2str(codecTag)); } - + return NULL; } void QTPlayer::startAudio() { if (!_audStream) // No audio/audio not supported return; - + g_system->getMixer()->playInputStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream); } @@ -205,19 +205,19 @@ void QTPlayer::stopAudio() { g_system->getMixer()->stopHandle(_audHandle); } -Graphics::Surface *QTPlayer::getNextFrame() { +Graphics::Surface *QTPlayer::getNextFrame() { if (_noCodecFound || _curFrame >= (int32)getFrameCount() - 1) return NULL; - + if (_nextFrameStart == 0) _nextFrameStart = g_system->getMillis() * 100; - + _lastFrameStart = _nextFrameStart; _curFrame++; _nextFrameStart = getFrameDuration() + _lastFrameStart; - + Common::SeekableReadStream *frameData = getNextFramePacket(); - + if (!_videoCodec) { _videoCodec = createCodec(getCodecTag(), getBitsPerPixel()); // If we don't get it still, the codec is unsupported ;) @@ -261,7 +261,7 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) { MOVatom atom = { 0, 0, 0xffffffff }; - if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT)) + if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT)) return false; debug(0, "on_parse_exit_offset=%d", _fd->pos()); @@ -297,22 +297,22 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) { sc->ffindex = i; sc->is_ff_stream = 1; - + if (sc->codec_type == CODEC_TYPE_VIDEO && _videoStreamIndex < 0) _videoStreamIndex = i; else if (sc->codec_type == CODEC_TYPE_AUDIO && _audioStreamIndex < 0) _audioStreamIndex = i; } - + if (_audioStreamIndex >= 0 && checkAudioCodecSupport(_streams[_audioStreamIndex]->codec_tag)) { _audStream = Audio::makeQueuingAudioStream(_streams[_audioStreamIndex]->sample_rate, _streams[_audioStreamIndex]->channels == 2); _curAudioChunk = 0; - + // Make sure the bits per sample transfers to the sample size if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('twos')) _streams[_audioStreamIndex]->sample_size = (_streams[_audioStreamIndex]->bits_per_sample / 8) * _streams[_audioStreamIndex]->channels; } - + return true; } @@ -359,29 +359,29 @@ int QTPlayer::readDefault(MOVatom atom) { while(((total_size + 8) < atom.size) && !_fd->eos() && !err) { a.size = atom.size; a.type = 0; - + if (atom.size >= 8) { a.size = _fd->readUint32BE(); a.type = _fd->readUint32BE(); } - + total_size += 8; a.offset += 8; debug(4, "type: %08x %.4s sz: %x %x %x", a.type, tag2str(a.type), a.size, atom.size, total_size); - + if (a.size == 1) { // 64 bit extended size warning("64 bit extended size is not supported in QuickTime"); return -1; } - + if (a.size == 0) { a.size = atom.size - total_size; if (a.size <= 8) break; } - + uint32 i = 0; - + for (; _parseTable[i].type != 0 && _parseTable[i].type != a.type; i++) // empty; @@ -397,9 +397,9 @@ int QTPlayer::readDefault(MOVatom atom) { } else { uint32 start_pos = _fd->pos(); err = (this->*_parseTable[i].func)(a); - + uint32 left = a.size - _fd->pos() + start_pos; - + if (left > 0) // skip garbage at atom end _fd->seek(left, SEEK_CUR); } @@ -445,40 +445,40 @@ int QTPlayer::readCMOV(MOVatom atom) { warning("Unknown cmov compression type"); return -1; } - + // Read in the cmvd atom uint32 compressedSize = _fd->readUint32BE() - 12; if (_fd->readUint32BE() != MKID_BE('cmvd')) return -1; uint32 uncompressedSize = _fd->readUint32BE(); - + // Read in data byte *compressedData = (byte *)malloc(compressedSize); _fd->read(compressedData, compressedSize); - + // Create uncompressed stream byte *uncompressedData = (byte *)malloc(uncompressedSize); - + // Uncompress the data unsigned long dstLen = uncompressedSize; if (!Common::uncompress(uncompressedData, &dstLen, compressedData, compressedSize)) { warning ("Could not uncompress cmov chunk"); return -1; } - + // Load data into a new MemoryReadStream and assign _fd to be that Common::SeekableReadStream *oldStream = _fd; _fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES); - + // Read the contents of the uncompressed data MOVatom a = { MKID_BE('moov'), 0, uncompressedSize }; int err = readDefault(a); - + // Assign the file handle back to the original handle free(compressedData); delete _fd; _fd = oldStream; - + return err; #else warning ("zlib not found, cannot read QuickTime cmov atom"); @@ -498,7 +498,7 @@ int QTPlayer::readMVHD(MOVatom atom) { _fd->readUint32BE(); // creation time _fd->readUint32BE(); // modification time } - + _timeScale = _fd->readUint32BE(); // time scale debug(0, "time scale = %i\n", _timeScale); @@ -593,7 +593,7 @@ int QTPlayer::readTKHD(MOVatom atom) { _fd->readUint32BE(); // creation time _fd->readUint32BE(); // modification time } - + /* st->id = */_fd->readUint32BE(); // track id (NOT 0 !) _fd->readUint32BE(); // reserved //st->start_time = 0; // check @@ -605,7 +605,7 @@ int QTPlayer::readTKHD(MOVatom atom) { _fd->readUint16BE(); // alternate group _fd->readUint16BE(); // volume _fd->readUint16BE(); // reserved - + // We only need the two values from the displacement matrix for a track. // See readMVHD() for more information. uint32 xMod = _fd->readUint32BE(); @@ -643,9 +643,9 @@ int QTPlayer::readELST(MOVatom atom) { _fd->readUint32BE(); // Media time _fd->readUint32BE(); // Media rate } - + debug(0, "track[%i].edit_count = %i", _numStreams - 1, _streams[_numStreams - 1]->edit_count); - + if (editCount != 1) warning("Multiple edit list entries. Things may go awry"); @@ -743,7 +743,7 @@ int QTPlayer::readSTSD(MOVatom atom) { if (st->codec_type == CODEC_TYPE_VIDEO) { debug(0, "Video Codec FourCC: \'%s\'", tag2str(format)); - + _fd->readUint16BE(); // version _fd->readUint16BE(); // revision level _fd->readUint32BE(); // vendor @@ -804,7 +804,7 @@ int QTPlayer::readSTSD(MOVatom atom) { #if 0 byte *color_table; byte r, g, b; - + if (colorDepth == 2) color_table = ff_qt_default_palette_4; else if (colorDepth == 4) @@ -846,7 +846,7 @@ int QTPlayer::readSTSD(MOVatom atom) { st->palettized = false; } else if (st->codec_type == CODEC_TYPE_AUDIO) { debug(0, "Audio Codec FourCC: \'%s\'", tag2str(format)); - + st->stsd_version = _fd->readUint16BE(); _fd->readUint16BE(); // revision level _fd->readUint32BE(); // vendor @@ -877,7 +877,7 @@ int QTPlayer::readSTSD(MOVatom atom) { warning("Unsupported QuickTime STSD audio version %d", st->stsd_version); return 1; } - + // Version 0 videos (such as the Riven ones) don't have this set, // but we need it later on. Add it in here. if (format == MKID_BE('ima4')) { @@ -888,7 +888,7 @@ int QTPlayer::readSTSD(MOVatom atom) { // other codec type, just skip (rtp, mp4s, tmcd ...) _fd->seek(size - (_fd->pos() - start_pos), SEEK_CUR); } - + // this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) a.size = size - (_fd->pos() - start_pos); if (a.size > 8) @@ -924,7 +924,7 @@ int QTPlayer::readSTSC(MOVatom atom) { st->sample_to_chunk[i].id = _fd->readUint32BE(); //printf ("Sample to Chunk[%d]: First = %d, Count = %d\n", i, st->sample_to_chunk[i].first, st->sample_to_chunk[i].count); } - + return 0; } @@ -974,7 +974,7 @@ int QTPlayer::readSTSZ(MOVatom atom) { st->sample_sizes[i] = _fd->readUint32BE(); debug(6, "sample_sizes[%d] = %d", i, st->sample_sizes[i]); } - + return 0; } @@ -990,7 +990,7 @@ int QTPlayer::readSTTS(MOVatom atom) { _fd->readByte(); // version _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - + st->stts_count = _fd->readUint32BE(); st->stts_data = new MOVstts[st->stts_count]; @@ -1031,7 +1031,7 @@ int QTPlayer::readSTCO(MOVatom atom) { st->chunk_count = _fd->readUint32BE(); st->chunk_offsets = new uint32[st->chunk_count]; - + if (!st->chunk_offsets) return -1; @@ -1053,7 +1053,7 @@ int QTPlayer::readSTCO(MOVatom atom) { _ni = 1; } } - + return 0; } @@ -1062,7 +1062,7 @@ int QTPlayer::readWAVE(MOVatom atom) { return 0; MOVStreamContext *st = _streams[_numStreams - 1]; - + if (atom.size > (1 << 30)) return -1; @@ -1079,50 +1079,50 @@ int QTPlayer::readWAVE(MOVatom atom) { void QTPlayer::closeFile() { for (uint32 i = 0; i < _numStreams; i++) delete _streams[i]; - + delete _fd; - + // The audio stream is deleted automatically _audStream = NULL; } void QTPlayer::resetInternal() { - + } Common::SeekableReadStream *QTPlayer::getNextFramePacket() { if (_videoStreamIndex < 0) return NULL; - + // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for. int32 totalSampleCount = 0; int32 sampleInChunk = 0; int32 actualChunk = -1; - + for (uint32 i = 0; i < _streams[_videoStreamIndex]->chunk_count; i++) { int32 sampleToChunkIndex = -1; - + for (uint32 j = 0; j < _streams[_videoStreamIndex]->sample_to_chunk_sz; j++) if (i >= _streams[_videoStreamIndex]->sample_to_chunk[j].first - 1) sampleToChunkIndex = j; - + if (sampleToChunkIndex < 0) error("This chunk (%d) is imaginary", sampleToChunkIndex); - + totalSampleCount += _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count; - + if (totalSampleCount > getCurFrame()) { actualChunk = i; sampleInChunk = _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count - totalSampleCount + getCurFrame(); break; } } - + if (actualChunk < 0) { warning ("Could not find data for frame %d", getCurFrame()); return NULL; } - + // Next seek to that frame _fd->seek(_streams[_videoStreamIndex]->chunk_offsets[actualChunk]); @@ -1136,10 +1136,10 @@ Common::SeekableReadStream *QTPlayer::getNextFramePacket() { // Finally, read in the raw data for the frame //printf ("Frame Data[%d]: Offset = %d, Size = %d\n", getCurFrame(), _fd->pos(), _streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); - + if (_streams[_videoStreamIndex]->sample_size != 0) return _fd->readStream(_streams[_videoStreamIndex]->sample_size); - + return _fd->readStream(_streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); } @@ -1156,7 +1156,7 @@ bool QTPlayer::checkAudioCodecSupport(uint32 tag) { Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stream) { if (!stream || _audioStreamIndex < 0) return NULL; - + if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('twos') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ')) { // Fortunately, most of the audio used in Myst videos is raw... uint16 flags = 0; @@ -1178,9 +1178,9 @@ Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stre // Several Myst ME videos use this codec return new QDM2Stream(stream, _streams[_audioStreamIndex]->extradata); } - + error("Unsupported audio codec"); - + return NULL; } @@ -1191,20 +1191,20 @@ void QTPlayer::updateAudioBuffer() { // Keep two streams in buffer so that when the first ends, it goes right into the next for (; _audStream->numQueuedStreams() < 2 && _curAudioChunk < _streams[_audioStreamIndex]->chunk_count; _curAudioChunk++) { Common::MemoryWriteStreamDynamic *wStream = new Common::MemoryWriteStreamDynamic(); - + _fd->seek(_streams[_audioStreamIndex]->chunk_offsets[_curAudioChunk]); - + // First, we have to get the sample count uint32 sampleCount = 0; for (uint32 j = 0; j < _streams[_audioStreamIndex]->sample_to_chunk_sz; j++) if (_curAudioChunk >= (_streams[_audioStreamIndex]->sample_to_chunk[j].first - 1)) sampleCount = _streams[_audioStreamIndex]->sample_to_chunk[j].count; assert(sampleCount); - + // Then calculate the right sizes while (sampleCount > 0) { uint32 samples = 0, size = 0; - + if (_streams[_audioStreamIndex]->samples_per_frame >= 160) { samples = _streams[_audioStreamIndex]->samples_per_frame; size = _streams[_audioStreamIndex]->bytes_per_frame; @@ -1215,7 +1215,7 @@ void QTPlayer::updateAudioBuffer() { samples = MIN<uint32>(1024, sampleCount); size = samples * _streams[_audioStreamIndex]->sample_size; } - + // Now, we read in the data for this data and output it byte *data = (byte *)malloc(size); _fd->read(data, size); @@ -1223,7 +1223,7 @@ void QTPlayer::updateAudioBuffer() { free(data); sampleCount -= samples; } - + // Now queue the buffer _audStream->queueAudioStream(createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES))); delete wStream; diff --git a/engines/mohawk/video/qt_player.h b/engines/mohawk/video/qt_player.h index 2d8f87f479..bad3a542c1 100644 --- a/engines/mohawk/video/qt_player.h +++ b/engines/mohawk/video/qt_player.h @@ -74,13 +74,13 @@ public: * @return the amount of frames in the video */ uint32 getFrameCount(); - + /** * Returns the bits per pixel of the video * @return the bits per pixel of the video */ byte getBitsPerPixel(); - + /** * Returns the codec tag of the video * @return the codec tag of the video @@ -97,26 +97,26 @@ public: * Close a QuickTime encoded video file */ void closeFile(); - + /** * Returns the downscale mode of the video * @return the downscale mode of the video */ ScaleMode getScaleMode(); - + /** * Returns the palette of the video * @return the palette of the video */ byte *getPalette() { return _palette; } - + /** * Set the beginning offset of the video so we can modify the offsets in the stco * atom of videos inside the Mohawk archives * @param the beginning offset of the video */ void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; } - + int32 getCurFrame() { return _curFrame; } void addPauseTime(uint32 p) { _lastFrameStart += p; _nextFrameStart += p; } Graphics::Surface *getNextFrame(); @@ -251,7 +251,7 @@ protected: int8 _audioStreamIndex; uint _curAudioChunk; uint32 _beginOffset; - + Graphics::Codec *createCodec(uint32 codecTag, byte bitsPerPixel); Graphics::Codec *_videoCodec; bool _noCodecFound; diff --git a/engines/mohawk/video/qtrle.cpp b/engines/mohawk/video/qtrle.cpp index 1ad9f99838..c06dbefcb3 100644 --- a/engines/mohawk/video/qtrle.cpp +++ b/engines/mohawk/video/qtrle.cpp @@ -25,15 +25,15 @@ // QuickTime RLE Decoder // Based off ffmpeg's QuickTime RLE decoder (written by Mike Melanson) - + #include "mohawk/video/qtrle.h" - + #include "common/scummsys.h" #include "common/stream.h" #include "common/system.h" #include "graphics/colormasks.h" #include "graphics/surface.h" - + namespace Mohawk { QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Graphics::Codec() { @@ -83,7 +83,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui pixelPtr += 2 * skip; if (rleCode < 0) { - // decode the run length code + // decode the run length code rleCode = -rleCode; // get the next 2 bytes from the stream, treat them as groups of 8 pixels, and output them rleCode times */ CHECK_STREAM_PTR(2); @@ -287,7 +287,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u CHECK_PIXEL_PTR(rleCode); - while (rleCode--) + while (rleCode--) rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b); } else { CHECK_STREAM_PTR(rleCode * 3); @@ -333,7 +333,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u CHECK_PIXEL_PTR(rleCode); - while (rleCode--) + while (rleCode--) rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b); } else { CHECK_STREAM_PTR(rleCode * 4); diff --git a/engines/mohawk/video/qtrle.h b/engines/mohawk/video/qtrle.h index 60796b3803..fdccf626a6 100644 --- a/engines/mohawk/video/qtrle.h +++ b/engines/mohawk/video/qtrle.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef MOHAWK_QTRLE_H #define MOHAWK_QTRLE_H @@ -40,10 +40,10 @@ public: private: byte _bitsPerPixel; - + Graphics::Surface *_surface; Graphics::PixelFormat _pixelFormat; - + void decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange); void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp); void decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange); diff --git a/engines/mohawk/video/rpza.cpp b/engines/mohawk/video/rpza.cpp index ae003fa491..f48c055ae2 100644 --- a/engines/mohawk/video/rpza.cpp +++ b/engines/mohawk/video/rpza.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + // Based off ffmpeg's RPZA decoder #include "mohawk/video/rpza.h" @@ -43,7 +43,7 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Graphics::Codec() { debug(2, "RPZA corrected width: %d", width); _surface = new Graphics::Surface(); - _surface->create(width, height, _pixelFormat.bytesPerPixel); + _surface->create(width, height, _pixelFormat.bytesPerPixel); } #define ADVANCE_BLOCK() \ diff --git a/engines/mohawk/video/rpza.h b/engines/mohawk/video/rpza.h index 4aa5a5d990..b9522ec2e3 100644 --- a/engines/mohawk/video/rpza.h +++ b/engines/mohawk/video/rpza.h @@ -38,7 +38,7 @@ public: Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); -private: +private: Graphics::Surface *_surface; Graphics::PixelFormat _pixelFormat; }; diff --git a/engines/mohawk/video/smc.cpp b/engines/mohawk/video/smc.cpp index c196d97e1e..4a0d16dfcc 100644 --- a/engines/mohawk/video/smc.cpp +++ b/engines/mohawk/video/smc.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + // Based off ffmpeg's SMC decoder #include "mohawk/video/smc.h" @@ -357,7 +357,7 @@ Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { } break; - // 16-color block encoding (every pixel is a different color) + // 16-color block encoding (every pixel is a different color) case 0xE0: numBlocks = (opcode & 0x0F) + 1; diff --git a/engines/mohawk/video/smc.h b/engines/mohawk/video/smc.h index f5895f7dbd..331fddb9a5 100644 --- a/engines/mohawk/video/smc.h +++ b/engines/mohawk/video/smc.h @@ -44,7 +44,7 @@ public: Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); -private: +private: Graphics::Surface *_surface; // SMC color tables diff --git a/engines/mohawk/video/video.cpp b/engines/mohawk/video/video.cpp index 9e61e2361c..1aa51cf237 100644 --- a/engines/mohawk/video/video.cpp +++ b/engines/mohawk/video/video.cpp @@ -30,11 +30,11 @@ #include "common/events.h" namespace Mohawk { - + VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) { _pauseStart = 0; } - + VideoManager::~VideoManager() { _mlstRecords.clear(); stopVideos(); @@ -51,7 +51,7 @@ void VideoManager::resumeVideos() { _videoStreams[i]->addPauseTime(_vm->_system->getMillis() * 100 - _pauseStart); _videoStreams[i]->resumeAudio(); } - + _pauseStart = 0; } @@ -110,18 +110,18 @@ void VideoManager::playMovieCentered(Common::String filename, bool clearScreen) entry.loop = false; playMovie(entry); } - + void VideoManager::playMovie(VideoEntry videoEntry) { // Add video to the list _videoStreams.push_back(videoEntry); - + bool continuePlaying = true; videoEntry->startAudio(); - + while (!videoEntry->endOfVideo() && !_vm->shouldQuit() && continuePlaying) { if (updateBackgroundMovies()) _vm->_system->updateScreen(); - + Common::Event event; while (_vm->_system->getEventManager()->pollEvent(event)) { switch (event.type) { @@ -144,11 +144,11 @@ void VideoManager::playMovie(VideoEntry videoEntry) { break; } } - + // Cut down on CPU usage _vm->_system->delayMillis(10); } - + videoEntry->stop(); _videoStreams.clear(); @@ -161,24 +161,24 @@ void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y VideoEntry entry; entry.video = new QTPlayer(); - + if (!entry.video) return; - + entry->loadFile(file); - + // Center x if requested if (x < 0) x = (_vm->_system->getWidth() - entry->getWidth()) / 2; - + // Center y if requested if (y < 0) y = (_vm->_system->getHeight() - entry->getHeight()) / 2; - + entry.x = x; entry.y = y; entry.loop = loop; - + entry->startAudio(); _videoStreams.push_back(entry); } @@ -204,16 +204,16 @@ bool VideoManager::updateBackgroundMovies() { Graphics::Surface *frame = _videoStreams[i]->getNextFrame(); bool deleteFrame = false; - if (frame) { + if (frame) { // Convert from 8bpp to the current screen format if necessary if (frame->bytesPerPixel == 1) { Graphics::Surface *newFrame = new Graphics::Surface(); Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat(); byte *palette = _videoStreams[i]->getPalette(); assert(palette); - + newFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); - + for (uint16 j = 0; j < frame->h; j++) { for (uint16 k = 0; k < frame->w; k++) { byte palIndex = *((byte *)frame->getBasePtr(k, j)); @@ -226,12 +226,12 @@ bool VideoManager::updateBackgroundMovies() { *((uint32 *)newFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); } } - + frame = newFrame; deleteFrame = true; } - // Check if we're drawing at a 2x or 4x resolution (because of + // Check if we're drawing at a 2x or 4x resolution (because of // evil QuickTime scaling it first). if (_videoStreams[i]->getScaleMode() == kScaleHalf || _videoStreams[i]->getScaleMode() == kScaleQuarter) { byte scaleFactor = (_videoStreams[i]->getScaleMode() == kScaleHalf) ? 2 : 4; @@ -254,7 +254,7 @@ bool VideoManager::updateBackgroundMovies() { // We've drawn something to the screen, make sure we update it updateScreen = true; - + // Delete the frame if we're using the buffer from the 8bpp conversion if (deleteFrame) { frame->free(); @@ -289,7 +289,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { if (mlstStream->readUint16BE() != 0xFFFF) warning("u0[2] in MLST not 0xFFFF"); - + mlstRecord.loop = mlstStream->readUint16BE(); mlstRecord.volume = mlstStream->readUint16BE(); mlstRecord.u1 = mlstStream->readUint16BE(); @@ -305,7 +305,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { break; } } - + delete mlstStream; } @@ -336,7 +336,7 @@ void VideoManager::playMovieBlocking(uint16 id) { for (uint16 i = 0; i < _mlstRecords.size(); i++) if (_mlstRecords[i].code == id) { warning("STUB: Play tMOV %d (blocking) at (%d, %d)", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top); - + // TODO: See if a non-blocking movie has been activated with the same id, // and if so, block input until that movie is finished. QTPlayer *qtPlayer = new QTPlayer(); |