Some decoder commands are implemented in the decoder plugins, thus
they need to have an API call to signal that their current command has
been finished.  Let them use the new decoder_command_finished()
instead of the internal dc_command_finished().
---

 src/decode.c                        |    8 --------
 src/decode.h                        |    7 -------
 src/decoder_api.c                   |   15 ++++++++++++---
 src/decoder_api.h                   |    7 +++++++
 src/inputPlugins/aac_plugin.c       |    4 ++--
 src/inputPlugins/audiofile_plugin.c |    2 +-
 src/inputPlugins/flac_plugin.c      |    2 +-
 src/inputPlugins/mod_plugin.c       |    2 +-
 src/inputPlugins/mp3_plugin.c       |    8 ++++----
 src/inputPlugins/mp4_plugin.c       |    4 ++--
 src/inputPlugins/mpc_plugin.c       |    2 +-
 src/inputPlugins/oggflac_plugin.c   |    2 +-
 src/inputPlugins/oggvorbis_plugin.c |    2 +-
 src/inputPlugins/wavpack_plugin.c   |    2 +-
 14 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/src/decode.c b/src/decode.c
index 9cef281..ec69a2f 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -48,14 +48,6 @@ static void dc_command(enum decoder_command cmd)
        dc_command_wait();
 }
 
