rygel r23 - in trunk: . src
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r23 - in trunk: . src
- Date: Tue, 28 Oct 2008 20:58:31 +0000 (UTC)
Author: zeeshanak
Date: Tue Oct 28 20:58:31 2008
New Revision: 23
URL: http://svn.gnome.org/viewvc/rygel?rev=23&view=rev
Log:
Add skeleton for tracker-based media provider.
Added:
trunk/src/gupnp-media-tracker.c
trunk/src/gupnp-media-tracker.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gupnp-media-server.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Oct 28 20:58:31 2008
@@ -11,7 +11,9 @@
gupnp_media_server_SOURCES = main.c \
gupnp-media-server.h \
- gupnp-media-server.c
+ gupnp-media-server.c \
+ gupnp-media-tracker.h \
+ gupnp-media-tracker.c
gupnp_media_server_LDADD = $(LIBGUPNP_LIBS) \
$(LIBGUPNP_AV_LIBS) \
$(LIBGCONF_LIBS)
Modified: trunk/src/gupnp-media-server.c
==============================================================================
--- trunk/src/gupnp-media-server.c (original)
+++ trunk/src/gupnp-media-server.c Tue Oct 28 20:58:31 2008
@@ -29,6 +29,7 @@
#include <libgupnp-av/gupnp-av.h>
#include "gupnp-media-server.h"
+#include "gupnp-media-tracker.h"
#define HOME_DIR_ALIAS "/media"
@@ -41,24 +42,7 @@
GUPnPService *content_dir;
- GUPnPDIDLLiteWriter *didl_writer;
- GUPnPSearchCriteriaParser *search_parser;
-};
-
-/* Hard-coded items (mime, title, path)
- *
- * paths are relative to home directory
- * */
-char *items[3][4] = {
- { "4000",
- "audio/mpeg",
- "Maa",
- "entertainment/songs/Maa.mp3" },
- { "4001",
- "audio/mpeg",
- "Hoo",
- "entertainment/songs/Ho.mp3" },
- { NULL }
+ GUPnPMediaTracker *tracker;
};
/* GObject stuff */
@@ -71,14 +55,9 @@
server = GUPNP_MEDIA_SERVER (object);
/* Free GUPnP resources */
- if (server->priv->search_parser) {
- g_object_unref (server->priv->search_parser);
- server->priv->search_parser = NULL;
- }
-
- if (server->priv->didl_writer) {
- g_object_unref (server->priv->didl_writer);
- server->priv->didl_writer = NULL;
+ if (server->priv->tracker) {
+ g_object_unref (server->priv->tracker);
+ server->priv->tracker = NULL;
}
if (server->priv->content_dir) {
g_object_unref (server->priv->content_dir);
@@ -96,12 +75,6 @@
server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server,
GUPNP_TYPE_MEDIA_SERVER,
GUPnPMediaServerPrivate);
-
- /* Create a new DIDL-Lite writer */
- server->priv->didl_writer = gupnp_didl_lite_writer_new ();
-
- /* Create a new search criteria parser */
- server->priv->search_parser = gupnp_search_criteria_parser_new ();
}
static GObject *
@@ -147,8 +120,7 @@
context = gupnp_device_info_get_context (GUPNP_DEVICE_INFO (server));
- /* Host user's home dir */
- gupnp_context_host_path (context, g_get_home_dir (), HOME_DIR_ALIAS);
+ server->priv->tracker = gupnp_media_tracker_new ("0", context);
return object;
}
@@ -166,193 +138,6 @@
g_type_class_add_private (klass, sizeof (GUPnPMediaServerPrivate));
}
-static void
-add_root_container (GUPnPDIDLLiteWriter *didl_writer)
-{
- guint child_count;
-
- /* Count items */
- for (child_count = 0; items[child_count][0]; child_count++);
-
- gupnp_didl_lite_writer_start_container (didl_writer,
- "0",
- "-1",
- child_count,
- FALSE,
- FALSE);
-
- gupnp_didl_lite_writer_add_string
- (didl_writer,
- "class",
- GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
- NULL,
- "object.container.storageFolder");
-
- /* End of Container */
- gupnp_didl_lite_writer_end_container (didl_writer);
-}
-
-static void
-add_item (GUPnPContext *context,
- GUPnPDIDLLiteWriter *didl_writer,
- const char *id,
- const char *parent_id,
- const char *mime,
- const char *title,
- const char *path)
-{
- GUPnPDIDLLiteResource res;
-
- gupnp_didl_lite_writer_start_item (didl_writer,
- id,
- parent_id,
- NULL,
- FALSE);
-
- /* Add fields */
- gupnp_didl_lite_writer_add_string (didl_writer,
- "title",
- GUPNP_DIDL_LITE_WRITER_NAMESPACE_DC,
- NULL,
- title);
-
- gupnp_didl_lite_writer_add_string
- (didl_writer,
- "class",
- GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
- NULL,
- "object.item.audioItem.musicTrack");
-
- gupnp_didl_lite_writer_add_string
- (didl_writer,
- "album",
- GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
- NULL,
- "Some album");
-
- /* Add resource data */
- gupnp_didl_lite_resource_reset (&res);
-
- /* URI */
- res.uri = g_strdup_printf ("http://%s:%d%s/%s",
- gupnp_context_get_host_ip (context),
- gupnp_context_get_port (context),
- HOME_DIR_ALIAS,
- path);
-
- /* Protocol info */
- res.protocol_info = g_strdup_printf ("http-get:*:%s:*", mime);
-
- gupnp_didl_lite_writer_add_res (didl_writer, &res);
-
- /* Cleanup */
- g_free (res.protocol_info);
- g_free (res.uri);
-
- /* End of item */
- gupnp_didl_lite_writer_end_item (didl_writer);
-}
-
-static char *
-browse_direct_children (GUPnPMediaServer *server, guint *num_returned)
-{
- GUPnPContext *context;
- const char *didl;
- char *result;
- guint i;
-
- context = gupnp_device_info_get_context (GUPNP_DEVICE_INFO (server));
-
- /* Start DIDL-Lite fragment */
- gupnp_didl_lite_writer_start_didl_lite (server->priv->didl_writer,
- NULL,
- NULL,
- TRUE);
- /* Add items */
- for (i = 0; items[i][0]; i++)
- add_item (context,
- server->priv->didl_writer,
- items[i][0],
- "0",
- items[i][1],
- items[i][2],
- items[i][3]);
-
- /* End DIDL-Lite fragment */
- gupnp_didl_lite_writer_end_didl_lite (server->priv->didl_writer);
-
- /* Retrieve generated string */
- didl = gupnp_didl_lite_writer_get_string (server->priv->didl_writer);
- result = g_strdup (didl);
-
- /* Reset the parser state */
- gupnp_didl_lite_writer_reset (server->priv->didl_writer);
-
- *num_returned = i;
-
- return result;
-}
-
-static char *
-get_metadata (GUPnPMediaServer *server,
- const char *object_id,
- guint *num_returned)
-{
- GUPnPContext *context;
- char *result;
- guint i;
-
- context = gupnp_device_info_get_context (GUPNP_DEVICE_INFO (server));
-
- /* Start DIDL-Lite fragment */
- gupnp_didl_lite_writer_start_didl_lite (server->priv->didl_writer,
- NULL,
- NULL,
- TRUE);
- *num_returned = 0;
- if (strcmp (object_id, "0") == 0) {
- add_root_container (server->priv->didl_writer);
-
- *num_returned = 1;
- } else {
- /* Find and add the item */
- for (i = 0; items[i][0]; i++) {
- if (strcmp (object_id, items[i][0]) == 0) {
- add_item (context,
- server->priv->didl_writer,
- items[i][0],
- "0",
- items[i][1],
- items[i][2],
- items[i][3]);
-
- *num_returned = 1;
-
- break;
- }
- }
- }
-
- if (*num_returned != 0) {
- const char *didl;
-
- /* End DIDL-Lite fragment */
- gupnp_didl_lite_writer_end_didl_lite
- (server->priv->didl_writer);
-
- /* Retrieve generated string */
- didl = gupnp_didl_lite_writer_get_string
- (server->priv->didl_writer);
- result = g_strdup (didl);
- } else
- result = NULL;
-
- /* Reset the parser state */
- gupnp_didl_lite_writer_reset (server->priv->didl_writer);
-
- return result;
-}
-
/* Browse action implementation */
void
browse_cb (GUPnPService *service,
@@ -362,8 +147,9 @@
GUPnPMediaServer *server;
char *object_id, *browse_flag;
gboolean browse_metadata;
- char *result;
- guint num_returned;
+ char *result, *sort_criteria, *filter;
+ guint32 starting_index, requested_count;
+ guint32 num_returned, total_matches, update_id;
server = GUPNP_MEDIA_SERVER (user_data);
@@ -375,6 +161,18 @@
"BrowseFlag",
G_TYPE_STRING,
&browse_flag,
+ "Filter",
+ G_TYPE_STRING,
+ &filter,
+ "StartingIndex",
+ G_TYPE_UINT,
+ &starting_index,
+ "RequestedCount",
+ G_TYPE_UINT,
+ &requested_count,
+ "SortCriteria",
+ G_TYPE_STRING,
+ &sort_criteria,
NULL);
/* BrowseFlag */
@@ -398,26 +196,38 @@
}
if (browse_metadata) {
- result = get_metadata (server, object_id, &num_returned);
+ result = gupnp_media_tracker_get_metadata
+ (server->priv->tracker,
+ object_id,
+ filter,
+ sort_criteria,
+ &update_id);
- if (result == NULL) {
- gupnp_service_action_return_error
- (action, 701, "No such object");
-
- goto OUT;
- }
+ num_returned = 1;
+ total_matches = 1;
} else {
- /* We only have a root object */
- if (strcmp (object_id, "0")) {
- gupnp_service_action_return_error
- (action, 701, "No such object");
+ result = gupnp_media_tracker_browse (server->priv->tracker,
+ object_id,
+ filter,
+ starting_index,
+ requested_count,
+ sort_criteria,
+ &num_returned,
+ &total_matches,
+ &update_id);
+ }
- goto OUT;
- }
+ if (result == NULL) {
+ gupnp_service_action_return_error (action,
+ 701,
+ "No such object");
- result = browse_direct_children (server, &num_returned);
+ goto OUT;
}
+ if (update_id == GUPNP_INVALID_UPDATE_ID)
+ update_id = server->priv->system_update_id;
+
/* Set action return arguments */
gupnp_service_action_set (action,
"Result",
@@ -428,10 +238,10 @@
num_returned,
"TotalMatches",
G_TYPE_UINT,
- num_returned,
+ total_matches,
"UpdateID",
G_TYPE_UINT,
- server->priv->system_update_id,
+ update_id,
NULL);
gupnp_service_action_return (action);
Added: trunk/src/gupnp-media-tracker.c
==============================================================================
--- (empty file)
+++ trunk/src/gupnp-media-tracker.c Tue Oct 28 20:58:31 2008
@@ -0,0 +1,457 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
+ * Copyright (C) 2007 OpenedHand Ltd.
+ *
+ * Author: Zeeshan Ali <zeenix gmail com>
+ * Jorn Baayen <jorn openedhand com>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+#include <string.h>
+#include <libgupnp/gupnp.h>
+#include <libgupnp-av/gupnp-av.h>
+
+#include "gupnp-media-tracker.h"
+
+#define HOME_DIR_ALIAS "/media"
+
+G_DEFINE_TYPE (GUPnPMediaTracker,
+ gupnp_media_tracker,
+ G_TYPE_OBJECT);
+
+struct _GUPnPMediaTrackerPrivate {
+ char *root_id;
+
+ GUPnPContext *context;
+
+ GUPnPDIDLLiteWriter *didl_writer;
+ GUPnPSearchCriteriaParser *search_parser;
+};
+
+enum {
+ PROP_0,
+ PROP_ROOT_ID,
+ PROP_CONTEXT
+};
+
+/* Hard-coded items (mime, title, path)
+ *
+ * paths are relative to home directory
+ * */
+static char *items[3][4] = {
+ { "4000",
+ "audio/mpeg",
+ "Maa",
+ "entertainment/songs/Maa.mp3" },
+ { "4001",
+ "audio/mpeg",
+ "Hoo",
+ "entertainment/songs/Ho.mp3" },
+ { NULL }
+};
+
+/* GObject stuff */
+static void
+gupnp_media_tracker_dispose (GObject *object)
+{
+ GUPnPMediaTracker *tracker;
+ GObjectClass *object_class;
+
+ tracker = GUPNP_MEDIA_TRACKER (object);
+
+ if (tracker->priv->context) {
+ g_object_unref (tracker->priv->context);
+ tracker->priv->context = NULL;
+ }
+
+ /* Free GUPnP resources */
+ if (tracker->priv->search_parser) {
+ g_object_unref (tracker->priv->search_parser);
+ tracker->priv->search_parser = NULL;
+ }
+
+ if (tracker->priv->didl_writer) {
+ g_object_unref (tracker->priv->didl_writer);
+ tracker->priv->didl_writer = NULL;
+ }
+
+ if (tracker->priv->root_id) {
+ g_free (tracker->priv->root_id);
+ tracker->priv->root_id = NULL;
+ }
+
+ /* Call super */
+ object_class = G_OBJECT_CLASS (gupnp_media_tracker_parent_class);
+ object_class->dispose (object);
+}
+
+static void
+gupnp_media_tracker_init (GUPnPMediaTracker *tracker)
+{
+ tracker->priv = G_TYPE_INSTANCE_GET_PRIVATE (tracker,
+ GUPNP_TYPE_MEDIA_TRACKER,
+ GUPnPMediaTrackerPrivate);
+
+ /* Create a new DIDL-Lite writer */
+ tracker->priv->didl_writer = gupnp_didl_lite_writer_new ();
+
+ /* Create a new search criteria parser */
+ tracker->priv->search_parser = gupnp_search_criteria_parser_new ();
+}
+
+static GObject *
+gupnp_media_tracker_constructor (GType type,
+ guint n_construct_params,
+ GObjectConstructParam *construct_params)
+{
+ GObject *object;
+ GObjectClass *object_class;
+ GUPnPMediaTracker *tracker;
+
+ object_class = G_OBJECT_CLASS (gupnp_media_tracker_parent_class);
+ object = object_class->constructor (type,
+ n_construct_params,
+ construct_params);
+
+ if (object == NULL)
+ return NULL;
+
+ tracker = GUPNP_MEDIA_TRACKER (object);
+
+ /* Host user's home dir */
+ gupnp_context_host_path (tracker->priv->context,
+ g_get_home_dir (),
+ HOME_DIR_ALIAS);
+
+ return object;
+}
+
+static void
+gupnp_media_tracker_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPMediaTracker *tracker;
+
+ tracker = GUPNP_MEDIA_TRACKER (object);
+
+ switch (property_id) {
+ case PROP_ROOT_ID:
+ tracker->priv->root_id = g_value_dup_string (value);
+ break;
+ case PROP_CONTEXT:
+ tracker->priv->context = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_media_tracker_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GUPnPMediaTracker *tracker;
+
+ tracker = GUPNP_MEDIA_TRACKER (object);
+
+ switch (property_id) {
+ case PROP_ROOT_ID:
+ g_value_set_string (value, tracker->priv->root_id);
+ break;
+ case PROP_CONTEXT:
+ g_value_set_object (value, tracker->priv->context);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gupnp_media_tracker_class_init (GUPnPMediaTrackerClass *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = gupnp_media_tracker_set_property;
+ object_class->get_property = gupnp_media_tracker_get_property;
+ object_class->dispose = gupnp_media_tracker_dispose;
+ object_class->constructor = gupnp_media_tracker_constructor;
+
+ g_type_class_add_private (klass, sizeof (GUPnPMediaTrackerPrivate));
+
+ /**
+ * GUPnPMediaTracker:root-id
+ *
+ * ID of the root container.
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_ROOT_ID,
+ g_param_spec_string ("root-id",
+ "RootID",
+ "ID of the root container",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ /**
+ * GUPnPMediaTracker:context
+ *
+ * The GUPnP context to use.
+ **/
+ g_object_class_install_property
+ (object_class,
+ PROP_CONTEXT,
+ g_param_spec_object ("context",
+ "Context",
+ "The GUPnP context to use",
+ GUPNP_TYPE_CONTEXT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+}
+
+static void
+add_root_container (const char *root_id,
+ GUPnPDIDLLiteWriter *didl_writer)
+{
+ guint child_count;
+
+ /* Count items */
+ for (child_count = 0; items[child_count][0]; child_count++);
+
+ gupnp_didl_lite_writer_start_container (didl_writer,
+ root_id,
+ "-1",
+ child_count,
+ FALSE,
+ FALSE);
+
+ gupnp_didl_lite_writer_add_string
+ (didl_writer,
+ "class",
+ GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
+ NULL,
+ "object.container.storageFolder");
+
+ /* End of Container */
+ gupnp_didl_lite_writer_end_container (didl_writer);
+}
+
+static void
+add_item (GUPnPContext *context,
+ GUPnPDIDLLiteWriter *didl_writer,
+ const char *id,
+ const char *parent_id,
+ const char *mime,
+ const char *title,
+ const char *path)
+{
+ GUPnPDIDLLiteResource res;
+
+ gupnp_didl_lite_writer_start_item (didl_writer,
+ id,
+ parent_id,
+ NULL,
+ FALSE);
+
+ /* Add fields */
+ gupnp_didl_lite_writer_add_string (didl_writer,
+ "title",
+ GUPNP_DIDL_LITE_WRITER_NAMESPACE_DC,
+ NULL,
+ title);
+
+ gupnp_didl_lite_writer_add_string
+ (didl_writer,
+ "class",
+ GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
+ NULL,
+ "object.item.audioItem.musicTrack");
+
+ gupnp_didl_lite_writer_add_string
+ (didl_writer,
+ "album",
+ GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP,
+ NULL,
+ "Some album");
+
+ /* Add resource data */
+ gupnp_didl_lite_resource_reset (&res);
+
+ /* URI */
+ res.uri = g_strdup_printf ("http://%s:%d%s/%s",
+ gupnp_context_get_host_ip (context),
+ gupnp_context_get_port (context),
+ HOME_DIR_ALIAS,
+ path);
+
+ /* Protocol info */
+ res.protocol_info = g_strdup_printf ("http-get:*:%s:*", mime);
+
+ gupnp_didl_lite_writer_add_res (didl_writer, &res);
+
+ /* Cleanup */
+ g_free (res.protocol_info);
+ g_free (res.uri);
+
+ /* End of item */
+ gupnp_didl_lite_writer_end_item (didl_writer);
+}
+
+GUPnPMediaTracker *
+gupnp_media_tracker_new (const char *root_id,
+ GUPnPContext *context)
+{
+ GUPnPResourceFactory *factory;
+
+ factory = gupnp_resource_factory_get_default ();
+
+ return g_object_new (GUPNP_TYPE_MEDIA_TRACKER,
+ "root-id", root_id,
+ "context", context,
+ NULL);
+}
+
+char *
+gupnp_media_tracker_browse (GUPnPMediaTracker *tracker,
+ const char *container_id,
+ const char *filter,
+ guint32 starting_index,
+ guint32 requested_count,
+ const char *sort_criteria,
+ guint32 *number_returned,
+ guint32 *total_matches,
+ guint32 *update_id)
+{
+ const char *didl;
+ char *result;
+ guint i;
+
+ if (strcmp (container_id, tracker->priv->root_id) != 0)
+ return NULL;
+
+ /* Start DIDL-Lite fragment */
+ gupnp_didl_lite_writer_start_didl_lite (tracker->priv->didl_writer,
+ NULL,
+ NULL,
+ TRUE);
+ /* Add items */
+ for (i = 0; items[i][0]; i++)
+ add_item (tracker->priv->context,
+ tracker->priv->didl_writer,
+ items[i][0],
+ tracker->priv->root_id,
+ items[i][1],
+ items[i][2],
+ items[i][3]);
+
+ /* End DIDL-Lite fragment */
+ gupnp_didl_lite_writer_end_didl_lite (tracker->priv->didl_writer);
+
+ /* Retrieve generated string */
+ didl = gupnp_didl_lite_writer_get_string (tracker->priv->didl_writer);
+ result = g_strdup (didl);
+
+ /* Reset the parser state */
+ gupnp_didl_lite_writer_reset (tracker->priv->didl_writer);
+
+ *number_returned = i;
+ *total_matches = *number_returned;
+ *update_id = GUPNP_INVALID_UPDATE_ID;
+
+ return result;
+}
+
+char *
+gupnp_media_tracker_get_metadata (GUPnPMediaTracker *tracker,
+ const char *object_id,
+ const char *filter,
+ const char *sort_criteria,
+ guint32 *update_id)
+{
+ char *result;
+ guint i;
+ gboolean found;
+
+ /* Start DIDL-Lite fragment */
+ gupnp_didl_lite_writer_start_didl_lite (tracker->priv->didl_writer,
+ NULL,
+ NULL,
+ TRUE);
+ found = FALSE;
+ if (strcmp (object_id, tracker->priv->root_id) == 0) {
+ add_root_container (tracker->priv->root_id,
+ tracker->priv->didl_writer);
+
+ found = TRUE;
+ } else {
+ /* Find and add the item */
+ for (i = 0; items[i][0]; i++) {
+ if (strcmp (object_id, items[i][0]) == 0) {
+ add_item (tracker->priv->context,
+ tracker->priv->didl_writer,
+ items[i][0],
+ tracker->priv->root_id,
+ items[i][1],
+ items[i][2],
+ items[i][3]);
+
+ found = TRUE;
+
+ break;
+ }
+ }
+ }
+
+ if (found) {
+ const char *didl;
+
+ /* End DIDL-Lite fragment */
+ gupnp_didl_lite_writer_end_didl_lite
+ (tracker->priv->didl_writer);
+
+ /* Retrieve generated string */
+ didl = gupnp_didl_lite_writer_get_string
+ (tracker->priv->didl_writer);
+ result = g_strdup (didl);
+ } else
+ result = NULL;
+
+ /* Reset the parser state */
+ gupnp_didl_lite_writer_reset (tracker->priv->didl_writer);
+
+ *update_id = GUPNP_INVALID_UPDATE_ID;
+
+ return result;
+}
+
Added: trunk/src/gupnp-media-tracker.h
==============================================================================
--- (empty file)
+++ trunk/src/gupnp-media-tracker.h Tue Oct 28 20:58:31 2008
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali <zeenix gmail com>.
+ *
+ * Author: Zeeshan Ali <zeenix gmail com>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GUPNP_MEDIA_TRACKER_H__
+#define __GUPNP_MEDIA_TRACKER_H__
+
+#include <libgupnp/gupnp.h>
+
+#define GUPNP_MAX_UPDATE_ID G_MAXUINT32 - 1
+#define GUPNP_INVALID_UPDATE_ID G_MAXUINT32
+
+G_BEGIN_DECLS
+
+GType
+gupnp_media_tracker_get_type (void) G_GNUC_CONST;
+
+#define GUPNP_TYPE_MEDIA_TRACKER \
+ (gupnp_media_tracker_get_type ())
+#define GUPNP_MEDIA_TRACKER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GUPNP_TYPE_MEDIA_TRACKER, \
+ GUPnPMediaTracker))
+#define GUPNP_MEDIA_TRACKER_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_CAST ((obj), \
+ GUPNP_TYPE_MEDIA_TRACKER, \
+ GUPnPMediaTrackerClass))
+#define GUPNP_IS_MEDIA_TRACKER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GUPNP_TYPE_MEDIA_TRACKER))
+#define GUPNP_IS_MEDIA_TRACKER_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE ((obj), \
+ GUPNP_TYPE_MEDIA_TRACKER))
+#define GUPNP_MEDIA_TRACKER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ GUPNP_TYPE_MEDIA_TRACKER, \
+ GUPnPMediaTrackerClass))
+
+typedef struct _GUPnPMediaTrackerPrivate GUPnPMediaTrackerPrivate;
+
+typedef struct {
+ GObject parent;
+
+ GUPnPMediaTrackerPrivate *priv;
+} GUPnPMediaTracker;
+
+typedef struct {
+ GObjectClass parent_class;
+
+ /* future padding */
+ void (* _gupnp_reserved1) (void);
+ void (* _gupnp_reserved2) (void);
+ void (* _gupnp_reserved3) (void);
+ void (* _gupnp_reserved4) (void);
+} GUPnPMediaTrackerClass;
+
+GUPnPMediaTracker *
+gupnp_media_tracker_new (const char *root_id,
+ GUPnPContext *context);
+
+char *
+gupnp_media_tracker_browse (GUPnPMediaTracker *tracker,
+ const char *container_id,
+ const char *filter,
+ guint32 starting_index,
+ guint32 requested_count,
+ const char *sort_criteria,
+ guint32 *number_returned,
+ guint32 *total_matches,
+ guint32 *update_id);
+
+char *
+gupnp_media_tracker_get_metadata (GUPnPMediaTracker *tracker,
+ const char *object_id,
+ const char *filter,
+ const char *sort_criteria,
+ guint32 *update_id);
+
+G_END_DECLS
+
+#endif /* __GUPNP_MEDIA_TRACKER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]