aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-22 08:29:07 +0200
committerMax Kellermann <max@duempel.org>2014-09-22 08:29:07 +0200
commitee027f237b1fb53972d574d3c6efa16c49d8692d (patch)
treedd8d9f3c9e0923de27780c679fc23b0f2672370c
parent3ae0d6f4210e370225cf0b9177f6c16d84d9255b (diff)
downloadmpd-ee027f237b1fb53972d574d3c6efa16c49d8692d.tar.gz
mpd-ee027f237b1fb53972d574d3c6efa16c49d8692d.tar.xz
mpd-ee027f237b1fb53972d574d3c6efa16c49d8692d.zip
decoder/faad: allocate DecoderBuffer on stack
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/FaadDecoderPlugin.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx
index 6a2744243..7ae36ff3e 100644
--- a/src/decoder/plugins/FaadDecoderPlugin.cxx
+++ b/src/decoder/plugins/FaadDecoderPlugin.cxx
@@ -307,27 +307,24 @@ faad_decoder_decode(NeAACDecHandle decoder, DecoderBuffer *buffer,
static std::pair<bool, SignedSongTime>
faad_get_file_time(InputStream &is)
{
- DecoderBuffer *buffer =
- new DecoderBuffer(nullptr, is,
- FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
- auto duration = faad_song_duration(buffer, is);
+ DecoderBuffer buffer(nullptr, is,
+ FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
+ auto duration = faad_song_duration(&buffer, is);
bool recognized = !duration.IsNegative();
if (!recognized) {
NeAACDecHandle decoder = faad_decoder_new();
- decoder_buffer_fill(buffer);
+ decoder_buffer_fill(&buffer);
AudioFormat audio_format;
- if (faad_decoder_init(decoder, buffer, audio_format,
+ if (faad_decoder_init(decoder, &buffer, audio_format,
IgnoreError()))
recognized = true;
NeAACDecClose(decoder);
}
- delete buffer;
-
return std::make_pair(recognized, duration);
}
@@ -414,20 +411,18 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is,
static void
faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
{
- DecoderBuffer *buffer =
- new DecoderBuffer(&mpd_decoder, is,
- FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
+ DecoderBuffer buffer(&mpd_decoder, is,
+ FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
/* create the libfaad decoder */
const NeAACDecHandle decoder = faad_decoder_new();
- faad_stream_decode(mpd_decoder, is, buffer, decoder);
+ faad_stream_decode(mpd_decoder, is, &buffer, decoder);
/* cleanup */
NeAACDecClose(decoder);
- delete buffer;
}
static bool