Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

command: moved player functions to player.c

  • Loading branch information...
commit 40c8107f6ae6565b8a7b1b03df4504f788d0fbcd 1 parent a1878e3
@MaxKellermann MaxKellermann authored
View
2  Makefile.am
@@ -16,6 +16,7 @@ mpdinclude_HEADERS = \
include/mpd/list.h \
include/mpd/parser.h \
include/mpd/password.h \
+ include/mpd/player.h \
include/mpd/playlist.h \
include/mpd/protocol.h \
include/mpd/queue.h \
@@ -55,6 +56,7 @@ src_libmpdclient_la_SOURCES = \
src/list.c \
src/parser.c \
src/password.c \
+ src/player.c \
src/playlist.c \
src/queue.c \
src/quote.c src/quote.h \
View
1  include/mpd/client.h
@@ -54,6 +54,7 @@
#include <mpd/output.h>
#include <mpd/pair.h>
#include <mpd/password.h>
+#include <mpd/player.h>
#include <mpd/playlist.h>
#include <mpd/queue.h>
#include <mpd/recv.h>
View
65 include/mpd/command.h
@@ -31,14 +31,6 @@
#include <stdbool.h>
-enum {
- /**
- * use this to start playing at the beginning, useful when in
- * random mode
- */
- MPD_PLAY_AT_BEGINNING = -1,
-};
-
struct mpd_connection;
#ifdef __cplusplus
@@ -46,63 +38,6 @@ extern "C" {
#endif
/*
- * Status commands
- *
- */
-
-/**
- * Fetches the currently selected song (the song referenced by
- * status->song and status->songid).
- */
-bool
-mpd_send_currentsong(struct mpd_connection *connection);
-
-/*
- * Player commands
- *
- */
-
-bool
-mpd_send_play(struct mpd_connection *connection, int song_pos);
-
-bool
-mpd_send_playid(struct mpd_connection *connection, int id);
-
-bool
-mpd_send_stop(struct mpd_connection *connection);
-
-bool
-mpd_send_pause(struct mpd_connection *connection, int mode);
-
-bool
-mpd_send_next(struct mpd_connection *connection);
-
-bool
-mpd_send_previous(struct mpd_connection *connection);
-
-bool
-mpd_send_seek(struct mpd_connection *connection, int song_pos, int time);
-
-bool
-mpd_send_seekid(struct mpd_connection *connection, int id, int time);
-
-bool
-mpd_send_repeat(struct mpd_connection *connection, int mode);
-
-bool
-mpd_send_random(struct mpd_connection *connection, int mode);
-
-bool
-mpd_send_single(struct mpd_connection *connection, int mode);
-
-bool
-mpd_send_consume(struct mpd_connection *connection, int mode);
-
-bool
-mpd_send_crossfade(struct mpd_connection *connection, int seconds);
-
-
-/*
* Stored playlist commands
*
*/
View
98 include/mpd/player.h
@@ -0,0 +1,98 @@
+/* libmpdclient
+ (c) 2003-2009 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MPD_PLAYER_H
+#define MPD_PLAYER_H
+
+#include <stdbool.h>
+
+enum {
+ /**
+ * use this to start playing at the beginning, useful when in
+ * random mode
+ */
+ MPD_PLAY_AT_BEGINNING = -1,
+};
+
+struct mpd_connection;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Fetches the currently selected song (the song referenced by
+ * status->song and status->songid).
+ */
+bool
+mpd_send_currentsong(struct mpd_connection *connection);
+
+bool
+mpd_send_play(struct mpd_connection *connection, int song_pos);
+
+bool
+mpd_send_playid(struct mpd_connection *connection, int id);
+
+bool
+mpd_send_stop(struct mpd_connection *connection);
+
+bool
+mpd_send_pause(struct mpd_connection *connection, int mode);
+
+bool
+mpd_send_next(struct mpd_connection *connection);
+
+bool
+mpd_send_previous(struct mpd_connection *connection);
+
+bool
+mpd_send_seek(struct mpd_connection *connection, int song_pos, int time);
+
+bool
+mpd_send_seekid(struct mpd_connection *connection, int id, int time);
+
+bool
+mpd_send_repeat(struct mpd_connection *connection, int mode);
+
+bool
+mpd_send_random(struct mpd_connection *connection, int mode);
+
+bool
+mpd_send_single(struct mpd_connection *connection, int mode);
+
+bool
+mpd_send_consume(struct mpd_connection *connection, int mode);
+
+bool
+mpd_send_crossfade(struct mpd_connection *connection, int seconds);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
View
95 src/command.c
@@ -39,101 +39,6 @@ enum {
LONGLONGLEN = (sizeof(long long) * CHAR_BIT + 1) / 3 + 1,
};
-/*
- * Status commands
- *
- */
-
-bool
-mpd_send_currentsong(struct mpd_connection *connection)
-{
- return mpd_send_command(connection, "currentsong", NULL);
-}
-
-
-/*
- * Player commands
- *
- */
-
-bool
-mpd_send_play(struct mpd_connection *connection, int song_pos)
-{
- return mpd_send_int_command(connection, "play", song_pos);
-}
-
-bool
-mpd_send_playid(struct mpd_connection *connection, int id)
-{
- return mpd_send_int_command(connection, "playid", id);
-}
-
-bool
-mpd_send_stop(struct mpd_connection *connection)
-{
- return mpd_send_command(connection, "stop", NULL);
-}
-
-bool
-mpd_send_pause(struct mpd_connection *connection, int mode)
-{
- return mpd_send_int_command(connection, "pause", mode);
-}
-
-bool
-mpd_send_next(struct mpd_connection *connection)
-{
- return mpd_send_command(connection, "next", NULL);
-}
-
-bool
-mpd_send_previous(struct mpd_connection *connection)
-{
- return mpd_send_command(connection, "previous", NULL);
-}
-
-bool
-mpd_send_seek(struct mpd_connection *connection, int song_pos, int time)
-{
- return mpd_send_int2_command(connection, "seek", song_pos, time);
-}
-
-bool
-mpd_send_seekid(struct mpd_connection *connection, int id, int time)
-{
- return mpd_send_int2_command(connection, "seekid", id, time);
-}
-
-bool
-mpd_send_repeat(struct mpd_connection *connection, int mode)
-{
- return mpd_send_int_command(connection, "repeat", mode);
-}
-
-bool
-mpd_send_random(struct mpd_connection *connection, int mode)
-{
- return mpd_send_int_command(connection, "random", mode);
-}
-
-bool
-mpd_send_single(struct mpd_connection *connection, int mode)
-{
- return mpd_send_int_command(connection, "single", mode);
-}
-
-bool
-mpd_send_consume(struct mpd_connection *connection, int mode)
-{
- return mpd_send_int_command(connection, "consume", mode);
-}
-
-bool
-mpd_send_crossfade(struct mpd_connection *connection, int seconds)
-{
- return mpd_send_int_command(connection, "crossfade", seconds);
-}
-
/*
* Stored playlist commands
View
118 src/player.c
@@ -0,0 +1,118 @@
+/* libmpdclient
+ (c) 2003-2009 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <mpd/player.h>
+#include <mpd/send.h>
+#include "isend.h"
+
+#include <limits.h>
+#include <stdio.h>
+
+bool
+mpd_send_currentsong(struct mpd_connection *connection)
+{
+ return mpd_send_command(connection, "currentsong", NULL);
+}
+
+bool
+mpd_send_play(struct mpd_connection *connection, int song_pos)
+{
+ return mpd_send_int_command(connection, "play", song_pos);
+}
+
+bool
+mpd_send_playid(struct mpd_connection *connection, int id)
+{
+ return mpd_send_int_command(connection, "playid", id);
+}
+
+bool
+mpd_send_stop(struct mpd_connection *connection)
+{
+ return mpd_send_command(connection, "stop", NULL);
+}
+
+bool
+mpd_send_pause(struct mpd_connection *connection, int mode)
+{
+ return mpd_send_int_command(connection, "pause", mode);
+}
+
+bool
+mpd_send_next(struct mpd_connection *connection)
+{
+ return mpd_send_command(connection, "next", NULL);
+}
+
+bool
+mpd_send_previous(struct mpd_connection *connection)
+{
+ return mpd_send_command(connection, "previous", NULL);
+}
+
+bool
+mpd_send_seek(struct mpd_connection *connection, int song_pos, int time)
+{
+ return mpd_send_int2_command(connection, "seek", song_pos, time);
+}
+
+bool
+mpd_send_seekid(struct mpd_connection *connection, int id, int time)
+{
+ return mpd_send_int2_command(connection, "seekid", id, time);
+}
+
+bool
+mpd_send_repeat(struct mpd_connection *connection, int mode)
+{
+ return mpd_send_int_command(connection, "repeat", mode);
+}
+
+bool
+mpd_send_random(struct mpd_connection *connection, int mode)
+{
+ return mpd_send_int_command(connection, "random", mode);
+}
+
+bool
+mpd_send_single(struct mpd_connection *connection, int mode)
+{
+ return mpd_send_int_command(connection, "single", mode);
+}
+
+bool
+mpd_send_consume(struct mpd_connection *connection, int mode)
+{
+ return mpd_send_int_command(connection, "consume", mode);
+}
+
+bool
+mpd_send_crossfade(struct mpd_connection *connection, int seconds)
+{
+ return mpd_send_int_command(connection, "crossfade", seconds);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.