aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input/CurlInputPlugin.cxx28
-rw-r--r--src/input/DespotifyInputPlugin.cxx11
-rw-r--r--src/input/RewindInputPlugin.cxx5
-rw-r--r--src/input_stream.h7
4 files changed, 25 insertions, 26 deletions
diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx
index fe944b752..33bacffc5 100644
--- a/src/input/CurlInputPlugin.cxx
+++ b/src/input/CurlInputPlugin.cxx
@@ -23,7 +23,7 @@
#include "InputStream.hxx"
#include "InputPlugin.hxx"
#include "conf.h"
-#include "tag.h"
+#include "Tag.hxx"
#include "IcyMetaDataParser.hxx"
#include "event/MultiSocketMonitor.hxx"
#include "event/Loop.hxx"
@@ -160,7 +160,7 @@ struct input_curl {
/** the tag object ready to be requested via
input_stream_tag() */
- struct tag *tag;
+ Tag *tag;
GError *postponed_error;
@@ -696,8 +696,8 @@ curl_total_buffer_size(const struct input_curl *c)
input_curl::~input_curl()
{
- if (tag != NULL)
- tag_free(tag);
+ delete tag;
+
g_free(meta_name);
input_curl_easy_free_indirect(this);
@@ -720,11 +720,11 @@ input_curl_check(struct input_stream *is, GError **error_r)
return success;
}
-static struct tag *
+static Tag *
input_curl_tag(struct input_stream *is)
{
struct input_curl *c = (struct input_curl *)is;
- struct tag *tag = c->tag;
+ Tag *tag = c->tag;
c->tag = NULL;
return tag;
@@ -798,16 +798,15 @@ read_from_buffer(IcyMetaDataParser &icy, std::list<CurlInputBuffer> &buffers,
static void
copy_icy_tag(struct input_curl *c)
{
- struct tag *tag = c->icy.ReadTag();
+ Tag *tag = c->icy.ReadTag();
if (tag == NULL)
return;
- if (c->tag != NULL)
- tag_free(c->tag);
+ delete c->tag;
- if (c->meta_name != NULL && !tag_has_type(tag, TAG_NAME))
- tag_add_item(tag, TAG_NAME, c->meta_name);
+ if (c->meta_name != NULL && !tag->HasType(TAG_NAME))
+ tag->AddItem(TAG_NAME, c->meta_name);
c->tag = tag;
}
@@ -931,11 +930,10 @@ input_curl_headerfunction(void *ptr, size_t size, size_t nmemb, void *stream)
g_free(c->meta_name);
c->meta_name = g_strndup(value, end - value);
- if (c->tag != NULL)
- tag_free(c->tag);
+ delete c->tag;
- c->tag = tag_new();
- tag_add_item(c->tag, TAG_NAME, c->meta_name);
+ c->tag = new Tag();
+ c->tag->AddItem(TAG_NAME, c->meta_name);
} else if (g_ascii_strcasecmp(name, "icy-metaint") == 0) {
char buffer[64];
size_t icy_metaint;
diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx
index 1e5a8c606..18e896608 100644
--- a/src/input/DespotifyInputPlugin.cxx
+++ b/src/input/DespotifyInputPlugin.cxx
@@ -23,7 +23,7 @@
#include "InputInternal.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
-#include "tag.h"
+#include "Tag.hxx"
extern "C" {
#include <despotify.h>
@@ -42,7 +42,7 @@ struct DespotifyInputStream {
struct despotify_session *session;
struct ds_track *track;
- struct tag *tag;
+ Tag *tag;
struct ds_pcm_data pcm;
size_t len_available;
bool eof;
@@ -64,8 +64,7 @@ struct DespotifyInputStream {
}
~DespotifyInputStream() {
- if (tag != NULL)
- tag_free(tag);
+ delete tag;
despotify_free_track(track);
}
@@ -216,11 +215,11 @@ input_despotify_seek(G_GNUC_UNUSED struct input_stream *is,
return false;
}
-static struct tag *
+static Tag *
input_despotify_tag(struct input_stream *is)
{
DespotifyInputStream *ctx = (DespotifyInputStream *)is;
- struct tag *tag = ctx->tag;
+ Tag *tag = ctx->tag;
ctx->tag = NULL;
diff --git a/src/input/RewindInputPlugin.cxx b/src/input/RewindInputPlugin.cxx
index d93d7d1ce..d68fd3d73 100644
--- a/src/input/RewindInputPlugin.cxx
+++ b/src/input/RewindInputPlugin.cxx
@@ -22,11 +22,12 @@
#include "InputInternal.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
#include <assert.h>
+#include <string.h>
#include <stdio.h>
#undef G_LOG_DOMAIN
@@ -127,7 +128,7 @@ input_rewind_update(struct input_stream *is)
r->CopyAttributes();
}
-static struct tag *
+static Tag *
input_rewind_tag(struct input_stream *is)
{
RewindInputStream *r = (RewindInputStream *)is;
diff --git a/src/input_stream.h b/src/input_stream.h
index 811aae3f9..b5b251f59 100644
--- a/src/input_stream.h
+++ b/src/input_stream.h
@@ -29,6 +29,7 @@
#include <stdbool.h>
#include <sys/types.h>
+struct Tag;
struct input_stream;
#ifdef __cplusplus
@@ -174,12 +175,12 @@ input_stream_lock_eof(struct input_stream *is);
*
* The caller must lock the mutex.
*
- * @return a tag object which must be freed with tag_free(), or NULL
+ * @return a tag object which must be freed by the caller, or nullptr
* if the tag has not changed since the last call
*/
gcc_nonnull(1)
gcc_malloc
-struct tag *
+Tag *
input_stream_tag(struct input_stream *is);
/**
@@ -188,7 +189,7 @@ input_stream_tag(struct input_stream *is);
*/
gcc_nonnull(1)
gcc_malloc
-struct tag *
+Tag *
input_stream_lock_tag(struct input_stream *is);
/**