diff options
Diffstat (limited to 'audio/decoders/adpcm.cpp')
-rw-r--r-- | audio/decoders/adpcm.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp index 61b0abaaca..fe5eec5dcc 100644 --- a/audio/decoders/adpcm.cpp +++ b/audio/decoders/adpcm.cpp @@ -8,12 +8,12 @@ * 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. @@ -457,4 +457,34 @@ RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, Dispo } } +class PacketizedADPCMStream : public StatelessPacketizedAudioStream { +public: + PacketizedADPCMStream(ADPCMType type, int rate, int channels, uint32 blockAlign) : + StatelessPacketizedAudioStream(rate, channels), _type(type), _blockAlign(blockAlign) {} + +protected: + AudioStream *makeStream(Common::SeekableReadStream *data); + +private: + ADPCMType _type; + uint32 _blockAlign; +}; + +AudioStream *PacketizedADPCMStream::makeStream(Common::SeekableReadStream *data) { + return makeADPCMStream(data, DisposeAfterUse::YES, data->size(), _type, getRate(), getChannels(), _blockAlign); +} + +PacketizedAudioStream *makePacketizedADPCMStream(ADPCMType type, int rate, int channels, uint32 blockAlign) { + // Filter out types we can't support (they're not fully stateless) + switch (type) { + case kADPCMOki: + case kADPCMDVI: + return 0; + default: + break; + } + + return new PacketizedADPCMStream(type, rate, channels, blockAlign); +} + } // End of namespace Audio |