Commit Graph
160 Commits
Author SHA1 Message Date
Paul Gilbert 11e33ba3fc JANITORIAL: Removing trailing spaces after int casts 2018-08-17 20:30:20 -07:00
Colin Snover e42ade073c AUDIO: Fix uninitialized data structures in PacketizedMP3Stream
If the audio thread called to readBuffer before any packet had been
added to the stream, the state of the stream would be changed from
INIT to EOS. Later, when a packet was received, the state would go
directly from EOS to READY, skipping decoder init, leaving garbage
memory in the decoder structs and causing a crash of the decoder.

Fixes Trac#9653.
2017-11-19 20:53:02 -06:00
Colin Snover 9fc24e19f2 AUDIO: Fix data race in PacketizedMP3Stream 2017-11-19 20:53:00 -06:00
Bastien Bouclet 1757f7dc5d AUDIO: Switch to BitStreamMemoryStream in the QDM2 decoder 2017-11-08 20:57:35 +01:00
Bastien Bouclet bf3c98815f AUDIO: Add some padding to the QDM2 decoder input buffer
Fixes out of bounds reads in the Myst ME intro videos.

OOB reads may happen because:
- The bitstream implementation reads 4 bytes at a time, and the buffer
  size is not guaranteed to be a multiple of 4.
- The huffman parsing code reads a fixed amount of bits when it
  sometimes needs not all of them.

Also fixed bits vs bytes mismatch for the size parameter of the calls to
the bitstream constructor, and removed a few unnecessary heap
allocations.

Fixes #10220.
2017-11-08 20:57:24 +01:00
Bastien Bouclet 9db2953ca3 AUDIO: QDM2: Use the shared int64 type instead of a custom one 2017-09-30 21:35:16 +02:00
Bastien Bouclet 3eb82462e7 ALL: Specify the DisposeAfterUse constructor argument for dynamic memory write streams 2017-09-22 07:06:21 +02:00
Bastien Bouclet 8547c89b86 VIDEO: Change QT edit list to a Common::Array
And fix an out of bounds acces when seeking to the end of a video.
Skipping samples is needed even when seeking through silent edits
because a silent stream is queued for those.

Fixes #10219.
2017-09-21 13:06:18 +02:00
Colin Snover dbf2f0c266 AUDIO: Fix compilation on AmigaOS 4 2017-09-10 02:08:21 -05:00
Colin Snover 10db6e9a44 AUDIO: Mark SCI engine as using ADPCM 2017-09-09 23:29:58 -05:00
Colin Snover 41506201b9 AUDIO: Fix incorrect reading of DK3 ADPCM audio data
Previously, _topNibble was not reset at the beginning of a new
audio block, and the alignment byte at the end of odd blocks was
being read as audio data, which caused audible clicks and
out-of-bounds sample generation. There may have also been read
errors related to the use of continue/break keywords inside of a
macro wrapped with do-while(0).

The introduction of partial block reads in this code when it was
converted from ffmpeg to a ReadStream interface was also confusing
and somewhat inefficient (calling SeekableReadStream::pos
frequently), so this code has been refactored for clarity and to
improve efficiency by reducing the number of virtual calls. Error
detection has also been improved somewhat by ensuring that there
are enough bytes to read a block header, and that the step indexes
in the header are within the valid range.
2017-09-09 23:29:58 -05:00
Willem Jan Palenstijn dde259f068 COMMON: Remove BitStream base class to allow inlining calls
All users of BitStream were in fact using a specific, hardcoded variant,
so we can hardcode that variant, removing the need for virtual calls,
and enabling inlining.
2017-08-24 19:46:59 +02:00
Paul Gilbert 7b10dac542 AUDIO: Support Wave files with an initial fact chunk 2016-12-20 22:47:49 -05:00
Torbjörn Andersson 579c024653 AUDIO: Keep packetized MP3 stream from ending prematurely
This fixes the audio in the intro AVI movie for German Fullpipe.
2016-09-19 07:25:55 +02:00
Paul Gilbert 7d0c83850c AUDIO: Whitespace fix in MP3 engine usage list 2016-09-03 09:58:50 -04:00
Paul Gilbert 4d11f2fbf0 AUDIO: Add Titanic to list of engines using MP3 decoder 2016-09-02 23:56:44 -04:00
Paul Gilbert d7e52b4b50 AUDIO: Disable MP3 decoding in Wave files if MAD dependency is disabled 2016-09-02 23:54:55 -04:00
Paul Gilbert 417cc51bcb AUDIO: Add support for MP3 encoded data in WAVE files
This is needed for playback of Starship Titanic speech data
2016-09-02 21:32:32 -04:00
Paul Gilbert b312c8fe9d AUDIO: Add titanic to list of engines using wave files 2016-08-05 19:19:17 -04:00
Willem Jan Palenstijn 567054d829 AUDIO: Fix build 2016-07-31 08:55:12 +02:00
Eugene Sandulenko 30498bfbf0 AUDIO: Fix indentation 2016-07-31 09:28:46 +03:00
Torbjörn Andersson 9382dab811 AUDIO: Fix audio corruption in MS ADPCM decoder
Since _decodedSamples[] is filled with either 2 or 4 samples, we
can't use 1 - (count - 1) to "ensure that acts as a FIFO". When
we have 4 samples, that index will become negative, putting
uninitialized data into the buffer.

