decoder/faad: use AtScopeExit()
This commit is contained in:
parent
6a78d11127
commit
12f11c97ae
@ -24,6 +24,7 @@
|
|||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "CheckAudioFormat.hxx"
|
#include "CheckAudioFormat.hxx"
|
||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
|
#include "util/ScopeExit.hxx"
|
||||||
#include "util/ConstBuffer.hxx"
|
#include "util/ConstBuffer.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
@ -310,6 +311,7 @@ faad_get_file_time(InputStream &is)
|
|||||||
|
|
||||||
if (!recognized) {
|
if (!recognized) {
|
||||||
NeAACDecHandle decoder = faad_decoder_new();
|
NeAACDecHandle decoder = faad_decoder_new();
|
||||||
|
AtScopeExit(decoder) { NeAACDecClose(decoder); };
|
||||||
|
|
||||||
buffer.Fill();
|
buffer.Fill();
|
||||||
|
|
||||||
@ -317,8 +319,6 @@ faad_get_file_time(InputStream &is)
|
|||||||
if (faad_decoder_init(decoder, buffer, audio_format,
|
if (faad_decoder_init(decoder, buffer, audio_format,
|
||||||
IgnoreError()))
|
IgnoreError()))
|
||||||
recognized = true;
|
recognized = true;
|
||||||
|
|
||||||
NeAACDecClose(decoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair(recognized, duration);
|
return std::make_pair(recognized, duration);
|
||||||
@ -413,12 +413,9 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
|
|||||||
/* create the libfaad decoder */
|
/* create the libfaad decoder */
|
||||||
|
|
||||||
const NeAACDecHandle decoder = faad_decoder_new();
|
const NeAACDecHandle decoder = faad_decoder_new();
|
||||||
|
AtScopeExit(decoder) { NeAACDecClose(decoder); };
|
||||||
|
|
||||||
faad_stream_decode(mpd_decoder, is, buffer, decoder);
|
faad_stream_decode(mpd_decoder, is, buffer, decoder);
|
||||||
|
|
||||||
/* cleanup */
|
|
||||||
|
|
||||||
NeAACDecClose(decoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user