Commit d2ef353f authored by W. Michael Petullo's avatar W. Michael Petullo

Apply Alexandre Rosenfeld's DACP patch from Google Summer of Code 2010

Add DACP support. This allows an application such as Rhythmbox to be
controlled using a remote control application on an iPhone, iPod Touch,
iPad or other similar device. The DACP code is not yet complete, but
progress warrants commiting it to the development tree and focusing
future work on specific patches.
Signed-off-by: 's avatarW. Michael Petullo <mike@flyn.org>
parent 979aa2d2
20 August 2010 Alexandre Rosenfeld <alexandre.rosenfeld@gmail.com>
* Apply Alexandre Rosenfeld's DACP patch from Google Summer of
Code 2010.
22 July 2010 W. Michael Petullo <mike@flyn.org>
* Remove redundancy between dmap_connection_build_message()
......
......@@ -2,12 +2,14 @@ SUBDIRS = docs libdmapsharing tests
DIST_SUBDIRS = docs libdmapsharing m4 media tests
### all of the standard pc files we need to generate
pcfiles = libdmapsharing-@LIBDMAPSHARING_MAJORMINOR@.pc
# pcfiles = libdmapsharing-@LIBDMAPSHARING_MAJORMINOR@.pc
pcfiles = libdmapsharing-@API_VERSION@.pc
all-local: $(pcfiles)
### how to generate pc files
%-@LIBDMAPSHARING_MAJORMINOR@.pc: %.pc
# %-@LIBDMAPSHARING_MAJORMINOR@.pc: %.pc
%-@API_VERSION@.pc: %.pc
cp $< $@
pkgconfigdir = $(libdir)/pkgconfig
......
......@@ -15,6 +15,9 @@
/* Define if libsoup supports SOUP_ENCODING_EOF */
#undef HAVE_ENCODING_EOF
/* Define if gdk-pixbuf support is enabled */
#undef HAVE_GDKPIXBUF
/* Defined when glib-2.0 was found */
#undef HAVE_GLIB
......@@ -82,6 +85,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
......
AC_INIT(libdmapsharing, 2.0.0)
AC_INIT(libdmapsharing, 2.1.0)
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
AS_VERSION(libdmapsharing, LIBDMAPSHARING, 2, 0, 0, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
AS_VERSION(libdmapsharing, LIBDMAPSHARING, 2, 1, 0, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
dnl FIXME:
dnl would like to automate this off the above definitions, but API might be 2.2 with version 2.1.
dnl see also Makefile.am, libdmapsharing/Makefile.am and libdmapsharing.pc.in
API_VERSION=2.2
#AC_DEFINE(API_VERSION, $API_VERSION, [library API version])
AC_SUBST(API_VERSION)
AM_INIT_AUTOMAKE
......@@ -105,6 +112,22 @@ dnl make GOBJECT_CFLAGS and GOBJECT_LIBS available
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)
dnl Check for gdk-pixbuf, needed for DACP Now Playing Artwork
PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0,
HAVE_GDKPIXBUF=yes,
HAVE_GDKPIXBUF=no)
if test x"$HAVE_GDKPIXBUF" = "xyes"; then
AC_DEFINE(HAVE_GDKPIXBUF, 1, [Define if gdk-pixbuf support is enabled])
else
AC_WARN(Gdk-pixbuf library not present, Now Playing artwork might be affected.)
fi
AM_CONDITIONAL(USE_GDKPIXBUF, test x"$HAVE_GDKPIXBUF" = "xyes")
AC_SUBST(GDKPIXBUF_CFLAGS)
AC_SUBST(GDKPIXBUF_LIBS)
AC_ARG_WITH(mdns,
AC_HELP_STRING([--with-mdns=auto|howl|avahi|dns_sd],
[Select the mDNS/DNS-SD implementation to use (default auto)]),
......
......@@ -51,6 +51,7 @@
<xi:include href="xml/dpap-connection.xml"/>
<xi:include href="xml/dpap-record.xml"/>
<xi:include href="xml/dpap-share.xml"/>
<xi:include href="xml/dacp-share.xml"/>
</chapter>
<chapter id="object-tree">
......
......@@ -8,4 +8,4 @@ Description: libdmapsharing
Version: @VERSION@
Requires: glib-2.0 libsoup-2.4
Libs: -L${libdir} -ldmapsharing
Cflags: -I${includedir}/libdmapsharing-@LIBDMAPSHARING_MAJORMINOR@
Cflags: -I${includedir}/libdmapsharing-@API_VERSION@
lib_LTLIBRARIES = libdmapsharing.la
BUILT_SOURCES = dmap-marshal.c dmap-marshal.h
BUILT_SOURCES = dmap-marshal.c dmap-marshal.h dmap-enums.c dmap-enums.h
libdmapsharing_la_SOURCES = \
$(BUILT_SOURCES) \
daap-record.c \
daap-share.c \
dacp-share.c \
dacp-player.c \
dmap-connection.c \
dmap-container-db.c \
dmap-container-record.c \
......@@ -45,6 +47,7 @@ endif
libdmapsharing_la_CFLAGS = \
-DG_LOG_DOMAIN=\"libdmapsharing\" \
-I$(top_srcdir) \
$(GDKPIXBUF_CFLAGS) \
$(SOUP_CFLAGS) \
$(GSTREAMERAPP_CFLAGS) \
$(MDNS_CFLAGS)
......@@ -54,16 +57,19 @@ libdmapsharing_la_LDFLAGS = \
$(GLIB_LIBS) \
$(GTHREAD_LIBS) \
$(GOBJECT_LIBS) \
$(GDKPIXBUF_LIBS) \
$(MDNS_LIBS) \
$(GSTREAMERAPP_LIBS) \
$(SOUP_LIBS)
libdmapsharingincludedir = \
$(includedir)/libdmapsharing-@LIBDMAPSHARING_MAJORMINOR@/libdmapsharing
$(includedir)/libdmapsharing-@API_VERSION@/libdmapsharing
libdmapsharinginclude_HEADERS = \
daap-record.h \
daap-share.h \
dacp-share.h \
dacp-player.h \
dmap.h \
dmap-connection.h \
dmap-container-db.h \
......@@ -79,6 +85,7 @@ libdmapsharinginclude_HEADERS = \
dpap-share.h
noinst_HEADERS = \
dmap-enums.h \
dmap-marshal.h \
dmap-config.h \
dmap-mdns-avahi.h \
......@@ -94,6 +101,26 @@ dmap-marshal.c: dmap-marshal.list
dmap-marshal.h: dmap-marshal.list
@glib-genmarshal --prefix=dmap_marshal $(srcdir)/dmap-marshal.list --header > dmap-marshal.h
dmap-enums.h: $(libdmapsharinginclude_HEADERS) Makefile
@glib-mkenums \
--fhead "/* Automatically generated by glib-mkenums */\n\n#ifndef DMAP_ENUMS_H\n#define DMAP_ENUMS_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n\n" \
--fprod "\n/* enumerations from \"@filename@\" */\n" \
--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define TYPE_@ENUMNAME@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* !DMAP_ENUMS_H */" $(addprefix $(srcdir)/,$(libdmapsharinginclude_HEADERS)) > $@.tmp \
&& sed -e "s/d_map/dmap/" -e "s/D_MAP/DMAP/" -e "s/d_acp/dacp/" -e "s/D_ACP/DACP/" $@.tmp > $@ \
&& rm -f $@.tmp
dmap-enums.c: $(libdmapsharinginclude_headers) Makefile dmap-enums.h
@glib-mkenums \
--fhead "/* Automatically generated by glib-mkenums */\n\n#include \"dacp-share.h\"\n#include \"dacp-player.h\"\n#include \"dmap-mdns-publisher.h\"\n#include \"dmap-mdns-browser.h\"\n#include \"dmap-connection.h\"\n#include \"dmap-enums.h\"" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
$(addprefix $(srcdir)/,$(libdmapsharinginclude_HEADERS)) > $@.tmp \
&& sed -e "s/d_map/dmap/" -e "s/D_MAP/DMAP/" -e "s/d_acp/dacp/" -e "s/D_ACP/DACP/" $@.tmp > $@ \
&& rm -f $@.tmp
CLEANFILES = $(BUILT_SOURCES)
......
......@@ -30,6 +30,17 @@ daap_record_init (DAAPRecordInterface *iface)
daap_record_init_count++;
if (! is_initialized) {
g_object_interface_install_property (iface,
g_param_spec_int ("itemid",
"Item ID",
"Item ID",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("location",
"URI pointing to song data",
......@@ -44,15 +55,34 @@ daap_record_init (DAAPRecordInterface *iface)
"Unknown",
G_PARAM_READWRITE));
/* NOTE: experimenting with matching property name with
* DAAP protocol keyword to make some code simpler. */
//FIXME: This is actually an enum
g_object_interface_install_property (iface,
g_param_spec_int ("mediakind",
"Media kind",
"Media kind",
0,
G_MAXINT,
1,
G_PARAM_READWRITE));
/* NOTE: the name must match the part after the last dot of the
DAAP name, so daap.songalbum becomes songalbum and so on.*/
g_object_interface_install_property (iface,
g_param_spec_string ("daap.songalbum",
g_param_spec_string ("songalbum",
"Album name",
"Album name",
"Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int64 ("songalbumid",
"Album id",
"Album id",
G_MININT64,
G_MAXINT64,
0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("sort-album",
"Album sort name",
......@@ -61,7 +91,7 @@ daap_record_init (DAAPRecordInterface *iface)
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("daap.songartist",
g_param_spec_string ("songartist",
"Song artist",
"Song artist",
"Unknown",
......@@ -75,7 +105,7 @@ daap_record_init (DAAPRecordInterface *iface)
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("daap.songgenre",
g_param_spec_string ("songgenre",
"Song genre",
"Song genre",
"Unknown",
......@@ -216,3 +246,29 @@ daap_record_read (DAAPRecord *record, GError **err)
{
return DAAP_RECORD_GET_INTERFACE (record)->read (record, err);
}
gint
daap_record_cmp_by_album (DAAPRecord *a, DAAPRecord *b)
{
gchar *album_a, *album_b;
gchar *sort_album_a, *sort_album_b;
gint track_a, track_b;
gint ret;
g_object_get (a, "songalbum", &album_a, "sort-album", &sort_album_a, "track", &track_a, NULL);
g_object_get (b, "songalbum", &album_b, "sort-album", &sort_album_b, "track", &track_b, NULL);
if (sort_album_a && sort_album_b)
ret = g_strcmp0 (sort_album_a, sort_album_b);
else
ret = g_strcmp0 (album_a, album_b);
if (ret == 0) {
if (track_a < track_b)
ret = -1;
else
ret = (track_a == track_b) ? 0 : 1;
}
g_free (album_a);
g_free (album_b);
g_free (sort_album_a);
g_free (sort_album_b);
return ret;
}
\ No newline at end of file
......@@ -93,6 +93,15 @@ gboolean daap_record_itunes_compat (DAAPRecord *record);
*/
GInputStream *daap_record_read (DAAPRecord *record, GError **err);
/**
* daap_record_cmp_by_album:
* @a: first DAAPRecord.
* @b: second DAAPRecord.
*
* Compares two records according to album. Suitable to sort lists of albums.
*/
gint daap_record_cmp_by_album (DAAPRecord *a, DAAPRecord *b);
#endif /* __DAAP_RECORD_H */
G_END_DECLS
......@@ -540,18 +540,27 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, ITEM_KIND))
dmap_structure_add (mlit, DMAP_CC_MIKD, (gchar) DAAP_ITEM_KIND_AUDIO);
if (_dmap_share_client_requested (mb->bits, ITEM_ID))
dmap_structure_add (mlit, DMAP_CC_MIID, GPOINTER_TO_UINT (id));
if (_dmap_share_client_requested (mb->bits, ITEM_ID)) {
gint itemid;
g_object_get (record, "itemid", &itemid, NULL);
dmap_structure_add (mlit, DMAP_CC_MIID, (guint) itemid);
}
if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) {
gchar *title;
g_object_get (record, "title", &title, NULL);
dmap_structure_add (mlit, DMAP_CC_MINM, title);
g_free (title);
}
if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID))
dmap_structure_add (mlit, DMAP_CC_MPER, GPOINTER_TO_UINT (id));
if (_dmap_share_client_requested (mb->bits, CONTAINER_ITEM_ID))
dmap_structure_add (mlit, DMAP_CC_MCTI, GPOINTER_TO_UINT (id));
if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID)) {
gint itemid;
g_object_get (record, "itemid", &itemid, NULL);
dmap_structure_add (mlit, DMAP_CC_MPER, (guint) itemid);
}
if (_dmap_share_client_requested (mb->bits, CONTAINER_ITEM_ID)) {
gint itemid;
g_object_get (record, "itemid", &itemid, NULL);
dmap_structure_add (mlit, DMAP_CC_MCTI, (guint) itemid);
}
if (_dmap_share_client_requested (mb->bits, SONG_DATA_KIND))
dmap_structure_add (mlit, DMAP_CC_ASDK, (gchar) DAAP_SONG_DATA_KIND_NONE);
/* FIXME: Any use for this?
......@@ -560,7 +569,7 @@ add_entry_to_mlcl (gpointer id,
*/
if (_dmap_share_client_requested (mb->bits, SONG_ALBUM)) {
gchar *album;
g_object_get (record, "daap.songalbum", &album, NULL);
g_object_get (record, "songalbum", &album, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAL, album);
g_free (album);
}
......@@ -568,7 +577,7 @@ add_entry_to_mlcl (gpointer id,
dmap_structure_add (mlit, DMAP_CC_AGRP, "");
if (_dmap_share_client_requested (mb->bits, SONG_ARTIST)) {
gchar *artist;
g_object_get (record, "daap.songartist", &artist, NULL);
g_object_get (record, "songartist", &artist, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAR, artist);
g_free (artist);
}
......@@ -618,7 +627,7 @@ add_entry_to_mlcl (gpointer id,
}
if (_dmap_share_client_requested (mb->bits, SONG_GENRE)) {
gchar *genre;
g_object_get (record, "daap.songgenre", &genre, NULL);
g_object_get (record, "songgenre", &genre, NULL);
dmap_structure_add (mlit, DMAP_CC_ASGN, genre);
g_free (genre);
}
......@@ -688,7 +697,9 @@ static void
genre_tabulator (gpointer id, DMAPRecord *record, GHashTable *ht)
{
const gchar *genre;
g_object_get (record, "daap.songgenre", &genre, NULL);
g_object_get (record, "songgenre", &genre, NULL);
if (!genre)
return;
if (! g_hash_table_lookup (ht, genre))
g_hash_table_insert (ht, (gchar *) genre, NULL);
}
......@@ -697,7 +708,9 @@ static void
artist_tabulator (gpointer id, DMAPRecord *record, GHashTable *ht)
{
const gchar *artist;
g_object_get (record, "daap.songartist", &artist, NULL);
g_object_get (record, "songartist", &artist, NULL);
if (!artist)
return;
if (! g_hash_table_lookup (ht, artist))
g_hash_table_insert (ht, (gchar *) artist, NULL);
}
......@@ -706,13 +719,15 @@ static void
album_tabulator (gpointer id, DMAPRecord *record, GHashTable *ht)
{
const gchar *album;
g_object_get (record, "daap.songalbum", &album, NULL);
g_object_get (record, "songalbum", &album, NULL);
if (!album)
return;
if (! g_hash_table_lookup (ht, album))
g_hash_table_insert (ht, (gchar *) album, NULL);
}
static void
add_to_category_listing (gpointer key, gpointer value, gpointer user_data)
add_to_category_listing (gpointer key, gpointer user_data)
{
GNode *mlit;
GNode *node = (GNode *) user_data;
......@@ -748,6 +763,7 @@ databases_browse_xxx (DMAPShare *share,
const gchar *browse_category;
GHashTable *category_items;
DMAPContentCode category_cc;
GList *values;
rest_of_path = strchr (path + 1, '/');
browse_category = rest_of_path + 10;
......@@ -783,9 +799,15 @@ databases_browse_xxx (DMAPShare *share,
node = dmap_structure_add (abro, category_cc);
g_hash_table_foreach (category_items,
add_to_category_listing,
node);
values = g_hash_table_get_keys (category_items);
if (g_hash_table_lookup (query, "include-sort-headers")) {
g_debug ("Sorting...");
values = g_list_sort (values, (GCompareFunc) g_ascii_strcasecmp);
}
g_list_foreach (values, add_to_category_listing, node);
g_list_free (values);
_dmap_share_message_set_from_dmap_structure (share, msg, abro);
dmap_structure_destroy (abro);
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* libdmapsharing
* Copyright (C) Alexandre Rosenfeld 2010 <alexandre.rosenfeld@gmail.com>
*
* libdmapsharing is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libdmapsharing is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libdmapsharing/dacp-player.h>
#include <libdmapsharing/dmap-enums.h>
#include <libdmapsharing/daap-record.h>
static void
dacp_player_init (DACPPlayerInterface *iface)
{
static gboolean initialized = FALSE;
//FIXME Remove debug message
g_debug ("DACPPlayer initializing: %d", initialized);
if (!initialized) {
initialized = TRUE;
g_object_interface_install_property (iface,
g_param_spec_ulong ("playing-time",
"Playing time",
"Playing time (ms)",
0,
G_MAXULONG,
0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_boolean ("shuffle-state",
"Shuffle state",
"Shufle state",
FALSE,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_enum ("repeat-state",
"Repeat state",
"Repeat state",
TYPE_DACP_REPEAT_STATE,
REPEAT_NONE,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_enum ("play-state",
"Play state",
"Play state",
TYPE_DACP_PLAY_STATE,
PLAY_STOPPED,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_ulong ("volume",
"Volume",
"Volume",
0,
100,
0,
G_PARAM_READWRITE));
}
}
static void
dacp_player_finalize (DACPPlayerInterface *iface)
{
//FIXME Remove debug message
g_debug ("DACPPlayer finalizing");
}
GType
dacp_player_get_type (void)
{
static GType object_type = 0;
if (!object_type) {
static const GTypeInfo object_info = {
sizeof(DACPPlayerInterface),
(GBaseInitFunc) dacp_player_init,
(GBaseFinalizeFunc) dacp_player_finalize
};
object_type = g_type_register_static(G_TYPE_INTERFACE,
"DACPPlayer",
&object_info, 0);
}
return object_type;
}
DAAPRecord *
dacp_player_now_playing_record (DACPPlayer *player)
{
return DACP_PLAYER_GET_INTERFACE (player)->now_playing_record (player);
}
gchar *
dacp_player_now_playing_artwork (DACPPlayer *player, guint width, guint height)
{
return DACP_PLAYER_GET_INTERFACE (player)->now_playing_artwork (player, width, height);
}
void
dacp_player_play_pause (DACPPlayer *player)
{
DACP_PLAYER_GET_INTERFACE (player)->play_pause (player);
}
void
dacp_player_pause (DACPPlayer *player)
{
DACP_PLAYER_GET_INTERFACE (player)->pause (player);
}
void
dacp_player_next_item (DACPPlayer *player)
{
DACP_PLAYER_GET_INTERFACE (player)->next_item (player);
}
void
dacp_player_prev_item (DACPPlayer *player)
{
DACP_PLAYER_GET_INTERFACE (player)->prev_item (player);
}
void
dacp_player_cue_clear (DACPPlayer *player)
{
DACP_PLAYER_GET_INTERFACE (player)->cue_clear (player);
}
void
dacp_player_cue_play (DACPPlayer *player, GList *records, guint index)
{
DACP_PLAYER_GET_INTERFACE (player)->cue_play (player, records, index);
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* libdmapsharing
* Copyright (C) Alexandre Rosenfeld 2010 <alexandre.rosenfeld@gmail.com>
*
* libdmapsharing is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libdmapsharing is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DACP_PLAYER_H_
#define _DACP_PLAYER_H_
#include <glib-object.h>
#include "daap-record.h"
G_BEGIN_DECLS
#define TYPE_DACP_PLAYER (dacp_player_get_type ())
#define DACP_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DACP_PLAYER, DACPPlayer))
#define IS_DACP_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DACP_PLAYER))
#define DACP_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
TYPE_DACP_PLAYER, DACPPlayerInterface))
typedef struct _DACPPlayerInterface DACPPlayerInterface;
typedef struct _DACPPlayer DACPPlayer;
/**
* DACPRepeatState:
*/
typedef enum {
REPEAT_NONE = 0,
REPEAT_SINGLE = 1,
REPEAT_ALL = 2
} DACPRepeatState;
/**
* DACPPlayState:
*/
typedef enum {
PLAY_STOPPED = 2,
PLAY_PAUSED = 3,
PLAY_PLAYING = 4
} DACPPlayState;
struct _DACPPlayerInterface
{
GTypeInterface parent_class;
DAAPRecord *(*now_playing_record) (DACPPlayer *player);
gchar *(*now_playing_artwork) (DACPPlayer *player, guint width, guint height);
void (*play_pause) (DACPPlayer *player);
void (*pause) (DACPPlayer *player);
void (*next_item) (DACPPlayer *player);
void (*prev_item) (DACPPlayer *player);
void (*cue_clear) (DACPPlayer *player);
void (*cue_play) (DACPPlayer *player, GList *records, guint index);
};
GType dacp_player_get_type (void);
DAAPRecord *dacp_player_now_playing_record (DACPPlayer *player);
gchar *dacp_player_now_playing_artwork (DACPPlayer *player, guint width, guint height);
void dacp_player_play_pause (DACPPlayer *player);
void dacp_player_pause (DACPPlayer *player);
void dacp_player_next_item (DACPPlayer *player);
void dacp_player_prev_item (DACPPlayer *player);
void dacp_player_cue_clear (DACPPlayer *player);
void dacp_player_cue_play (DACPPlayer *player, GList *records, guint index);
G_END_DECLS
#endif /* _DACP_PLAYER_H_ */
This diff is collapsed.
/*
* Header for DACP (e.g., iTunes Remote) sharing
*
* Copyright (C) 2010 Alexandre Rosenfeld <airmind@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __DACP_SHARE_H
#define __DACP_SHARE_H
#include <glib-object.h>
#include <libdmapsharing/dacp-player.h>
#include <libdmapsharing/dmap-share.h>
#include <libdmapsharing/dmap-db.h>
#include <libdmapsharing/dmap-container-db.h>
#include <libdmapsharing/daap-share.h>
G_BEGIN_DECLS
/**
* TYPE_DACP_SHARE:
*
* The type for #DACPShare.
*/
#define TYPE_DACP_SHARE (dacp_share_get_type ())
/**
* DACP_SHARE:
* @o: Object which is subject to casting.
*
* Casts a #DACPShare or derived pointer into a (DACPShare*) pointer.
* Depending on the current debugging level, this function may invoke
* certain runtime checks to identify invalid casts.
*/
#define DACP_SHARE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DACP_SHARE, DACPShare))
/**
* DACP_SHARE_CLASS:
* @k: a valid #DACPShareClass
*
* Casts a derived #DACPShareClass structure into a #DACPShareClass structure.
*/
#define DACP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_DACP_SHARE, DACPShareClass))
/**
* IS_DACP_SHARE:
* @o: Instance to check for being a %TYPE_DACP_SHARE.
*
* Checks whether a valid #GTypeInstance pointer is of type %TYPE_DACP_SHARE.
*/
#define IS_DACP_SHARE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DACP_SHARE))
/**
* IS_DACP_SHARE_CLASS:
* @k: a #DACPShareClass
*
* Checks whether @k "is a" valid #DACPShareClass structure of type
* %DACP_SHARE or derived.
*/
#define IS_DACP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
TYPE_DACP_SHARE))
/**
* DACP_SHARE_GET_CLASS:
* @o: a #DACPShare instance.
*
* Get the class structure associated to a #DACPShare instance.
*
* Returns: pointer to object class structure.