We could still use a similar trick, but I think it's much clearer
to use an index variable like this. We need an addition variable
either way.
2016-07-06 20:51:28 +02:00
Colin Snover 848abbee06 AUDIO: Fix incorrect forward declaration 2016-06-21 08:33:50 -05:00
Colin Snover cbc3b773aa AUDIO: Make WAV streams seekable
This allows raw PCM in WAVE containers to have duration and be
seekable, and opens the door for ADPCM streams to be seekable later
if necessary.

This change is needed to avoid duplication of RIFF/WAVE container
parsing for SCI engine, which uses raw PCM WAVE files and needs to
be able to determine their lengths.
2016-06-19 14:48:33 -05:00
Eugene Sandulenko 33184e822d AUDIO: Plug potential memory leak 2016-05-15 12:26:15 +02:00
Ori Avtalion 3564032330 JANITORIAL: Reduce audio header dependencies 2016-04-14 16:10:21 +03:00
Tobia Tesan 914537ab52 JANITORIAL: Mark audio/decoders/vorbis as: used in Wintermute 2016-03-28 12:36:41 +02:00
Christian Krause 1fdeb98e70 AUDIO: Fix compiler warning
This commit fixes a compiler warning about a "set but not used"
variable. The warning was introduced by commit 2f707bf2.
2015-09-15 20:48:09 -04:00
Matthew Hoops 8165e9aa4c AUDIO: Fix uninitialized read in MP3 initialization
Thanks to chkr-private for finding the issue
2015-09-15 20:44:09 -04:00
Matthew Hoops c8a7e39e05 AUDIO: Mark the old Codec class as deprecated
Once QuickTime audio edits are rewritten to use PacketizedAudioStream, we can remove this class.
2015-08-30 21:01:43 -04:00
Matthew Hoops 331d8ece21 AUDIO: Add a packetized version of ADPCM streams 2015-08-30 19:53:54 -04:00
Matthew Hoops 3aa9e2c581 AUDIO: Add a packetized version of the PCM stream 2015-08-30 19:53:54 -04:00
Matthew Hoops 562234b96b AUDIO: Implement a packetized version of MP3 2015-08-30 19:53:53 -04:00
Matthew Hoops 52f67cba39 AUDIO: Split the seeking MP3 class from the base decoding stream 2015-08-30 19:53:53 -04:00
Martin Kiewitz 10741d5bd6 AUDIO: makeAIFFStream seek to start of dataStream
fixes non working audio when playing a File(Stream)
2015-06-07 00:30:15 +02:00
Matthew Hoops b6fdc7be88 AUDIO: Make makeAIFFStream return a RewindableAudioStream
All callers requiring SeekableAudioStream have been adapted by using dynamic_cast
2015-06-06 17:20:41 -04:00
Matthew Hoops 7eb663a45b AUDIO: Fix another syntax error 2015-06-06 17:14:24 -04:00
Matthew Hoops 1cea582152 AUDIO: Fix syntax 2015-06-06 17:13:21 -04:00
Martin Kiewitz 97813f89ec SHERLOCK: rework 3DO audio, add AIFC file support
- rework 3DO audio decoders to decode into buffer only
- 3DO audio decoders also use streams without separate size arg now
- add support for ADP4 + SDX2 inside AIFC files
- add debug command "3do_playaudio" to play AIFC files
- remove audio flags and replace with stereo bool
2015-06-06 22:50:36 +02:00
Matthew Hoops 2f707bf207 AUDIO: Rewrite the AIFF decoder to support AIFC 2015-06-04 19:47:41 -04:00
Matthew Hoops b986b44827 AUDIO: Do not read the entire AIFF buffer into memory 2015-06-04 19:47:37 -04:00
Matthew Hoops 4266d76ce4 AUDIO: Mark AIFF as being used by BBVS 2015-06-04 19:47:32 -04:00
Matthew Hoops 3d1da64249 AUDIO: Only expose makeAIFFStream to clients 2015-06-04 19:47:28 -04:00
Torbjörn Andersson e71553af3b AUDIO: Add more engines that use wave.h that I missed before. 2015-06-05 01:37:02 +02:00
Torbjörn Andersson 34261b3fce AUDIO: Update list of engines that use wave.h 2015-06-05 01:32:39 +02:00
Martin Kiewitz 4dec07bf2d SHERLOCK: improve 3DO movie player, add SDX2 codec
- queue up to 0.5 seconds of audio to avoid buffer underruns
- support for SDX2 codec
- put both audio codecs into audio/decoders/3do.cpp
- made movie player capable of playing EA logo movie
2015-06-04 15:53:54 +02:00
Thierry Crozat 5c7cc826f0 AUDIO: Skip ID3 tag at start of mp3 files
This fixes bug #6834 MP3: ScummVM doesn't skip ID3 tag at
beginning of file.
2015-04-05 21:17:06 +01:00
Matthew Hoops d58f250918 AUDIO: Fix skipping samples when the skip length is greater than the first chunk 2015-01-26 19:54:32 -05:00
Matthew Hoops d2bf7f99fd AUDIO: Really fix seeking with audio edits
I really have no idea what I was thinking in acb127c2
2014-08-14 20:16:14 -04:00
Eugene Sandulenko 6e794a9823 Merge pull request #487 from clone2727/audio_fixes
AUDIO: Miscellaneous AudioStream fixes
2014-08-09 15:33:50 +02:00