[libdmapsharing] Documentation updates, install dmap-mdns-browser.h and add progress idle
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Documentation updates, install dmap-mdns-browser.h and add progress idle
- Date: Sun, 16 Aug 2009 00:07:56 +0000 (UTC)
commit 93ece3d5a69262dce635d94613e1f871f6594277
Author: W. Michael Petullo <mike flyn org>
Date: Sat Aug 15 20:05:40 2009 -0400
Documentation updates, install dmap-mdns-browser.h and add progress idle
function to dmap-connection.c.
ChangeLog | 22 +++++
Makefile.am | 4 +-
README | 32 +++-----
TODO | 2 +
autogen.sh | 104 ++----------------------
configure.ac | 10 ++-
distro/libdmapsharing.spec | 7 ++-
docs/Makefile.am | 33 +++++++-
docs/libdmapsharing-docs.sgml | 38 ++++++---
libdmapsharing/Makefile.am | 10 +--
libdmapsharing/daap-connection.h | 41 +++++++++
libdmapsharing/daap-record.h | 43 ++++++++++
libdmapsharing/daap-share.c | 106 +++++++++++++------------
libdmapsharing/daap-share.h | 52 ++++++++++++
libdmapsharing/dmap-connection.c | 10 +++
libdmapsharing/dmap-connection.h | 41 +++++++++
libdmapsharing/dmap-container-db.h | 52 ++++++++++++-
libdmapsharing/dmap-container-record.h | 57 +++++++++++++
libdmapsharing/dmap-db.c | 4 +-
libdmapsharing/dmap-db.h | 66 +++++++++++++++-
libdmapsharing/dmap-mdns-browser-avahi.c | 2 -
libdmapsharing/dmap-record-factory.h | 35 ++++++++
libdmapsharing/dmap-record.h | 27 ++++++
libdmapsharing/dmap-share.c | 130 +++++++++++++++---------------
libdmapsharing/dmap-share.h | 83 ++++++++++++++-----
libdmapsharing/dmap.h | 5 -
libdmapsharing/dpap-connection.h | 41 +++++++++
libdmapsharing/dpap-record.c | 4 +-
libdmapsharing/dpap-record.h | 40 +++++++++-
libdmapsharing/dpap-share.c | 60 +++++++-------
libdmapsharing/dpap-share.h | 52 ++++++++++++
tests/test-dmap-container-db.c | 6 +-
tests/test-dmap-container-db.h | 10 ---
tests/test-dmap-db.c | 20 ++---
tests/test-dmap-db.h | 8 --
tests/test-dmap-server.c | 1 +
tests/test-dpap-record.c | 2 +-
tests/test-dpap-record.h | 1 -
38 files changed, 895 insertions(+), 366 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eccdc30..cd5305e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+15 August 2009 W. Michael Petullo <mike flyn org>
+
+ * Documentation.
+
+ * Add progress idle function to dmap-connection.c.
+
+ * Install dmap-mdns-browser.h again.
+
+14 August 2009 W. Michael Petullo <mike flyn org>
+
+ * Add documentation overview.
+
+13 August 2009 W. Michael Petullo <mike flyn org>
+
+ * Proper reference counting for DMAPRecords in DMAPDbs.
+
+ * Documentation work.
+
+12 August 2009 W. Michael Petullo <mike flyn org>
+
+ * Simplify autogen.sh.
+
30 July 2009 W. Michael Petullo <mike flyn org>
* Modify configure.ac to require gstreamer-plugins-base >=
diff --git a/Makefile.am b/Makefile.am
index d6fcb21..41ef2aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = libdmapsharing tests
-DIST_SUBDIRS = common libdmapsharing m4 media tests
+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
diff --git a/README b/README
index 637a5d7..c5ca86c 100644
--- a/README
+++ b/README
@@ -1,22 +1,10 @@
-The libdmapsharing package includes two test programs, test-client-dmap
-and test-client-server. The source code for these programs provide good
-examples of how to develop a DMAP client or server application.
-
-There are three steps to writting a DMAP server:
-
-First, define classes that implement the DAAPDb (or DPAP) and DAAPRecord
-interfaces (for an example, see test-daap-db.c and test-daap-record.c). If
-your application already has a media database interface, then these new
-definitions will simply be adapter classes encapsulating your existing
-interface.
-
-Second, define classes that implement the DMAPContainerDb and
-DMAPContainerRecord interfaces (see test-dmap-container-db.c and
-test-dmap-container-record.c). These classes will allow the creation of
-playlists (DAAP) or albums (DPAP).
-
-Finally, write the code that creates a new DAAPShare object (see
-test-dmap-server.c) and provide it your DAAPDb object.
-
-The libdmapsharing package also provides an optional interface,
-DMAPRecordFactory, that may be convenient for application developers.
+libdmapsharing is a library you may use to access and share DMAP (DAAP &
+DPAP) content. The library is written in C using GObject and libsoup. The
+DMAP family of protocols are used by products such as iTunes(TM),
+iPhoto(TM) and the Roku SoundBridge(TM) family to share content such as
+music and photos.
+
+For documentation on libdmapsharing's API,
+please refer to the API documentation, available at
+http://www.flyn.org/projects/libdmapsharing/docs/ or with the
+libdmapsharing source code.
diff --git a/TODO b/TODO
index 57b4048..b0725b4 100644
--- a/TODO
+++ b/TODO
@@ -5,6 +5,8 @@ daap-connection.c:96: note: initialized from here
Ensure client test catches newly shared files?
+Ensure D[AP]APRecords are properly freed.
+
daap-connection.c
daap-connection.h
daap-connection.lo
diff --git a/autogen.sh b/autogen.sh
index 95fcfe3..bbcedb3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,99 +1,11 @@
#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-DIE=0
-package=libdmapsharing
-srcfile=configure.ac
+gtkdocize || exit 1
+aclocal -I m4 || exit 1
+autoconf || exit 1
+autoheader || exit 1
+libtoolize --force || exit 1
+automake -a || exit 1
+./configure $* || exit 1
-# a quick cvs co if necessary to alleviate the pain - may remove this
-# when developers get a clue ;)
-if test ! -d common;
-then
- echo "+ getting common/ from cvs"
- cvs co common
-fi
-
-# source helper functions
-if test ! -f common/autogen-helper.sh;
-then
- echo There is something wrong with your source tree.
- echo You are missing common/autogen-helper.sh
- exit 1
-fi
-. common/autogen-helper.sh
-
-CONFIGURE_DEF_OPT='--enable-maintainer-mode'
-
-autogen_options $*
-
-echo -n "+ check for build tools"
-if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi
-version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53" \
- "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 53 || DIE=1
-version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.8 automake-1.7 automake-1.6" \
- "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1
-version_check "libtoolize" "$LIBTOOLIZE libtoolize" \
- "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1
-version_check "pkg-config" "" \
- "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
-
-die_check $DIE
-
-aclocal_check || DIE=1
-autoheader_check || DIE=1
-
-die_check $DIE
-
-# if no arguments specified then this will be printed
-if test -z "$*"; then
- echo "+ checking for autogen.sh options"
- echo " This autogen script will automatically run ./configure as:"
- echo " ./configure $CONFIGURE_DEF_OPT"
- echo " To pass any additional options, please specify them on the $0"
- echo " command line."
-fi
-
-toplevel_check $srcfile
-
-tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS"
-tool_run "$libtoolize" "--copy --force"
-tool_run "$autoheader"
-
-# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
-echo timestamp > stamp-h.in 2> /dev/null
-
-tool_run "$autoconf"
-tool_run "$automake" "-a -c"
-
-# if enable exists, add an -enable option for each of the lines in that file
-if test -f enable; then
- for a in `cat enable`; do
- CONFIGURE_FILE_OPT="--enable-$a"
- done
-fi
-
-# if disable exists, add an -disable option for each of the lines in that file
-if test -f disable; then
- for a in `cat disable`; do
- CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
- done
-fi
-
-test -n "$NOCONFIGURE" && {
- echo "+ skipping configure stage for package $package, as requested."
- echo "+ autogen.sh done."
- exit 0
-}
-
-echo "+ running configure ... "
-test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT"
-test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT"
-test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
-echo
-
-./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
- echo " configure failed"
- exit 1
-}
-
-echo "Now type 'make' to compile $package."
+exit 0
diff --git a/configure.ac b/configure.ac
index 5b78425..6783c31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
-AC_INIT(libdmapsharing, 1.9.0.10)
+AC_INIT(libdmapsharing, 1.9.0.11)
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, 1, 9, 0, 10, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
+AS_VERSION(libdmapsharing, LIBDMAPSHARING, 1, 9, 0, 11, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
AM_INIT_AUTOMAKE
@@ -30,6 +30,10 @@ AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_LIBTOOL
+GTK_DOC_CHECK(1.0)
+AC_CONFIG_MACRO_DIR(m4)
+
+
dnl Test if --enable-debug given
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[enable debugging mode])])
if test "x$enable_debug" = "xyes" ; then
@@ -315,7 +319,7 @@ AC_SUBST(DMAP_HAVE_UNALIGNED_ACCESS_DEFINE)
AC_OUTPUT([
Makefile
-common/Makefile
+docs/Makefile
libdmapsharing.pc
libdmapsharing/Makefile
libdmapsharing/dmap-config.h
diff --git a/distro/libdmapsharing.spec b/distro/libdmapsharing.spec
index 643d61b..aaa53c9 100644
--- a/distro/libdmapsharing.spec
+++ b/distro/libdmapsharing.spec
@@ -1,5 +1,5 @@
Name: libdmapsharing
-Version: 1.9.0.10
+Version: 1.9.0.11
Release: 1%{?dist}
License: LGPLv2+
Source: http://downloads.sourceforge.net/%name/%{name}-%{version}.tar.gz
@@ -35,6 +35,7 @@ other resources needed for developing applications using libdmapsharing.
%{_libdir}/pkgconfig/libdmapsharing-*.pc
%{_includedir}/libdmapsharing-*/
%{_libdir}/libdmapsharing.so
+%{_datadir}/gtk-doc/html/libdmapsharing
%prep
@@ -57,6 +58,10 @@ rm -rf $RPM_BUILD_ROOT
%postun -p /sbin/ldconfig
%changelog
+* Sat Aug 15 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.11-1
+- New upstream version.
+- Add gtk-doc documentation to devel package.
+
* Wed Jul 29 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.10-1
- New upstream version.
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 409b89c..91dbb88 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -9,7 +9,7 @@ AUTOMAKE_OPTIONS = 1.6
# of using the various options.
# The name of the module, e.g. 'glib'.
-DOC_MODULE=
+DOC_MODULE=libdmapsharing
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2
@@ -22,7 +22,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
-DOC_SOURCE_DIR=
+DOC_SOURCE_DIR=../libdmapsharing
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
@@ -58,7 +58,18 @@ EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
-IGNORE_HFILES=
+IGNORE_HFILES= \
+ dmap-marshal.h \
+ dmap-config.h \
+ dmap-md5.h \
+ dmap-mdns-avahi.h \
+ dmap-mdns-publisher.h \
+ dmap-structure.h \
+ dmap-utils.h \
+ g-gst-input-stream.h \
+ g-gst-mp3-input-stream.h \
+ g-gst-wav-input-stream.h \
+ gst-util.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
@@ -78,8 +89,20 @@ expand_content_files=
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
-GTKDOC_CFLAGS=
-GTKDOC_LIBS=
+GTKDOC_CFLAGS= \
+ -I$(top_srcdir) \
+ $(SOUP_CFLAGS) \
+ $(GSTREAMERAPP_CFLAGS) \
+ $(MDNS_CFLAGS)
+
+GTKDOC_LIBS= \
+ $(top_builddir)/libdmapsharing/libdmapsharing.la \
+ $(GLIB_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GOBJECT_LIBS) \
+ $(MDNS_LIBS) \
+ $(GSTREAMERAPP_LIBS) \
+ $(SOUP_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
diff --git a/docs/libdmapsharing-docs.sgml b/docs/libdmapsharing-docs.sgml
index 6dfe5e4..c6b201f 100644
--- a/docs/libdmapsharing-docs.sgml
+++ b/docs/libdmapsharing-docs.sgml
@@ -8,29 +8,41 @@
<bookinfo>
<title>libdmapsharing Reference Manual</title>
<releaseinfo>
- for libdmapsharing [VERSION]
+ for libdmapsharing 1.9
The latest version of this documentation can be found on-line at
- <ulink role="online-location" url="http://[SERVER]/libdmapsharing/index.html">http://[SERVER]/libdmapsharing/</ulink>.
+ <ulink role="online-location" url="http://www.flyn.org/projects/libdmapsharing/docs/">http://www.flyn.org/projects/libdmapsharing/docs/</ulink>.
</releaseinfo>
</bookinfo>
+
+ <chapter>
+ <title>Libdmapsharing Sharing Overview</title>
+ <xi:include href="mediadb.sgml"/>
+ <xi:include href="containerdb.sgml"/>
+ <xi:include href="shareapi.sgml"/>
+ </chapter>
<chapter>
- <title>[Insert title here]</title>
- <xi:include href="xml/dmap-container-db.xml"/>
- <xi:include href="xml/dmap-share.xml"/>
- <xi:include href="xml/dpap-share.xml"/>
- <xi:include href="xml/dmap-container-record.xml"/>
- <xi:include href="xml/daap-share.xml"/>
- <xi:include href="xml/daap-record.xml"/>
+ <title>Libdmapsharing Browsing Overview</title>
+ </chapter>
+
+ <chapter>
+ <title>Libdmapsharing Objects and Interfaces</title>
<xi:include href="xml/daap-connection.xml"/>
+ <xi:include href="xml/daap-record.xml"/>
+ <xi:include href="xml/daap-share.xml"/>
+ <xi:include href="xml/dmap-connection.xml"/>
+ <xi:include href="xml/dmap-container-db.xml"/>
+ <xi:include href="xml/dmap-container-record.xml"/>
+ <xi:include href="xml/dmap-db.xml"/>
+ <xi:include href="xml/dmap-mdns-browser.xml"/>
+ <xi:include href="xml/dmap-share.xml"/>
<xi:include href="xml/dmap-record.xml"/>
- <xi:include href="xml/dpap-record.xml"/>
<xi:include href="xml/dmap-record-factory.xml"/>
<xi:include href="xml/dpap-connection.xml"/>
- <xi:include href="xml/dmap-connection.xml"/>
- <xi:include href="xml/dmap-db.xml"/>
-
+ <xi:include href="xml/dpap-record.xml"/>
+ <xi:include href="xml/dpap-share.xml"/>
</chapter>
+
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
diff --git a/libdmapsharing/Makefile.am b/libdmapsharing/Makefile.am
index 3dab209..40a0879 100644
--- a/libdmapsharing/Makefile.am
+++ b/libdmapsharing/Makefile.am
@@ -61,19 +61,14 @@ libdmapsharinginclude_HEADERS = \
daap-record.h \
daap-share.h \
dmap.h \
- dmap-config.h \
dmap-connection.h \
dmap-container-db.h \
dmap-container-record.h \
dmap-db.h \
- dmap-md5.h \
dmap-mdns-browser.h \
- dmap-mdns-publisher.h \
dmap-record.h \
dmap-record-factory.h \
dmap-share.h \
- dmap-structure.h \
- dmap-utils.h \
dpap-connection.h \
dpap-record.h \
dpap-share.h
@@ -81,8 +76,11 @@ libdmapsharinginclude_HEADERS = \
noinst_HEADERS = \
dmap-marshal.h \
dmap-config.h \
+ dmap-md5.h \
dmap-mdns-avahi.h \
- dmap-mdns-browser.h \
+ dmap-mdns-publisher.h \
+ dmap-structure.h \
+ dmap-utils.h \
g-gst-input-stream.h \
g-gst-mp3-input-stream.h \
g-gst-wav-input-stream.h \
diff --git a/libdmapsharing/daap-connection.h b/libdmapsharing/daap-connection.h
index e9c2778..49250a8 100644
--- a/libdmapsharing/daap-connection.h
+++ b/libdmapsharing/daap-connection.h
@@ -28,11 +28,52 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DAAP_CONNECTION:
+ *
+ * The type for #DAAPConnection.
+ */
#define TYPE_DAAP_CONNECTION (daap_connection_get_type ())
+/**
+ * DAAP_CONNECTION:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DAAPConnection or derived pointer into a (DAAPConnection *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DAAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DAAP_CONNECTION, DAAPConnection))
+/**
+ * DAAP_CONNECTION_CLASS:
+ * @k: a valid #DAAPConnectionClass
+ *
+ * Casts a derived #DAAPConnectionClass structure into a #DAAPConnectionClass
+ * structure.
+ */
#define DAAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_DAAP_CONNECTION, DAAPConnectionClass))
+/**
+ * IS_DAAP_CONNECTION:
+ * @o: Instance to check for being a %TYPE_DAAP_CONNECTION.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DAAP_CONNECTION.
+ */
#define IS_DAAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DAAP_CONNECTION))
+/**
+ * IS_DAAP_CONNECTION_CLASS:
+ * @k: a #DAAPConnectionClass
+ *
+ * Checks whether @k "is a" valid #DAAPConnectionClass structure of type
+ * %DAAP_CONNECTION or derived.
+ */
#define IS_DAAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DAAP_CONNECTION))
+/**
+ * DAAP_CONNECTION_GET_CLASS:
+ * @o: a #DAAPConnection instance.
+ *
+ * Get the class structure associated to a #DAAPConnection instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DAAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DAAP_CONNECTION, DAAPConnectionClass))
typedef struct _DAAPConnection DAAPConnection;
diff --git a/libdmapsharing/daap-record.h b/libdmapsharing/daap-record.h
index 17ee532..e1b8a57 100644
--- a/libdmapsharing/daap-record.h
+++ b/libdmapsharing/daap-record.h
@@ -28,11 +28,38 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DAAP_RECORD:
+ *
+ * The type for #DAAPRecord.
+ */
#define TYPE_DAAP_RECORD (daap_record_get_type ())
+/**
+ * DAAP_RECORD:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DAAPRecord or derived pointer into a (DAAPRecord *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DAAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DAAP_RECORD, DAAPRecord))
+/**
+ * IS_DAAP_RECORD:
+ * @o: Instance to check for being a %TYPE_DAAP_RECORD.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DAAP_RECORD.
+ */
#define IS_DAAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DAAP_RECORD))
+/**
+ * DAAP_RECORD_GET_INTERFACE:
+ * @o: a #DAAPRecord instance.
+ *
+ * Get the class structure associated to a #DAAPRecord instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DAAP_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DAAP_RECORD, DAAPRecordInterface))
@@ -47,7 +74,23 @@ struct _DAAPRecordInterface {
};
GType daap_record_get_type (void);
+
+/**
+ * daap_record_itunes_compat:
+ * @record: A DAAPRecord.
+ *
+ * Returns: TRUE if record is compatible with iTunes, else FALSE.
+ */
gboolean daap_record_itunes_compat (DAAPRecord *record);
+
+/**
+ * daap_record_read:
+ * @record: a DAAPRecord.
+ * @err: a GError.
+ *
+ * Returns: A GInputStream that provides read-only access to the data stream
+ * associated with record.
+ */
GInputStream *daap_record_read (DAAPRecord *record, GError **err);
#endif /* __DAAP_RECORD_H */
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index a3b4a02..017ca6b 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -241,8 +241,8 @@ daap_share_new (const char *name,
"transcode-mimetype", transcode_mimetype,
NULL));
- dmap_share_server_start (DMAP_SHARE (share));
- dmap_share_publish_start (DMAP_SHARE (share));
+ _dmap_share_server_start (DMAP_SHARE (share));
+ _dmap_share_publish_start (DMAP_SHARE (share));
transcode_format = mime_to_format (transcode_mimetype);
@@ -319,7 +319,7 @@ daap_share_server_info (DMAPShare *share,
* 3.0 is 2/3
*/
dmap_structure_add (msrv, DMAP_CC_MINM, nameprop);
- dmap_structure_add (msrv, DMAP_CC_MSAU, dmap_share_get_auth_method (share));
+ dmap_structure_add (msrv, DMAP_CC_MSAU, _dmap_share_get_auth_method (share));
/* authentication method
* 0 is nothing
* 1 is name & password
@@ -337,7 +337,7 @@ daap_share_server_info (DMAPShare *share,
dmap_structure_add (msrv, DMAP_CC_MSRS, (gchar) 0);
dmap_structure_add (msrv, DMAP_CC_MSDC, (gint32) 1);
- dmap_share_message_set_from_dmap_structure (share, message, msrv);
+ _dmap_share_message_set_from_dmap_structure (share, message, msrv);
dmap_structure_destroy (msrv);
g_free (nameprop);
@@ -564,73 +564,73 @@ add_entry_to_mlcl (gpointer id, DMAPRecord *record, gpointer _mb)
mb = (struct MLCL_Bits *) _mb;
mlit = dmap_structure_add (mb->mlcl, DMAP_CC_MLIT);
- if (dmap_share_client_requested (mb->bits, ITEM_KIND))
+ 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))
+ 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_NAME)) {
+ if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) {
const gchar *title;
g_object_get (record, "title", &title, NULL);
dmap_structure_add (mlit, DMAP_CC_MINM, title);
}
- if (dmap_share_client_requested (mb->bits, PERSISTENT_ID))
+ 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))
+ 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, SONG_DATA_KIND))
+ 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?
- if (dmap_share_client_requested (mb->bits, SONG_DATA_URL))
+ if (_dmap_share_client_requested (mb->bits, SONG_DATA_URL))
dmap_structure_add (mlit, DMAP_CC_ASUL, "daap://192.168.0.100:%u/databases/1/items/%d.%s?session-id=%s", data->port, *id, daap_record_get_format (DAAP_RECORD (record)), data->session_id);
*/
- if (dmap_share_client_requested (mb->bits, SONG_ALBUM)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_ALBUM)) {
const gchar *album;
g_object_get (record, "album", &album, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAL, album);
}
- if (dmap_share_client_requested (mb->bits, SONG_GROUPING))
+ if (_dmap_share_client_requested (mb->bits, SONG_GROUPING))
dmap_structure_add (mlit, DMAP_CC_AGRP, "");
- if (dmap_share_client_requested (mb->bits, SONG_ARTIST)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_ARTIST)) {
const gchar *artist;
g_object_get (record, "artist", &artist, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAR, artist);
}
- if (dmap_share_client_requested (mb->bits, SONG_BITRATE)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_BITRATE)) {
gulong bitrate;
g_object_get (record, "bitrate", &bitrate, NULL);
if (bitrate != 0)
dmap_structure_add (mlit, DMAP_CC_ASBR, (gint32) bitrate);
}
- if (dmap_share_client_requested (mb->bits, SONG_BPM))
+ if (_dmap_share_client_requested (mb->bits, SONG_BPM))
dmap_structure_add (mlit, DMAP_CC_ASBT, (gint32) 0);
- if (dmap_share_client_requested (mb->bits, SONG_COMMENT))
+ if (_dmap_share_client_requested (mb->bits, SONG_COMMENT))
dmap_structure_add (mlit, DMAP_CC_ASCM, "");
- if (dmap_share_client_requested (mb->bits, SONG_COMPILATION))
+ if (_dmap_share_client_requested (mb->bits, SONG_COMPILATION))
dmap_structure_add (mlit, DMAP_CC_ASCO, (gchar) FALSE);
- if (dmap_share_client_requested (mb->bits, SONG_COMPOSER))
+ if (_dmap_share_client_requested (mb->bits, SONG_COMPOSER))
dmap_structure_add (mlit, DMAP_CC_ASCP, "");
- if (dmap_share_client_requested (mb->bits, SONG_DATE_ADDED)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_DATE_ADDED)) {
gint32 firstseen;
g_object_get (record, "firstseen", &firstseen, NULL);
dmap_structure_add (mlit, DMAP_CC_ASDA, firstseen);
}
- if (dmap_share_client_requested (mb->bits, SONG_DATE_MODIFIED)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_DATE_MODIFIED)) {
gint32 mtime;
g_object_get (record, "mtime", &mtime, NULL);
dmap_structure_add (mlit, DMAP_CC_ASDM, mtime);
}
- if (dmap_share_client_requested (mb->bits, SONG_DISC_COUNT))
+ if (_dmap_share_client_requested (mb->bits, SONG_DISC_COUNT))
dmap_structure_add (mlit, DMAP_CC_ASDC, (gint32) 0);
- if (dmap_share_client_requested (mb->bits, SONG_DISC_NUMBER)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_DISC_NUMBER)) {
gint32 disc;
g_object_get (record, "disc", &disc, NULL);
dmap_structure_add (mlit, DMAP_CC_ASDN, disc);
}
- if (dmap_share_client_requested (mb->bits, SONG_DISABLED))
+ if (_dmap_share_client_requested (mb->bits, SONG_DISABLED))
dmap_structure_add (mlit, DMAP_CC_ASDB, (gchar) FALSE);
- if (dmap_share_client_requested (mb->bits, SONG_EQ_PRESET))
+ if (_dmap_share_client_requested (mb->bits, SONG_EQ_PRESET))
dmap_structure_add (mlit, DMAP_CC_ASEQ, "");
- if (dmap_share_client_requested (mb->bits, SONG_FORMAT)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_FORMAT)) {
gchar *format;
if (transcode_format)
format = transcode_format;
@@ -638,49 +638,49 @@ add_entry_to_mlcl (gpointer id, DMAPRecord *record, gpointer _mb)
g_object_get (record, "format", &format, NULL);
dmap_structure_add (mlit, DMAP_CC_ASFM, format);
}
- if (dmap_share_client_requested (mb->bits, SONG_GENRE)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_GENRE)) {
gchar *genre;
g_object_get (record, "genre", &genre, NULL);
dmap_structure_add (mlit, DMAP_CC_ASGN, genre);
}
- if (dmap_share_client_requested (mb->bits, SONG_DESCRIPTION))
+ if (_dmap_share_client_requested (mb->bits, SONG_DESCRIPTION))
dmap_structure_add (mlit, DMAP_CC_ASDT, ""); /* FIXME: e.g., wav audio file */
- if (dmap_share_client_requested (mb->bits, SONG_RELATIVE_VOLUME))
+ if (_dmap_share_client_requested (mb->bits, SONG_RELATIVE_VOLUME))
dmap_structure_add (mlit, DMAP_CC_ASRV, 0);
- if (dmap_share_client_requested (mb->bits, SONG_SAMPLE_RATE))
+ if (_dmap_share_client_requested (mb->bits, SONG_SAMPLE_RATE))
dmap_structure_add (mlit, DMAP_CC_ASSR, 0);
- if (dmap_share_client_requested (mb->bits, SONG_SIZE)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_SIZE)) {
guint64 filesize;
g_object_get (record, "filesize", &filesize, NULL);
dmap_structure_add (mlit, DMAP_CC_ASSZ, (gint32) filesize);
}
- if (dmap_share_client_requested (mb->bits, SONG_START_TIME))
+ if (_dmap_share_client_requested (mb->bits, SONG_START_TIME))
dmap_structure_add (mlit, DMAP_CC_ASST, 0);
- if (dmap_share_client_requested (mb->bits, SONG_STOP_TIME))
+ if (_dmap_share_client_requested (mb->bits, SONG_STOP_TIME))
dmap_structure_add (mlit, DMAP_CC_ASSP, 0);
- if (dmap_share_client_requested (mb->bits, SONG_TIME)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_TIME)) {
gint32 duration;
g_object_get (record, "duration", &duration, NULL);
dmap_structure_add (mlit, DMAP_CC_ASTM, (1000 * duration));
}
- if (dmap_share_client_requested (mb->bits, SONG_TRACK_COUNT))
+ if (_dmap_share_client_requested (mb->bits, SONG_TRACK_COUNT))
dmap_structure_add (mlit, DMAP_CC_ASTC, 0);
- if (dmap_share_client_requested (mb->bits, SONG_TRACK_NUMBER)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_TRACK_NUMBER)) {
gint32 track;
g_object_get (record, "track", &track, NULL);
dmap_structure_add (mlit, DMAP_CC_ASTN, track);
}
- if (dmap_share_client_requested (mb->bits, SONG_USER_RATING)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_USER_RATING)) {
gint32 rating;
g_object_get (record, "rating", &rating, NULL);
dmap_structure_add (mlit, DMAP_CC_ASUR, rating);
}
- if (dmap_share_client_requested (mb->bits, SONG_YEAR)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_YEAR)) {
gint32 year;
g_object_get (record, "year", &year, NULL);
dmap_structure_add (mlit, DMAP_CC_ASYR, year);
}
- if (dmap_share_client_requested (mb->bits, SONG_HAS_VIDEO)) {
+ if (_dmap_share_client_requested (mb->bits, SONG_HAS_VIDEO)) {
gboolean has_video;
g_object_get (record, "has-video", &has_video, NULL);
dmap_structure_add (mlit, DMAP_CC_AEHV, has_video);
@@ -773,7 +773,7 @@ build_filter (gchar *filterstr)
GSList *filter = NULL;
gchar **t2;
- t2 = dmap_db_strsplit_using_quotes (t1[i]);
+ t2 = _dmap_db_strsplit_using_quotes (t1[i]);
for (j = 0; t2[j]; j++) {
FilterDefinition *def;
@@ -861,7 +861,7 @@ daap_share_databases (DMAPShare *share,
g_debug ("Path is %s.", path);
g_hash_table_foreach (query, debug_param, NULL);
- if (! dmap_share_session_id_validate (share, context, message, query, NULL)) {
+ if (! _dmap_share_session_id_validate (share, context, message, query, NULL)) {
soup_message_set_status (message, SOUP_STATUS_FORBIDDEN);
return;
}
@@ -902,7 +902,7 @@ daap_share_databases (DMAPShare *share,
dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DAAP_SHARE (share)->priv->db));
dmap_structure_add (mlit, DMAP_CC_MCTC, (gint32) 1);
- dmap_share_message_set_from_dmap_structure (share, message, avdb);
+ _dmap_share_message_set_from_dmap_structure (share, message, avdb);
dmap_structure_destroy (avdb);
g_free (nameprop);
@@ -928,7 +928,7 @@ daap_share_databases (DMAPShare *share,
if (record_query) {
GSList *filter_def;
filter_def = build_filter (record_query);
- records = dmap_db_apply_filter (DMAP_DB (DAAP_SHARE (share)->priv->db), filter_def);
+ records = _dmap_db_apply_filter (DMAP_DB (DAAP_SHARE (share)->priv->db), filter_def);
g_debug ("Found %d records", g_hash_table_size (records));
num_songs = g_hash_table_size (records);
free_filter (filter_def);
@@ -936,7 +936,7 @@ daap_share_databases (DMAPShare *share,
num_songs = dmap_db_count (DAAP_SHARE (share)->priv->db);
}
- mb.bits = dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
+ mb.bits = _dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
adbs = dmap_structure_add (NULL, DMAP_CC_ADBS);
dmap_structure_add (adbs, DMAP_CC_MSTT, (gint32) DAAP_STATUS_OK);
@@ -953,7 +953,7 @@ daap_share_databases (DMAPShare *share,
dmap_db_foreach (DAAP_SHARE (share)->priv->db, add_entry_to_mlcl, &mb);
}
- dmap_share_message_set_from_dmap_structure (share, message, adbs);
+ _dmap_share_message_set_from_dmap_structure (share, message, adbs);
dmap_structure_destroy (adbs);
adbs = NULL;
} else if (g_ascii_strcasecmp ("/1/containers", rest_of_path) == 0) {
@@ -994,9 +994,9 @@ daap_share_databases (DMAPShare *share,
dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DAAP_SHARE (share)->priv->db));
dmap_structure_add (mlit, DMAP_CC_ABPL, (gchar) 1);
- dmap_container_db_foreach (DAAP_SHARE (share)->priv->container_db, dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
+ dmap_container_db_foreach (DAAP_SHARE (share)->priv->container_db, _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
- dmap_share_message_set_from_dmap_structure (share, message, aply);
+ _dmap_share_message_set_from_dmap_structure (share, message, aply);
dmap_structure_destroy (aply);
g_free (nameprop);
@@ -1018,7 +1018,7 @@ daap_share_databases (DMAPShare *share,
struct MLCL_Bits mb = {NULL,0};
gint pl_id = atoi (rest_of_path + 14);
- mb.bits = dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
+ mb.bits = _dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
apso = dmap_structure_add (NULL, DMAP_CC_APSO);
dmap_structure_add (apso, DMAP_CC_MSTT, (gint32) DAAP_STATUS_OK);
@@ -1045,9 +1045,11 @@ daap_share_databases (DMAPShare *share,
mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
dmap_db_foreach (entries, add_entry_to_mlcl, &mb);
+
+ g_object_unref (record);
}
- dmap_share_message_set_from_dmap_structure (share, message, apso);
+ _dmap_share_message_set_from_dmap_structure (share, message, apso);
dmap_structure_destroy (apso);
} else if (g_ascii_strncasecmp ("/1/browse/", rest_of_path, 9) == 0) {
/* ABRO database browse
@@ -1073,7 +1075,7 @@ daap_share_databases (DMAPShare *share,
filter = g_hash_table_lookup (query, "filter");
filter_def = build_filter (filter);
- filtered = dmap_db_apply_filter (DMAP_DB (DAAP_SHARE (share)->priv->db), filter_def);
+ filtered = _dmap_db_apply_filter (DMAP_DB (DAAP_SHARE (share)->priv->db), filter_def);
if (g_ascii_strcasecmp (browse_category, "genres") == 0) {
g_hash_table_foreach (filtered, (GHFunc) genre_tabulator, category_items);
@@ -1104,7 +1106,7 @@ daap_share_databases (DMAPShare *share,
add_to_category_listing,
node);
- dmap_share_message_set_from_dmap_structure (share, message, abro);
+ _dmap_share_message_set_from_dmap_structure (share, message, abro);
dmap_structure_destroy (abro);
_bad_category:
free_filter (filter_def);
@@ -1149,6 +1151,8 @@ daap_share_databases (DMAPShare *share,
soup_message_set_status (message, SOUP_STATUS_OK);
}
send_chunked_file (server, message, record, filesize, offset, DAAP_SHARE (share)->priv->transcode_mimetype);
+
+ g_object_unref (record);
} else {
g_warning ("Unhandled: %s\n", path);
}
diff --git a/libdmapsharing/daap-share.h b/libdmapsharing/daap-share.h
index 42c56c8..5396952 100644
--- a/libdmapsharing/daap-share.h
+++ b/libdmapsharing/daap-share.h
@@ -32,15 +32,55 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DAAP_SHARE:
+ *
+ * The type for #DAAPShare.
+ */
#define TYPE_DAAP_SHARE (daap_share_get_type ())
+/**
+ * DAAP_SHARE:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DAAPShare or derived pointer into a (DAAPShare*) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DAAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DAAP_SHARE, DAAPShare))
+/**
+ * DAAP_SHARE_CLASS:
+ * @k: a valid #DAAPShareClass
+ *
+ * Casts a derived #DAAPShareClass structure into a #DAAPShareClass structure.
+ */
#define DAAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_DAAP_SHARE, DAAPShareClass))
+/**
+ * IS_DAAP_SHARE:
+ * @o: Instance to check for being a %TYPE_DAAP_SHARE.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DAAP_SHARE.
+ */
#define IS_DAAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DAAP_SHARE))
+/**
+ * IS_DAAP_SHARE_CLASS:
+ * @k: a #DAAPShareClass
+ *
+ * Checks whether @k "is a" valid #DAAPShareClass structure of type
+ * %DAAP_SHARE or derived.
+ */
#define IS_DAAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
TYPE_DAAP_SHARE))
+/**
+ * DAAP_SHARE_GET_CLASS:
+ * @o: a #DAAPShare instance.
+ *
+ * Get the class structure associated to a #DAAPShare instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DAAP_SHARE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
TYPE_DAAP_SHARE, DAAPShareClass))
@@ -57,6 +97,18 @@ typedef struct {
GType daap_share_get_type (void);
+/**
+ * daap_share_new:
+ * @name: The name that will be published by mDNS.
+ * @password: A share password or NULL.
+ * @db: A media database.
+ * @container_db: A container (album) database.
+ * @transcode_mimetype: A transcode mimetype or NULL.
+ *
+ * Creates a new DAAP share and publishes it using mDNS.
+ *
+ * Returns: a pointer to a DAAPShare.
+ */
DAAPShare *daap_share_new (const char *name, const char *password,
DMAPDb *db, DMAPContainerDb *container_db,
gchar *transcode_mimetype);
diff --git a/libdmapsharing/dmap-connection.c b/libdmapsharing/dmap-connection.c
index 2506a1d..58e9662 100644
--- a/libdmapsharing/dmap-connection.c
+++ b/libdmapsharing/dmap-connection.c
@@ -991,7 +991,17 @@ handle_song_listing (DMAPConnection *connection,
g_free (uri);
dmap_db_add (priv->db, record);
+ g_debug ("Got song: %s", title);
+ g_object_unref (record);
+
+ if (i % commit_batch == 0) {
+ connection->priv->progress = ((float) i / (float) returned_count);
+ if (priv->emit_progress_id != 0) {
+ g_source_remove (connection->priv->emit_progress_id);
+ }
+ connection->priv->emit_progress_id = g_idle_add ((GSourceFunc) emit_progress_idle, connection);
}
+ }
dmap_connection_state_done (connection, TRUE);
}
diff --git a/libdmapsharing/dmap-connection.h b/libdmapsharing/dmap-connection.h
index 7bbfc8a..504cf63 100644
--- a/libdmapsharing/dmap-connection.h
+++ b/libdmapsharing/dmap-connection.h
@@ -36,11 +36,52 @@ typedef struct {
GList *uris;
} DMAPPlaylist;
+/**
+ * TYPE_DMAP_CONNECTION:
+ *
+ * The type for #DMAPConnection.
+ */
#define TYPE_DMAP_CONNECTION (dmap_connection_get_type ())
+/**
+ * DMAP_CONNECTION:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPConnection or derived pointer into a (DMAPConnection *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DMAP_CONNECTION, DMAPConnection))
+/**
+ * DMAP_CONNECTION_CLASS:
+ * @k: a valid #DMAPConnectionClass
+ *
+ * Casts a derived #DMAPConnectionClass structure into a #DMAPConnectionClass
+ * structure.
+ */
#define DMAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_DMAP_CONNECTION, DMAPConnectionClass))
+/**
+ * IS_DMAP_CONNECTION:
+ * @o: Instance to check for being a %TYPE_DMAP_CONNECTION.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DMAP_CONNECTION.
+ */
#define IS_DMAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DMAP_CONNECTION))
+/**
+ * IS_DMAP_CONNECTION_CLASS:
+ * @k: a #DMAPConnectionClass
+ *
+ * Checks whether @k "is a" valid #DMAPConnectionClass structure of type
+ * %DMAP_CONNECTION or derived.
+ */
#define IS_DMAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DMAP_CONNECTION))
+/**
+ * DMAP_CONNECTION_GET_CLASS:
+ * @o: a #DMAPConnection instance.
+ *
+ * Get the class structure associated to a #DMAPConnection instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DMAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DMAP_CONNECTION, DMAPConnectionClass))
typedef struct DMAPConnectionPrivate DMAPConnectionPrivate;
diff --git a/libdmapsharing/dmap-container-db.h b/libdmapsharing/dmap-container-db.h
index 93a3ea3..8be4b89 100644
--- a/libdmapsharing/dmap-container-db.h
+++ b/libdmapsharing/dmap-container-db.h
@@ -27,11 +27,39 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_CONTAINER_DB:
+ *
+ * The type for #DMAPContainerDb.
+ */
#define TYPE_DMAP_CONTAINER_DB (dmap_container_db_get_type ())
+/**
+ * DMAP_CONTAINER_DB:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPContainerDb or derived pointer into a (DMAPContainerDb*)
+ * pointer. Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_CONTAINER_DB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_CONTAINER_DB, DMAPContainerDb))
+/**
+ * IS_DMAP_CONTAINER_DB:
+ * @o: Instance to check for being a %TYPE_DMAP_CONTAINER_DB.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type
+ * %TYPE_DMAP_CONTAINER_DB.
+ */
#define IS_DMAP_CONTAINER_DB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_CONTAINER_DB))
+/**
+ * DMAP_CONTAINER_DB_GET_INTERFACE:
+ * @o: a #DMAPContainerDb instance.
+ *
+ * Get the interface structure associated to a #DMAPContainerDb instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DMAP_CONTAINER_DB_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DMAP_CONTAINER_DB, DMAPContainerDbInterface))
@@ -53,15 +81,35 @@ struct _DMAPContainerDbInterface {
GType dmap_container_db_get_type (void);
-gint dmap_container_db_get_id (DMAPContainerDb *db);
-
+/**
+ * dmap_container_db_lookup_by_id:
+ * @db: A container database.
+ * @id: A record ID.
+ *
+ * Returns: the database record corresponding to @id. This record should
+ * be unrefed when no longer required.
+ */
DMAPContainerRecord *dmap_container_db_lookup_by_id (DMAPContainerDb *db, gint id);
+/**
+ * dmap_container_db_foreach:
+ * @db: A container database.
+ * @fn: The function to apply to each record in the database.
+ * @data: User data to pass to the function.
+ *
+ * Apply a function to each record in a container database.
+ */
void dmap_container_db_foreach (DMAPContainerDb *db,
void (*fn) (DMAPContainerRecord *record,
gpointer data),
gpointer data);
+/**
+ * dmap_container_db_count:
+ * @db: A container database.
+ *
+ * Returns: the number of records in the database.
+ */
gulong dmap_container_db_count (DMAPContainerDb *db);
#endif /* __DMAP_CONTAINER_DB_H */
diff --git a/libdmapsharing/dmap-container-record.h b/libdmapsharing/dmap-container-record.h
index 71dd059..2ccd53e 100644
--- a/libdmapsharing/dmap-container-record.h
+++ b/libdmapsharing/dmap-container-record.h
@@ -26,11 +26,39 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_CONTAINER_RECORD:
+ *
+ * The type for #DMAPContainerRecord.
+ */
#define TYPE_DMAP_CONTAINER_RECORD (dmap_container_record_get_type ())
+/**
+ * DMAP_CONTAINER_RECORD:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPContainerRecord or derived pointer into a (DMAPContainerRecord*)
+ * pointer. Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_CONTAINER_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_CONTAINER_RECORD, DMAPContainerRecord))
+/**
+ * IS_DMAP_CONTAINER_RECORD:
+ * @o: Instance to check for being a %TYPE_DMAP_CONTAINER_RECORD.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type
+ * %TYPE_DMAP_CONTAINER_RECORD.
+ */
#define IS_DMAP_CONTAINER_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_CONTAINER_RECORD))
+/**
+ * DMAP_CONTAINER_RECORD_GET_INTERFACE:
+ * @o: a #DMAPContainerRecord instance.
+ *
+ * Get the class structure associated to a #DMAPContainerRecord instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DMAP_CONTAINER_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DMAP_CONTAINER_RECORD, DMAPContainerRecordInterface))
@@ -50,13 +78,42 @@ struct _DMAPContainerRecordInterface {
};
GType dmap_container_record_get_type (void);
+
+/**
+ * dmap_container_record_get_id:
+ * @record: A DMAPContainerRecord.
+ *
+ * Returns: the ID for the given record.
+ */
gint dmap_container_record_get_id (DMAPContainerRecord *record);
+
+/**
+ * dmap_container_record_add_entry:
+ * @container_record: A DMAPContainerRecord.
+ * @record: A DMAPRecord.
+ * @id: The record's ID.
+ *
+ * Add a record to the database. It is assumed that the record is placed
+ * directly into the database (not copied) and not freed.
+ */
void dmap_container_record_add_entry (DMAPContainerRecord *container_record,
DMAPRecord *record,
gint id);
+/**
+ * dmap_container_record_get_entry_count:
+ * @record: A DMAPContainerRecord.
+ *
+ * Returns: the number of records in the container record.
+ */
guint64 dmap_container_record_get_entry_count (DMAPContainerRecord *record);
+/**
+ * dmap_container_record_get_entries:
+ * @record: A DMAPContainerRecord.
+ *
+ * Returns: A pointer to a DMAPDb containing the entries contained in record.
+ */
const DMAPDb *dmap_container_record_get_entries (DMAPContainerRecord *record);
#endif /* __DMAP_CONTAINER_RECORD_H */
diff --git a/libdmapsharing/dmap-db.c b/libdmapsharing/dmap-db.c
index acfdc8b..f7544d8 100644
--- a/libdmapsharing/dmap-db.c
+++ b/libdmapsharing/dmap-db.c
@@ -108,7 +108,7 @@ unescape (const gchar *str)
}
gchar **
-dmap_db_strsplit_using_quotes (const gchar *str)
+_dmap_db_strsplit_using_quotes (const gchar *str)
{
/* What we are splitting looks something like this:
* 'foo'text to ignore'bar'.
@@ -181,7 +181,7 @@ apply_filter (gpointer id, DMAPRecord *record, gpointer data)
}
GHashTable *
-dmap_db_apply_filter (DMAPDb *db, GSList *filter_def)
+_dmap_db_apply_filter (DMAPDb *db, GSList *filter_def)
{
GHashTable *ht;
FilterData data;
diff --git a/libdmapsharing/dmap-db.h b/libdmapsharing/dmap-db.h
index 24985b9..98a89da 100644
--- a/libdmapsharing/dmap-db.h
+++ b/libdmapsharing/dmap-db.h
@@ -27,11 +27,38 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_DB:
+ *
+ * The type for #DMAPDb.
+ */
#define TYPE_DMAP_DB (dmap_db_get_type ())
+/**
+ * DMAP_DB:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPDb or derived pointer into a (DMAPDb *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_DB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_DB, DMAPDb))
+/**
+ * IS_DMAP_DB:
+ * @o: Instance to check for being a %TYPE_DMAP_DB.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DMAP_DB.
+ */
#define IS_DMAP_DB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_DB))
+/**
+ * DMAP_DB_GET_INTERFACE:
+ * @o: a #DMAPDb instance.
+ *
+ * Get the insterface structure associated to a #DMAPDb instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DMAP_DB_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DMAP_DB, DMAPDbInterface))
@@ -60,21 +87,56 @@ typedef struct FilterDefinition {
GType dmap_db_get_type (void);
+/**
+ * dmap_db_add:
+ * @db: A media database.
+ * @record: A database record.
+ *
+ * Add a record to the database.
+ *
+ * Returns: The ID for the newly added record. A reference to the record
+ * will be retained by the database (if required; an adapter-type
+ * implementation may not want to retain a reference as the record data may
+ * be placed elsewhere). In all cases, the record should be unrefed by the
+ * calling code.
+ */
gint dmap_db_add (DMAPDb *db, DMAPRecord *record);
+/**
+ * dmap_db_lookup_by_id:
+ * @db: A media database.
+ * @id: A record ID.
+ *
+ * Returns: the database record corresponding to @id. This record should
+ * be unrefed by the calling code when no longer required.
+ */
DMAPRecord *dmap_db_lookup_by_id (DMAPDb *db, guint id);
+/**
+ * dmap_db_foreach:
+ * @db: A media database.
+ * @fn: The function to apply to each record in the database.
+ * @data: User data to pass to the function.
+ *
+ * Apply a function to each record in a media database.
+ */
void dmap_db_foreach (const DMAPDb *db,
void (*fn) (gpointer id,
DMAPRecord *record,
gpointer data),
gpointer data);
+/**
+ * dmap_db_count:
+ * @db: A media database.
+ *
+ * Returns: the number of records in the database.
+ */
gulong dmap_db_count (const DMAPDb *db);
-gchar **dmap_db_strsplit_using_quotes (const gchar *str);
+gchar **_dmap_db_strsplit_using_quotes (const gchar *str);
-GHashTable *dmap_db_apply_filter (DMAPDb *db, GSList *filter_def);
+GHashTable *_dmap_db_apply_filter (DMAPDb *db, GSList *filter_def);
#endif /* __DMAP_DB_H */
diff --git a/libdmapsharing/dmap-mdns-browser-avahi.c b/libdmapsharing/dmap-mdns-browser-avahi.c
index 2aa3ea2..ebc80b4 100644
--- a/libdmapsharing/dmap-mdns-browser-avahi.c
+++ b/libdmapsharing/dmap-mdns-browser-avahi.c
@@ -494,12 +494,10 @@ browse_cb (AvahiServiceBrowser *service_browser,
#ifdef HAVE_AVAHI_0_6
local = ((flags & AVAHI_LOOKUP_RESULT_LOCAL) != 0);
#endif
- /* FIXME:
if (local) {
g_debug ("Ignoring local service %s", name);
return;
}
- */
if (event == AVAHI_BROWSER_NEW) {
browser_add_service (browser, name, domain);
diff --git a/libdmapsharing/dmap-record-factory.h b/libdmapsharing/dmap-record-factory.h
index 7b2d561..dfff16a 100644
--- a/libdmapsharing/dmap-record-factory.h
+++ b/libdmapsharing/dmap-record-factory.h
@@ -27,11 +27,39 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_RECORD_FACTORY:
+ *
+ * The type for #DMAPRecordFactory.
+ */
#define TYPE_DMAP_RECORD_FACTORY (dmap_record_factory_get_type ())
+/**
+ * DMAP_RECORD_FACTORY:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPRecordFactory or derived pointer into a (DMAPRecordFactory *)
+ * pointer. Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_RECORD_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_RECORD_FACTORY, DMAPRecordFactory))
+/**
+ * IS_DMAP_RECORD_FACTORY:
+ * @o: Instance to check for being a %TYPE_DMAP_RECORD_FACTORY.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type
+ * %TYPE_DMAP_RECORD_FACTORY.
+ */
#define IS_DMAP_RECORD_FACTORY(o)(G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_RECORD_FACTORY))
+/**
+ * DMAP_RECORD_FACTORY_GET_INTERFACE:
+ * @o: a #DMAPRecordFactory instance.
+ *
+ * Get the interface structure associated to a #DMAPRecordFactory instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DMAP_RECORD_FACTORY_GET_INTERFACE(o) \
(G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DMAP_RECORD_FACTORY, \
@@ -48,6 +76,13 @@ struct _DMAPRecordFactoryInterface {
GType dmap_record_factory_get_type (void);
+/**
+ * dmap_record_factory_create:
+ * @factory: A DMAPRecordFactory.
+ * @path: A file path.
+ *
+ * Returns: a new DMAPRecord as read from path.
+ */
DMAPRecord *dmap_record_factory_create (DMAPRecordFactory *factory, const char *path);
#endif /* __DMAP_RECORD_FACTORY_H */
diff --git a/libdmapsharing/dmap-record.h b/libdmapsharing/dmap-record.h
index c86dcb2..4b0fa2b 100644
--- a/libdmapsharing/dmap-record.h
+++ b/libdmapsharing/dmap-record.h
@@ -25,11 +25,38 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_RECORD:
+ *
+ * The type for #DMAPRecord.
+ */
#define TYPE_DMAP_RECORD (dmap_record_get_type ())
+/**
+ * DMAP_RECORD:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPRecord or derived pointer into a (DMAPRecord *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_RECORD, DMAPRecord))
+/**
+ * IS_DMAP_RECORD:
+ * @o: Instance to check for being a %TYPE_DMAP_RECORD.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DMAP_RECORD.
+ */
#define IS_DMAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_RECORD))
+/**
+ * DAAP_RECORD_GET_INTERFACE:
+ * @o: a #DAAPRecord instance.
+ *
+ * Get the class structure associated to a #DAAPRecord instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DMAP_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DMAP_RECORD, DMAPRecordInterface))
diff --git a/libdmapsharing/dmap-share.c b/libdmapsharing/dmap-share.c
index 7f1067e..c004abe 100644
--- a/libdmapsharing/dmap-share.c
+++ b/libdmapsharing/dmap-share.c
@@ -84,7 +84,7 @@ G_DEFINE_ABSTRACT_TYPE (DMAPShare, dmap_share, G_TYPE_OBJECT)
TYPE_DMAP_SHARE, DMAPSharePrivate))
static gboolean
-dmap_share_soup_auth_callback (SoupAuthDomain *auth_domain,
+_dmap_share_soup_auth_callback (SoupAuthDomain *auth_domain,
SoupMessage *msg,
const char *username,
gpointer password,
@@ -193,7 +193,7 @@ static void databases_adapter (SoupServer *server,
}
gboolean
-dmap_share_server_start (DMAPShare *share)
+_dmap_share_server_start (DMAPShare *share)
{
guint port = DMAP_SHARE_GET_CLASS (share)->get_desired_port (share);
gboolean password_required;
@@ -221,10 +221,10 @@ dmap_share_server_start (DMAPShare *share)
SOUP_AUTH_DOMAIN_ADD_PATH, "/login",
SOUP_AUTH_DOMAIN_ADD_PATH, "/update",
SOUP_AUTH_DOMAIN_ADD_PATH, "/database",
- SOUP_AUTH_DOMAIN_FILTER, dmap_share_soup_auth_filter,
+ SOUP_AUTH_DOMAIN_FILTER, _dmap_share_soup_auth_filter,
NULL);
soup_auth_domain_basic_set_auth_callback (auth_domain,
- (SoupAuthDomainBasicAuthCallback) dmap_share_soup_auth_callback,
+ (SoupAuthDomainBasicAuthCallback) _dmap_share_soup_auth_callback,
g_object_ref (share),
g_object_unref);
soup_server_add_auth_domain (share->priv->server, auth_domain);
@@ -259,7 +259,7 @@ dmap_share_server_start (DMAPShare *share)
}
static gboolean
-dmap_share_server_stop (DMAPShare *share)
+_dmap_share_server_stop (DMAPShare *share)
{
g_warning ("Stopping music sharing server on port %d", share->priv->port);
@@ -280,7 +280,7 @@ dmap_share_server_stop (DMAPShare *share)
}
gboolean
-dmap_share_publish_start (DMAPShare *share)
+_dmap_share_publish_start (DMAPShare *share)
{
gchar *nameprop;
GError *error;
@@ -318,7 +318,7 @@ dmap_share_publish_start (DMAPShare *share)
}
static gboolean
-dmap_share_publish_stop (DMAPShare *share)
+_dmap_share_publish_stop (DMAPShare *share)
{
if (share->priv->publisher) {
gboolean res;
@@ -337,30 +337,30 @@ dmap_share_publish_stop (DMAPShare *share)
}
static void
-dmap_share_restart (DMAPShare *share)
+_dmap_share_restart (DMAPShare *share)
{
gboolean res;
- dmap_share_server_stop (share);
- res = dmap_share_server_start (share);
+ _dmap_share_server_stop (share);
+ res = _dmap_share_server_start (share);
if (res) {
/* To update information just publish again */
- dmap_share_publish_start (share);
+ _dmap_share_publish_start (share);
} else {
- dmap_share_publish_stop (share);
+ _dmap_share_publish_stop (share);
}
}
static void
-dmap_share_maybe_restart (DMAPShare *share)
+_dmap_share_maybe_restart (DMAPShare *share)
{
if (share->priv->published) {
- dmap_share_restart (share);
+ _dmap_share_restart (share);
}
}
static void
-dmap_share_set_name (DMAPShare *share, const char *name)
+_dmap_share_set_name (DMAPShare *share, const char *name)
{
GError *error;
gboolean res;
@@ -382,7 +382,7 @@ dmap_share_set_name (DMAPShare *share, const char *name)
}
static void
-dmap_share_set_password (DMAPShare *share, const char *password)
+_dmap_share_set_password (DMAPShare *share, const char *password)
{
g_return_if_fail (share != NULL);
@@ -399,11 +399,11 @@ dmap_share_set_password (DMAPShare *share, const char *password)
share->priv->auth_method = DMAP_SHARE_AUTH_METHOD_NONE;
}
- dmap_share_maybe_restart (share);
+ _dmap_share_maybe_restart (share);
}
static void
-dmap_share_set_property (GObject *object,
+_dmap_share_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
@@ -412,10 +412,10 @@ dmap_share_set_property (GObject *object,
switch (prop_id) {
case PROP_NAME:
- dmap_share_set_name (share, g_value_get_string (value));
+ _dmap_share_set_name (share, g_value_get_string (value));
break;
case PROP_PASSWORD:
- dmap_share_set_password (share, g_value_get_string (value));
+ _dmap_share_set_password (share, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -424,7 +424,7 @@ dmap_share_set_property (GObject *object,
}
static void
-dmap_share_get_property (GObject *object,
+_dmap_share_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
@@ -440,12 +440,12 @@ dmap_share_get_property (GObject *object,
break;
case PROP_REVISION_NUMBER:
g_value_set_uint (value,
- dmap_share_get_revision_number
+ _dmap_share_get_revision_number
(DMAP_SHARE (object)));
break;
case PROP_AUTH_METHOD:
g_value_set_uint (value,
- dmap_share_get_auth_method
+ _dmap_share_get_auth_method
(DMAP_SHARE (object)));
break;
default:
@@ -455,16 +455,16 @@ dmap_share_get_property (GObject *object,
}
static void
-dmap_share_dispose (GObject *object)
+_dmap_share_dispose (GObject *object)
{
DMAPShare *share = DMAP_SHARE (object);
if (share->priv->published) {
- dmap_share_publish_stop (share);
+ _dmap_share_publish_stop (share);
}
if (share->priv->server_active) {
- dmap_share_server_stop (share);
+ _dmap_share_server_stop (share);
}
g_free (share->priv->name);
@@ -481,24 +481,24 @@ dmap_share_class_init (DMAPShareClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = dmap_share_get_property;
- object_class->set_property = dmap_share_set_property;
- object_class->dispose = dmap_share_dispose;
+ object_class->get_property = _dmap_share_get_property;
+ object_class->set_property = _dmap_share_set_property;
+ object_class->dispose = _dmap_share_dispose;
/* Pure virtual methods: */
klass->get_desired_port = NULL;
klass->get_type_of_service = NULL;
klass->message_add_standard_headers = NULL;
klass->server_info = NULL;
- klass->content_codes = dmap_share_content_codes;
- klass->login = dmap_share_login;
- klass->logout = dmap_share_logout;
- klass->update = dmap_share_update;
+ klass->content_codes = _dmap_share_content_codes;
+ klass->login = _dmap_share_login;
+ klass->logout = _dmap_share_logout;
+ klass->update = _dmap_share_update;
klass->databases = NULL;
/* Virtual methods: */
- klass->published = dmap_share_published;
- klass->name_collision = dmap_share_name_collision;
+ klass->published = _dmap_share_published;
+ klass->name_collision = _dmap_share_name_collision;
g_object_class_install_property (object_class,
PROP_NAME,
@@ -573,13 +573,13 @@ dmap_share_init (DMAPShare *share)
}
guint
-dmap_share_get_auth_method (DMAPShare *share)
+_dmap_share_get_auth_method (DMAPShare *share)
{
return share->priv->auth_method;
}
guint
-dmap_share_get_revision_number (DMAPShare *share)
+_dmap_share_get_revision_number (DMAPShare *share)
{
return share->priv->revision_number;
}
@@ -607,7 +607,7 @@ get_session_id (GHashTable *query,
}
gboolean
-dmap_share_get_revision_number_from_query (GHashTable *query,
+_dmap_share_get_revision_number_from_query (GHashTable *query,
guint *number)
{
char *revision_number_str;
@@ -627,7 +627,7 @@ dmap_share_get_revision_number_from_query (GHashTable *query,
}
gboolean
-dmap_share_session_id_validate (DMAPShare *share,
+_dmap_share_session_id_validate (DMAPShare *share,
SoupClientContext *context,
SoupMessage *message,
GHashTable *query,
@@ -684,7 +684,7 @@ session_id_generate (DMAPShare *share,
}
guint32
-dmap_share_session_id_create (DMAPShare *share,
+_dmap_share_session_id_create (DMAPShare *share,
SoupClientContext *context)
{
guint32 id;
@@ -710,7 +710,7 @@ dmap_share_session_id_create (DMAPShare *share,
}
void
-dmap_share_session_id_remove (DMAPShare *share,
+_dmap_share_session_id_remove (DMAPShare *share,
SoupClientContext *context,
guint32 id)
{
@@ -718,7 +718,7 @@ dmap_share_session_id_remove (DMAPShare *share,
}
void
-dmap_share_message_set_from_dmap_structure (DMAPShare *share,
+_dmap_share_message_set_from_dmap_structure (DMAPShare *share,
SoupMessage *message,
GNode *structure)
{
@@ -742,20 +742,20 @@ dmap_share_message_set_from_dmap_structure (DMAPShare *share,
gboolean
-dmap_share_client_requested (bitwise bits,
+_dmap_share_client_requested (bitwise bits,
gint field)
{
return 0 != (bits & (((bitwise) 1) << field));
}
gboolean
-dmap_share_uri_is_local (const char *text_uri)
+_dmap_share_uri_is_local (const char *text_uri)
{
return g_str_has_prefix (text_uri, "file://");
}
gboolean
-dmap_share_soup_auth_filter (SoupAuthDomain *auth_domain,
+_dmap_share_soup_auth_filter (SoupAuthDomain *auth_domain,
SoupMessage *msg,
gpointer user_data)
{
@@ -776,7 +776,7 @@ dmap_share_soup_auth_filter (SoupAuthDomain *auth_domain,
}
void
-dmap_share_published (DMAPShare *share,
+_dmap_share_published (DMAPShare *share,
DmapMdnsPublisher *publisher,
const char *name)
{
@@ -798,7 +798,7 @@ dmap_share_published (DMAPShare *share,
}
void
-dmap_share_name_collision (DMAPShare *share,
+_dmap_share_name_collision (DMAPShare *share,
DmapMdnsPublisher *publisher,
const char *name)
{
@@ -815,7 +815,7 @@ dmap_share_name_collision (DMAPShare *share,
if (strcmp (nameprop, name) == 0) {
g_warning ("Duplicate share name on mDNS");
- dmap_share_set_name (DMAP_SHARE(share), new_name);
+ _dmap_share_set_name (DMAP_SHARE(share), new_name);
g_free (new_name);
}
@@ -825,7 +825,7 @@ dmap_share_name_collision (DMAPShare *share,
}
void
-dmap_share_content_codes (DMAPShare *share,
+_dmap_share_content_codes (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
@@ -862,12 +862,12 @@ dmap_share_content_codes (DMAPShare *share,
dmap_structure_add (mdcl, DMAP_CC_MCTY, (gint32) defs[i].type);
}
- dmap_share_message_set_from_dmap_structure (share, message, mccr);
+ _dmap_share_message_set_from_dmap_structure (share, message, mccr);
dmap_structure_destroy (mccr);
}
void
-dmap_share_login (DMAPShare *share,
+_dmap_share_login (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
@@ -883,18 +883,18 @@ dmap_share_login (DMAPShare *share,
g_debug ("Path is %s.", path);
- session_id = dmap_share_session_id_create (share, context);
+ session_id = _dmap_share_session_id_create (share, context);
mlog = dmap_structure_add (NULL, DMAP_CC_MLOG);
dmap_structure_add (mlog, DMAP_CC_MSTT, (gint32) DMAP_STATUS_OK);
dmap_structure_add (mlog, DMAP_CC_MLID, session_id);
- dmap_share_message_set_from_dmap_structure (share, message, mlog);
+ _dmap_share_message_set_from_dmap_structure (share, message, mlog);
dmap_structure_destroy (mlog);
}
void
-dmap_share_logout (DMAPShare *share,
+_dmap_share_logout (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
@@ -906,8 +906,8 @@ dmap_share_logout (DMAPShare *share,
g_debug ("Path is %s.", path);
- if (dmap_share_session_id_validate (share, context, message, query, &id)) {
- dmap_share_session_id_remove (share, context, id);
+ if (_dmap_share_session_id_validate (share, context, message, query, &id)) {
+ _dmap_share_session_id_remove (share, context, id);
status = SOUP_STATUS_NO_CONTENT;
} else {
@@ -918,7 +918,7 @@ dmap_share_logout (DMAPShare *share,
}
void
-dmap_share_update (DMAPShare *share,
+_dmap_share_update (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
@@ -930,9 +930,9 @@ dmap_share_update (DMAPShare *share,
g_debug ("Path is %s.", path);
- res = dmap_share_get_revision_number_from_query (query, &revision_number);
+ res = _dmap_share_get_revision_number_from_query (query, &revision_number);
- if (res && revision_number != dmap_share_get_revision_number (share)) {
+ if (res && revision_number != _dmap_share_get_revision_number (share)) {
/* MUPD update response
* MSTT status
* MUSR server revision
@@ -941,9 +941,9 @@ dmap_share_update (DMAPShare *share,
mupd = dmap_structure_add (NULL, DMAP_CC_MUPD);
dmap_structure_add (mupd, DMAP_CC_MSTT, (gint32) DMAP_STATUS_OK);
- dmap_structure_add (mupd, DMAP_CC_MUSR, (gint32) dmap_share_get_revision_number (share));
+ dmap_structure_add (mupd, DMAP_CC_MUSR, (gint32) _dmap_share_get_revision_number (share));
- dmap_share_message_set_from_dmap_structure (share, message, mupd);
+ _dmap_share_message_set_from_dmap_structure (share, message, mupd);
dmap_structure_destroy (mupd);
} else {
/* FIXME: This seems like a bug. It just leaks the
@@ -955,7 +955,7 @@ dmap_share_update (DMAPShare *share,
}
bitwise
-dmap_share_parse_meta_str (const char *attrs, struct DMAPMetaDataMap *mdm, guint mdmlen)
+_dmap_share_parse_meta_str (const char *attrs, struct DMAPMetaDataMap *mdm, guint mdmlen)
{
guint i;
bitwise bits = 0;
@@ -984,7 +984,7 @@ dmap_share_parse_meta_str (const char *attrs, struct DMAPMetaDataMap *mdm, guint
}
bitwise
-dmap_share_parse_meta (GHashTable *query, struct DMAPMetaDataMap *mdm, guint mdmlen)
+_dmap_share_parse_meta (GHashTable *query, struct DMAPMetaDataMap *mdm, guint mdmlen)
{
const gchar *attrs;
@@ -992,11 +992,11 @@ dmap_share_parse_meta (GHashTable *query, struct DMAPMetaDataMap *mdm, guint mdm
if (attrs == NULL) {
return 0;
}
- return dmap_share_parse_meta_str (attrs, mdm, mdmlen);
+ return _dmap_share_parse_meta_str (attrs, mdm, mdmlen);
}
void
-dmap_share_add_playlist_to_mlcl (DMAPContainerRecord *record, gpointer mlcl)
+_dmap_share_add_playlist_to_mlcl (DMAPContainerRecord *record, gpointer mlcl)
{
/* MLIT listing item
* MIID item id
diff --git a/libdmapsharing/dmap-share.h b/libdmapsharing/dmap-share.h
index e7e3104..f08c639 100644
--- a/libdmapsharing/dmap-share.h
+++ b/libdmapsharing/dmap-share.h
@@ -38,15 +38,56 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DMAP_SHARE:
+ *
+ * The type for #DMAPShare.
+ */
#define TYPE_DMAP_SHARE (dmap_share_get_type ())
+/**
+ * DMAP_SHARE:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DMAPShare or derived pointer into a (DMAPShare*) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DMAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DMAP_SHARE, DMAPShare))
+/**
+ * DMAP_SHARE_CLASS:
+ * @k: a valid #DMAPShareClass
+ *
+ * Casts a derived #DMAPShareClass structure into a #DMAPShareClass structure.
+ */
#define DMAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_DMAP_SHARE, DMAPShareClass))
+/**
+ * IS_DMAP_SHARE:
+ * @o: Instance to check for being a %TYPE_DMAP_SHARE.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DMAP_SHARE.
+ */
+
#define IS_DMAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DMAP_SHARE))
+/**
+ * IS_DMAP_SHARE_CLASS:
+ * @k: a #DMAPShareClass
+ *
+ * Checks whether @k "is a" valid #DMAPShareClass structure of type
+ * %DMAP_SHARE or derived.
+ */
#define IS_DMAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
TYPE_DMAP_SHARE))
+/**
+ * DMAP_SHARE_GET_CLASS:
+ * @o: a #DMAPShare instance.
+ *
+ * Get the class structure associated to a #DMAPShare instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DMAP_SHARE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
TYPE_DMAP_SHARE, DMAPShareClass))
@@ -110,74 +151,74 @@ struct DMAPMetaDataMap {
GType dmap_share_get_type (void);
/* Non-virtual methods */
-guint dmap_share_get_auth_method (DMAPShare *share);
+guint _dmap_share_get_auth_method (DMAPShare *share);
-guint dmap_share_get_revision_number (DMAPShare *share);
+guint _dmap_share_get_revision_number (DMAPShare *share);
-gboolean dmap_share_get_revision_number_from_query (GHashTable *query,
+gboolean _dmap_share_get_revision_number_from_query (GHashTable *query,
guint *number);
-gboolean dmap_share_session_id_validate (DMAPShare *share,
+gboolean _dmap_share_session_id_validate (DMAPShare *share,
SoupClientContext *context,
SoupMessage *msg, GHashTable *query,
guint32 *id);
-guint32 dmap_share_session_id_create (DMAPShare *share,
+guint32 _dmap_share_session_id_create (DMAPShare *share,
SoupClientContext *ctx);
-void dmap_share_session_id_remove (DMAPShare *share,
+void _dmap_share_session_id_remove (DMAPShare *share,
SoupClientContext *ctx,
guint32 id);
-gboolean dmap_share_client_requested (bitwise bits, gint field);
+gboolean _dmap_share_client_requested (bitwise bits, gint field);
-gboolean dmap_share_uri_is_local (const char *text_uri);
+gboolean _dmap_share_uri_is_local (const char *text_uri);
-gboolean dmap_share_soup_auth_filter (SoupAuthDomain *auth_domain,
+gboolean _dmap_share_soup_auth_filter (SoupAuthDomain *auth_domain,
SoupMessage *msg, gpointer user_data);
-gboolean dmap_share_server_start (DMAPShare *share);
+gboolean _dmap_share_server_start (DMAPShare *share);
-gboolean dmap_share_publish_start (DMAPShare *share);
+gboolean _dmap_share_publish_start (DMAPShare *share);
-void dmap_share_message_set_from_dmap_structure (DMAPShare *share,
+void _dmap_share_message_set_from_dmap_structure (DMAPShare *share,
SoupMessage *message,
GNode *structure);
-bitwise dmap_share_parse_meta (GHashTable *query,
+bitwise _dmap_share_parse_meta (GHashTable *query,
struct DMAPMetaDataMap *mdm,
guint mdmlen);
-bitwise dmap_share_parse_meta_str (const char *attrs,
+bitwise _dmap_share_parse_meta_str (const char *attrs,
struct DMAPMetaDataMap *mdm,
guint mdmlen);
-void dmap_share_add_playlist_to_mlcl (DMAPContainerRecord *record,
+void _dmap_share_add_playlist_to_mlcl (DMAPContainerRecord *record,
gpointer mlcl);
/* Virtual methods (libsoup callbacks with default implementation): */
-void dmap_share_content_codes (DMAPShare *share,
+void _dmap_share_content_codes (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
GHashTable *query,
SoupClientContext *context);
-void dmap_share_login (DMAPShare *share,
+void _dmap_share_login (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
GHashTable *query,
SoupClientContext *context);
-void dmap_share_logout (DMAPShare *share,
+void _dmap_share_logout (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
GHashTable *query,
SoupClientContext *context);
-void dmap_share_update (DMAPShare *share,
+void _dmap_share_update (DMAPShare *share,
SoupServer *server,
SoupMessage *message,
const char *path,
@@ -186,11 +227,11 @@ void dmap_share_update (DMAPShare *share,
/* Virtual methods: MDNS callbacks */
-void dmap_share_published (DMAPShare *share,
+void _dmap_share_published (DMAPShare *share,
DmapMdnsPublisher *publisher,
const char *name);
-void dmap_share_name_collision(DMAPShare *share,
+void _dmap_share_name_collision(DMAPShare *share,
DmapMdnsPublisher *publisher,
const char *name);
diff --git a/libdmapsharing/dmap.h b/libdmapsharing/dmap.h
index d98b1e2..4d445e5 100644
--- a/libdmapsharing/dmap.h
+++ b/libdmapsharing/dmap.h
@@ -4,19 +4,14 @@
#include <libdmapsharing/daap-connection.h>
#include <libdmapsharing/daap-record.h>
#include <libdmapsharing/daap-share.h>
-#include <libdmapsharing/dmap-config.h>
#include <libdmapsharing/dmap-connection.h>
#include <libdmapsharing/dmap-container-db.h>
#include <libdmapsharing/dmap-container-record.h>
#include <libdmapsharing/dmap-db.h>
-#include <libdmapsharing/dmap-md5.h>
#include <libdmapsharing/dmap-mdns-browser.h>
-#include <libdmapsharing/dmap-mdns-publisher.h>
#include <libdmapsharing/dmap-record.h>
#include <libdmapsharing/dmap-record-factory.h>
#include <libdmapsharing/dmap-share.h>
-#include <libdmapsharing/dmap-structure.h>
-#include <libdmapsharing/dmap-utils.h>
#include <libdmapsharing/dpap-connection.h>
#include <libdmapsharing/dpap-record.h>
#include <libdmapsharing/dpap-share.h>
diff --git a/libdmapsharing/dpap-connection.h b/libdmapsharing/dpap-connection.h
index e0d9eca..b86019c 100644
--- a/libdmapsharing/dpap-connection.h
+++ b/libdmapsharing/dpap-connection.h
@@ -28,11 +28,52 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DPAP_CONNECTION:
+ *
+ * The type for #DPAPConnection.
+ */
#define TYPE_DPAP_CONNECTION (dpap_connection_get_type ())
+/**
+ * DPAP_CONNECTION:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DPAPConnection or derived pointer into a (DPAPConnection*) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DPAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DPAP_CONNECTION, DPAPConnection))
+/**
+ * DPAP_CONNECTION_CLASS:
+ * @k: a valid #DPAPConnectionClass
+ *
+ * Casts a derived #DPAPConnectionClass structure into a #DPAPConnectionClass
+ * structure.
+ */
#define DPAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_DPAP_CONNECTION, DPAPConnectionClass))
+/**
+ * IS_DPAP_CONNECTION:
+ * @o: Instance to check for being a %TYPE_DPAP_CONNECTION.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DPAP_CONNECTION.
+ */
#define IS_DPAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DPAP_CONNECTION))
+/**
+ * IS_DPAP_CONNECTION_CLASS:
+ * @k: a #DPAPConnectionClass
+ *
+ * Checks whether @k "is a" valid #DPAPConnectionClass structure of type
+ * %DPAP_CONNECTION_CLASS or derived.
+ */
#define IS_DPAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DPAP_CONNECTION))
+/**
+ * DPAP_CONNECTION_GET_CLASS:
+ * @o: a #DPAPConnection instance.
+ *
+ * Get the class structure associated to a #DPAPConnection instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DPAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DPAP_CONNECTION, DPAPConnectionClass))
typedef struct _DPAPConnection DPAPConnection;
diff --git a/libdmapsharing/dpap-record.c b/libdmapsharing/dpap-record.c
index 00f6c7a..fe22d9a 100644
--- a/libdmapsharing/dpap-record.c
+++ b/libdmapsharing/dpap-record.c
@@ -161,7 +161,7 @@ dpap_record_get_type (void)
}
GInputStream *
-dpap_record_read (DPAPRecord *record, gchar *transcode_mimetype, GError **err)
+dpap_record_read (DPAPRecord *record, GError **err)
{
- return DPAP_RECORD_GET_INTERFACE (record)->read (record, transcode_mimetype, err);
+ return DPAP_RECORD_GET_INTERFACE (record)->read (record, err);
}
diff --git a/libdmapsharing/dpap-record.h b/libdmapsharing/dpap-record.h
index 67f3a2f..0cdd11c 100644
--- a/libdmapsharing/dpap-record.h
+++ b/libdmapsharing/dpap-record.h
@@ -28,11 +28,38 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DPAP_RECORD:
+ *
+ * The type for #DPAPRecord.
+ */
#define TYPE_DPAP_RECORD (dpap_record_get_type ())
+/**
+ * DPAP_RECORD:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DPAPRecord or derived pointer into a (DPAPRecord *) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DPAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DPAP_RECORD, DPAPRecord))
+/**
+ * IS_DPAP_RECORD:
+ * @o: Instance to check for being a %TYPE_DPAP_RECORD.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DPAP_RECORD.
+ */
#define IS_DPAP_RECORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DPAP_RECORD))
+/**
+ * DPAP_RECORD_GET_INTERFACE:
+ * @o: a #DPAPRecord instance.
+ *
+ * Get the class structure associated to a #DPAPRecord instance.
+ *
+ * Returns: pointer to object interface structure.
+ */
#define DPAP_RECORD_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \
TYPE_DPAP_RECORD, DPAPRecordInterface))
@@ -42,11 +69,20 @@ typedef struct _DPAPRecordInterface DPAPRecordInterface;
struct _DPAPRecordInterface {
GTypeInterface parent;
- GInputStream * (*read) (DPAPRecord *record, gchar *transcode_mimetype, GError **err);
+ GInputStream * (*read) (DPAPRecord *record, GError **err);
};
GType dpap_record_get_type (void);
-GInputStream *dpap_record_read (DPAPRecord *record, gchar *transcode_mimetype, GError **err);
+
+/**
+ * dpap_record_read:
+ * @record: a DPAPRecord.
+ * @err: a GError.
+ *
+ * Returns: A GInputStream that provides read-only access to the data stream
+ * associated with record.
+ */
+GInputStream *dpap_record_read (DPAPRecord *record, GError **err);
#endif /* __DPAP_RECORD_H */
diff --git a/libdmapsharing/dpap-share.c b/libdmapsharing/dpap-share.c
index 89e8284..310881a 100644
--- a/libdmapsharing/dpap-share.c
+++ b/libdmapsharing/dpap-share.c
@@ -208,8 +208,8 @@ dpap_share_new (const char *name,
"container-db", container_db,
NULL));
- dmap_share_server_start (DMAP_SHARE (share));
- dmap_share_publish_start (DMAP_SHARE (share));
+ _dmap_share_server_start (DMAP_SHARE (share));
+ _dmap_share_publish_start (DMAP_SHARE (share));
return share;
}
@@ -276,7 +276,7 @@ dpap_share_server_info (DMAPShare *share,
dmap_structure_add (msrv, DMAP_CC_MPRO, (gdouble) DMAP_VERSION);
dmap_structure_add (msrv, DMAP_CC_PPRO, (gdouble) DPAP_VERSION);
dmap_structure_add (msrv, DMAP_CC_MINM, nameprop);
- /*dmap_structure_add (msrv, DMAP_CC_MSAU, dmap_share_get_auth_method (share));*/
+ /*dmap_structure_add (msrv, DMAP_CC_MSAU, _dmap_share_get_auth_method (share));*/
/* authentication method
* 0 is nothing
* 1 is name & password
@@ -294,7 +294,7 @@ dpap_share_server_info (DMAPShare *share,
/* dmap_structure_add (msrv, DMAP_CC_MSRS, (gchar) 0); */
dmap_structure_add (msrv, DMAP_CC_MSDC, (gint32) 1);
- dmap_share_message_set_from_dmap_structure (share, message, msrv);
+ _dmap_share_message_set_from_dmap_structure (share, message, msrv);
dmap_structure_destroy (msrv);
g_free (nameprop);
@@ -379,69 +379,69 @@ add_entry_to_mlcl (gpointer id, DMAPRecord *record, gpointer _mb)
mlit = dmap_structure_add (mb->mlcl, DMAP_CC_MLIT);
- if (dmap_share_client_requested (mb->bits, ITEM_KIND))
+ if (_dmap_share_client_requested (mb->bits, ITEM_KIND))
dmap_structure_add (mlit, DMAP_CC_MIKD, (gchar) DPAP_ITEM_KIND_PHOTO);
- if (dmap_share_client_requested (mb->bits, ITEM_ID))
+ if (_dmap_share_client_requested (mb->bits, ITEM_ID))
dmap_structure_add (mlit, DMAP_CC_MIID, (gint32) GPOINTER_TO_UINT (id));
- if (dmap_share_client_requested (mb->bits, ITEM_NAME)) {
+ if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) {
gchar *filename;
g_object_get (record, "filename", &filename, NULL);
dmap_structure_add (mlit, DMAP_CC_MINM, filename);
}
- if (dmap_share_client_requested (mb->bits, PERSISTENT_ID))
+ if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID))
dmap_structure_add (mlit, DMAP_CC_MPER, (gint64) GPOINTER_TO_UINT (id));
/* dpap-sharp claims iPhoto '08 will not show thumbnails without PASP: */
g_object_get (record, "aspect-ratio", &aspect_ratio, NULL);
dmap_structure_add (mlit, DMAP_CC_PASP, aspect_ratio);
- if (dmap_share_client_requested (mb->bits, PHOTO_CREATIONDATE)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_CREATIONDATE)) {
gint creation_date;
g_object_get (record, "creation-date", &creation_date, NULL);
dmap_structure_add (mlit, DMAP_CC_PICD, creation_date);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILENAME)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILENAME)) {
gchar *filename;
g_object_get (record, "filename", &filename, NULL);
dmap_structure_add (mlit, DMAP_CC_PIMF, filename);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFORMAT)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFORMAT)) {
gchar *format;
g_object_get (record, "format", &format, NULL);
dmap_structure_add (mlit, DMAP_CC_PFMT, format);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILESIZE)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILESIZE)) {
gint filesize;
g_object_get (record, "filesize", &filesize, NULL);
dmap_structure_add (mlit, DMAP_CC_PIFS, filesize);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGELARGEFILESIZE)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGELARGEFILESIZE)) {
gint large_filesize;
g_object_get (record, "large-filesize", &large_filesize, NULL);
dmap_structure_add (mlit, DMAP_CC_PLSZ, large_filesize);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELHEIGHT)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELHEIGHT)) {
gint pixel_height;
g_object_get (record, "pixel-height", &pixel_height, NULL);
dmap_structure_add (mlit, DMAP_CC_PHGT, pixel_height);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELWIDTH)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELWIDTH)) {
gint pixel_width;
g_object_get (record, "pixel-width", &pixel_width, NULL);
dmap_structure_add (mlit, DMAP_CC_PWTH, pixel_width);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGERATING)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGERATING)) {
gint rating;
g_object_get (record, "rating", &rating, NULL);
dmap_structure_add (mlit, DMAP_CC_PRAT, rating);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_IMAGECOMMENTS)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGECOMMENTS)) {
gchar *comments;
g_object_get (record, "comments", &comments, NULL);
dmap_structure_add (mlit, DMAP_CC_PCMT, comments);
}
- if (dmap_share_client_requested (mb->bits, PHOTO_FILEDATA)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_FILEDATA)) {
size_t size = 0;
unsigned char *data = NULL;
- if (dmap_share_client_requested (mb->bits, PHOTO_THUMB)) {
+ if (_dmap_share_client_requested (mb->bits, PHOTO_THUMB)) {
g_object_get (record, "thumbnail", &data, NULL);
g_object_get (record, "filesize", &size, NULL);
} else {
@@ -500,7 +500,7 @@ build_filter (gchar *filterstr)
GSList *filter = NULL;
gchar **t2;
- t2 = dmap_db_strsplit_using_quotes (t1[i]);
+ t2 = _dmap_db_strsplit_using_quotes (t1[i]);
for (j = 0; t2[j]; j++) {
FilterDefinition *def;
@@ -553,7 +553,7 @@ dpap_share_databases (DMAPShare *share,
g_debug ("Path is %s.", path);
g_hash_table_foreach (query, debug_param, NULL);
- if (! dmap_share_session_id_validate (share, context, message, query, NULL)) {
+ if (! _dmap_share_session_id_validate (share, context, message, query, NULL)) {
soup_message_set_status (message, SOUP_STATUS_FORBIDDEN);
return;
}
@@ -594,7 +594,7 @@ dpap_share_databases (DMAPShare *share,
dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DPAP_SHARE (share)->priv->db));
dmap_structure_add (mlit, DMAP_CC_MCTC, (gint32) 1);
- dmap_share_message_set_from_dmap_structure (share, message, avdb);
+ _dmap_share_message_set_from_dmap_structure (share, message, avdb);
dmap_structure_destroy (avdb);
g_free (nameprop);
@@ -615,7 +615,7 @@ dpap_share_databases (DMAPShare *share,
gint32 num_songs = dmap_db_count (DPAP_SHARE (share)->priv->db);
struct MLCL_Bits mb = {NULL,0};
- mb.bits = dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
+ mb.bits = _dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
adbs = dmap_structure_add (NULL, DMAP_CC_ADBS);
dmap_structure_add (adbs, DMAP_CC_MSTT, (gint32) DPAP_STATUS_OK);
@@ -632,14 +632,14 @@ dpap_share_databases (DMAPShare *share,
/* FIXME: fix memory leaks (DAAP too): */
filter_def = build_filter (record_query);
- records = dmap_db_apply_filter (DMAP_DB (DPAP_SHARE (share)->priv->db), filter_def);
+ records = _dmap_db_apply_filter (DMAP_DB (DPAP_SHARE (share)->priv->db), filter_def);
g_hash_table_foreach (records, (GHFunc) add_entry_to_mlcl, &mb);
/* FIXME: need to free hash table keys but not records */
} else {
g_warning ("Missing query parameter");
}
- dmap_share_message_set_from_dmap_structure (share, message, adbs);
+ _dmap_share_message_set_from_dmap_structure (share, message, adbs);
dmap_structure_destroy (adbs);
adbs = NULL;
} else if (g_ascii_strcasecmp ("/1/containers", rest_of_path) == 0) {
@@ -679,9 +679,9 @@ dpap_share_databases (DMAPShare *share,
dmap_structure_add (mlit, DMAP_CC_MIMC, dmap_db_count (DPAP_SHARE (share)->priv->db));
dmap_structure_add (mlit, DMAP_CC_ABPL, (gchar) 1); /* base album (AKA playlist) */
- dmap_container_db_foreach (DPAP_SHARE (share)->priv->container_db, dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
+ dmap_container_db_foreach (DPAP_SHARE (share)->priv->container_db, _dmap_share_add_playlist_to_mlcl, (gpointer) mlcl);
- dmap_share_message_set_from_dmap_structure (share, message, aply);
+ _dmap_share_message_set_from_dmap_structure (share, message, aply);
dmap_structure_destroy (aply);
g_free (nameprop);
@@ -703,7 +703,7 @@ dpap_share_databases (DMAPShare *share,
struct MLCL_Bits mb = {NULL,0};
gint pl_id = atoi (rest_of_path + 14);
- mb.bits = dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
+ mb.bits = _dmap_share_parse_meta (query, meta_data_map, G_N_ELEMENTS (meta_data_map));
apso = dmap_structure_add (NULL, DMAP_CC_APSO);
dmap_structure_add (apso, DMAP_CC_MSTT, (gint32) DPAP_STATUS_OK);
@@ -730,9 +730,11 @@ dpap_share_databases (DMAPShare *share,
mb.mlcl = dmap_structure_add (apso, DMAP_CC_MLCL);
dmap_db_foreach (entries, add_entry_to_mlcl, (gpointer) &mb);
+
+ g_object_unref (record);
}
- dmap_share_message_set_from_dmap_structure (share, message, apso);
+ _dmap_share_message_set_from_dmap_structure (share, message, apso);
dmap_structure_destroy (apso);
} else {
g_warning ("Unhandled: %s\n", path);
diff --git a/libdmapsharing/dpap-share.h b/libdmapsharing/dpap-share.h
index e005159..709f93b 100644
--- a/libdmapsharing/dpap-share.h
+++ b/libdmapsharing/dpap-share.h
@@ -30,14 +30,54 @@
G_BEGIN_DECLS
+/**
+ * TYPE_DPAP_SHARE:
+ *
+ * The type for #DPAPShare.
+ */
#define TYPE_DPAP_SHARE (dpap_share_get_type ())
+/**
+ * DPAP_SHARE:
+ * @o: Object which is subject to casting.
+ *
+ * Casts a #DPAPShare or derived pointer into a (DPAPShare*) pointer.
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ */
#define DPAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_DPAP_SHARE, DPAPShare))
+/**
+ * DPAP_SHARE_CLASS:
+ * @k: a valid #DPAPShareClass
+ *
+ * Casts a derived #DPAPShareClass structure into a #DPAPShareClass structure.
+ */
#define DPAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_DPAP_SHARE, DPAPShareClass))
+/**
+ * IS_DPAP_SHARE:
+ * @o: Instance to check for being a %TYPE_DPAP_SHARE.
+ *
+ * Checks whether a valid #GTypeInstance pointer is of type %TYPE_DPAP_SHARE.
+ */
#define IS_DPAP_SHARE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
TYPE_DPAP_SHARE))
+/**
+ * IS_DPAP_SHARE_CLASS:
+ * @k: a #DPAPShareClass
+ *
+ * Checks whether @k "is a" valid #DPAPShareClass structure of type
+ * %DPAP_SHARE or derived.
+ */
#define IS_DPAP_SHARE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DPAP_SHARE))
+/**
+ * DPAP_SHARE_GET_CLASS:
+ * @o: a #DPAPShare instance.
+ *
+ * Get the class structure associated to a #DPAPShare instance.
+ *
+ * Returns: pointer to object class structure.
+ */
#define DPAP_SHARE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
TYPE_DPAP_SHARE, DPAPShareClass))
@@ -54,6 +94,18 @@ typedef struct {
GType dpap_share_get_type (void);
+/**
+ * dpap_share_new:
+ * @name: The name that will be published by mDNS.
+ * @password: A share password or NULL.
+ * @db: A media database.
+ * @container_db: A container (album) database.
+ * @transcode_mimetype: A transcode mimetype or NULL.
+ *
+ * Creates a new DPAP share and publishes it using mDNS.
+ *
+ * Returns: a pointer to a DPAPShare.
+ */
DPAPShare *dpap_share_new (const char *name, const char *password,
gpointer db, gpointer container_db,
gchar *transcode_mimetype);
diff --git a/tests/test-dmap-container-db.c b/tests/test-dmap-container-db.c
index b0472fa..18da9fa 100644
--- a/tests/test-dmap-container-db.c
+++ b/tests/test-dmap-container-db.c
@@ -26,14 +26,14 @@
*/
static DMAPContainerRecord *record = NULL;
-DMAPContainerRecord *
+static DMAPContainerRecord *
test_dmap_container_db_lookup_by_id (DMAPContainerDb *db, gint id)
{
/* In reality, lookup the proper record and return it. */
return record;
}
-void
+static void
test_dmap_container_db_foreach (DMAPContainerDb *db,
void (*fn) (DMAPContainerRecord *record,
gpointer data),
@@ -43,7 +43,7 @@ test_dmap_container_db_foreach (DMAPContainerDb *db,
fn (record, data);
}
-gint64
+static gint64
test_dmap_container_db_count (DMAPContainerDb *db)
{
/* In reality, return the record count. */
diff --git a/tests/test-dmap-container-db.h b/tests/test-dmap-container-db.h
index 26d1f64..b505739 100644
--- a/tests/test-dmap-container-db.h
+++ b/tests/test-dmap-container-db.h
@@ -51,16 +51,6 @@ TestDMAPContainerDb *test_dmap_container_db_new (DMAPContainerRecord
GType test_dmap_container_db_get_type (void);
-DMAPContainerRecord *test_dmap_container_db_lookup_by_id (DMAPContainerDb *db, gint id);
-
-void test_dmap_container_db_foreach_by_type (DMAPContainerDb *db,
- gpointer type,
- void (*fn) (DMAPContainerRecord *record,
- gpointer data),
- gpointer data);
-
-gint64 test_dmap_container_db_count_by_type (DMAPContainerDb *db, gpointer type);
-
#endif /* __TEST_DMAP_CONTAINER_DB */
G_END_DECLS
diff --git a/tests/test-dmap-db.c b/tests/test-dmap-db.c
index 48501ee..8bf1711 100644
--- a/tests/test-dmap-db.c
+++ b/tests/test-dmap-db.c
@@ -27,13 +27,16 @@ struct TestDMAPDbPrivate {
guint nextid;
};
-DMAPRecord *
+static DMAPRecord *
test_dmap_db_lookup_by_id (DMAPDb *db, guint id)
{
- return g_hash_table_lookup (TEST_DMAP_DB (db)->priv->db, GUINT_TO_POINTER (id));
+ DMAPRecord *record;
+ record = g_hash_table_lookup (TEST_DMAP_DB (db)->priv->db, GUINT_TO_POINTER (id));
+ g_object_ref (record);
+ return record;
}
-void
+static void
test_dmap_db_foreach (const DMAPDb *db,
void (*fn) (gpointer id,
DMAPRecord *record,
@@ -43,7 +46,7 @@ test_dmap_db_foreach (const DMAPDb *db,
g_hash_table_foreach (TEST_DMAP_DB (db)->priv->db, (GHFunc) fn, data);
}
-gint64
+static gint64
test_dmap_db_count (const DMAPDb *db)
{
return g_hash_table_size (TEST_DMAP_DB (db)->priv->db);
@@ -54,18 +57,11 @@ test_dmap_db_add (DMAPDb *db, DMAPRecord *record)
{
guint id;
id = TEST_DMAP_DB (db)->priv->nextid--;
+ g_object_ref (record);
g_hash_table_insert (TEST_DMAP_DB (db)->priv->db, GUINT_TO_POINTER (id), record);
return id;
}
-gint
-test_dmap_db_add_with_id (DMAPDb *db, DMAPRecord *record, guint id)
-{
- g_hash_table_insert (TEST_DMAP_DB (db)->priv->db, GUINT_TO_POINTER (id), record);
- return id;
-}
-
-
static void
test_dmap_db_init (TestDMAPDb *db)
{
diff --git a/tests/test-dmap-db.h b/tests/test-dmap-db.h
index b450490..1b0884e 100644
--- a/tests/test-dmap-db.h
+++ b/tests/test-dmap-db.h
@@ -54,14 +54,6 @@ typedef struct {
TestDMAPDb *test_dmap_db_new (void);
GType test_dmap_db_get_type (void);
-DMAPRecord *test_dmap_db_lookup_by_id (DMAPDb *db, guint id);
-void test_dmap_db_foreach (const DMAPDb *db,
- void (*fn) (gpointer id,
- DMAPRecord *record,
- gpointer data),
- gpointer data);
-gint64 test_dmap_db_count (const DMAPDb *db);
-
#endif /* __TEST_DMAP_DB */
G_END_DECLS
diff --git a/tests/test-dmap-server.c b/tests/test-dmap-server.c
index 81a2400..d401b47 100644
--- a/tests/test-dmap-server.c
+++ b/tests/test-dmap-server.c
@@ -75,6 +75,7 @@ create_share (guint conn_type)
record = DMAP_RECORD (dmap_record_factory_create (factory, NULL));
db = DMAP_DB (test_dmap_db_new ());
dmap_db_add (db, record);
+ g_object_unref (record);
g_warning ("initialize DAAP sharing");
diff --git a/tests/test-dpap-record.c b/tests/test-dpap-record.c
index bb727e2..4096145 100644
--- a/tests/test-dpap-record.c
+++ b/tests/test-dpap-record.c
@@ -147,7 +147,7 @@ test_dpap_record_get_property (GObject *object,
}
}
-GInputStream *test_dpap_record_read (DPAPRecord *record, gchar *transcode_mimetype, GError **error)
+GInputStream *test_dpap_record_read (DPAPRecord *record, GError **error)
{
GFile *file;
GInputStream *stream;
diff --git a/tests/test-dpap-record.h b/tests/test-dpap-record.h
index cd731db..bc12038 100644
--- a/tests/test-dpap-record.h
+++ b/tests/test-dpap-record.h
@@ -58,7 +58,6 @@ GType test_dpap_record_get_type (void);
TestDPAPRecord *test_dpap_record_new (void);
GInputStream *test_dpap_record_read (DPAPRecord *record,
- gchar *transcode_mimetype,
GError **err);
#endif /* __TEST_DPAP_RECORD */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]