diff options
author | Max Kellermann <max@duempel.org> | 2013-01-21 18:24:26 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-21 19:01:10 +0100 |
commit | 9ec069104f82184fbdc33bb82ead393441a41728 (patch) | |
tree | d887d486682b9f3916f84032d08812954d6b9aeb /src/playlist | |
parent | 7d21d60dbaefa90a2d52636766f7d060cb1cf481 (diff) | |
download | mpd-9ec069104f82184fbdc33bb82ead393441a41728.tar.gz mpd-9ec069104f82184fbdc33bb82ead393441a41728.tar.xz mpd-9ec069104f82184fbdc33bb82ead393441a41728.zip |
input,playlist/despotify: convert to C++
Diffstat (limited to 'src/playlist')
-rw-r--r-- | src/playlist/DespotifyPlaylistPlugin.cxx (renamed from src/playlist/despotify_playlist_plugin.c) | 44 | ||||
-rw-r--r-- | src/playlist/DespotifyPlaylistPlugin.hxx (renamed from src/playlist/despotify_playlist_plugin.h) | 6 |
2 files changed, 28 insertions, 22 deletions
diff --git a/src/playlist/despotify_playlist_plugin.c b/src/playlist/DespotifyPlaylistPlugin.cxx index 30b852c73..049c9499c 100644 --- a/src/playlist/despotify_playlist_plugin.c +++ b/src/playlist/DespotifyPlaylistPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 The Music Player Daemon Project + * Copyright (C) 2011-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,8 @@ */ #include "config.h" -#include "playlist/despotify_playlist_plugin.h" +#include "DespotifyPlaylistPlugin.hxx" +#include "DespotifyUtils.hxx" #include "playlist_plugin.h" #include "playlist_list.h" #include "conf.h" @@ -26,14 +27,16 @@ #include "tag.h" #include "song.h" #include "input_stream.h" -#include "despotify_utils.h" + +extern "C" { +#include <despotify.h> +} #include <glib.h> #include <assert.h> #include <string.h> #include <stdlib.h> -#include <despotify.h> struct despotify_playlist { struct playlist_provider base; @@ -131,7 +134,7 @@ despotify_playlist_open_uri(const char *url, G_GNUC_UNUSED GMutex *mutex, ctx = g_new(struct despotify_playlist, 1); - ctx->list = NULL; + ctx->list = nullptr; ctx->session = session; playlist_provider_init(&ctx->base, &despotify_playlist_plugin); @@ -159,7 +162,7 @@ clean_playlist: g_slist_free(ctx->list); clean_none: - return NULL; + return nullptr; } static void @@ -175,7 +178,7 @@ despotify_playlist_close(struct playlist_provider *_playlist) { struct despotify_playlist *ctx = (struct despotify_playlist *)_playlist; - g_slist_foreach(ctx->list, track_free_callback, NULL); + g_slist_foreach(ctx->list, track_free_callback, nullptr); g_slist_free(ctx->list); g_free(ctx); @@ -186,13 +189,12 @@ static struct song * despotify_playlist_read(struct playlist_provider *_playlist) { struct despotify_playlist *ctx = (struct despotify_playlist *)_playlist; - struct song *out; if (!ctx->list) - return NULL; + return nullptr; /* Remove the current track */ - out = ctx->list->data; + song *out = (song *)ctx->list->data; ctx->list = g_slist_remove(ctx->list, out); return out; @@ -200,18 +202,22 @@ despotify_playlist_read(struct playlist_provider *_playlist) static const char *const despotify_schemes[] = { - "spt", - NULL + "spt", + nullptr }; const struct playlist_plugin despotify_playlist_plugin = { - .name = "despotify", + "despotify", + + despotify_playlist_init, + despotify_playlist_finish, - .init = despotify_playlist_init, - .finish = despotify_playlist_finish, - .open_uri = despotify_playlist_open_uri, - .read = despotify_playlist_read, - .close = despotify_playlist_close, + despotify_playlist_open_uri, + nullptr, + despotify_playlist_close, + despotify_playlist_read, - .schemes = despotify_schemes, + despotify_schemes, + nullptr, + nullptr, }; diff --git a/src/playlist/despotify_playlist_plugin.h b/src/playlist/DespotifyPlaylistPlugin.hxx index f8ee20de0..c1e5b7f39 100644 --- a/src/playlist/despotify_playlist_plugin.h +++ b/src/playlist/DespotifyPlaylistPlugin.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 The Music Player Daemon Project + * Copyright (C) 2011-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_H -#define MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_H +#ifndef MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_HXX +#define MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_HXX extern const struct playlist_plugin despotify_playlist_plugin; |