-void dc_command_finished(void)
-{
-       assert(dc.command != DECODE_COMMAND_NONE);
-
-       dc.command = DECODE_COMMAND_NONE;
-       notify_signal(&pc.notify);
-}
-
 static void stopDecode(void)
 {
        if (dc.command == DECODE_COMMAND_START ||
diff --git a/src/decode.h b/src/decode.h
index ab94362..fbee97c 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -63,11 +63,4 @@ void decode(void);
 
 void decoderInit(void);
 
-/**
- * Called by the decoder thread when it has performed the requested
- * command (dc->command).  This function resets dc->command and wakes
- * up the player thread.
- */
-void dc_command_finished(void);
-
 #endif
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 639278c..9d9b1b9 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -50,11 +50,20 @@ enum decoder_command decoder_get_command(mpd_unused struct 
decoder * decoder)
        return dc.command;
 }
 
+void decoder_command_finished(mpd_unused struct decoder * decoder)
+{
+       assert(dc.command != DECODE_COMMAND_NONE);
+
+       dc.command = DECODE_COMMAND_NONE;
+       notify_signal(&pc.notify);
+}
+
 /**
  * All chunks are full of decoded data; wait for the player to free
  * one.
  */
-static int need_chunks(InputStream * inStream, int seekable)
+static int need_chunks(struct decoder *decoder, InputStream * inStream,
+                      int seekable)
 {
        if (dc.command == DECODE_COMMAND_STOP)
                return OUTPUT_BUFFER_DC_STOP;
@@ -64,7 +73,7 @@ static int need_chunks(InputStream * inStream, int seekable)
                        return OUTPUT_BUFFER_DC_SEEK;
                } else {
                        dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
        }
 
@@ -119,7 +128,7 @@ int decoder_data(struct decoder *decoder, InputStream * 
inStream,
                data += nbytes;
 
                if (datalen > 0) {
-                       ret = need_chunks(inStream, seekable);
+                       ret = need_chunks(decoder, inStream, seekable);
                        if (ret != 0)
                                return ret;
                }
diff --git a/src/decoder_api.h b/src/decoder_api.h
index 5913a59..9806933 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -106,6 +106,13 @@ void decoder_initialized(struct decoder * decoder,
 enum decoder_command decoder_get_command(struct decoder * decoder);
 
 /**
+ * Called by the decoder when it has performed the requested command
+ * (dc->command).  This function resets dc->command and wakes up the
+ * player thread.
+ */
+void decoder_command_finished(struct decoder * decoder);
+
+/**
  * This function is called by the decoder plugin when it has
  * successfully decoded block of input data.
  *
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index 29cb23d..b3c72f5 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -391,7 +391,7 @@ static int aac_decode(struct decoder * mpd_decoder, char 
*path)
                             bitRate, NULL);
                if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
                        dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                } else if (decoder_get_command(decoder) == DECODE_COMMAND_STOP)
                        break;
        }
@@ -407,7 +407,7 @@ static int aac_decode(struct decoder * mpd_decoder, char 
*path)
 
        if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
                dc.seekError = 1;
-               dc_command_finished();
+               decoder_command_finished(decoder);
        }
 
        return 0;
diff --git a/src/inputPlugins/audiofile_plugin.c 
b/src/inputPlugins/audiofile_plugin.c
index c75c189..105edc4 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -95,7 +95,7 @@ static int audiofile_decode(struct decoder * decoder, char 
*path)
                        current = dc.seekWhere *
                                audio_format.sampleRate;
                        afSeekFrame(af_fp, AF_DEFAULT_TRACK, current);
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
 
                ret = afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk,
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index fd6ab4e..cef1f6e 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -433,7 +433,7 @@ static int flac_decode_internal(struct decoder * decoder,
                                data.position = 0;
                        } else
                                dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
        }
        if (decoder_get_command(decoder) != DECODE_COMMAND_STOP) {
diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c
index 9f972ed..9386bfc 100644
--- a/src/inputPlugins/mod_plugin.c
+++ b/src/inputPlugins/mod_plugin.c
@@ -189,7 +189,7 @@ static int mod_decode(struct decoder * decoder, char *path)
        while (1) {
                if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
                        dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
 
                if (decoder_get_command(decoder) == DECODE_COMMAND_STOP)
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index e1262fa..5685cb5 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -855,7 +855,7 @@ static int mp3Read(mp3DecodeData * data, struct decoder 
*decoder,
                        data->outputPtr = data->outputBuffer;
                        decoder_clear(decoder);
                        data->muteFrame = 0;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
                break;
        default:
@@ -968,12 +968,12 @@ static int mp3Read(mp3DecodeData * data, struct decoder 
*decoder,
                                } else
                                        dc.seekError = 1;
                                data->muteFrame = 0;
-                               dc_command_finished();
+                               decoder_command_finished(decoder);
                        }
                } else if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK 
&&
                           !data->inStream->seekable) {
                        dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
        }
 
@@ -1076,7 +1076,7 @@ static int mp3_decode(struct decoder * decoder, 
InputStream * inStream)
        if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK &&
            data.muteFrame == MUTEFRAME_SEEK) {
                decoder_clear(decoder);
-               dc_command_finished();
+               decoder_command_finished(decoder);
        }
 
        decoder_flush(decoder);
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c
index 91bf68e..2ebb2a4 100644
--- a/src/inputPlugins/mp4_plugin.c
+++ b/src/inputPlugins/mp4_plugin.c
@@ -213,7 +213,7 @@ static int mp4_decode(struct decoder * mpd_decoder, 
InputStream * inStream)
                        seekPositionFound = 0;
                        decoder_clear(mpd_decoder);
                        seeking = 0;
-                       dc_command_finished();
+                       decoder_command_finished(mpd_decoder);
                }
 
                if (seeking)
@@ -284,7 +284,7 @@ static int mp4_decode(struct decoder * mpd_decoder, 
InputStream * inStream)
 
        if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK && seeking) 
{
                decoder_clear(mpd_decoder);
-               dc_command_finished();
+               decoder_command_finished(mpd_decoder);
        }
        decoder_flush(mpd_decoder);
 
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index ff378fe..5be9ba4 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -185,7 +185,7 @@ static int mpc_decode(struct decoder * mpd_decoder, 
InputStream * inStream)
                                chunkpos = 0;
                        } else
                                dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(mpd_decoder);
                }
 
                vbrUpdateAcc = 0;
diff --git a/src/inputPlugins/oggflac_plugin.c 
b/src/inputPlugins/oggflac_plugin.c
index 09a5141..38474d7 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -364,7 +364,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, 
InputStream * inStream)
                                data.position = 0;
                        } else
                                dc.seekError = 1;
-                       dc_command_finished(dc);
+                       decoder_command_finished(mpd_decoder);
                }
        }
 
diff --git a/src/inputPlugins/oggvorbis_plugin.c 
b/src/inputPlugins/oggvorbis_plugin.c
index 8e98bdf..1b8c715 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -273,7 +273,7 @@ static int oggvorbis_decode(struct decoder * decoder, 
InputStream * inStream)
                                chunkpos = 0;
                        } else
                                dc.seekError = 1;
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
                ret = ov_read(&vf, chunk + chunkpos,
                              OGG_CHUNK_SIZE - chunkpos,
diff --git a/src/inputPlugins/wavpack_plugin.c 
b/src/inputPlugins/wavpack_plugin.c
index 926c9f7..75afb86 100644
--- a/src/inputPlugins/wavpack_plugin.c
+++ b/src/inputPlugins/wavpack_plugin.c
@@ -188,7 +188,7 @@ static void wavpack_decode(struct decoder * decoder,
                                dc.seekError = 1;
                        }
 
-                       dc_command_finished();
+                       decoder_command_finished(decoder);
                }
 
                if (decoder_get_command(decoder) == DECODE_COMMAND_STOP)


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to