Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9ec06910
Commit
9ec06910
authored
Jan 21, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input,playlist/despotify: convert to C++
parent
7d21d60d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
61 deletions
+73
-61
Makefile.am
Makefile.am
+12
-16
DespotifyUtils.cxx
src/DespotifyUtils.cxx
+10
-6
DespotifyUtils.hxx
src/DespotifyUtils.hxx
+0
-2
InputRegistry.cxx
src/InputRegistry.cxx
+1
-1
DespotifyInputPlugin.cxx
src/input/DespotifyInputPlugin.cxx
+18
-10
DespotifyInputPlugin.hxx
src/input/DespotifyInputPlugin.hxx
+3
-3
DespotifyPlaylistPlugin.cxx
src/playlist/DespotifyPlaylistPlugin.cxx
+25
-19
DespotifyPlaylistPlugin.hxx
src/playlist/DespotifyPlaylistPlugin.hxx
+3
-3
playlist_list.c
src/playlist_list.c
+1
-1
No files found.
Makefile.am
View file @
9ec06910
...
...
@@ -79,8 +79,6 @@ mpd_headers = \
src/decoder/pcm_decoder_plugin.h
\
src/input_plugin.h
\
src/input_stream.h
\
src/input/despotify_input_plugin.h
\
src/despotify_utils.h
\
src/text_input_stream.h
\
src/icy_server.h
\
src/ls.h
\
...
...
@@ -106,7 +104,6 @@ mpd_headers = \
src/playlist/asx_playlist_plugin.h
\
src/playlist/rss_playlist_plugin.h
\
src/playlist/lastfm_playlist_plugin.h
\
src/playlist/despotify_playlist_plugin.h
\
src/playlist/cue_playlist_plugin.h
\
src/poison.h
\
src/riff.h
\
...
...
@@ -311,7 +308,7 @@ endif
if
ENABLE_DESPOTIFY
src_mpd_SOURCES
+=
\
src/
despotify_utils.c
src/
DespotifyUtils.cxx src/DespotifyUtils.hxx
endif
if
ENABLE_INOTIFY
...
...
@@ -756,7 +753,9 @@ libinput_a_SOURCES += \
endif
if
ENABLE_DESPOTIFY
libinput_a_SOURCES
+=
src/input/despotify_input_plugin.c
libinput_a_SOURCES
+=
\
src/input/DespotifyInputPlugin.cxx
\
src/input/DespotifyInputPlugin.hxx
endif
...
...
@@ -938,7 +937,9 @@ libplaylist_plugins_a_SOURCES += src/playlist/lastfm_playlist_plugin.c
endif
if
ENABLE_DESPOTIFY
libplaylist_plugins_a_SOURCES
+=
src/playlist/despotify_playlist_plugin.c
libplaylist_plugins_a_SOURCES
+=
\
src/playlist/DespotifyPlaylistPlugin.cxx
\
src/playlist/DespotifyPlaylistPlugin.hxx
endif
if
ENABLE_SOUNDCLOUD
...
...
@@ -1189,16 +1190,11 @@ test_run_filter_SOURCES = test/run_filter.c \
src/AudioCompress/compress.c
if
ENABLE_DESPOTIFY
test_read_tags_SOURCES
+=
\
src/despotify_utils.c
test_run_input_SOURCES
+=
\
src/despotify_utils.c
test_dump_text_file_SOURCES
+=
\
src/despotify_utils.c
test_dump_playlist_SOURCES
+=
\
src/despotify_utils.c
test_run_decoder_SOURCES
+=
\
src/despotify_utils.c
test_read_tags_SOURCES
+=
src/DespotifyUtils.cxx
test_run_input_SOURCES
+=
src/DespotifyUtils.cxx
test_dump_text_file_SOURCES
+=
src/DespotifyUtils.cxx
test_dump_playlist_SOURCES
+=
src/DespotifyUtils.cxx
test_run_decoder_SOURCES
+=
src/DespotifyUtils.cxx
endif
if
ENABLE_ENCODER
...
...
src/
despotify_utils.c
→
src/
DespotifyUtils.cxx
View file @
9ec06910
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,12 +17,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "
despotify_utils.h
"
#include "
DespotifyUtils.hxx
"
#include "tag.h"
#include "conf.h"
#include <glib.h>
extern
"C"
{
#include <despotify.h>
}
static
struct
despotify_session
*
g_session
;
static
void
(
*
registered_callbacks
[
8
])(
struct
despotify_session
*
,
...
...
@@ -116,24 +119,25 @@ struct despotify_session *mpd_despotify_get_session(void)
if
(
user
==
NULL
||
passwd
==
NULL
)
{
g_debug
(
"disabling despotify because account is not configured"
);
return
NULL
;
return
nullptr
;
}
if
(
!
despotify_init
())
{
g_debug
(
"Can't initialize despotify
\n
"
);
return
false
;
return
nullptr
;
}
g_session
=
despotify_init_client
(
callback
,
NULL
,
high_bitrate
,
true
);
if
(
!
g_session
)
{
g_debug
(
"Can't initialize despotify client
\n
"
);
return
false
;
return
nullptr
;
}
if
(
!
despotify_authenticate
(
g_session
,
user
,
passwd
))
{
g_debug
(
"Can't authenticate despotify session
\n
"
);
despotify_exit
(
g_session
);
return
false
;
return
nullptr
;
}
return
g_session
;
...
...
src/
despotify_utils.h
→
src/
DespotifyUtils.hxx
View file @
9ec06910
...
...
@@ -20,8 +20,6 @@
#ifndef MPD_DESPOTIFY_H
#define MPD_DESPOTIFY_H
#include <stdbool.h>
struct
despotify_session
;
struct
ds_track
;
...
...
src/InputRegistry.cxx
View file @
9ec06910
...
...
@@ -46,7 +46,7 @@
#endif
#ifdef ENABLE_DESPOTIFY
#include "input/
despotify_input_plugin.h
"
#include "input/
DespotifyInputPlugin.hxx
"
#endif
#include <glib.h>
...
...
src/input/
despotify_input_plugin.c
→
src/input/
DespotifyInputPlugin.cxx
View file @
9ec06910
/*
* 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,18 +18,21 @@
*/
#include "config.h"
#include "input/despotify_input_plugin.h"
#include "DespotifyInputPlugin.hxx"
#include "DespotifyUtils.hxx"
#include "input_internal.h"
#include "input_plugin.h"
#include "tag.h"
#include "despotify_utils.h"
extern
"C"
{
#include <despotify.h>
}
#include <glib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <despotify.h>
#include <stdio.h>
...
...
@@ -220,11 +223,16 @@ input_despotify_tag(struct input_stream *is)
}
const
struct
input_plugin
input_plugin_despotify
=
{
.
name
=
"spt"
,
.
open
=
input_despotify_open
,
.
close
=
input_despotify_close
,
.
read
=
input_despotify_read
,
.
eof
=
input_despotify_eof
,
.
seek
=
input_despotify_seek
,
"spt"
,
nullptr
,
nullptr
,
input_despotify_open
,
input_despotify_close
,
nullptr
,
nullptr
,
.
tag
=
input_despotify_tag
,
nullptr
,
input_despotify_read
,
input_despotify_eof
,
input_despotify_seek
,
};
src/input/
despotify_input_plugin.h
→
src/input/
DespotifyInputPlugin.hxx
View file @
9ec06910
/*
* 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 INPUT_DESPOTIFY_H
#define INPUT_DESPOTIFY_H
#ifndef INPUT_DESPOTIFY_H
XX
#define INPUT_DESPOTIFY_H
XX
extern
const
struct
input_plugin
input_plugin_despotify
;
...
...
src/playlist/
despotify_playlist_plugin.c
→
src/playlist/
DespotifyPlaylistPlugin.cxx
View file @
9ec06910
/*
* 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
,
};
src/playlist/
despotify_playlist_plugin.h
→
src/playlist/
DespotifyPlaylistPlugin.hxx
View file @
9ec06910
/*
* 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_H
XX
#define MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_H
XX
extern
const
struct
playlist_plugin
despotify_playlist_plugin
;
...
...
src/playlist_list.c
View file @
9ec06910
...
...
@@ -24,7 +24,7 @@
#include "playlist/m3u_playlist_plugin.h"
#include "playlist/xspf_playlist_plugin.h"
#include "playlist/lastfm_playlist_plugin.h"
#include "playlist/
despotify_playlist_plugin.h
"
#include "playlist/
DespotifyPlaylistPlugin.hxx
"
#include "playlist/soundcloud_playlist_plugin.h"
#include "playlist/pls_playlist_plugin.h"
#include "playlist/asx_playlist_plugin.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment