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.
This commit is contained in:
parent
39b302dcad
commit
d8aec4b2dc
|
@ -23,7 +23,7 @@
|
||||||
#include "event/Thread.hxx"
|
#include "event/Thread.hxx"
|
||||||
#include "decoder/DecoderList.hxx"
|
#include "decoder/DecoderList.hxx"
|
||||||
#include "decoder/DecoderPlugin.hxx"
|
#include "decoder/DecoderPlugin.hxx"
|
||||||
#include "decoder/Client.hxx"
|
#include "decoder/DecoderAPI.hxx" /* for class StopDecoder */
|
||||||
#include "input/Init.hxx"
|
#include "input/Init.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
|
@ -244,10 +244,16 @@ try {
|
||||||
|
|
||||||
ChromaprintDecoderClient client;
|
ChromaprintDecoderClient client;
|
||||||
if (plugin->file_decode != nullptr) {
|
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) {
|
} else if (plugin->stream_decode != nullptr) {
|
||||||
auto is = InputStream::OpenReady(c.uri, client.mutex);
|
auto is = InputStream::OpenReady(c.uri, client.mutex);
|
||||||
plugin->StreamDecode(client, *is);
|
try {
|
||||||
|
plugin->StreamDecode(client, *is);
|
||||||
|
} catch (StopDecoder) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Decoder plugin is not usable\n");
|
fprintf(stderr, "Decoder plugin is not usable\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "event/Thread.hxx"
|
#include "event/Thread.hxx"
|
||||||
#include "decoder/DecoderList.hxx"
|
#include "decoder/DecoderList.hxx"
|
||||||
#include "decoder/DecoderPlugin.hxx"
|
#include "decoder/DecoderPlugin.hxx"
|
||||||
|
#include "decoder/DecoderAPI.hxx" /* for class StopDecoder */
|
||||||
#include "DumpDecoderClient.hxx"
|
#include "DumpDecoderClient.hxx"
|
||||||
#include "input/Init.hxx"
|
#include "input/Init.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
|
@ -116,10 +117,16 @@ try {
|
||||||
|
|
||||||
DumpDecoderClient client;
|
DumpDecoderClient client;
|
||||||
if (plugin->file_decode != nullptr) {
|
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) {
|
} else if (plugin->stream_decode != nullptr) {
|
||||||
auto is = InputStream::OpenReady(c.uri, client.mutex);
|
auto is = InputStream::OpenReady(c.uri, client.mutex);
|
||||||
plugin->StreamDecode(client, *is);
|
try {
|
||||||
|
plugin->StreamDecode(client, *is);
|
||||||
|
} catch (StopDecoder) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Decoder plugin is not usable\n");
|
fprintf(stderr, "Decoder plugin is not usable\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
Loading…
Reference in New Issue