aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-02 17:07:39 +0100
committerMax Kellermann <max@duempel.org>2008-11-02 17:07:39 +0100
commit395aa4e847424e74b874ce7e04bcec53e7347925 (patch)
treedb4f560d54553241bdd50864ab36ff7f04c1ce0e
parent5183d858864bcb221ee30d805792a6926b8e0544 (diff)
downloadmpd-395aa4e847424e74b874ce7e04bcec53e7347925.tar.gz
mpd-395aa4e847424e74b874ce7e04bcec53e7347925.tar.xz
mpd-395aa4e847424e74b874ce7e04bcec53e7347925.zip
decoder: moved code to decoder_try_decode()
-rw-r--r--src/decoder_thread.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 43db36311..403c2bac8 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -28,6 +28,16 @@
#include "log.h"
#include "ls.h"
+static bool
+decoder_try_decode(const struct decoder_plugin *plugin,
+ struct input_stream *input_stream)
+{
+ if (plugin->try_decode == NULL)
+ return true;
+
+ return plugin->try_decode(input_stream);
+}
+
static void decodeStart(void)
{
struct song *song = dc.next_song;
@@ -91,8 +101,7 @@ static void decodeStart(void)
continue;
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
continue;
- if (plugin->try_decode != NULL
- && !plugin->try_decode(&inStream))
+ if (!decoder_try_decode(plugin, &inStream))
continue;
ret = plugin->stream_decode(&decoder, &inStream);
break;
@@ -108,8 +117,7 @@ static void decodeStart(void)
if (!(plugin->stream_types &
INPUT_PLUGIN_STREAM_URL))
continue;
- if (plugin->try_decode != NULL &&
- !plugin->try_decode(&inStream))
+ if (!decoder_try_decode(plugin, &inStream))
continue;
decoder.plugin = plugin;
ret = plugin->stream_decode(&decoder,
@@ -136,8 +144,7 @@ static void decodeStart(void)
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
continue;
- if (plugin->try_decode != NULL &&
- !plugin->try_decode(&inStream))
+ if (!decoder_try_decode(plugin, &inStream))
continue;
if (plugin->file_decode != NULL) {