aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2010-01-19 00:56:29 +0000
committerMax Horn2010-01-19 00:56:29 +0000
commit557bb394de6619dd1f360b72333fd2ec7b3defab (patch)
treeb1166a12105d01c92edb528177d24aa5115232e5 /graphics
parent69be7476212916b166ac16db41253cd367fb0dcc (diff)
downloadscummvm-rg350-557bb394de6619dd1f360b72333fd2ec7b3defab.tar.gz
scummvm-rg350-557bb394de6619dd1f360b72333fd2ec7b3defab.tar.bz2
scummvm-rg350-557bb394de6619dd1f360b72333fd2ec7b3defab.zip
Get rid of Mixer::FLAG_AUTOFREE.
Also fix several recently introduced new/delete vs. malloc/free mismatches. svn-id: r47369
Diffstat (limited to 'graphics')
-rw-r--r--graphics/video/avi_decoder.cpp4
-rw-r--r--graphics/video/coktelvideo/coktelvideo.cpp24
-rw-r--r--graphics/video/smk_decoder.cpp10
3 files changed, 19 insertions, 19 deletions
diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp
index f54de46731..704ad36320 100644
--- a/graphics/video/avi_decoder.cpp
+++ b/graphics/video/avi_decoder.cpp
@@ -323,13 +323,13 @@ Surface *AviDecoder::getNextFrame() {
byte *data = new byte[chunkSize];
_fileStream->read(data, chunkSize);
- byte flags = Audio::Mixer::FLAG_AUTOFREE;
+ byte flags = 0;
if (_audsHeader.sampleSize == 2)
flags |= Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
else
flags |= Audio::Mixer::FLAG_UNSIGNED;
- _audStream->queueBuffer(data, chunkSize, flags);
+ _audStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, flags);
_fileStream->skip(chunkSize & 1); // Alignment
} else if (getStreamType(nextTag) == 'dc' || getStreamType(nextTag) == 'id' || getStreamType(nextTag) == 'AM') {
// Compressed Frame
diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp
index 88bbbd8afc..9f9c40b6ed 100644
--- a/graphics/video/coktelvideo/coktelvideo.cpp
+++ b/graphics/video/coktelvideo/coktelvideo.cpp
@@ -600,12 +600,12 @@ void Imd::nextSoundSlice(bool hasNextCmd) {
return;
}
- byte *soundBuf = new byte[_soundSliceSize];
+ byte *soundBuf = (byte *)malloc(_soundSliceSize);
_stream->read(soundBuf, _soundSliceSize);
unsignedToSigned(soundBuf, _soundSliceSize);
- _audioStream->queueBuffer(soundBuf, _soundSliceSize, 0);
+ _audioStream->queueBuffer(soundBuf, _soundSliceSize, DisposeAfterUse::YES, 0);
}
bool Imd::initialSoundSlice(bool hasNextCmd) {
@@ -616,12 +616,12 @@ bool Imd::initialSoundSlice(bool hasNextCmd) {
return false;
}
- byte *soundBuf = new byte[dataLength];
+ byte *soundBuf = (byte *)malloc(dataLength);
_stream->read(soundBuf, dataLength);
unsignedToSigned(soundBuf, dataLength);
- _audioStream->queueBuffer(soundBuf, dataLength, 0);
+ _audioStream->queueBuffer(soundBuf, dataLength, DisposeAfterUse::YES, 0);
return _soundStage == 1;
}
@@ -630,11 +630,11 @@ void Imd::emptySoundSlice(bool hasNextCmd) {
if (hasNextCmd || !_soundEnabled)
return;
- byte *soundBuf = new byte[_soundSliceSize];
+ byte *soundBuf = (byte *)malloc(_soundSliceSize);
memset(soundBuf, 0, _soundSliceSize);
- _audioStream->queueBuffer(soundBuf, _soundSliceSize, 0);
+ _audioStream->queueBuffer(soundBuf, _soundSliceSize, DisposeAfterUse::YES, 0);
}
void Imd::videoData(uint32 size, State &state) {
@@ -2022,7 +2022,7 @@ byte *Vmd::deDPCM(const byte *data, uint32 &size, int32 init[2]) {
uint32 inSize = size;
uint32 outSize = size + channels;
- int16 *out = new int16[outSize];
+ int16 *out = (int16 *)malloc(outSize * 2);
byte *sound = (byte *) out;
int channel = 0;
@@ -2056,7 +2056,7 @@ byte *Vmd::deADPCM(const byte *data, uint32 &size, int32 init, int32 index) {
uint32 outSize = size * 2;
- int16 *out = new int16[outSize];
+ int16 *out = (int16 *)malloc(outSize * 2);
byte *sound = (byte *) out;
index = CLIP<int32>(index, 0, 88);
@@ -2110,7 +2110,7 @@ byte *Vmd::soundEmpty(uint32 &size) {
if (!_audioStream)
return 0;
- byte *soundBuf = new byte[size];
+ byte *soundBuf = (byte *)malloc(size);
memset(soundBuf, 0, size);
return soundBuf;
@@ -2122,7 +2122,7 @@ byte *Vmd::sound8bitDirect(uint32 &size) {
return 0;
}
- byte *soundBuf = new byte[size];
+ byte *soundBuf = (byte *)malloc(size);
_stream->read(soundBuf, size);
unsignedToSigned(soundBuf, size);
@@ -2187,7 +2187,7 @@ void Vmd::emptySoundSlice(uint32 size) {
flags |= (_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0;
flags |= (_soundStereo > 0) ? Audio::Mixer::FLAG_STEREO : 0;
- _audioStream->queueBuffer(sound, size, flags);
+ _audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags);
}
}
@@ -2205,7 +2205,7 @@ void Vmd::filledSoundSlice(uint32 size) {
flags |= (_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0;
flags |= (_soundStereo > 0) ? Audio::Mixer::FLAG_STEREO : 0;
- _audioStream->queueBuffer(sound, size, flags);
+ _audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags);
}
}
diff --git a/graphics/video/smk_decoder.cpp b/graphics/video/smk_decoder.cpp
index a3b056b6a3..991ebbf589 100644
--- a/graphics/video/smk_decoder.cpp
+++ b/graphics/video/smk_decoder.cpp
@@ -562,14 +562,14 @@ bool SmackerDecoder::decodeNextFrame() {
if (_header.audioInfo[i].hasAudio && chunkSize > 0 && i == 0) {
// If it's track 0, play the audio data
- byte *soundBuffer = new byte[chunkSize];
+ byte *soundBuffer = (byte *)malloc(chunkSize);
_fileStream->read(soundBuffer, chunkSize);
if (_header.audioInfo[i].isCompressed) {
// Compressed audio (Huffman DPCM encoded)
queueCompressedBuffer(soundBuffer, chunkSize, dataSizeUnpacked, i);
- delete[] soundBuffer;
+ free(soundBuffer);
} else {
// Uncompressed audio (PCM)
byte flags = 0;
@@ -578,7 +578,7 @@ bool SmackerDecoder::decodeNextFrame() {
if (_header.audioInfo[0].isStereo)
flags = flags | Audio::Mixer::FLAG_STEREO;
- _audioStream->queueBuffer(soundBuffer, chunkSize, flags);
+ _audioStream->queueBuffer(soundBuffer, chunkSize, DisposeAfterUse::YES, flags);
// The sound buffer will be deleted by QueuingAudioStream
}
@@ -767,7 +767,7 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
int numBytes = 1 * (isStereo ? 2 : 1) * (is16Bits ? 2 : 1);
- byte *unpackedBuffer = new byte[unpackedSize];
+ byte *unpackedBuffer = (byte *)malloc(unpackedSize);
byte *curPointer = unpackedBuffer;
uint32 curPos = 0;
@@ -832,7 +832,7 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
flags = flags | Audio::Mixer::FLAG_16BITS;
if (_header.audioInfo[0].isStereo)
flags = flags | Audio::Mixer::FLAG_STEREO;
- _audioStream->queueBuffer(unpackedBuffer, unpackedSize, flags);
+ _audioStream->queueBuffer(unpackedBuffer, unpackedSize, DisposeAfterUse::YES, flags);
// unpackedBuffer will be deleted by QueuingAudioStream
}