aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-26 22:27:01 +0100
committerMax Kellermann <max@duempel.org>2014-12-26 22:27:01 +0100
commit58a5da33c243c057ac4f70ffcfa179b9710161d2 (patch)
tree389077b8e9f78c001daf40a8e1b1d7bd562414c4 /src/output
parent7077eac589bf828188e7dbcfb4ac6002203063d4 (diff)
downloadmpd-58a5da33c243c057ac4f70ffcfa179b9710161d2.tar.gz
mpd-58a5da33c243c057ac4f70ffcfa179b9710161d2.tar.xz
mpd-58a5da33c243c057ac4f70ffcfa179b9710161d2.zip
OutputPlugin: pass Tag reference to _send_tag()
Diffstat (limited to 'src/output')
-rw-r--r--src/output/OutputPlugin.cxx2
-rw-r--r--src/output/OutputPlugin.hxx4
-rw-r--r--src/output/OutputThread.cxx2
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx4
-rw-r--r--src/output/plugins/RoarOutputPlugin.cxx4
-rw-r--r--src/output/plugins/ShoutOutputPlugin.cxx8
-rw-r--r--src/output/plugins/httpd/HttpdInternal.hxx2
-rw-r--r--src/output/plugins/httpd/HttpdOutputPlugin.cxx10
8 files changed, 17 insertions, 19 deletions
diff --git a/src/output/OutputPlugin.cxx b/src/output/OutputPlugin.cxx
index 33bb854d4..cf5c34449 100644
--- a/src/output/OutputPlugin.cxx
+++ b/src/output/OutputPlugin.cxx
@@ -75,7 +75,7 @@ ao_plugin_delay(AudioOutput *ao)
}
void
-ao_plugin_send_tag(AudioOutput *ao, const Tag *tag)
+ao_plugin_send_tag(AudioOutput *ao, const Tag &tag)
{
if (ao->plugin.send_tag != nullptr)
ao->plugin.send_tag(ao, tag);
diff --git a/src/output/OutputPlugin.hxx b/src/output/OutputPlugin.hxx
index 00fa36bc0..654b2e0d7 100644
--- a/src/output/OutputPlugin.hxx
+++ b/src/output/OutputPlugin.hxx
@@ -107,7 +107,7 @@ struct AudioOutputPlugin {
* Display metadata for the next chunk. Optional method,
* because not all devices can display metadata.
*/
- void (*send_tag)(AudioOutput *data, const Tag *tag);
+ void (*send_tag)(AudioOutput *data, const Tag &tag);
/**
* Play a chunk of audio data.
@@ -186,7 +186,7 @@ unsigned
ao_plugin_delay(AudioOutput *ao);
void
-ao_plugin_send_tag(AudioOutput *ao, const Tag *tag);
+ao_plugin_send_tag(AudioOutput *ao, const Tag &tag);
size_t
ao_plugin_play(AudioOutput *ao, const void *chunk, size_t size,
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx
index eb9277d04..c602a531c 100644
--- a/src/output/OutputThread.cxx
+++ b/src/output/OutputThread.cxx
@@ -455,7 +455,7 @@ AudioOutput::PlayChunk(const MusicChunk *chunk)
if (tags && gcc_unlikely(chunk->tag != nullptr)) {
mutex.unlock();
- ao_plugin_send_tag(this, chunk->tag);
+ ao_plugin_send_tag(this, *chunk->tag);
mutex.lock();
}
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index d618aebdc..4dc516996 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -257,11 +257,11 @@ RecorderOutput::SendTag(const Tag &tag)
}
static void
-recorder_output_send_tag(AudioOutput *ao, const Tag *tag)
+recorder_output_send_tag(AudioOutput *ao, const Tag &tag)
{
RecorderOutput &recorder = *(RecorderOutput *)ao;
- recorder.SendTag(*tag);
+ recorder.SendTag(tag);
}
static size_t
diff --git a/src/output/plugins/RoarOutputPlugin.cxx b/src/output/plugins/RoarOutputPlugin.cxx
index aa37c91b7..87a3f4e8f 100644
--- a/src/output/plugins/RoarOutputPlugin.cxx
+++ b/src/output/plugins/RoarOutputPlugin.cxx
@@ -407,10 +407,10 @@ RoarOutput::SendTag(const Tag &tag)
}
static void
-roar_send_tag(AudioOutput *ao, const Tag *meta)
+roar_send_tag(AudioOutput *ao, const Tag &meta)
{
RoarOutput *self = (RoarOutput *)ao;
- self->SendTag(*meta);
+ self->SendTag(meta);
}
const struct AudioOutputPlugin roar_output_plugin = {
diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx
index b51f7ed82..014c246c0 100644
--- a/src/output/plugins/ShoutOutputPlugin.cxx
+++ b/src/output/plugins/ShoutOutputPlugin.cxx
@@ -462,7 +462,7 @@ my_shout_pause(AudioOutput *ao)
}
static void
-shout_tag_to_metadata(const Tag *tag, char *dest, size_t size)
+shout_tag_to_metadata(const Tag &tag, char *dest, size_t size)
{
char artist[size];
char title[size];
@@ -470,7 +470,7 @@ shout_tag_to_metadata(const Tag *tag, char *dest, size_t size)
artist[0] = 0;
title[0] = 0;
- for (const auto &item : *tag) {
+ for (const auto &item : tag) {
switch (item.type) {
case TAG_ARTIST:
strncpy(artist, item.value, size);
@@ -488,7 +488,7 @@ shout_tag_to_metadata(const Tag *tag, char *dest, size_t size)
}
static void my_shout_set_tag(AudioOutput *ao,
- const Tag *tag)
+ const Tag &tag)
{
ShoutOutput *sd = (ShoutOutput *)ao;
@@ -498,7 +498,7 @@ static void my_shout_set_tag(AudioOutput *ao,
Error error;
if (!encoder_pre_tag(sd->encoder, error) ||
!write_page(sd, error) ||
- !encoder_tag(sd->encoder, tag, error)) {
+ !encoder_tag(sd->encoder, &tag, error)) {
LogError(error);
return;
}
diff --git a/src/output/plugins/httpd/HttpdInternal.hxx b/src/output/plugins/httpd/HttpdInternal.hxx
index 303170268..721b6dc94 100644
--- a/src/output/plugins/httpd/HttpdInternal.hxx
+++ b/src/output/plugins/httpd/HttpdInternal.hxx
@@ -250,7 +250,7 @@ public:
bool EncodeAndPlay(const void *chunk, size_t size, Error &error);
- void SendTag(const Tag *tag);
+ void SendTag(const Tag &tag);
size_t Play(const void *chunk, size_t size, Error &error);
diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
index e3ba7727d..9bc2030fe 100644
--- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx
+++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
@@ -499,10 +499,8 @@ httpd_output_pause(AudioOutput *ao)
}
inline void
-HttpdOutput::SendTag(const Tag *tag)
+HttpdOutput::SendTag(const Tag &tag)
{
- assert(tag != nullptr);
-
if (encoder->plugin.tag != nullptr) {
/* embed encoder tags */
@@ -514,7 +512,7 @@ HttpdOutput::SendTag(const Tag *tag)
/* send the tag to the encoder - which starts a new
stream now */
- encoder_tag(encoder, tag, IgnoreError());
+ encoder_tag(encoder, &tag, IgnoreError());
/* the first page generated by the encoder will now be
used as the new "header" page, which is sent to all
@@ -538,7 +536,7 @@ HttpdOutput::SendTag(const Tag *tag)
TAG_NUM_OF_ITEM_TYPES
};
- metadata = icy_server_metadata_page(*tag, &types[0]);
+ metadata = icy_server_metadata_page(tag, &types[0]);
if (metadata != nullptr) {
const ScopeLock protect(mutex);
for (auto &client : clients)
@@ -548,7 +546,7 @@ HttpdOutput::SendTag(const Tag *tag)
}
static void
-httpd_output_tag(AudioOutput *ao, const Tag *tag)
+httpd_output_tag(AudioOutput *ao, const Tag &tag)
{
HttpdOutput *httpd = HttpdOutput::Cast(ao);