Commit 1a8c96a3 authored by Max Kellermann's avatar Max Kellermann

decoder/mpcdec: use AtScopeExit()

parent a88040e4
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "util/Clamp.hxx" #include "util/Clamp.hxx"
#include "util/ScopeExit.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <mpc/mpcdec.h> #include <mpc/mpcdec.h>
...@@ -158,6 +159,8 @@ mpcdec_decode(DecoderClient &client, InputStream &is) ...@@ -158,6 +159,8 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
return; return;
} }
AtScopeExit(demux) { mpc_demux_exit(demux); };
mpc_streaminfo info; mpc_streaminfo info;
mpc_demux_get_info(demux, &info); mpc_demux_get_info(demux, &info);
...@@ -217,8 +220,6 @@ mpcdec_decode(DecoderClient &client, InputStream &is) ...@@ -217,8 +220,6 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
chunk, ret * sizeof(chunk[0]), chunk, ret * sizeof(chunk[0]),
bit_rate); bit_rate);
} while (cmd != DecoderCommand::STOP); } while (cmd != DecoderCommand::STOP);
mpc_demux_exit(demux);
} }
static SignedSongTime static SignedSongTime
...@@ -238,9 +239,10 @@ mpcdec_get_file_duration(InputStream &is) ...@@ -238,9 +239,10 @@ mpcdec_get_file_duration(InputStream &is)
if (demux == nullptr) if (demux == nullptr)
return SignedSongTime::Negative(); return SignedSongTime::Negative();
AtScopeExit(demux) { mpc_demux_exit(demux); };
mpc_streaminfo info; mpc_streaminfo info;
mpc_demux_get_info(demux, &info); mpc_demux_get_info(demux, &info);
mpc_demux_exit(demux);
return SongTime::FromS(mpc_streaminfo_get_length(&info)); return SongTime::FromS(mpc_streaminfo_get_length(&info));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment