diff options
author | Max Kellermann <max@duempel.org> | 2009-02-09 16:35:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-09 16:35:51 +0100 |
commit | f340fb613d91ddfa707635431c458ea6840f5f0e (patch) | |
tree | f21f39ab5bc6575d1ccad558359dd741a1aabf53 /src | |
parent | f3076436fbbea7c9bdfe16f3dd0ec03ace5f679a (diff) | |
download | mpd-f340fb613d91ddfa707635431c458ea6840f5f0e.tar.gz mpd-f340fb613d91ddfa707635431c458ea6840f5f0e.tar.xz mpd-f340fb613d91ddfa707635431c458ea6840f5f0e.zip |
shout: removed shout_data.tag_to_send
When shout_data.tag!=NULL, there is a "tag to send". The tag_to_send
flag is redundant.
Diffstat (limited to 'src')
-rw-r--r-- | src/output/shout_plugin.c | 14 | ||||
-rw-r--r-- | src/output/shout_plugin.h | 1 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c index c8a39ed62..95b5c0aae 100644 --- a/src/output/shout_plugin.c +++ b/src/output/shout_plugin.c @@ -57,7 +57,6 @@ static struct shout_data *new_shout_data(void) ret->shout_meta = shout_metadata_new(); ret->opened = 0; ret->tag = NULL; - ret->tag_to_send = 0; ret->bitrate = -1; ret->quality = -2.0; ret->timeout = DEFAULT_CONN_TIMEOUT; @@ -459,7 +458,6 @@ static int open_shout_conn(void *data) write_page(sd); sd->opened = true; - sd->tag_to_send = 1; sd->conn_attempts = 0; return 0; @@ -486,7 +484,9 @@ static void send_metadata(struct shout_data * sd) static const int size = 1024; char song[size]; - if (!sd->opened || !sd->tag) + assert(sd->tag != NULL); + + if (!sd->opened) return; if (sd->encoder->send_metadata_func(sd, song, size)) { @@ -494,11 +494,11 @@ static void send_metadata(struct shout_data * sd) if (SHOUTERR_SUCCESS != shout_set_metadata(sd->shout_conn, sd->shout_meta)) { g_warning("error setting shout metadata\n"); - return; } } - sd->tag_to_send = 0; + tag_free(sd->tag); + sd->tag = NULL; } static bool @@ -512,7 +512,7 @@ my_shout_play(void *data, const char *chunk, size_t size) timer_add(sd->timer, size); - if (sd->opened && sd->tag_to_send) + if (sd->opened && sd->tag != NULL) send_metadata(sd); if (!sd->opened) { @@ -557,13 +557,11 @@ static void my_shout_set_tag(void *data, if (sd->tag) tag_free(sd->tag); sd->tag = NULL; - sd->tag_to_send = 0; if (!tag) return; sd->tag = tag_dup(tag); - sd->tag_to_send = 1; } const struct audio_output_plugin shoutPlugin = { diff --git a/src/output/shout_plugin.h b/src/output/shout_plugin.h index ee544152a..e35437185 100644 --- a/src/output/shout_plugin.h +++ b/src/output/shout_plugin.h @@ -71,7 +71,6 @@ struct shout_data { bool opened; struct tag *tag; - int tag_to_send; int timeout; int conn_attempts; |