aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-07-30 20:11:57 +0200
committerMax Kellermann <max@duempel.org>2013-07-30 20:19:53 +0200
commit06f898cc1240a29b293de0e97ad95a4fdc971254 (patch)
tree001a6d3db039cdc03323f3bfddc13b94bde31ce4 /src/playlist
parent6a9ab8bc0e2f5d34803513bb2d94d041a607a58c (diff)
downloadmpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.gz
mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.xz
mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.zip
tag: convert to C++
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/AsxPlaylistPlugin.cxx8
-rw-r--r--src/playlist/CuePlaylistPlugin.cxx2
-rw-r--r--src/playlist/DespotifyPlaylistPlugin.cxx2
-rw-r--r--src/playlist/EmbeddedCuePlaylistPlugin.cxx2
-rw-r--r--src/playlist/ExtM3uPlaylistPlugin.cxx18
-rw-r--r--src/playlist/PlsPlaylistPlugin.cxx8
-rw-r--r--src/playlist/RssPlaylistPlugin.cxx8
-rw-r--r--src/playlist/SoundCloudPlaylistPlugin.cxx8
-rw-r--r--src/playlist/XspfPlaylistPlugin.cxx7
9 files changed, 30 insertions, 33 deletions
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx
index 198b1d581..be94f81ff 100644
--- a/src/playlist/AsxPlaylistPlugin.cxx
+++ b/src/playlist/AsxPlaylistPlugin.cxx
@@ -22,7 +22,7 @@
#include "MemoryPlaylistProvider.hxx"
#include "input_stream.h"
#include "Song.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
@@ -169,9 +169,9 @@ asx_text(G_GNUC_UNUSED GMarkupParseContext *context,
case AsxParser::ENTRY:
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
if (parser->song->tag == NULL)
- parser->song->tag = tag_new();
- tag_add_item_n(parser->song->tag, parser->tag,
- text, text_len);
+ parser->song->tag = new Tag();
+ parser->song->tag->AddItem(parser->tag,
+ text, text_len);
}
break;
diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx
index 23f2aa82a..fd9c2de09 100644
--- a/src/playlist/CuePlaylistPlugin.cxx
+++ b/src/playlist/CuePlaylistPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "CuePlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "Song.hxx"
#include "input_stream.h"
#include "cue/CueParser.hxx"
diff --git a/src/playlist/DespotifyPlaylistPlugin.cxx b/src/playlist/DespotifyPlaylistPlugin.cxx
index 444a41a13..99724292e 100644
--- a/src/playlist/DespotifyPlaylistPlugin.cxx
+++ b/src/playlist/DespotifyPlaylistPlugin.cxx
@@ -21,7 +21,7 @@
#include "DespotifyPlaylistPlugin.hxx"
#include "DespotifyUtils.hxx"
#include "MemoryPlaylistProvider.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "Song.hxx"
extern "C" {
diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
index 8a5eb10d7..3d69ed72b 100644
--- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx
+++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
@@ -26,7 +26,7 @@
#include "config.h"
#include "EmbeddedCuePlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include "ApeTag.hxx"
diff --git a/src/playlist/ExtM3uPlaylistPlugin.cxx b/src/playlist/ExtM3uPlaylistPlugin.cxx
index 72be308a1..fc79ba26b 100644
--- a/src/playlist/ExtM3uPlaylistPlugin.cxx
+++ b/src/playlist/ExtM3uPlaylistPlugin.cxx
@@ -21,7 +21,7 @@
#include "ExtM3uPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "Song.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "util/StringUtil.hxx"
#include "TextInputStream.hxx"
@@ -70,13 +70,13 @@ extm3u_close(struct playlist_provider *_playlist)
*
* @param line the rest of the input line after the colon
*/
-static struct tag *
+static Tag *
extm3u_parse_tag(const char *line)
{
long duration;
char *endptr;
const char *name;
- struct tag *tag;
+ Tag *tag;
duration = strtol(line, &endptr, 10);
if (endptr[0] != ',')
@@ -93,14 +93,14 @@ extm3u_parse_tag(const char *line)
object */
return NULL;
- tag = tag_new();
+ tag = new Tag();
tag->time = duration;
/* unfortunately, there is no real specification for the
EXTM3U format, so we must assume that the string after the
comma is opaque, and is just the song name*/
if (*name != 0)
- tag_add_item(tag, TAG_NAME, name);
+ tag->AddItem(TAG_NAME, name);
return tag;
}
@@ -109,23 +109,21 @@ static Song *
extm3u_read(struct playlist_provider *_playlist)
{
ExtM3uPlaylist *playlist = (ExtM3uPlaylist *)_playlist;
- struct tag *tag = NULL;
+ Tag *tag = NULL;
std::string line;
const char *line_s;
Song *song;
do {
if (!playlist->tis->ReadLine(line)) {
- if (tag != NULL)
- tag_free(tag);
+ delete tag;
return NULL;
}
line_s = line.c_str();
if (g_str_has_prefix(line_s, "#EXTINF:")) {
- if (tag != NULL)
- tag_free(tag);
+ delete tag;
tag = extm3u_parse_tag(line_s + 8);
continue;
}
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx
index 268211b59..fdb7db77a 100644
--- a/src/playlist/PlsPlaylistPlugin.cxx
+++ b/src/playlist/PlsPlaylistPlugin.cxx
@@ -22,7 +22,7 @@
#include "MemoryPlaylistProvider.hxx"
#include "input_stream.h"
#include "Song.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
@@ -71,8 +71,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
g_free(key);
if(error == NULL && value){
if (song->tag == NULL)
- song->tag = tag_new();
- tag_add_item(song->tag,TAG_TITLE, value);
+ song->tag = new Tag();
+ song->tag->AddItem(TAG_TITLE, value);
}
/* Ignore errors? Most likely value not present */
if(error) g_error_free(error);
@@ -85,7 +85,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
g_free(key);
if(error == NULL && length > 0){
if (song->tag == NULL)
- song->tag = tag_new();
+ song->tag = new Tag();
song->tag->time = length;
}
/* Ignore errors? Most likely value not present */
diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx
index f96b54ae3..e8f279bb2 100644
--- a/src/playlist/RssPlaylistPlugin.cxx
+++ b/src/playlist/RssPlaylistPlugin.cxx
@@ -22,7 +22,7 @@
#include "MemoryPlaylistProvider.hxx"
#include "input_stream.h"
#include "Song.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
@@ -166,9 +166,9 @@ rss_text(G_GNUC_UNUSED GMarkupParseContext *context,
case RssParser::ITEM:
if (parser->tag != TAG_NUM_OF_ITEM_TYPES) {
if (parser->song->tag == NULL)
- parser->song->tag = tag_new();
- tag_add_item_n(parser->song->tag, parser->tag,
- text, text_len);
+ parser->song->tag = new Tag();
+ parser->song->tag->AddItem(parser->tag,
+ text, text_len);
}
break;
diff --git a/src/playlist/SoundCloudPlaylistPlugin.cxx b/src/playlist/SoundCloudPlaylistPlugin.cxx
index 7c93a57b3..01055d1c9 100644
--- a/src/playlist/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/SoundCloudPlaylistPlugin.cxx
@@ -23,7 +23,7 @@
#include "conf.h"
#include "input_stream.h"
#include "Song.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
#include <yajl/yajl_parse.h>
@@ -204,16 +204,16 @@ static int handle_end_map(void *ctx)
data->got_url = 0;
Song *s;
- struct tag *t;
char *u;
u = g_strconcat(data->stream_url, "?client_id=", soundcloud_config.apikey, NULL);
s = Song::NewRemote(u);
g_free(u);
- t = tag_new();
+
+ Tag *t = new Tag();
t->time = data->duration / 1000;
if (data->title != NULL)
- tag_add_item(t, TAG_NAME, data->title);
+ t->AddItem(TAG_NAME, data->title);
s->tag = t;
data->songs.emplace_front(s);
diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx
index a0bb33f1c..cb3d19033 100644
--- a/src/playlist/XspfPlaylistPlugin.cxx
+++ b/src/playlist/XspfPlaylistPlugin.cxx
@@ -21,7 +21,7 @@
#include "XspfPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
#include "input_stream.h"
-#include "tag.h"
+#include "Tag.hxx"
#include <glib.h>
@@ -177,9 +177,8 @@ xspf_text(G_GNUC_UNUSED GMarkupParseContext *context,
if (parser->song != NULL &&
parser->tag != TAG_NUM_OF_ITEM_TYPES) {
if (parser->song->tag == NULL)
- parser->song->tag = tag_new();
- tag_add_item_n(parser->song->tag, parser->tag,
- text, text_len);
+ parser->song->tag = new Tag();
+ parser->song->tag->AddItem(parser->tag, text, text_len);
}
break;