From 8cf73e3fb4e44567a7afa527a0705acb90033a78 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 7 Apr 2011 19:29:49 -0400 Subject: AUDIO: Split QuickTime audio into a new class Standalone QuickTime files can now be played as an AudioStream --- audio/decoders/quicktime.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 audio/decoders/quicktime.h (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h new file mode 100644 index 0000000000..eb0f791748 --- /dev/null +++ b/audio/decoders/quicktime.h @@ -0,0 +1,96 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef AUDIO_QUICKTIME_H +#define AUDIO_QUICKTIME_H + +#include "common/quicktime.h" +#include "common/scummsys.h" +#include "common/types.h" + +namespace Common { + class SeekableReadStream; + class String; +} + +namespace Audio { + +class AudioStream; +class RewindableAudioStream; +class QueuingAudioStream; + +class QuickTimeAudioDecoder : public Common::QuickTimeParser { +public: + QuickTimeAudioDecoder(); + virtual ~QuickTimeAudioDecoder(); + + /** + * Load a QuickTime audio file + * @param filename the filename to load + */ + bool loadFile(const Common::String &filename); + + /** + * Load a QuickTime audio file from a SeekableReadStream + * @param stream the stream to load + */ + bool loadStream(Common::SeekableReadStream *stream); + +protected: + struct AudioSampleDesc : public Common::QuickTimeParser::SampleDesc { + AudioSampleDesc(); + + uint16 channels; + uint32 sampleRate; + uint32 samplesPerFrame; + uint32 bytesPerFrame; + }; + + // Common::QuickTimeParser API + virtual Common::QuickTimeParser::SampleDesc *readSampleDesc(MOVStreamContext *st, uint32 format); + + AudioStream *createAudioStream(Common::SeekableReadStream *stream); + bool checkAudioCodecSupport(uint32 tag); + void init(); + + void queueNextAudioChunk(); + uint32 getAudioChunkSampleCount(uint chunk); + int8 _audioStreamIndex; + uint _curAudioChunk; + QueuingAudioStream *_audStream; +}; + +/** + * Try to load a QuickTime sound file from the given file name and create a RewindableAudioStream + * from that data. + * + * @param filename the filename of the file from which to read the data + * @return a new RewindableAudioStream, or NULL, if an error occurred + */ +RewindableAudioStream *makeQuickTimeStream(const Common::String &filename); + +} // End of namespace Audio + +#endif -- cgit v1.2.3 From 88ebf13077a072ac0b3100e54f2949db46960e5e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 8 Apr 2011 10:50:16 -0400 Subject: AUDIO: Allow for seeking in a QuickTimeAudioStream --- audio/decoders/quicktime.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index eb0f791748..9e2e95b705 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -80,16 +80,18 @@ protected: int8 _audioStreamIndex; uint _curAudioChunk; QueuingAudioStream *_audStream; + + void setAudioStreamPos(const Timestamp &where); }; /** - * Try to load a QuickTime sound file from the given file name and create a RewindableAudioStream + * Try to load a QuickTime sound file from the given file name and create a SeekableAudioStream * from that data. * * @param filename the filename of the file from which to read the data - * @return a new RewindableAudioStream, or NULL, if an error occurred + * @return a new SeekableAudioStream, or NULL, if an error occurred */ -RewindableAudioStream *makeQuickTimeStream(const Common::String &filename); +SeekableAudioStream *makeQuickTimeStream(const Common::String &filename); } // End of namespace Audio -- cgit v1.2.3 From faee277978c54ccb3dcccfedc75ddb31f44e630f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 8 Apr 2011 17:04:29 -0400 Subject: COMMON: Add a DisposeAfterUse flag to QuickTimeParser --- audio/decoders/quicktime.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index 9e2e95b705..be4d1097da 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -50,13 +50,13 @@ public: * Load a QuickTime audio file * @param filename the filename to load */ - bool loadFile(const Common::String &filename); + bool loadAudioFile(const Common::String &filename); /** * Load a QuickTime audio file from a SeekableReadStream * @param stream the stream to load */ - bool loadStream(Common::SeekableReadStream *stream); + bool loadAudioStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle); protected: struct AudioSampleDesc : public Common::QuickTimeParser::SampleDesc { @@ -93,6 +93,16 @@ protected: */ SeekableAudioStream *makeQuickTimeStream(const Common::String &filename); +/** + * Try to load a QuickTime sound file from the given seekable stream and create a SeekableAudioStream + * from that data. + * + * @param stream the SeekableReadStream from which to read the data + * @param disposeAfterUse whether to delete the stream after use + * @return a new SeekableAudioStream, or NULL, if an error occurred + */ +SeekableAudioStream *makeQuickTimeStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + } // End of namespace Audio #endif -- cgit v1.2.3 From 7c5dfaa04c2d02a22b301823bedb2940c3e590aa Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 8 Apr 2011 22:46:19 -0400 Subject: COMMON: Parse the MPEG-4 esds atom --- audio/decoders/quicktime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index be4d1097da..6e9f5b2c4e 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -72,7 +72,7 @@ protected: virtual Common::QuickTimeParser::SampleDesc *readSampleDesc(MOVStreamContext *st, uint32 format); AudioStream *createAudioStream(Common::SeekableReadStream *stream); - bool checkAudioCodecSupport(uint32 tag); + bool checkAudioCodecSupport(uint32 tag, byte objectTypeMP4); void init(); void queueNextAudioChunk(); -- cgit v1.2.3 From 9d0e5a7132341b1f9d31fa775cb4f98fa95b73a6 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 10 Apr 2011 15:11:03 -0400 Subject: ALL: Add/update some comments --- audio/decoders/quicktime.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index 6e9f5b2c4e..2fca5d6944 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -23,6 +23,14 @@ * */ +/** + * @file + * Sound decoder used in engines: + * - groovie + * - mohawk + * - sci + */ + #ifndef AUDIO_QUICKTIME_H #define AUDIO_QUICKTIME_H -- cgit v1.2.3 From 08b70fa1a737f325a0114632b3cef8cbf028fd3a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 12 Apr 2011 14:23:23 -0400 Subject: AUDIO: Fix QuickTime/MPEG-4 seeking MPEG-4 seeking was broken while QuickTime seeking was extremely slow. All is fixed now --- audio/decoders/quicktime.h | 1 + 1 file changed, 1 insertion(+) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index 2fca5d6944..8a779d45a6 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -90,6 +90,7 @@ protected: QueuingAudioStream *_audStream; void setAudioStreamPos(const Timestamp &where); + bool isOldDemuxing() const; }; /** -- cgit v1.2.3 From 76105b29b7f885ed873f6af7321d8e48a5b0a41e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 14 Apr 2011 10:25:02 -0400 Subject: AUDIO: Split the QuickTimeAudioDecoder into a new header file (Mirroring the new adpcm_intern.h file) --- audio/decoders/quicktime.h | 49 +--------------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) (limited to 'audio/decoders/quicktime.h') diff --git a/audio/decoders/quicktime.h b/audio/decoders/quicktime.h index 8a779d45a6..ff81ec9390 100644 --- a/audio/decoders/quicktime.h +++ b/audio/decoders/quicktime.h @@ -34,7 +34,6 @@ #ifndef AUDIO_QUICKTIME_H #define AUDIO_QUICKTIME_H -#include "common/quicktime.h" #include "common/scummsys.h" #include "common/types.h" @@ -45,53 +44,7 @@ namespace Common { namespace Audio { -class AudioStream; -class RewindableAudioStream; -class QueuingAudioStream; - -class QuickTimeAudioDecoder : public Common::QuickTimeParser { -public: - QuickTimeAudioDecoder(); - virtual ~QuickTimeAudioDecoder(); - - /** - * Load a QuickTime audio file - * @param filename the filename to load - */ - bool loadAudioFile(const Common::String &filename); - - /** - * Load a QuickTime audio file from a SeekableReadStream - * @param stream the stream to load - */ - bool loadAudioStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle); - -protected: - struct AudioSampleDesc : public Common::QuickTimeParser::SampleDesc { - AudioSampleDesc(); - - uint16 channels; - uint32 sampleRate; - uint32 samplesPerFrame; - uint32 bytesPerFrame; - }; - - // Common::QuickTimeParser API - virtual Common::QuickTimeParser::SampleDesc *readSampleDesc(MOVStreamContext *st, uint32 format); - - AudioStream *createAudioStream(Common::SeekableReadStream *stream); - bool checkAudioCodecSupport(uint32 tag, byte objectTypeMP4); - void init(); - - void queueNextAudioChunk(); - uint32 getAudioChunkSampleCount(uint chunk); - int8 _audioStreamIndex; - uint _curAudioChunk; - QueuingAudioStream *_audStream; - - void setAudioStreamPos(const Timestamp &where); - bool isOldDemuxing() const; -}; +class SeekableAudioStream; /** * Try to load a QuickTime sound file from the given file name and create a SeekableAudioStream -- cgit v1.2.3