aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder_api.c2
-rw-r--r--src/decoder_control.c2
-rw-r--r--src/decoder_control.h11
-rw-r--r--src/decoder_thread.c5
4 files changed, 13 insertions, 7 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 7681b7b85..2350396a9 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -86,7 +86,7 @@ char *decoder_get_uri(G_GNUC_UNUSED struct decoder *decoder)
assert(dc->pipe != NULL);
- return song_get_uri(dc->current_song);
+ return song_get_uri(dc->song);
}
enum decoder_command decoder_get_command(G_GNUC_UNUSED struct decoder * decoder)
diff --git a/src/decoder_control.c b/src/decoder_control.c
index b3092f773..058cd3f33 100644
--- a/src/decoder_control.c
+++ b/src/decoder_control.c
@@ -89,7 +89,7 @@ dc_start(struct decoder_control *dc, struct song *song)
assert(dc->pipe != NULL);
assert(song != NULL);
- dc->next_song = song;
+ dc->song = song;
dc_command(dc, DECODE_COMMAND_START);
}
diff --git a/src/decoder_control.h b/src/decoder_control.h
index f3bd26d53..a70adff05 100644
--- a/src/decoder_control.h
+++ b/src/decoder_control.h
@@ -72,8 +72,13 @@ struct decoder_control {
/** the format being sent to the music pipe */
struct audio_format out_audio_format;
- const struct song *current_song;
- const struct song *next_song;
+ /**
+ * The song currently being decoded. This attribute is set by
+ * the player thread, when it sends the #DECODE_COMMAND_START
+ * command.
+ */
+ const struct song *song;
+
float total_time;
/** the #music_chunk allocator */
@@ -198,7 +203,7 @@ decoder_current_song(const struct decoder_control *dc)
case DECODE_STATE_START:
case DECODE_STATE_DECODE:
- return dc->current_song;
+ return dc->song;
}
assert(false);
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index d02e6985c..175f343e0 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -268,9 +268,11 @@ decoder_run_song(struct decoder_control *dc,
static void
decoder_run(struct decoder_control *dc)
{
- const struct song *song = dc->next_song;
+ const struct song *song = dc->song;
char *uri;
+ assert(song != NULL);
+
if (song_is_file(song))
uri = map_song_fs(song);
else
@@ -281,7 +283,6 @@ decoder_run(struct decoder_control *dc)
return;
}
- dc->current_song = dc->next_song; /* NEED LOCK */
decoder_run_song(dc, song, uri);
g_free(uri);