From d8aec4b2dc8a709a078bbce44e3a9f5866065a59 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Jul 2019 17:49:12 +0200 Subject: test/run_decoder: catch StopDecoder This exception is usually thrown by class DecoderBridge, but the Opus plugin (ab)uses it as well, so we need to catch it. --- test/RunChromaprint.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/RunChromaprint.cxx') diff --git a/test/RunChromaprint.cxx b/test/RunChromaprint.cxx index b04bf9060..a28c6336f 100644 --- a/test/RunChromaprint.cxx +++ b/test/RunChromaprint.cxx @@ -23,7 +23,7 @@ #include "event/Thread.hxx" #include "decoder/DecoderList.hxx" #include "decoder/DecoderPlugin.hxx" -#include "decoder/Client.hxx" +#include "decoder/DecoderAPI.hxx" /* for class StopDecoder */ #include "input/Init.hxx" #include "input/InputStream.hxx" #include "fs/Path.hxx" @@ -244,10 +244,16 @@ try { ChromaprintDecoderClient client; if (plugin->file_decode != nullptr) { - plugin->FileDecode(client, Path::FromFS(c.uri)); + try { + plugin->FileDecode(client, Path::FromFS(c.uri)); + } catch (StopDecoder) { + } } else if (plugin->stream_decode != nullptr) { auto is = InputStream::OpenReady(c.uri, client.mutex); - plugin->StreamDecode(client, *is); + try { + plugin->StreamDecode(client, *is); + } catch (StopDecoder) { + } } else { fprintf(stderr, "Decoder plugin is not usable\n"); return EXIT_FAILURE; -- cgit v1.2.3