bognor-regis/0000755000175000017500000000000011533735426013374 5ustar paulliupaulliubognor-regis/bognor-regis/0000755000175000017500000000000011533735426015771 5ustar paulliupaulliubognor-regis/bognor-regis/br-player.h0000644000175000017500000000472111533735426020043 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __BR_PLAYER_H__ #define __BR_PLAYER_H__ #include G_BEGIN_DECLS #define BR_TYPE_PLAYER \ (br_player_get_type()) #define BR_PLAYER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BR_TYPE_PLAYER, \ BrPlayer)) #define BR_PLAYER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BR_TYPE_PLAYER, \ BrPlayerClass)) #define IS_BR_PLAYER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BR_TYPE_PLAYER)) #define IS_BR_PLAYER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BR_TYPE_PLAYER)) #define BR_PLAYER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BR_TYPE_PLAYER, \ BrPlayerClass)) typedef struct _BrPlayerPrivate BrPlayerPrivate; typedef struct _BrPlayer BrPlayer; typedef struct _BrPlayerClass BrPlayerClass; struct _BrPlayer { GObject parent; BrPlayerPrivate *priv; }; struct _BrPlayerClass { GObjectClass parent_class; }; GType br_player_get_type (void) G_GNUC_CONST; G_END_DECLS #endif /* __BR_PLAYER_H__ */ bognor-regis/bognor-regis/br-queue.c0000644000175000017500000012247111533735426017671 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include #include #ifdef USE_QUEUE_CONFIG #include #endif #include "br-marshal.h" #include "br-queue.h" #include "bognor-queue-bindings.h" /* default settings */ #define BR_QUEUE_DBUS_SERVICE "org.moblin.BognorRegis" #define BR_LOCAL_QUEUE_PATH "/org/moblin/BognorRegis/Queues/local_queue" enum { PROP_0, PROP_PATH, PROP_SERVICE, }; enum { ADDED, REMOVED, MOVED, INDEX_CHANGED, POSITION_CHANGED, STATE_CHANGED, LAST_SIGNAL }; struct _BrQueuePrivate { DBusGProxy *proxy; char *object_path; char *service_name; }; struct _AsyncClosure { BrQueue *queue; GCallback cb; gpointer userdata; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BR_TYPE_QUEUE, BrQueuePrivate)) G_DEFINE_TYPE (BrQueue, br_queue, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0, }; static void uri_added_cb (DBusGProxy *proxy, const char *uri, int index, BrQueue *queue); static void uri_removed_cb (DBusGProxy *proxy, const char *uri, int index, BrQueue *queue); static void item_moved_cb (DBusGProxy *proxy, int old_position, int new_position, int updated_index, BrQueue *queue); static void index_changed_cb (DBusGProxy *proxy, int index, BrQueue *queue); static void position_changed_cb (DBusGProxy *proxy, double position, BrQueue *queue); static void state_changed_cb (DBusGProxy *proxy, int state, BrQueue *queue); static void br_queue_finalize (GObject *object) { BrQueue *self = (BrQueue *) object; BrQueuePrivate *priv = self->priv; if (priv->object_path) { g_free (priv->object_path); priv->object_path = NULL; } if (priv->service_name) { g_free (priv->service_name); priv->service_name = NULL; } G_OBJECT_CLASS (br_queue_parent_class)->finalize (object); } static void br_queue_dispose (GObject *object) { BrQueue *self = (BrQueue *) object; BrQueuePrivate *priv = self->priv; if (priv->proxy) { dbus_g_proxy_disconnect_signal (priv->proxy, "UriAdded", G_CALLBACK (uri_added_cb), self); dbus_g_proxy_disconnect_signal (priv->proxy, "UriRemoved", G_CALLBACK (uri_removed_cb), self); dbus_g_proxy_disconnect_signal (priv->proxy, "ItemMoved", G_CALLBACK (item_moved_cb), self); dbus_g_proxy_disconnect_signal (priv->proxy, "IndexChanged", G_CALLBACK (index_changed_cb), self); dbus_g_proxy_disconnect_signal (priv->proxy, "PositionChanged", G_CALLBACK (position_changed_cb), self); dbus_g_proxy_disconnect_signal (priv->proxy, "StateChanged", G_CALLBACK (state_changed_cb), self); g_object_unref (priv->proxy); priv->proxy = NULL; } G_OBJECT_CLASS (br_queue_parent_class)->dispose (object); } static void br_queue_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BrQueue *self = (BrQueue *) object; BrQueuePrivate *priv = self->priv; switch (prop_id) { case PROP_PATH: priv->object_path = g_value_dup_string (value); break; case PROP_SERVICE: priv->service_name = g_value_dup_string (value); break; default: break; } } static void br_queue_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BrQueue *self = (BrQueue *) object; switch (prop_id) { default: break; } } static void uri_added_cb (DBusGProxy *proxy, const char *uri, int index, BrQueue *queue) { g_signal_emit (queue, signals[ADDED], 0, uri, index); } static void uri_removed_cb (DBusGProxy *proxy, const char *uri, int index, BrQueue *queue) { g_signal_emit (queue, signals[REMOVED], 0, uri, index); } static void item_moved_cb (DBusGProxy *proxy, int old_position, int new_position, int updated_index, BrQueue *queue) { g_signal_emit (queue, signals[MOVED], 0, old_position, new_position, updated_index); } static void index_changed_cb (DBusGProxy *proxy, int index, BrQueue *queue) { g_signal_emit (queue, signals[INDEX_CHANGED], 0, index); } static void position_changed_cb (DBusGProxy *proxy, double position, BrQueue *queue) { g_signal_emit (queue, signals[POSITION_CHANGED], 0, position); } static void state_changed_cb (DBusGProxy *proxy, int state, BrQueue *queue) { g_signal_emit (queue, signals[STATE_CHANGED], 0, state); } static GObject * br_queue_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { BrQueue *queue; BrQueuePrivate *priv; DBusGConnection *connection; DBusGProxy *proxy; GError *error = NULL; guint start_ret; queue = BR_QUEUE (G_OBJECT_CLASS (br_queue_parent_class)->constructor (type, n_construct_properties, construct_properties)); priv = queue->priv; connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { g_warning ("Failed to open connection to bus: %s", error->message); g_error_free (error); priv->proxy = NULL; return G_OBJECT (queue); } proxy = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if (!org_freedesktop_DBus_start_service_by_name (proxy, priv->service_name, 0, &start_ret, &error)) { g_warning ("bognor-regis could not start queue service '%s': %s", priv->service_name, error->message); g_error_free (error); priv->proxy = NULL; return G_OBJECT (queue); } priv->proxy = dbus_g_proxy_new_for_name (connection, priv->service_name, priv->object_path, BR_QUEUE_DBUS_INTERFACE); dbus_g_proxy_add_signal (priv->proxy, "UriAdded", G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_add_signal (priv->proxy, "UriRemoved", G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_add_signal (priv->proxy, "ItemMoved", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_add_signal (priv->proxy, "IndexChanged", G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_add_signal (priv->proxy, "PositionChanged", G_TYPE_DOUBLE, G_TYPE_INVALID); dbus_g_proxy_add_signal (priv->proxy, "StateChanged", G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (priv->proxy, "UriAdded", G_CALLBACK (uri_added_cb), queue, NULL); dbus_g_proxy_connect_signal (priv->proxy, "UriRemoved", G_CALLBACK (uri_removed_cb), queue, NULL); dbus_g_proxy_connect_signal (priv->proxy, "ItemMoved", G_CALLBACK (item_moved_cb), queue, NULL); dbus_g_proxy_connect_signal (priv->proxy, "IndexChanged", G_CALLBACK (index_changed_cb), queue, NULL); dbus_g_proxy_connect_signal (priv->proxy, "PositionChanged", G_CALLBACK (position_changed_cb), queue, NULL); dbus_g_proxy_connect_signal (priv->proxy, "StateChanged", G_CALLBACK (state_changed_cb), queue, NULL); return G_OBJECT (queue); } static void br_queue_class_init (BrQueueClass *klass) { GObjectClass *o_class = (GObjectClass *)klass; o_class->dispose = br_queue_dispose; o_class->finalize = br_queue_finalize; o_class->set_property = br_queue_set_property; o_class->get_property = br_queue_get_property; o_class->constructor = br_queue_constructor; g_type_class_add_private (klass, sizeof (BrQueuePrivate)); dbus_g_object_register_marshaller (br_marshal_VOID__STRING_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); dbus_g_object_register_marshaller (br_marshal_VOID__INT_INT_INT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID); #if 0 dbus_g_object_register_marshaller (br_marshal_VOID__INT_DOUBLE, G_TYPE_NONE, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_INVALID); #endif g_object_class_install_property (o_class, PROP_PATH, g_param_spec_string ("object-path", "", "", "", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (o_class, PROP_SERVICE, g_param_spec_string ("service-name", "", "", "", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); signals[ADDED] = g_signal_new ("uri-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, br_marshal_VOID__STRING_INT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT); signals[REMOVED] = g_signal_new ("uri-removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, br_marshal_VOID__STRING_INT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT); signals[MOVED] = g_signal_new ("item-moved", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, br_marshal_VOID__INT_INT_INT, G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); signals[INDEX_CHANGED] = g_signal_new ("index-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); signals[POSITION_CHANGED] = g_signal_new ("position-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__DOUBLE, G_TYPE_NONE, 1, G_TYPE_DOUBLE); signals[STATE_CHANGED] = g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); } static void br_queue_init (BrQueue *self) { self->priv = GET_PRIVATE (self); } BrQueue * br_queue_new (const char *service_name, const char *object_path) { BrQueue *queue; queue = g_object_new (BR_TYPE_QUEUE, "object-path", object_path, "service-name", service_name, NULL); return queue; } /* allow different implementations of the queue service */ static char * get_queue_dbus_service (void) { #ifdef USE_QUEUE_CONFIG char *queue; queue = gconf_client_get_string (gconf_client_get_default (), "/desktop/moblin/media_queue/service", NULL); if (queue) return queue; #endif return g_strdup (BR_QUEUE_DBUS_SERVICE); } static char * get_local_dbus_path (void) { #ifdef USE_QUEUE_CONFIG char *path; path = gconf_client_get_string (gconf_client_get_default (), "/desktop/moblin/media_queue/local_queue", NULL); if (path) return path; #endif return g_strdup (BR_LOCAL_QUEUE_PATH); } BrQueue * br_queue_new_local (void) { BrQueue *queue; #ifdef USE_QUEUE_CONFIG char *path, *service; path = get_local_dbus_path (); service = get_queue_dbus_service (); queue = br_queue_new (service, path); g_free (path); g_free (service); #else queue = br_queue_new (BR_QUEUE_DBUS_SERVICE, BR_LOCAL_QUEUE_PATH); #endif return queue; } static void async_reply (DBusGProxy *proxy, GError *error, gpointer userdata) { if (error != NULL) { g_warning ("Error talking to Bognor-Regis : %s", error->message); g_error_free (error); } } /** * br_queue_play: * @queue: A #BrQueue * * Requests that the queue represented by @queue starts to play */ void br_queue_play (BrQueue *queue) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_play_async (priv->proxy, async_reply, queue); } /** * br_queue_stop: * @queue: A #BrQueue * * Requests that the queue represented by @queue stops playing */ void br_queue_stop (BrQueue *queue) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_stop_async (priv->proxy, async_reply, queue); } /** * br_queue_next: * @queue: A #BrQueue * * Requests that the queue represented by @queue moves to the next track. This * does not affect the queue's state. If it was playing before the request, * it will still be playing after. If it was not playing before the request, * it will still be stopped after. */ void br_queue_next (BrQueue *queue) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_next_async (priv->proxy, async_reply, queue); } /** * br_queue_previous: * @queue: A #BrQueue * * Requests that the queue represented by @queue moves to the previous track. * This does not affect the queue's state. */ void br_queue_previous (BrQueue *queue) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_previous_async (priv->proxy, async_reply, queue); } static void get_state_reply (DBusGProxy *proxy, int state, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetStateCallback cb; cb = (BrQueueGetStateCallback) (data->cb); if (error) { /* Initialise the parameters correctly */ state = BR_QUEUE_STATE_STOPPED; } cb (data->queue, state, error, data->userdata); if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_state: * @queue: A #BrQueue * @cb: The callback when the state has been returned * @userdata: Data to be passed to @cb * * Requests the current state of the queue represented by @queue. This is an * asynchronous command, and @cb will be called with @userdata whenever the * state has been returned */ void br_queue_get_state (BrQueue *queue, BrQueueGetStateCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_state_async (priv->proxy, get_state_reply, data); } /** * br_queue_set_index: * @queue: A #BrQueue * @index: The index of the item * * Requests that the queue represented by @queue sets @index as the current * track. This does not affect the state of the queue. */ void br_queue_set_index (BrQueue *queue, int index) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_set_index_async (priv->proxy, index, async_reply, queue); } static void get_index_reply (DBusGProxy *proxy, int OUT_index, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetIndexCallback cb; cb = (BrQueueGetIndexCallback) (data->cb); if (error) { OUT_index = 0; } cb (data->queue, OUT_index, error, data->userdata); if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_index: * @queue: A #BrQueue * @cb: The callback for when the index is returned * @userdata: The data to be passed to @cb * * Requests the index of the current item in the queue represented by @queue. * This is an asynchronous call, and @cb will be called with @userdata whenever * the index has been returned. */ void br_queue_get_index (BrQueue *queue, BrQueueGetIndexCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_index_async (priv->proxy, get_index_reply, data); } static void get_metadata_reply (DBusGProxy *proxy, char *OUT_title, char *OUT_artist, char *OUT_album, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetMetadataCallback cb; cb = (BrQueueGetMetadataCallback) (data->cb); if (error) { OUT_title = NULL; OUT_artist = NULL; OUT_album = NULL; } cb (data->queue, OUT_title, OUT_artist, OUT_album, error, data->userdata); if (error) { g_error_free (error); } else { g_free (OUT_title); g_free (OUT_artist); g_free (OUT_album); } g_free (data); } /** * br_queue_get_index_metadata: * @queue: A #BrQueue * @index: The index of the item being requested * @cb: The callback for when the metadata is returned * @userdata: The data to be passed to @cb * * Requests the title, artist and album of the item at @index position * in the queue represented by @queue. * This is an asynchronous call, and @cb will be called with @userdata whenever * the data has been returned. */ void br_queue_get_index_metadata (BrQueue *queue, int index, BrQueueGetMetadataCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_index_metadata_async (priv->proxy, index, get_metadata_reply, data); } /** * br_queue_get_next_metadata: * @queue: A #BrQueue * @cb: The callback for when the metadata is returned * @userdata: The data to be passed to @cb * * Requests the title, artist and album of the item next * in the queue represented by @queue. * This is an asynchronous call, and @cb will be called with @userdata whenever * the data has been returned. */ void br_queue_get_next_metadata (BrQueue *queue, BrQueueGetMetadataCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_next_metadata_async (priv->proxy, get_metadata_reply, data); } static void get_repeat_mode_reply (DBusGProxy *proxy, int OUT_repeat_mode, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetRepeatModeCallback cb; cb = (BrQueueGetRepeatModeCallback) (data->cb); if (error) { OUT_repeat_mode= -1; } if (cb) { cb (data->queue, OUT_repeat_mode, error, data->userdata); } if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_repeat_mode: * @queue: A #BrQueue * @cb: The callback for when the repeat_mode is returned * @userdata: The data to be passed to @cb * * Requests the repeat-mode of the queue represented by @queue. * This is an asynchronous call, and @cb will be called with @userdata whenever * the repeat_mode has been returned. */ void br_queue_get_repeat_mode (BrQueue *queue, BrQueueGetRepeatModeCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_repeat_mode_async (priv->proxy, get_repeat_mode_reply, data); } static void get_duration_reply (DBusGProxy *proxy, int OUT_duration, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetDurationCallback cb; cb = (BrQueueGetDurationCallback) (data->cb); if (error) { OUT_duration= 0; } if (cb) { cb (data->queue, OUT_duration, error, data->userdata); } if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_duration: * @queue: A #BrQueue * @cb: The callback for when duration is returned * @userdata: The data to be passed to @cb * * Requests the repeat-mode of the queue represented by @queue. * This is an asynchronous call, and @cb will be called with @userdata whenever * the repeat_mode has been returned. */ void br_queue_get_duration (BrQueue *queue, BrQueueGetDurationCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_duration_async (priv->proxy, get_duration_reply, data); } static void get_index_uri_reply (DBusGProxy *proxy, char *OUT_uri, char *OUT_mimetype, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetIndexUriCallback cb; cb = (BrQueueGetIndexUriCallback) (data->cb); if (error) { OUT_uri = NULL; OUT_mimetype = NULL; } cb (data->queue, OUT_uri, OUT_mimetype, error, data->userdata); if (error) { g_error_free (error); } else { g_free (OUT_uri); g_free (OUT_mimetype); } g_free (data); } /** * br_queue_get_index_uri: * @queue: A #BrQueue * @index: The index of the item being requested * @cb: The callback that will be used when the data is returned * @userdata: The data to be passed to @cb * * Requests the uri and mimetype of the item at @index position in the queue * represented by @queue. This is an asynchronous call and @cb will be called * with @userdata whenever the data is returned */ void br_queue_get_index_uri (BrQueue *queue, int index, BrQueueGetIndexUriCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_index_uri_async (priv->proxy, index, get_index_uri_reply, data); } /** * br_queue_append_uris: * @queue: A #BrQueue * @count: The number of uris to be added * @uris: An array of uris, NULL-terminated * @mimetypes: An array of mimetypes, NULL-terminated * * Requests that @count uris be appended to the end of the queue represented by * @queue. The mimetypes in @mimetypes correspond to the uris in @uris. No * checking is done on the contents of @uris for their existence or suitability * when this call is made. Bognor-Regis will ignore any invalid URIs when they * are attempted to be played. */ void br_queue_append_uris (BrQueue *queue, int count, const char **uris, const char **mimetypes) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_append_uris_async (priv->proxy, count, uris, mimetypes, async_reply, queue); } /** * br_queue_remove_range: * @queue: A #BrQueue * @index: The first item to be removed * @count: The number of items to be removed * * Requests that @count items, starting from @index, be removed from the queue * represented by @queue */ void br_queue_remove_range (BrQueue *queue, int index, int count) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_remove_range_async (priv->proxy, index, count, async_reply, queue); } /** * br_queue_set_repeat_mode: * @queue: A #BrQueue * @mode: repeat mode * * set @queue's repeat mode * BOGNOR_QUEUE_MODE_NORMAL, * BOGNOR_QUEUE_MODE_REPEATING, * BOGNOR_QUEUE_MODE_SINGLE_REPEATING, * BOGNOR_QUEUE_MODE_SHUFFLE = 1 << 7, */ void br_queue_set_repeat_mode (BrQueue *queue, int mode) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_set_repeat_mode_async (priv->proxy, mode, async_reply, queue); } /** * br_queue_move_item: * @queue: A #BrQueue * @old_position: The position of the item to be moved * @new_position: The position where the item should be moved to * * Requests that the item at position @old_position, be moved to @new_position * in the queue represented by @queue. * * This is d */ void br_queue_move_item (BrQueue *queue, int old_position, int new_position) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_move_item_async (priv->proxy, old_position, new_position, async_reply, queue); } /** * br_queue_insert_uris: * @queue: A #BrQueue * @index: The position that the first item will be inserted * @count: The number of items to be added * @uris: An array of uris, NULL-terminated * @mimetypes: An array of mimetypes, NULL-terminated * * Requests that @count items be inserted at @index into the queue represented * by @queue. For example, if a queue exists containing 0 1 2 3, and 2 items are * added at index=2, then the queue will look like 0 a b 1 2 3 after the * operation. * * The mimetypes in @mimetypes correspond to the uris in @uris. No * checking is done on the contents of @uris for their existence or suitability * when this call is made. Bognor-Regis will ignore any invalid URIs when they * are attempted to be played. */ void br_queue_insert_uris (BrQueue *queue, int index, int count, const char **uris, const char **mimetypes) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_insert_uris_async (priv->proxy, index, count, uris, mimetypes, async_reply, queue); } static void list_uris_reply (DBusGProxy *proxy, char **OUT_uris, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueListUrisCallback cb; cb = (BrQueueListUrisCallback) (data->cb); if (error) { /* Initialise the parameters correctly */ OUT_uris = NULL; } cb (data->queue, (const char **) OUT_uris, error, data->userdata); if (error) { g_error_free (error); } else { g_strfreev (OUT_uris); } g_free (data); } /** * br_queue_list_uris: * @queue: A #BrQueue * @cb: The callback for when the data is returned * @userdata: The data passed to @cb * * Requests an array containing the uris currently in the queue represented by * @queue. This is an asychronous call and @cb will be called with @userdata * when the data is returned */ void br_queue_list_uris (BrQueue *queue, BrQueueListUrisCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_list_uris_async (priv->proxy, list_uris_reply, data); } static void get_name_reply (DBusGProxy *proxy, char *OUT_name, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetNameCallback cb; cb = (BrQueueGetNameCallback) (data->cb); if (error) { OUT_name = NULL; } cb (data->queue, (const char *) OUT_name, error, data->userdata); if (error) { g_error_free (error); } else { g_free (OUT_name); } g_free (data); } /** * br_queue_get_name: * @queue: A #BrQueue * @cb: The callback for when the name is returned * @userdata: The data to be passed to @cb * * Requests the name of the queue represented by @queue. This is an * asynchronous call, and @cb will be called with @userdata when the name is * returned */ void br_queue_get_name (BrQueue *queue, BrQueueGetNameCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_name_async (priv->proxy, get_name_reply, data); } /** * br_queue_set_position: * @queue: A #BrQueue * @position: The play position in the current item * * Requests that that play position in the current item in the queue represented * by @queue is set to @position. @position is a value in the range [0.0, 1.0] * with 0.0 representing the start of the track, and 1.0 representing the end. */ void br_queue_set_position (BrQueue *queue, double position) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_set_position_async (priv->proxy, position, async_reply, queue); } static void get_position_reply (DBusGProxy *proxy, double OUT_position, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetPositionCallback cb; cb = (BrQueueGetPositionCallback) (data->cb); if (error) { OUT_position = 0.0; } cb (data->queue, OUT_position, error, data->userdata); if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_position: * @queue: A #BrQueue * @cb: The callback for when the position is returned * @userdata: The data to be passed to @cb * * Requests the play position of the current item in the queue represented by * @queue. The position will be returned as a double in the range [0.0, 1.0] * with 0.0 representing the start of the track and 1.0 representing the end. * This is an asynchronous call and @cb will be called with @userdata when the * position is returned */ void br_queue_get_position (BrQueue *queue, BrQueueGetPositionCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_position_async (priv->proxy, get_position_reply, data); } /** * br_queue_set_mute: * @queue: A #BrQueue * @mute: to mute the playbin or not * * Requests to set playbin to mute state * @mute is a boolean * with TRUE means 'mute', FALSE means 'not mute' */ void br_queue_set_mute (BrQueue *queue, gboolean mute) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_set_mute_async (priv->proxy, mute, async_reply, queue); } static void get_mute_reply (DBusGProxy *proxy, gboolean OUT_mute, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetMuteCallback cb; cb = (BrQueueGetMuteCallback) (data->cb); if (error) { OUT_mute = 0.0; } cb (data->queue, OUT_mute, error, data->userdata); if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_mute: * @queue: A #BrQueue * @cb: The callback for when the mute status is returned * @userdata: The data to be passed to @cb * * Requests the mute status of @queue * This is an asynchronous call and @cb will be called with @userdata when the * mute is returned */ void br_queue_get_mute (BrQueue *queue, BrQueueGetMuteCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_mute_async (priv->proxy, get_mute_reply, data); } /** * br_queue_set_volume: * @queue: A #BrQueue * @volume: volume level * * Requests to set playbin volume level * audio stream volume [0.0, 10.0] * */ void br_queue_set_volume (BrQueue *queue, double volume) { BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; org_moblin_BognorRegis_Queue_set_volume_async (priv->proxy, volume, async_reply, queue); g_printf("set volume %f\n", volume); } static void get_volume_reply (DBusGProxy *proxy, double OUT_volume, GError *error, gpointer userdata) { struct _AsyncClosure *data = (struct _AsyncClosure *) userdata; BrQueueGetVolumeCallback cb; cb = (BrQueueGetVolumeCallback) (data->cb); if (error) { OUT_volume = 1.0; } cb (data->queue, OUT_volume, error, data->userdata); if (error) { g_error_free (error); } g_free (data); } /** * br_queue_get_volume: * @queue: A #BrQueue * @cb: The callback for when the volume level is returned * @userdata: The data to be passed to @cb * * Requests the volume level of @queue * This is an asynchronous call and @cb will be called with @userdata when the * volume is returned */ void br_queue_get_volume (BrQueue *queue, BrQueueGetVolumeCallback cb, gpointer userdata) { struct _AsyncClosure *data; BrQueuePrivate *priv; g_return_if_fail (IS_BR_QUEUE (queue)); priv = queue->priv; data = g_new (struct _AsyncClosure, 1); data->queue = queue; data->cb = G_CALLBACK (cb); data->userdata = userdata; org_moblin_BognorRegis_Queue_get_volume_async (priv->proxy, get_volume_reply, data); } bognor-regis/bognor-regis/br-player.c0000644000175000017500000001110011533735426020023 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "br-marshal.h" #include "br-player.h" enum { SHOW_URI, COMPLETED, CHANGED, LAST_SIGNAL }; struct _BrPlayerPrivate { gboolean can_show_video; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BR_TYPE_PLAYER, BrPlayerPrivate)) G_DEFINE_TYPE (BrPlayer, br_player, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0, }; static gboolean bognor_player_show_uri (BrPlayer *player, const char *uri, const char *mimetype, GError **error); static gboolean bognor_player_can_show_video (BrPlayer *player, gboolean *OUT_can_show_video, GError **error); #include "bognor-player-glue.h" static void br_player_finalize (GObject *object) { G_OBJECT_CLASS (br_player_parent_class)->finalize (object); } static void br_player_dispose (GObject *object) { G_OBJECT_CLASS (br_player_parent_class)->dispose (object); } static gboolean bognor_player_show_uri (BrPlayer *player, const char *uri, const char *mimetype, GError **error) { g_signal_emit (player, signals[SHOW_URI], 0, uri, mimetype); return TRUE; } static gboolean bognor_player_can_show_video (BrPlayer *player, gboolean *OUT_can_show_video, GError **error) { BrPlayerPrivate *priv = player->priv; *OUT_can_show_video = priv->can_show_video; return TRUE; } static void br_player_class_init (BrPlayerClass *klass) { GObjectClass *o_class = (GObjectClass *)klass; o_class->dispose = br_player_dispose; o_class->finalize = br_player_finalize; g_type_class_add_private (klass, sizeof (BrPlayerPrivate)); dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), &dbus_glib_bognor_player_object_info); signals[SHOW_URI] = g_signal_new ("show-uri", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, br_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals[COMPLETED] = g_signal_new ("uri-completed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); signals[CHANGED] = g_signal_new ("can-show-video-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); } static void br_player_init (BrPlayer *self) { BrPlayerPrivate *priv; self->priv = GET_PRIVATE (self); priv = self->priv; priv->can_show_video = FALSE; } void br_player_set_can_show_video (BrPlayer *player, gboolean can_show_video) { BrPlayerPrivate *priv = player->priv; priv->can_show_video = can_show_video; g_signal_emit (player, signals[CHANGED], 0, can_show_video); } void br_player_uri_completed (BrPlayer *player, const char *uri) { g_signal_emit (player, signals[COMPLETED], 0, uri); } bognor-regis/bognor-regis/br-iface-player.h0000644000175000017500000000605211533735426021107 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __BR_IFACE_PLAYER_H__ #define __BR_IFACE_PLAYER_H__ #include G_BEGIN_DECLS #define BR_TYPE_IFACE_PLAYER (br_iface_player_get_type ()) #define BR_IFACE_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BR_TYPE_IFACE_PLAYER, BrIfacePlayer)) #define BR_IFACE_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BR_TYPE_IFACE_PLAYER, BrIfacePlayerClass)) #define BR_IFACE_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BR_TYPE_IFACE_PLAYER, BrIfacePlayerClass)) typedef struct _BrIfacePlayer BrIfacePlayer; typedef struct _BrIfacePlayerClass BrIfacePlayerClass; struct _BrIfacePlayerClass { GTypeInterface base_iface; gboolean (* play) (BrIfacePlayer *player, GError **error); gboolean (* stop) (BrIfacePlayer *player, GError **error); gboolean (* set_position) (BrIfacePlayer *player, double position, GError **error); gboolean (* show_uri) (BrIfacePlayer *player, const char *uri, const char *mimetype, GError **error); gboolean (* can_show_visual) (BrIfacePlayer *player, gboolean *can_show_visual, GError **error); gboolean (* force_visual_mode) (BrIfacePlayer *player, GError **error); /* signals */ void (*can_show_visual_changed) (BrIfacePlayer *player, gboolean can_show); void (*uri_completed) (BrIfacePlayer *player, const char *uri); void (*position_changed) (BrIfacePlayer *player, double position); }; GType br_iface_player_get_type (void); void br_iface_player_emit_uri_completed (BrIfacePlayer *player, const char *uri); void br_iface_player_emit_can_show_visual_changed (BrIfacePlayer *player, gboolean can_show); void br_iface_player_emit_position_changed (BrIfacePlayer *player, double position); G_END_DECLS #endif bognor-regis/bognor-regis/Makefile.am0000644000175000017500000000372711533735426020036 0ustar paulliupaulliulib_LTLIBRARIES = libbognor-regis-@BOGNOR_MAJORMINOR@.la BUILT_SOURCES = \ br-marshal.c \ br-marshal.h \ br-iface-player-glue.h \ bognor-queue-bindings.h libbognor_regis_@BOGNOR_MAJORMINOR@_la_SOURCES = \ $(BUILT_SOURCES) \ br-iface-player.c \ br-queue.c libbognor_regis_@BOGNOR_MAJORMINOR@_la_CFLAGS = \ -I$(top_srcdir) \ -I$(top_builddir) \ $(BOGNOR_REGIS_CFLAGS) libbognor_regis_@BOGNOR_MAJORMINOR@_la_LIBADD = \ $(BOGNOR_REGIS_LIBS) bognor_regis_headers = \ br-iface-player.h \ br-queue.h libbognor_regis_includedir = $(includedir)/bognor-regis-@BOGNOR_MAJORMINOR@/bognor libbognor_regis_include_HEADERS = \ $(bognor_regis_headers) if HAVE_QUEUE_CONFIG schemadir = @GCONF_SCHEMA_FILE_DIR@ schema_DATA = bognor-regis.schemas endif if GCONF_SCHEMAS_INSTALL install-data-local: GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA) else install-data-local: endif CLEANFILES = $(BUILT_SOURCES) \ stamp-br-iface-player-glue.h \ stamp-bognor-queue-bindings.h %-bindings.h: stamp-%-bindings.h @true stamp-bognor-queue-bindings.h: ../interfaces/BognorQueue.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --mode=glib-client --prefix=bognor_queue $< > xgen-$(@F) \ && (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \ && rm -f xgen-$(@F) \ && echo timestamp > $(@F) %-glue.h: stamp-%-glue.h @true stamp-br-iface-player-glue.h: ../interfaces/BognorPlayer.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --mode=glib-server --prefix=br_iface_player $< > xgen-$(@F) \ && (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \ && rm -f xgen-$(@F) \ && echo timestamp > $(@F) br-marshal.h: br-marshal.list $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=br_marshal > $@ br-marshal.c: br-marshal.list $(AM_V_GEN)echo "#include \"br-marshal.h\"" > $@ \ && $(GLIB_GENMARSHAL) $< --body --prefix=br_marshal >> $@ MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST=$(schema_DATA) br-marshal.list bognor-regis/bognor-regis/br-iface-player.c0000644000175000017500000001416111533735426021102 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include "br-iface-player.h" enum { COMPLETED, CHANGED, POSITION_CHANGED, LAST_SIGNAL }; static guint32 signals[LAST_SIGNAL] = {0, }; static gboolean br_iface_player_play (BrIfacePlayer *player, GError **error); static gboolean br_iface_player_stop (BrIfacePlayer *player, GError **error); static gboolean br_iface_player_set_position (BrIfacePlayer *player, double position, GError **error); static gboolean br_iface_player_show_uri (BrIfacePlayer *player, const char *uri, const char *mimetype, GError **error); static gboolean br_iface_player_can_show_visual (BrIfacePlayer *player, gboolean *can_show_visual, GError **error); static gboolean br_iface_player_force_visual_mode (BrIfacePlayer *player, GError **error); #include "br-iface-player-glue.h" static void br_iface_player_base_init (gpointer klass) { static gboolean initialized = FALSE; if (initialized) { return; } initialized = TRUE; signals[COMPLETED] = g_signal_new ("uri-completed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); signals[CHANGED] = g_signal_new ("can-show-visual-changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[POSITION_CHANGED] = g_signal_new ("position-changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__DOUBLE, G_TYPE_NONE, 1, G_TYPE_DOUBLE); dbus_g_object_type_install_info (br_iface_player_get_type (), &dbus_glib_br_iface_player_object_info); } GType br_iface_player_get_type (void) { static GType type = 0; if (!type) { const GTypeInfo info = { sizeof (BrIfacePlayerClass), br_iface_player_base_init, NULL, }; type = g_type_register_static (G_TYPE_INTERFACE, "BrIfacePlayer", &info, 0); } return type; } static gboolean br_iface_player_play (BrIfacePlayer *player, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->play (player, error); } static gboolean br_iface_player_stop (BrIfacePlayer *player, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->stop (player, error); } static gboolean br_iface_player_set_position (BrIfacePlayer *player, double position, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->set_position (player, position, error); } static gboolean br_iface_player_show_uri (BrIfacePlayer *player, const char *uri, const char *mimetype, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->show_uri (player, uri, mimetype, error); } static gboolean br_iface_player_can_show_visual (BrIfacePlayer *player, gboolean *can_show_visual, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->can_show_visual (player, can_show_visual, error); } static gboolean br_iface_player_force_visual_mode (BrIfacePlayer *player, GError **error) { return BR_IFACE_PLAYER_GET_CLASS (player)->force_visual_mode (player, error); } void br_iface_player_emit_uri_completed (BrIfacePlayer *player, const char *uri) { g_signal_emit (player, signals[COMPLETED], 0, uri); } void br_iface_player_emit_can_show_visual_changed (BrIfacePlayer *player, gboolean can_show) { g_signal_emit (player, signals[CHANGED], 0, can_show); } void br_iface_player_emit_position_changed (BrIfacePlayer *player, double position) { g_signal_emit (player, signals[POSITION_CHANGED], 0, position); } bognor-regis/bognor-regis/br-marshal.list0000644000175000017500000000010411533735426020711 0ustar paulliupaulliuVOID:STRING,INT VOID:STRING,STRING VOID:INT,DOUBLE VOID:INT,INT,INT bognor-regis/bognor-regis/.gitignore0000644000175000017500000000020411533735426017755 0ustar paulliupaulliubognor-queue-bindings.h br-iface-player-glue.h br-marshal.c br-marshal.h stamp-bognor-queue-bindings.h stamp-br-iface-player-glue.h bognor-regis/bognor-regis/br-queue.h0000644000175000017500000002251111533735426017670 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __BR_QUEUE_H__ #define __BR_QUEUE_H__ #include G_BEGIN_DECLS #define BR_TYPE_QUEUE \ (br_queue_get_type()) #define BR_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BR_TYPE_QUEUE, \ BrQueue)) #define BR_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BR_TYPE_QUEUE, \ BrQueueClass)) #define IS_BR_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BR_TYPE_QUEUE)) #define IS_BR_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BR_TYPE_QUEUE)) #define BR_QUEUE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BR_TYPE_QUEUE, \ BrQueueClass)) #define BR_QUEUE_DBUS_INTERFACE "org.moblin.BognorRegis.Queue" #define BR_QUEUE_INDEX_END -1 typedef enum _BrQueueState { BR_QUEUE_STATE_STOPPED, BR_QUEUE_STATE_PLAYING, } BrQueueState; typedef struct _BrQueuePrivate BrQueuePrivate; typedef struct _BrQueue BrQueue; typedef struct _BrQueueClass BrQueueClass; typedef void (*BrQueueListUrisCallback) (BrQueue *queue, const char **uris, const GError *error, gpointer userdata); typedef void (*BrQueueGetIndexCallback) (BrQueue *queue, int index, const GError *error, gpointer userdata); typedef void (*BrQueueGetMetadataCallback) (BrQueue *queue, const char *title, const char *artist, const char *album, const GError *error, gpointer userdata); typedef void (*BrQueueGetNameCallback) (BrQueue *queue, const char *name, const GError *error, gpointer userdata); typedef void (*BrQueueGetPositionCallback) (BrQueue *queue, double position, const GError *error, gpointer userdata); typedef void (*BrQueueGetMuteCallback) (BrQueue *queue, gboolean mute, const GError *error, gpointer userdata); typedef void (*BrQueueGetVolumeCallback) (BrQueue *queue, double volume, const GError *error, gpointer userdata); typedef void (*BrQueueGetStateCallback) (BrQueue *queue, BrQueueState state, const GError *error, gpointer userdata); typedef void (*BrQueueGetIndexUriCallback) (BrQueue *queue, const char *uri, const char *mimetype, const GError *error, gpointer userdata); typedef void (*BrQueueGetDurationCallback) (BrQueue *queue, int duration_in_sec, const GError *error, gpointer userdata); typedef void (*BrQueueGetRepeatModeCallback) (BrQueue *queue, const int repeat_mode, const GError *error, gpointer userdata); struct _BrQueue { GObject parent; BrQueuePrivate *priv; }; struct _BrQueueClass { GObjectClass parent_class; }; GType br_queue_get_type (void) G_GNUC_CONST; BrQueue *br_queue_new (const char *service_name, const char *object_path); BrQueue *br_queue_new_local (void); void br_queue_play (BrQueue *queue); void br_queue_stop (BrQueue *queue); void br_queue_next (BrQueue *queue); void br_queue_previous (BrQueue *queue); void br_queue_set_position (BrQueue *queue, double position); void br_queue_get_position (BrQueue *queue, BrQueueGetPositionCallback cb, gpointer userdata); void br_queue_set_mute (BrQueue *queue, gboolean mute); void br_queue_get_mute (BrQueue *queue, BrQueueGetMuteCallback cb, gpointer userdata); void br_queue_set_volume (BrQueue *queue, double volume); void br_queue_get_volume (BrQueue *queue, BrQueueGetVolumeCallback cb, gpointer userdata); void br_queue_get_state (BrQueue *queue, BrQueueGetStateCallback cb, gpointer userdata); void br_queue_set_index (BrQueue *queue, int index); void br_queue_get_index (BrQueue *queue, BrQueueGetIndexCallback cb, gpointer userdata); void br_queue_get_index_metadata (BrQueue *queue, int index, BrQueueGetMetadataCallback cb, gpointer userdata); void br_queue_get_next_metadata (BrQueue *queue, BrQueueGetMetadataCallback cb, gpointer userdata); void br_queue_get_duration (BrQueue *queue, BrQueueGetDurationCallback cb, gpointer userdata); void br_queue_get_repeat_mode (BrQueue *queue, BrQueueGetRepeatModeCallback cb, gpointer userdata); void br_queue_set_repeat_mode(BrQueue *queue, int mode); void br_queue_get_index_uri (BrQueue *queue, int index, BrQueueGetIndexUriCallback cb, gpointer userdata); void br_queue_append_uris (BrQueue *queue, int count, const char **uri, const char **mimetype); void br_queue_insert_uris (BrQueue *queue, int index, int count, const char **uri, const char **mimetype); void br_queue_remove_range (BrQueue *queue, int index, int count); void br_queue_move_item (BrQueue *queue, int old_position, int new_position); void br_queue_list_uris (BrQueue *queue, BrQueueListUrisCallback cb, gpointer userdata); void br_queue_get_name (BrQueue *queue, BrQueueGetNameCallback cb, gpointer userdata); G_END_DECLS #endif /* __BR_QUEUE_H__ */ bognor-regis/autogen.sh0000755000175000017500000000020511533735426015372 0ustar paulliupaulliu#! /bin/sh #gtkdocize || exit 1 intltoolize --force || die "intltoolize failed" autoreconf -v --install || exit 1 ./configure "$@" bognor-regis/Makefile.am0000644000175000017500000000041211533735426015425 0ustar paulliupaulliuSUBDIRS = src bognor-regis examples data po scpd ACLOCAL_AMFLAGS = -I m4 DIST_SUBDIRS = src bognor-regis examples data interfaces po scpd MAINTAINERCLEANFILES = aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh Makefile.in missing bognor-regis/configure.ac0000644000175000017500000000766411533735426015677 0ustar paulliupaulliu# bognor package version number, (as distinct from shared library version) # An odd micro number indicates in-progress developmen # An even micro number indicates a released version. m4_define(bognor_major_version, 0) m4_define(bognor_minor_version, 6) m4_define(bognor_micro_version, 12) m4_define([bognor_version], [bognor_major_version.bognor_minor_version.bognor_micro_version]) m4_define([bognor_api_version], [bognor_major_version.bognor_minor_version]) # increase the interface age for each release; if the API changes, set to 0 m4_define([bognor_interface_age], [0]) m4_define([bognor_binary_age], [m4_eval(100 * bognor_minor_version + bognor_micro_version)]) AC_PREREQ(2.53) AC_INIT([bognor-regis], [bognor_version], [http://bugzilla.moblin.org]) AC_CONFIG_SRCDIR(src/bognor-queue.c) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE([1.9]) AM_CONFIG_HEADER([config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) GETTEXT_PACKAGE=bognor-regis AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [The gettext package name]) IT_PROG_INTLTOOL([0.34.90]) BOGNOR_MAJOR_VERSION=bognor_major_version BOGNOR_MINOR_VERSION=bognor_minor_version BOGNOR_MICRO_VERSION=bognor_micro_version BOGNOR_VERSION=bognor_version BOGNOR_API_VERSION=bognor_api_version BOGNOR_MAJORMINOR=bognor_api_version AC_SUBST(BOGNOR_MAJOR_VERSION) AC_SUBST(BOGNOR_MINOR_VERSION) AC_SUBST(BOGNOR_MICRO_VERSION) AC_SUBST(BOGNOR_VERSION) AC_SUBST(BOGNOR_API_VERSION) AC_SUBST(BOGNOR_MAJORMINOR) m4_define([lt_current], [m4_eval(100 * bognor_minor_version + bognor_micro_version - bognor_interface_age)]) m4_define([lt_revision], [bognor_interface_age]) m4_define([lt_age], [m4_eval(bognor_binary_age - bognor_interface_age)]) BOGNOR_LT_CURRENT=lt_current BOGNOR_LT_REV=lt_revision BOGNOR_LT_AGE=lt_age BOGNOR_LT_VERSION="$BOGNOR_LT_CURRENT:$BOGNOR_LT_REV:$BOGNOR_LT_AGE" BOGNOR_LT_LDFLAGS="-version-info $BOGNOR_LT_VERSION" AC_SUBST(BOGNOR_LT_VERSION) AC_SUBST(BOGNOR_LT_LDFLAGS) AC_PROG_CC AM_PROG_CC_C_O AM_PROG_LIBTOOL AC_ARG_ENABLE(queue-config, AC_HELP_STRING([--enable-queue-config],[Build with configurable queue service]), enable_queue_config="$enableval", enable_queue_config=no) gconf_pkg= if test "x$enable_queue_config" = "xyes" ; then AC_DEFINE(USE_QUEUE_CONFIG, 1, [Build with configurable queue service]) AC_PATH_PROG(GCONFTOOL, gconftool-2, no) if test x"$GCONFTOOL" = xno; then AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf]) fi AM_GCONF_SOURCE_2 gconf_pkg=gconf-2.0 else GCONF_SCHEMAS_INSTALL_TRUE='#' GCONF_SCHEMAS_INSTALL_FALSE= fi AM_CONDITIONAL(HAVE_QUEUE_CONFIG, test "x$enable_queue_config" = "xyes") PKG_CHECK_MODULES(BOGNOR, gtk+-2.0 glib-2.0 dbus-glib-1 gio-2.0 libnotify tracker-client-0.9 gupnp-1.0 >= 0.13.0 gupnp-av-1.0 >= 0.5) PKG_CHECK_MODULES(BOGNOR_REGIS, glib-2.0 dbus-glib-1 $gconf_pkg) PKG_CHECK_MODULES(CLIENT, gio-2.0) AC_ARG_ENABLE(helix, AC_HELP_STRING([--enable-helix], [enable helix support]), [enable_helix=${enableval}], [enable_helix="no"]) AS_IF([test "${enable_helix}" = "yes"], [ PKG_CHECK_MODULES(HELIX, hxclient) AC_SUBST(HELIX_CFLAGS) AC_SUBST(HELIX_LIBS) AC_DEFINE(ENABLE_HELIX, [1], [Use Helix Client]) ], [ PKG_CHECK_MODULES(GST, gstreamer-0.10) AC_SUBST(GST_CFLAGS) AC_SUBST(GST_LIBS) AC_DEFINE(ENABLE_GST, [1], [Use Gstreamer Media Framework]) ]) AM_CONDITIONAL(HELIX, test "${enable_helix}" = "yes") AM_CONDITIONAL(GST, test "${enable_helix}" = "no") AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool) DBUS_SERVICES_DIR="${datadir}/dbus-1/services" AC_SUBST(DBUS_SERVICES_DIR) AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) AS_ALL_LINGUAS AC_OUTPUT([ Makefile src/Makefile bognor-regis/Makefile examples/Makefile po/Makefile.in data/Makefile data/bognor-regis.pc interfaces/Makefile scpd/Makefile ]) bognor-regis/data/0000755000175000017500000000000011533735426014305 5ustar paulliupaulliubognor-regis/data/bognor-regis.pc.in0000644000175000017500000000053711533735426017640 0ustar paulliupaulliuprefix=@prefix@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: bognor-regis Description: Bognor-Regis is a media playing daemon thing Version: @VERSION@ Requires: glib-2.0 >= 2.14 gobject-2.0 dbus-glib-1 Libs: -L${libdir} -lbognor-regis-@BOGNOR_MAJORMINOR@ Cflags: -I${includedir}/bognor-regis-@BOGNOR_MAJORMINOR@ bognor-regis/data/Makefile.am0000644000175000017500000000121711533735426016342 0ustar paulliupaulliuservicedir = $(DBUS_SERVICES_DIR) service_in_files = org.moblin.BognorRegis.service.in service_DATA = $(service_in_files:.service.in=.service) org.moblin.BognorRegis.service: org.moblin.BognorRegis.service.in @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ bognor-regis-@BOGNOR_MAJORMINOR@.pc: bognor-regis.pc @cp -f bognor-regis.pc bognor-regis-@BOGNOR_MAJORMINOR@.pc pkgconfig_DATA = bognor-regis-@BOGNOR_MAJORMINOR@.pc pkgconfigdir = $(libdir)/pkgconfig EXTRA_DIST = org.moblin.BognorRegis.service.in \ bognor-regis.pc.in CLEANFILES = org.moblin.BognorRegis.service \ bognor-regis-@BOGNOR_MAJORMINOR@.pc MAINTAINERCLEANFILES = Makefile.in bognor-regis/data/org.moblin.BognorRegis.service.in0000644000175000017500000000012211533735426022554 0ustar paulliupaulliu[D-BUS Service] Name=org.moblin.BognorRegis Exec=@libexecdir@/bognor-regis-daemon bognor-regis/data/.gitignore0000644000175000017500000000006011533735426016271 0ustar paulliupaulliubognor-regis*.pc org.moblin.BognorRegis.service bognor-regis/po/0000755000175000017500000000000011533735426014012 5ustar paulliupaulliubognor-regis/po/th.po0000644000175000017500000000247011533735426014770 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: bogor\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: 2009-08-19 14:02+0700\n" "Last-Translator: Anuchit Chalothorn \n" "Language-Team: Thai \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Thai\n" "X-Poedit-Country: THAILAND\n" #: ../src/bognor-local-queue-gst.c:361 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "ลำดับการเล่น" #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "ไม่สามารถเล่นได้" #: ../src/bognor-queue.c:721 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "เสียใจด้วย เราไม่สามารถเล่น %s เพราะเราไม่มีปลักอินที่ถูกต้อง คุณควรลองค้นหา ❝gstreamer codecs❞ จากเว็บ" bognor-regis/po/eu.po0000644000175000017500000000214311533735426014763 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Mikel Pascual Aldabaldetreku , 2009. # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: 2009-10-14 14:51+0100\n" "Last-Translator: Mikel Pascual Aldabaldetreku \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "Erreprodukzio-zerrenda" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "Lastima, ezin dugu %s erreproduzitu, ez daukagu-eta plugin egokia. " "❝gstreamer codec❞-ak bilatu beharko zenituzke interneten." #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "Ezin dugu hau erreproduzitu" bognor-regis/po/ru.po0000644000175000017500000000256611533735426015011 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-05-03 09:32+0000\n" "PO-Revision-Date: \n" "Last-Translator: Alexander Mineev \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Russian\n" "X-Poedit-Country: Russia\n" #: ../src/bognor-local-queue-gst.c:386 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Список для воспроизведения" #: ../src/bognor-queue.c:285 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "" "К сожалению, файл %s не возможно воспроизвести по причине отсутствия нужного " "плагина." #: ../src/bognor-queue.c:287 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "К сожалению, файл %s не возможно воспроизвести по причине отсутствия нужного " "кодека. Вы можете попробовать найти ❝кодеки gstreamer❞ в Интернете." #: ../src/bognor-queue.c:291 msgid "We can't play this" msgstr "Невозможно вопроизвести " bognor-regis/po/it.po0000644000175000017500000000242011533735426014764 0ustar paulliupaulliu# Italian translation of bognor-regis. # Copyright (C) 2009 the bognor-regis copyright holder # This file is distributed under the same license as the bognor-regis package. # Milo Casagrande , 2009 # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: 2009-09-04 16:17-0800\n" "Last-Translator: GLS\n" "Language-Team: Itaian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Riproduzione" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Impossibile riprodurre %s poiché non è disponibile il plugin corretto. È possibile eseguire una ricerca per «gstreamer codecs» sul web." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Impossibile riprodurre questo" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Impossibile riprodurre %s poiché non è disponibile il plugin corretto." bognor-regis/po/sl.po0000644000175000017500000000210511533735426014766 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: 2009-12-12 10:08+0100\n" "Last-Translator: Boštjan Pišler \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:361 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Predvajalna vrsta" #: ../src/bognor-queue.c:721 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Ne morem predvajati %s saj manjkajo potrebni vtičniki. Lahko poizkusite poiskati ❝gstreamer codecs❞ na spletu." #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "Tega ne morem predvajati" bognor-regis/po/fi.po0000644000175000017500000000215411533735426014752 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-26 03:41+0000\n" "PO-Revision-Date: \n" "Last-Translator: Omar Antila \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: Finnish\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Soittojono" #: ../src/bognor-queue.c:223 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Kohdetta '%s' ei voi soittaa, koska tarvittava liitännäinen puuttuu. Voisit yritää etsiä verkossa ❝gstreamer codecs❞." #: ../src/bognor-queue.c:227 msgid "We can't play this" msgstr "Tätä ei voi soittaa" #: ../src/bognor-queue.c:221 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Kohdetta '%s' ei voi toistaa, koska tarvittava laajennus puuttuu. " bognor-regis/po/wa.po0000644000175000017500000000254111533735426014763 0ustar paulliupaulliu# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Jean Cayron , 2009. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-17 09:32+0000\n" "PO-Revision-Date: 2009-10-03 21:02+0000\n" "Last-Translator: Jean Cayron \n" "Language-Team: Walloon \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Lokalize 1.0\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Djouwer cawêye" #: ../src/bognor-queue.c:231 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Dji rgrete, nos n' savans djouwer %s paski ns n' avans nén l' bon tchôke-divins. Vos pôrîz sayî d' cachî après ❝gstreamer codecs❞ sol waibe." #: ../src/bognor-queue.c:235 msgid "We can't play this" msgstr "Nos n' savans nén djouwer çouci" #: ../src/bognor-queue.c:229 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Dji rgrete, nos n' savans djouwer %s paski ns n' avans nén l' bon tchôke-divins." bognor-regis/po/ms.po0000644000175000017500000000142511533735426014773 0ustar paulliupaulliumsgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: \n" "Last-Translator: Mohamad Elrashidin Bin Sajeli \n" "Language-Team: Malaysia\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Malay\n" "X-Poedit-Country: MALAYSIA\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "Senarai putar" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "" bognor-regis/po/en_GB.po0000644000175000017500000000263011533735426015325 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: Moblin Bognor Regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-26 03:41+0000\n" "PO-Revision-Date: 2009-11-19 15:59-0800\n" "Last-Translator: Margie Foster \n" "Language-Team: British English \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: English\n" "X-Poedit-SourceCharset: utf-8\n" "X-Poedit-Country: UNITED KINGDOM\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Playqueue" #: ../src/bognor-queue.c:223 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." #: ../src/bognor-queue.c:227 msgid "We can't play this" msgstr "We can't play this" #: ../src/bognor-queue.c:221 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Sorry, we can't play %s, as we don't have the correct plugin. " bognor-regis/po/POTFILES.in0000644000175000017500000000020711533735426015566 0ustar paulliupaulliusrc/bognor-local-queue-gst.c src/bognor-local-queue-helix.c src/bognor-queue.c # List of source files containing translatable strings. bognor-regis/po/pt_BR.po0000644000175000017500000000242211533735426015360 0ustar paulliupaulliu# GLS_PTB , 2009. # Og Maciel , 2009. # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-04-28 09:34+0000\n" "PO-Revision-Date: 2009-11-09 14:10-0500\n" "Last-Translator: Og Maciel \n" "Language-Team: Moblin \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: Portuguese\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:386 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Lista de reprodução" #: ../src/bognor-queue.c:285 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "" "Desculpe, não podemos reproduzir %s porque não temos o plugin correto. " #: ../src/bognor-queue.c:287 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "Desculpe, não podemos reproduzir %s porque não temos o plug-in correto. " "Tente procurar por \"gstreamer codecs\" na web." #: ../src/bognor-queue.c:291 msgid "We can't play this" msgstr "Não é possível reproduzir isso" bognor-regis/po/uk.po0000644000175000017500000000202711533735426014772 0ustar paulliupaulliumsgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: \n" "Last-Translator: Oleksii Baranov \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Ukrainian\n" "X-Poedit-Country: Ukraine\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "Плейлист" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "На жаль, ми не можемо грати %s, тому що в нас немає потрібного плагіну. Ви " "можете спробувати пошукати ❝кодеки gstreamer❞ в Інтернеті." #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "Ми не можемо грати це. " bognor-regis/po/tr.po0000644000175000017500000000235111533735426015000 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: Ceyhun Alyesil \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Oynatım sırası" #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Bunu oynatamıyoruz" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Üzgünüz, %s dosyasını oynatamıyoruz çünkü doğru eklenti yok.İnternet üzerinde ❝gstreamer codecs❝ kelimesini aratabilirsiniz." #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Üzgünüz, %s dosyasını oynatamıyoruz çünkü doğru eklenti yok." bognor-regis/po/gl.po0000644000175000017500000000247011533735426014757 0ustar paulliupaulliu# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Xosé , 2009. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: 2009-09-16 16:33+0200\n" "Last-Translator: Xosé \n" "Language-Team: Galego \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Lokalize 1.0\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Lista de reprodución" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Desculpe, non podemos reproducir %s porque non temos o engadido correcto. Pode tentar procurando por \"gstreamer codecs\" na web." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Isto non se pode reproducir" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Desculpe, non podemos reproducir %s porque non temos o engadido correcto." bognor-regis/po/id.po0000644000175000017500000000241511533735426014750 0ustar paulliupaulliu# Translation of bognor-regis to Indonesian. # Copyright (C) 2009 Andika Triwidada # This file is distributed under the same license as the PACKAGE package. # Andika Triwidada , 2009. msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-10 10:28+0000\n" "PO-Revision-Date: 2009-08-25 17:13+0700\n" "Last-Translator: Andika Triwidada \n" "Language-Team: Indonesian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Antrian main" #: ../src/bognor-queue.c:231 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Maaf, kami tak bisa mainkan %s, karena kami tak punya plugin yang cocok. Anda dapat mencoba mencari \"gstreamer codecs\" di web." #: ../src/bognor-queue.c:235 msgid "We can't play this" msgstr "Kami tak bisa mainkain ini" #: ../src/bognor-queue.c:229 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Maaf, kami tak bisa mainkan %s, karena kami tak punya plugin yang cocok." bognor-regis/po/sk.po0000644000175000017500000000244211533735426014771 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Tomáš Virgl , 2010. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-04-19 09:36+0000\n" "PO-Revision-Date: 2010-04-20 18:12+0200\n" "Last-Translator: Tomáš Virgl \n" "Language-Team: slovak \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:386 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Playlist" #: ../src/bognor-queue.c:285 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "" "Prepáčte, ale %s nemôžeme prehrať, pretože nemáme správny zásuvný modul." #: ../src/bognor-queue.c:287 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "Prepáčte, ale %s nemôžeme prehrať, pretože nemáme správny zásuvný modul. " "Skúste vyhľadať ❝gstreamer codecs❞ na webe." #: ../src/bognor-queue.c:291 msgid "We can't play this" msgstr "Nie je možné prehrať" bognor-regis/po/nl.po0000644000175000017500000000244611533735426014771 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-04-28 09:34+0000\n" "PO-Revision-Date: 2009-08-14 14:10-0800\n" "Last-Translator: Auke Kok \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Dutch\n" #: ../src/bognor-local-queue-gst.c:386 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Afspeellijst" #: ../src/bognor-queue.c:285 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Sorry, %s kan niet gespeeld worden, geen correcte plugin gevonden." #: ../src/bognor-queue.c:287 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "Sorry, %s kan niet gespeeld worden, geen correcte plugin gevonden. Je kunt " "proberen te zoeken naar ❝gstreamer codecs❞ op het internet." #: ../src/bognor-queue.c:291 msgid "We can't play this" msgstr "Kan dit niet afspelen" bognor-regis/po/zh_TW.po0000644000175000017500000000214411533735426015406 0ustar paulliupaulliumsgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: Cheng-Chia Tseng \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Chinese\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "播放佇列" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "抱歉,由於我們沒有正確的外掛程式,所以我們無法播放 %s。" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "抱歉,由於我們沒有正確的外掛程式,所以我們無法播放 %s。你可以嘗試在網路上搜尋 ❝gstreamer codecs❞。" #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "我們無法播放它" bognor-regis/po/ca.po0000644000175000017500000000212611533735426014736 0ustar paulliupaulliu# Bognor Catalan translation. # Copyright (C) 2009 Free Software Foundation, Inc. # This file is distributed under the same license as the Bognor package. # Gil Forcada , 2009. # msgid "" msgstr "" "Project-Id-Version: Bognor 2.x\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: 2009-08-15 18:45+0200\n" "Last-Translator: Gil Forcada \n" "Language-Team: Catalan \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "Cua de reproducció" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "No es pot reproduir %s ja que no hi ha el connector necessari. Podeu mirar " "de buscar «gstreamer codecs» per Internet." #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "No es pot reproduir" bognor-regis/po/ja.po0000644000175000017500000000213711533735426014747 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-27 10:38+0000\n" "PO-Revision-Date: \n" "Last-Translator: takashi \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Japanese\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "プレイキュー" #: ../src/bognor-queue.c:221 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "適切なプラグインがないので、%s を再生できません。" #: ../src/bognor-queue.c:223 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "適切なプラグインがないので、%s を再生できません。Web 上で ❝gstreamer codecs❞ を検索してください。" #: ../src/bognor-queue.c:227 msgid "We can't play this" msgstr "再生できません" bognor-regis/po/ast.po0000644000175000017500000000202611533735426015141 0ustar paulliupaulliumsgid "" msgstr "" "Project-Id-Version: bognor-regis.master.ast\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: \n" "Last-Translator: astur \n" "Language-Team: asturian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: asturian\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:361 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Llista de reproducción" #: ../src/bognor-queue.c:721 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Sentímoslo, nun podemos reproducir %s, porque nun tenemos el plugin correutu. Puedes intentar guetar ❝gstreamer codecs❞ na web." #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "Nun puede reproducise" #~ msgid "El mio repertoriu" #~ msgstr "Llista de reproducción" bognor-regis/po/sv.po0000644000175000017500000000221511533735426015002 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-10 10:28+0000\n" "PO-Revision-Date: \n" "Last-Translator: Annika Olsson \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: Swedish\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Spelkö" #: ../src/bognor-queue.c:231 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Det går inte att spela %s eftersom vi inte har tillgång till rätt pluginmodul. Försök med att söka efter ❝gstreamer codecs❞ på internet." #: ../src/bognor-queue.c:235 msgid "We can't play this" msgstr "Kan inte spela detta" #: ../src/bognor-queue.c:229 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Det går inte att spela %s eftersom vi inte har tillgång till rätt pluginmodul." bognor-regis/po/hu.po0000644000175000017500000000230511533735426014766 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: 2009-12-22 22:48+0100\n" "Last-Translator: Gergely Lónyai \n" "Language-Team: Hungarian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Hungarian\n" "X-Poedit-Country: HUNGARY\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:361 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Lejátszási lista" #: ../src/bognor-queue.c:721 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Bocsi, de a %s nem lejátszható, mert nem találok hozzá megfelelő plugint. Próbálj találni hozzá megfelelő ❝gstreamer codecs❞-et a weben." #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "Ez nem lejátszható" bognor-regis/po/pa.po0000644000175000017500000000251411533735426014754 0ustar paulliupaulliu# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # A S Alam , 2009. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: 2009-09-04 06:41+0530\n" "Last-Translator: A S Alam \n" "Language-Team: Punjabi/Panjabi \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 1.0\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "ਪਲੇਅ-ਕਤਾਰ" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "ਅਫਸੋਸ, ਅਸੀਂ %s ਚਲਾ ਨਹੀਂ ਸਕਦੇ, ਕਿਉਂਕਿ ਸਾਡੇ ਕੋਲ ਢੁੱਕਵੀਂ ਪਲੱਗਇਨ ਨਹੀਂ ਹੈ। ਤੁਸੀਂ ਵੈੱਬ ਉੱਤੇ " "❝gstreamer codecs❞ ਲਈ ਖੋਜ ਕਰ ਸਕਦੇ ਹੋ।" #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "ਅਸੀਂ ਇਹ ਚਲਾ ਨਹੀਂ ਸਕਦੇ" bognor-regis/po/de.po0000644000175000017500000000217011533735426014742 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: GLSDEU_Andreas \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: German\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Playliste" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Leider können wir %s nicht abspielen, da wir nicht das passende Plugin haben. Du könntest versuchen, im Internet nach ❝gstreamer codecs❞ zu suchen." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Das können wir nicht abspielen" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Leider können wir %s nicht abspielen, da wir nicht das passende Plugin haben. " bognor-regis/po/.gitignore0000644000175000017500000000007511533735426016004 0ustar paulliupaulliu*.gmo .intltool-merge-cache POTFILES stamp-it Makefile.in.in bognor-regis/po/es.po0000644000175000017500000000224011533735426014757 0ustar paulliupaulliumsgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: GLS_ESPX \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Spanish\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Lista de reproducción" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Lo sentimos, no podemos reproducir %s, pues no tenemos el plugin correcto." #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Lo sentimos, no podemos reproducir %s, pues no tenemos el plugin correcto. Puedes intentar buscar ❝gstreamer codecs❞ en la web." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "No podemos reproducirlo" #~ msgid "Mi repertorio" #~ msgstr "Lista de reproducción" bognor-regis/po/bn_IN.po0000644000175000017500000000254011533735426015340 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # sankarshan mukhopadhyay , 2009. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: 2009-12-12 10:32+0530\n" "Last-Translator: sankarshan mukhopadhyay \n" "Language-Team: anubad@lists.ankur.org.in\n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Virtaal 0.4.1\n" #: ../src/bognor-local-queue-gst.c:361 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "প্লেকিউ" #: ../src/bognor-queue.c:721 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "সঠিক প্লাগ-ইন অনুপস্থিত থাকার কারণে %s বাজানো সম্ভব নয়। আপনি ওয়েব-এ " "❝gstreamer codecs❞ খুঁজে নিন।" #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "এটি বাজানো সম্ভব নয়" bognor-regis/po/ar.po0000644000175000017500000000224711533735426014761 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-11-09 19:10+0000\n" "PO-Revision-Date: 2009-11-16 12:06+0200\n" "Last-Translator: Yousef Abu Al Naser \n" "Language-Team: ITSOFTEX \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Arabic\n" #: ../src/bognor-local-queue-gst.c:361 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "قائمة التشغيل" #: ../src/bognor-queue.c:721 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "نأسف، لايمكننا تشغيل %s، لاننا لا نملك المكوّن الاضافي. يمكنك البحث عن gstreamer codecs في الشبكة." #: ../src/bognor-queue.c:724 msgid "We can't play this" msgstr "لا يمكننا تشغيل هذا" bognor-regis/po/ko.po0000644000175000017500000000225211533735426014764 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-01 10:33+0000\n" "PO-Revision-Date: \n" "Last-Translator: GLSKOR_Sook \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: Korean\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "재생줄" #: ../src/bognor-queue.c:223 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "죄송합니다. 적절한 플러그인이 없어서 %s(을)를 재생할 수 없습니다. 웹사이트에서 \"gstreamer codecs\"를 찾아보십시오." #: ../src/bognor-queue.c:227 msgid "We can't play this" msgstr "재생할 수 없습니다." #: ../src/bognor-queue.c:221 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "죄송합니다. 적절한 플러그인이 없어서 %s(을)를 재생할 수 없습니다." bognor-regis/po/ro.po0000644000175000017500000000235311533735426014775 0ustar paulliupaulliu# Romanian translations for bognor-regis package. # Copyright (C) 2009 The bognor-regis copyright holder # This file is distributed under the same license as the bognor-regis package. # Cosmin Bordeianu , 2009. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-10-28 15:16+0000\n" "PO-Revision-Date: 2009-08-25 05:28+0200\n" "Last-Translator: Cosmin Bordeianu \n" "Language-Team: Moblin Romania \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Romanian\n" "X-Poedit-Country: ROMANIA\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:357 ../src/bognor-local-queue-helix.c:329 msgid "Playqueue" msgstr "Lista de așteptare" #: ../src/bognor-queue.c:695 #, c-format msgid "" "Sorry, we can't play %s, as we don't have the correct plugin. You could try " "searching for ❝gstreamer codecs❞ on the web." msgstr "" "Ne pare rău dar se poate reda %s, pentru ca nu există plugin-ul corect. Ați " "putea încerca să căutaţi ❝gstreamer codecs❞ pe internet." #: ../src/bognor-queue.c:698 msgid "We can't play this" msgstr "Nu se poate reda" bognor-regis/po/cs.po0000644000175000017500000000242111533735426014756 0ustar paulliupaulliu# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: 2010-02-07 14:54+0100\n" "Last-Translator: Petr Novák \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Playlist" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Je nám líto, ale %s nemůžeme přehrát, protože nemáme správný zásuvný modul. Můžete zkusit vyhledat ❝gstreamer codecs❞ na webu." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Nelze přehrát" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Je nám líto, ale %s nemůžeme přehrát, protože nemáme správný zásuvný modul." bognor-regis/po/zh_CN.po0000644000175000017500000000251111533735426015352 0ustar paulliupaulliu# bognor. # Copyright Intel (C) 2009 # This file is distributed under the same license as the PACKAGE package. # Zhu Yanhai , 2009 # msgid "" msgstr "" "Project-Id-Version: bognor\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: 2009-09-18 10:28-0800\n" "Last-Translator: GLS \n" "Language-Team: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Chinese\n" "X-Poedit-SourceCharset: UTF-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "播放队列" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "" "抱歉,因为缺少合适的插件,我们不能播放 %s. 也许您可以试着以\n" "'gstreamer codecs'为关键词在网络上搜索一下" #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "目前我们不能播放这个文件" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "抱歉,因为缺少合适的插件,我们不能播放 %s。" bognor-regis/po/fr.po0000644000175000017500000000240211533735426014757 0ustar paulliupaulliu# msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: Loïc Dufresne de Virel \n" "Language-Team: lpdufres \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: French\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "File de lecture" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Désolé, nous ne pouvons pas jouer %s, car nous n'avons pas le plug-in nécessaire. Vous pouvez chercher les ❝codecs gstreamer❞ sur internet." # Is there anything coming after "this"? This will change the French # translation. #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Impossible de jouer ça" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Désolé, nous ne pouvons pas jouer %s car nous n'avons pas le plug-in nécessaire." bognor-regis/po/pl.po0000644000175000017500000000312011533735426014761 0ustar paulliupaulliu# pl locale # Copyright (C) 2009 Intel Corporation # This file is distributed under the same license as the bognor-regis package. # Andrzej Zaborowski , 2009. # msgid "" msgstr "" "Project-Id-Version: Moblin\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-11 22:54+0000\n" "PO-Revision-Date: \n" "Last-Translator: Andrzej Zaborowski \n" "Language-Team: Moblin\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Poedit-Language: Polish\n" "X-Poedit-SourceCharset: utf-8\n" # Translated as playlist. The literal translation would be "kolejka # odtwarzania" but I'm not sure whether it's worth inventing this term to # account for the small difference between playlist and playqueue. #: ../src/bognor-local-queue-gst.c:376 ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Playlista" #: ../src/bognor-queue.c:222 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Niestety nie możemy puścić %s bo nie mamy odpowiedniej wtyczki. Możesz spróbować wyszukać ❝gstreamer codecs❞ na www." #: ../src/bognor-queue.c:226 msgid "We can't play this" msgstr "Nie można odtworzyć" #: ../src/bognor-queue.c:220 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Niestety nie możemy puścić %s, bo nie mamy odpowiedniej wtyczki." bognor-regis/po/da.po0000644000175000017500000000261211533735426014737 0ustar paulliupaulliu# Danish translation of bognor-regis # Copyright (C) 2009 # This file is distributed under the same license as the bognor-regis package. # Kris Thomsen , 2009. # msgid "" msgstr "" "Project-Id-Version: bognor-regis\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-04-14 09:34+0000\n" "PO-Revision-Date: 2010-04-15 07:34+0100\n" "Last-Translator: Jon Hedemann \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n!=1;\n" "X-Poedit-Language: Danish\n" "X-Poedit-Country: DENMARK\n" "X-Poedit-SourceCharset: utf-8\n" #: ../src/bognor-local-queue-gst.c:376 #: ../src/bognor-local-queue-helix.c:357 msgid "Playqueue" msgstr "Afspilningskø" #: ../src/bognor-queue.c:229 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin." msgstr "Beklager, men vi kan ikke afspille %s, fordi vi ikke har det korrekte plugin." #: ../src/bognor-queue.c:231 #, c-format msgid "Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web." msgstr "Beklager, men vi kan ikke afspille %s, fordi vi ikke har det korrekte plugin. Prøv at søge efter ❝gstreamer codecs❞ på internettet." #: ../src/bognor-queue.c:235 msgid "We can't play this" msgstr "Vi kan ikke afspille denne fil" bognor-regis/m4/0000755000175000017500000000000011533735426013714 5ustar paulliupaulliubognor-regis/m4/as-linguas.m40000644000175000017500000000146611533735426016230 0ustar paulliupaulliu# Set ALL_ALL_LINGUAS based on the .po files present. Optional argument is the # name of the po directory. $podir/LINGUAS.ignore can be used to ignore a # subset of the po files. AC_DEFUN([AS_ALL_LINGUAS], [ AC_MSG_CHECKING([for linguas]) podir="m4_default([$1],[$srcdir/po])" linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $[]1 }'` if test -f "$podir/LINGUAS.ignore"; then ALL_LINGUAS=""; ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \ -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`; for lang in $linguas; do if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then ALL_LINGUAS="$ALL_LINGUAS $lang"; fi; done; else ALL_LINGUAS="$linguas"; fi; AC_SUBST([ALL_LINGUAS]) AC_MSG_RESULT($ALL_LINGUAS) ]) bognor-regis/m4/.gitignore0000644000175000017500000000002411533735426015700 0ustar paulliupaulliu*.m4 !as-linguas.m4 bognor-regis/NEWS0000644000175000017500000000000011533735426014061 0ustar paulliupaulliubognor-regis/ChangeLog0000644000175000017500000000000011533735426015134 0ustar paulliupaulliubognor-regis/scpd/0000755000175000017500000000000011533735426014325 5ustar paulliupaulliubognor-regis/scpd/Makefile.am0000644000175000017500000000033411533735426016361 0ustar paulliupaulliuscpddir = $(datadir)/bognor-regis/scpd scpd_DATA = AVTransport2.xml \ ConnectionManager2.xml \ MediaRenderer2.xml \ RenderingControl2.xml \ bird_icon.png MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = $(scpd_DATA) bognor-regis/scpd/RenderingControl2.xml0000644000175000017500000006013711533735426020416 0ustar paulliupaulliu LastChange yes string PresetNameList no string Brightness no ui2 0 1 Contrast no ui2 0 1 Sharpness no ui2 0 1 RedVideoGain no ui2 0 1 GreenVideoGain no ui2 0 1 BlueVideoGain no ui2 0 1 RedVideoBlackLevel no ui2 0 1 GreenVideoBlackLevel no ui2 0 1 BlueVideoBlackLevel no ui2 0 1 ColorTemperature no ui2 0 1 HorizontalKeystone no i2 1 VerticalKeystone no i2 1 Mute no boolean Volume no ui2 0 1 VolumeDB no i2 Loudness no boolean A_ARG_TYPE_Channel no string Master A_ARG_TYPE_InstanceID no ui4 A_ARG_TYPE_PresetName no string FactoryDefaults A_ARG_TYPE_DeviceUDN no string A_ARG_TYPE_ServiceType no string A_ARG_TYPE_ServiceID no string A_ARG_TYPE_StateVariableValuePairs no string A_ARG_TYPE_StateVariableList no string ListPresets InstanceID in A_ARG_TYPE_InstanceID CurrentPresetNameList out PresetNameList SelectPreset InstanceID in A_ARG_TYPE_InstanceID PresetName in A_ARG_TYPE_PresetName GetBrightness InstanceID in A_ARG_TYPE_InstanceID CurrentBrightness out Brightness SetBrightness InstanceID in A_ARG_TYPE_InstanceID DesiredBrightness in Brightness GetContrast InstanceID in A_ARG_TYPE_InstanceID CurrentContrast out Contrast SetContrast InstanceID in A_ARG_TYPE_InstanceID DesiredContrast in Contrast GetSharpness InstanceID in A_ARG_TYPE_InstanceID CurrentSharpness out Sharpness SetSharpness InstanceID in A_ARG_TYPE_InstanceID DesiredSharpness in Sharpness GetRedVideoGain InstanceID in A_ARG_TYPE_InstanceID CurrentRedVideoGain out RedVideoGain SetRedVideoGain InstanceID in A_ARG_TYPE_InstanceID DesiredRedVideoGain in RedVideoGain GetGreenVideoGain InstanceID in A_ARG_TYPE_InstanceID CurrentGreenVideoGain out GreenVideoGain SetGreenVideoGain InstanceID in A_ARG_TYPE_InstanceID DesiredGreenVideoGain in GreenVideoGain GetBlueVideoGain InstanceID in A_ARG_TYPE_InstanceID CurrentBlueVideoGain out BlueVideoGain SetBlueVideoGain InstanceID in A_ARG_TYPE_InstanceID DesiredBlueVideoGain in BlueVideoGain GetRedVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID CurrentRedVideoBlackLevel out RedVideoBlackLevel SetRedVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID DesiredRedVideoBlackLevel in RedVideoBlackLevel GetGreenVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID CurrentGreenVideoBlackLevel out GreenVideoBlackLevel SetGreenVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID DesiredGreenVideoBlackLevel in GreenVideoBlackLevel GetBlueVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID CurrentBlueVideoBlackLevel out BlueVideoBlackLevel SetBlueVideoBlackLevel InstanceID in A_ARG_TYPE_InstanceID DesiredBlueVideoBlackLevel in BlueVideoBlackLevel GetColorTemperature InstanceID in A_ARG_TYPE_InstanceID CurrentColorTemperature out ColorTemperature SetColorTemperature InstanceID in A_ARG_TYPE_InstanceID DesiredColorTemperature in ColorTemperature GetHorizontalKeystone InstanceID in A_ARG_TYPE_InstanceID CurrentHorizontalKeystone out HorizontalKeystone SetHorizontalKeystone InstanceID in A_ARG_TYPE_InstanceID DesiredHorizontalKeystone in HorizontalKeystone GetVerticalKeystone InstanceID in A_ARG_TYPE_InstanceID CurrentVerticalKeystone out VerticalKeystone SetVerticalKeystone InstanceID in A_ARG_TYPE_InstanceID DesiredVerticalKeystone in VerticalKeystone GetMute InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel CurrentMute out Mute SetMute InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel DesiredMute in Mute GetVolume InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel CurrentVolume out Volume SetVolume InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel DesiredVolume in Volume GetVolumeDB InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel CurrentVolume out VolumeDB SetVolumeDB InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel DesiredVolume in VolumeDB GetVolumeDBRange InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel MinValue out VolumeDB MaxValue out VolumeDB GetLoudness InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel CurrentLoudness out Loudness SetLoudness InstanceID in A_ARG_TYPE_InstanceID Channel in A_ARG_TYPE_Channel DesiredLoudness in Loudness GetStateVariables InstanceID in A_ARG_TYPE_InstanceID StateVariableList in A_ARG_TYPE_StateVariableList StateVariableValuePairs out A_ARG_TYPE_StateVariableValuePairs SetStateVariables InstanceID in A_ARG_TYPE_InstanceID RenderingControlUDN in A_ARG_TYPE_DeviceUDN ServiceType in A_ARG_TYPE_ServiceType ServiceId in A_ARG_TYPE_ServiceID StateVariableValuePairs in A_ARG_TYPE_StateVariableValuePairs StateVariableList out A_ARG_TYPE_StateVariableList bognor-regis/scpd/bird_icon.png0000644000175000017500000000217311533735426016766 0ustar paulliupaulliuPNG  IHDR00WtEXtSoftwareAdobe ImageReadyqe<IDATxYKOSA{;>c-jdt•ʆ5,ܹ=Iqoƕ 6 0lK9psW-̝f}1E3 fю ]#F Tҁy/8 иdI<Bɺ!p "a9a 2WS^}nH6M >M5Ot'y6'BkjP`K_нC {MYn8 !_N{=16}/0^RwSй i;OW>͜bSKD*Sc.{W mB$CNdU:`"X!iW(X‚ 1vno|Ŋe~TBc#ɠ*/n8xJLId5ܾ" N/MOBnlPqP4sCuv 4rrz⺰&^CϤ|o72 4@Z݋|5szt/wA 4mtٻ^ ez"I񲯯&=N/YT'|MH%ȯ@M9Cg5` eۍƬq2a*+{.]S>2"?KsEƆRƐ z Z aW qoeq$IsYg[oQ4Li@d$l|SV+# TransportState no string STOPPED PLAYING TransportStatus no string OK ERROR_OCCURRED CurrentMediaCategory no string NO_MEDIA TRACK_AWARE TRACK_UNAWARE PlaybackStorageMedium no string RecordStorageMedium no string PossiblePlaybackStorageMedia no string PossibleRecordStorageMedia no string CurrentPlayMode no string NORMAL NORMAL TransportPlaySpeed no string 1 1 RecordMediumWriteStatus no string CurrentRecordQualityMode no string PossibleRecordQualityModes no string NumberOfTracks no ui4 0 CurrentTrack no ui4 0 1 CurrentTrackDuration no string CurrentMediaDuration no string CurrentTrackMetaData no string CurrentTrackURI no string AVTransportURI no string AVTransportURIMetaData no string NextAVTransportURI no string NextAVTransportURIMetaData no string RelativeTimePosition no string AbsoluteTimePosition no string RelativeCounterPosition no i4 AbsoluteCounterPosition no i4 CurrentTransportActions no string LastChange yes string DRMState yes string OK UNKNOWN A_ARG_TYPE_SeekMode no string TRACK_NR A_ARG_TYPE_SeekTarget no string A_ARG_TYPE_InstanceID no ui4 A_ARG_TYPE_DeviceUDN no string A_ARG_TYPE_ServiceType no string A_ARG_TYPE_ServiceID no string A_ARG_TYPE_StateVariableValuePairs no string A_ARG_TYPE_StateVariableList no string SetAVTransportURI InstanceID in A_ARG_TYPE_InstanceID CurrentURI in AVTransportURI CurrentURIMetaData in AVTransportURIMetaData SetNextAVTransportURI InstanceID in A_ARG_TYPE_InstanceID NextURI in NextAVTransportURI NextURIMetaData in NextAVTransportURIMetaData GetMediaInfo InstanceID in A_ARG_TYPE_InstanceID NrTracks out NumberOfTracks MediaDuration out CurrentMediaDuration CurrentURI out AVTransportURI CurrentURIMetaData out AVTransportURIMetaData NextURI out NextAVTransportURI NextURIMetaData out NextAVTransportURIMetaData PlayMedium out PlaybackStorageMedium RecordMedium out RecordStorageMedium WriteStatus out RecordMediumWriteStatus GetMediaInfo_Ext InstanceID in A_ARG_TYPE_InstanceID CurrentType out CurrentMediaCategory NrTracks out NumberOfTracks MediaDuration out CurrentMediaDuration CurrentURI out AVTransportURI CurrentURIMetaData out AVTransportURIMetaData NextURI out NextAVTransportURI NextURIMetaData out NextAVTransportURIMetaData PlayMedium out PlaybackStorageMedium RecordMedium out RecordStorageMedium WriteStatus out RecordMediumWriteStatus GetTransportInfo InstanceID in A_ARG_TYPE_InstanceID CurrentTransportState out TransportState CurrentTransportStatus out TransportStatus CurrentSpeed out TransportPlaySpeed GetPositionInfo InstanceID in A_ARG_TYPE_InstanceID Track out CurrentTrack TrackDuration out CurrentTrackDuration TrackMetaData out CurrentTrackMetaData TrackURI out CurrentTrackURI RelTime out RelativeTimePosition AbsTime out AbsoluteTimePosition RelCount out RelativeCounterPosition AbsCount out AbsoluteCounterPosition GetDeviceCapabilities InstanceID in A_ARG_TYPE_InstanceID PlayMedia out PossiblePlaybackStorageMedia RecMedia out PossibleRecordStorageMedia RecQualityModes out PossibleRecordQualityModes GetTransportSettings InstanceID in A_ARG_TYPE_InstanceID PlayMode out CurrentPlayMode RecQualityMode out CurrentRecordQualityMode Stop InstanceID in A_ARG_TYPE_InstanceID Play InstanceID in A_ARG_TYPE_InstanceID Speed in TransportPlaySpeed Pause InstanceID in A_ARG_TYPE_InstanceID Record InstanceID in A_ARG_TYPE_InstanceID Seek InstanceID in A_ARG_TYPE_InstanceID Unit in A_ARG_TYPE_SeekMode Target in A_ARG_TYPE_SeekTarget Next InstanceID in A_ARG_TYPE_InstanceID Previous InstanceID in A_ARG_TYPE_InstanceID SetPlayMode InstanceID in A_ARG_TYPE_InstanceID NewPlayMode in CurrentPlayMode SetRecordQualityMode InstanceID in A_ARG_TYPE_InstanceID NewRecordQualityMode in CurrentRecordQualityMode GetCurrentTransportActions InstanceID in A_ARG_TYPE_InstanceID Actions out CurrentTransportActions GetDRMState InstanceID in A_ARG_TYPE_InstanceID CurrentDRMState out DRMState GetStateVariables InstanceID in A_ARG_TYPE_InstanceID StateVariableList in A_ARG_TYPE_StateVariableList StateVariableValuePairs out A_ARG_TYPE_StateVariableValuePairs SetStateVariables InstanceID in A_ARG_TYPE_InstanceID AVTransportUDN in A_ARG_TYPE_DeviceUDN ServiceType in A_ARG_TYPE_ServiceType ServiceId in A_ARG_TYPE_ServiceID StateVariableValuePairs in A_ARG_TYPE_StateVariableValuePairs StateVariableList out A_ARG_TYPE_StateVariableList bognor-regis/scpd/ConnectionManager2.xml0000644000175000017500000001427511533735426020534 0ustar paulliupaulliu SourceProtocolInfo yes string SinkProtocolInfo yes string CurrentConnectionIDs yes string A_ARG_TYPE_ConnectionStatus no string OK ContentFormatMismatch InsufficientBandwidth UnreliableChannel Unknown A_ARG_TYPE_ConnectionManager no string A_ARG_TYPE_Direction no string Input Output A_ARG_TYPE_ProtocolInfo no string A_ARG_TYPE_ConnectionID no i4 A_ARG_TYPE_AVTransportID no i4 A_ARG_TYPE_RcsID no i4 GetProtocolInfo Source out SourceProtocolInfo Sink out SinkProtocolInfo PrepareForConnection RemoteProtocolInfo in A_ARG_TYPE_ProtocolInfo PeerConnectionManager in A_ARG_TYPE_ConnectionManager PeerConnectionID in A_ARG_TYPE_ConnectionID Direction in A_ARG_TYPE_Direction ConnectionID out A_ARG_TYPE_ConnectionID AVTransportID out A_ARG_TYPE_AVTransportID RcsID out A_ARG_TYPE_RcsID ConnectionComplete ConnectionID in A_ARG_TYPE_ConnectionID GetCurrentConnectionIDs ConnectionIDs out CurrentConnectionIDs GetCurrentConnectionInfo ConnectionID in A_ARG_TYPE_ConnectionID RcsID out A_ARG_TYPE_RcsID AVTransportID out A_ARG_TYPE_AVTransportID ProtocolInfo out A_ARG_TYPE_ProtocolInfo PeerConnectionManager out A_ARG_TYPE_ConnectionManager PeerConnectionID out A_ARG_TYPE_ConnectionID Direction out A_ARG_TYPE_Direction Status out A_ARG_TYPE_ConnectionStatus bognor-regis/scpd/MediaRenderer2.xml0000644000175000017500000000311211533735426017634 0ustar paulliupaulliu 1 0 urn:schemas-upnp-org:device:MediaRenderer:1 Moblin Intel Corporation Bognor Regis uuid:446b2118-fa60-4f6d-9aca-bca8ccc32eab image/png 48 48 24 bird_icon.png urn:schemas-upnp-org:service:RenderingControl:1 urn:upnp-org:serviceId:RenderingControl /RenderingControl2.xml /RenderingControl/Control /RenderingControl/Event urn:schemas-upnp-org:service:ConnectionManager:1 urn:upnp-org:serviceId:ConnectionManager /ConnectionManager2.xml /ConnectionManager/Control /ConnectionManager/Event urn:schemas-upnp-org:service:AVTransport:1 urn:upnp-org:serviceId:AVTransport /AVTransport2.xml /AVTransport/Control /AVTransport/Event bognor-regis/interfaces/0000755000175000017500000000000011533735426015517 5ustar paulliupaulliubognor-regis/interfaces/BognorQueue.xml0000644000175000017500000000743511533735426020505 0ustar paulliupaulliu bognor-regis/interfaces/Makefile.am0000644000175000017500000000011711533735426017552 0ustar paulliupaulliuEXTRA_DIST = BognorQueueManager.xml \ BognorQueue.xml \ BognorPlayer.xml bognor-regis/interfaces/BognorPlayer.xml0000644000175000017500000000174511533735426020653 0ustar paulliupaulliu bognor-regis/interfaces/BognorQueueManager.xml0000644000175000017500000000106211533735426021766 0ustar paulliupaulliu bognor-regis/INSTALL0000644000175000017500000002231011533735426014423 0ustar paulliupaulliuInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. bognor-regis/.gitignore0000644000175000017500000000047411533735426015371 0ustar paulliupaulliu*.la *.lo *.o .deps .libs Makefile Makefile.in* TAGS aclocal.m4 autom4te.cache compile config.guess config.h config.h.in config.h.in~ config.log config.status config.sub configure configure.lineno depcomp install-sh intltool-extract.in intltool-merge.in intltool-update.in libtool ltmain.sh missing stamp-h1 .*.sw? bognor-regis/README0000644000175000017500000000036011533735426014253 0ustar paulliupaulliuLightning code overview: bognor-regis/ Library that handles access to a remote queue manager implementing the BognorRegis interfaces interfaces/ specification of those D-Bus interfaces src/ implementation of the default queue manager bognor-regis/src/0000755000175000017500000000000011533735426014163 5ustar paulliupaulliubognor-regis/src/bognor-connection-manager.h0000644000175000017500000000400311533735426021364 0ustar paulliupaulliu#ifndef __BOGNOR_CONNECTION_MANAGER_H__ #define __BOGNOR_CONNECTION_MANAGER_H__ #include G_BEGIN_DECLS #define BOGNOR_TYPE_CONNECTION_MANAGER \ (bognor_connection_manager_get_type()) #define BOGNOR_CONNECTION_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_CONNECTION_MANAGER, \ BognorConnectionManager)) #define BOGNOR_CONNECTION_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_CONNECTION_MANAGER, \ BognorConnectionManagerClass)) #define IS_BOGNOR_CONNECTION_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_CONNECTION_MANAGER)) #define IS_BOGNOR_CONNECTION_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_CONNECTION_MANAGER)) #define BOGNOR_CONNECTION_MANAGER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_CONNECTION_MANAGER, \ BognorConnectionManagerClass)) typedef struct _BognorConnectionManagerPrivate BognorConnectionManagerPrivate; typedef struct _BognorConnectionManager BognorConnectionManager; typedef struct _BognorConnectionManagerClass BognorConnectionManagerClass; struct _BognorConnectionManager { GUPnPService parent; BognorConnectionManagerPrivate *priv; }; struct _BognorConnectionManagerClass { GUPnPServiceClass parent_class; }; GType bognor_connection_manager_get_type (void) G_GNUC_CONST; G_END_DECLS #endif /* __BOGNOR_CONNECTION_MANAGER_H__ */ bognor-regis/src/bognor-queue-item.c0000644000175000017500000001472311533735426017702 0ustar paulliupaulliu#include #include #include "bgr-item.h" #include "bognor-queue-item.h" enum { PROP_0, }; enum { DURATION_CHANGED, POSITION_CHANGED, LAST_SIGNAL, }; struct _BognorQueueItemPrivate { BgrItem *item; char *metadata; char *uri; char *mimetype; int duration; /* In seconds */ }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_QUEUE_ITEM, BognorQueueItemPrivate)) G_DEFINE_TYPE (BognorQueueItem, bognor_queue_item, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0,}; static void bognor_queue_item_finalize (GObject *object) { BognorQueueItem *self = (BognorQueueItem *) object; BognorQueueItemPrivate *priv = self->priv; g_free (priv->uri); g_free (priv->mimetype); g_free (priv->metadata); G_OBJECT_CLASS (bognor_queue_item_parent_class)->finalize (object); } static void bognor_queue_item_dispose (GObject *object) { BognorQueueItem *self = (BognorQueueItem *) object; BognorQueueItemPrivate *priv = self->priv; if (priv->item) { g_object_unref (priv->item); priv->item = NULL; priv->uri = NULL; priv->mimetype = NULL; } G_OBJECT_CLASS (bognor_queue_item_parent_class)->dispose (object); } static void bognor_queue_item_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorQueueItem *self = (BognorQueueItem *) object; switch (prop_id) { default: break; } } static void bognor_queue_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorQueueItem *self = (BognorQueueItem *) object; switch (prop_id) { default: break; } } static void bognor_queue_item_class_init (BognorQueueItemClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bognor_queue_item_dispose; o_class->finalize = bognor_queue_item_finalize; o_class->set_property = bognor_queue_item_set_property; o_class->get_property = bognor_queue_item_get_property; g_type_class_add_private (klass, sizeof (BognorQueueItemPrivate)); signals[DURATION_CHANGED] = g_signal_new ("duration-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); signals[POSITION_CHANGED] = g_signal_new ("position-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); } static void bognor_queue_item_init (BognorQueueItem *self) { BognorQueueItemPrivate *priv = GET_PRIVATE (self); self->priv = priv; } static char * bgr_to_didl_metadata (BgrItem *bgr) { GUPnPDIDLLiteWriter *writer; GUPnPDIDLLiteItem *item; GUPnPDIDLLiteObject *object; const char *str, *artist; char *didl; writer = gupnp_didl_lite_writer_new (NULL); item = gupnp_didl_lite_writer_add_item (writer); object = (GUPnPDIDLLiteObject *) item; str = bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_TITLE); if (str) { gupnp_didl_lite_object_set_title (object, str); } else { char *basename = g_path_get_basename (bgr_item_get_uri (bgr)); gupnp_didl_lite_object_set_title (object, basename); g_free (basename); } artist = bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_ARTIST); if (artist) { gupnp_didl_lite_object_set_artist (object, artist); } str = bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_ALBUM); if (str) { gupnp_didl_lite_object_set_album (object, str); } didl = gupnp_didl_lite_writer_get_string (writer); g_object_unref (writer); return didl; } BognorQueueItem * bognor_queue_item_new_from_item (BgrItem *bgr) { BognorQueueItem *item; BognorQueueItemPrivate *priv; item = g_object_new (BOGNOR_TYPE_QUEUE_ITEM, NULL); priv = item->priv; priv->item = g_object_ref (bgr); /* We don't duplicate these here as they're not freed if priv->item is !NULL */ priv->uri = (char *) bgr_item_get_uri (bgr); priv->mimetype = (char *) bgr_item_get_mimetype (bgr); priv->metadata = bgr_to_didl_metadata (bgr); priv->duration = 0; return item; } BognorQueueItem * bognor_queue_item_new (const char *uri, const char *mimetype, const char *metadata) { BognorQueueItem *item; BognorQueueItemPrivate *priv; item = g_object_new (BOGNOR_TYPE_QUEUE_ITEM, NULL); priv = item->priv; priv->item = NULL; priv->uri = g_strdup (uri); priv->mimetype = g_strdup (mimetype); priv->metadata = g_strdup (metadata); priv->duration = 0; return item; } void bognor_queue_item_set_duration (BognorQueueItem *item, int duration) { BognorQueueItemPrivate *priv = item->priv; if (priv->duration == duration) { return; } priv->duration = duration; g_signal_emit (item, signals[DURATION_CHANGED], 0, duration); } int bognor_queue_item_get_duration (BognorQueueItem *item) { BognorQueueItemPrivate *priv = item->priv; return priv->duration; } const char * bognor_queue_item_get_uri (BognorQueueItem *item) { BognorQueueItemPrivate *priv = item->priv; return priv->uri; } const char * bognor_queue_item_get_mimetype (BognorQueueItem *item) { BognorQueueItemPrivate *priv = item->priv; return priv->mimetype; } const char * bognor_queue_item_get_metadata (BognorQueueItem *item) { BognorQueueItemPrivate *priv = item->priv; return priv->metadata; } BgrItem * bognor_queue_item_get_item (BognorQueueItem *item) { BognorQueueItemPrivate *priv = item->priv; return priv->item; } bognor-regis/src/bognor-upnp-cp.h0000644000175000017500000000352411533735426017206 0ustar paulliupaulliu#ifndef __BOGNOR_UPNP_CP_H__ #define __BOGNOR_UPNP_CP_H__ #include G_BEGIN_DECLS #define BOGNOR_TYPE_UPNP_CP \ (bognor_upnp_cp_get_type()) #define BOGNOR_UPNP_CP(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_UPNP_CP, \ BognorUpnpCp)) #define BOGNOR_UPNP_CP_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_UPNP_CP, \ BognorUpnpCpClass)) #define IS_BOGNOR_UPNP_CP(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_UPNP_CP)) #define IS_BOGNOR_UPNP_CP_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_UPNP_CP)) #define BOGNOR_UPNP_CP_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_UPNP_CP, \ BognorUpnpCpClass)) typedef struct _BognorUpnpCpPrivate BognorUpnpCpPrivate; typedef struct _BognorUpnpCp BognorUpnpCp; typedef struct _BognorUpnpCpClass BognorUpnpCpClass; struct _BognorUpnpCp { GObject parent; BognorUpnpCpPrivate *priv; }; struct _BognorUpnpCpClass { GObjectClass parent_class; }; GType bognor_upnp_cp_get_type (void) G_GNUC_CONST; BognorUpnpCp *bognor_upnp_cp_new (BognorQueue *queue); G_END_DECLS #endif /* __BOGNOR_UPNP_CP_H__ */ bognor-regis/src/bognor-queue.c0000644000175000017500000011263711533735426016751 0ustar paulliupaulliu#include #include #include #include #include "bgr-item.h" #include "bgr-tracker-client.h" #include "bognor-marshal.h" #include "bognor-queue.h" #include "bognor-queue-glue.h" enum { PROP_0, PROP_NAME, PROP_TRACKER, }; enum { ADDED, REMOVED, MOVED, INDEX_CHANGED, ITEM_CHANGED, POSITION_CHANGED, STATE_CHANGED, LAST_SIGNAL, }; struct _BognorQueuePrivate { char *name; /* Name of the queue */ GVolumeMonitor *volume_monitor; /* This probably doesn't need to be here and should be in a subclass or in the QueueMonitor */ GQueue *play_queue; /* contains BognorQueueItem */ GList *current_position; /* Owned by @play_queue */ int current_index; int queue_duration; /* In seconds */ BgrTrackerClient *tracker; BognorQueueState state; BognorQueueStatus status; BognorQueueMode mode; int *shuffle_array; int shuffle_array_size; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_QUEUE, BognorQueuePrivate)) G_DEFINE_TYPE (BognorQueue, bognor_queue, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0,}; static void bq_sync_current_index(BognorQueue *queue) { BognorQueuePrivate *priv = queue->priv; int idx; idx = g_queue_link_index(priv->play_queue, priv->current_position); if (idx == -1) { // not found bognor_queue_set_index (queue, 0, NULL); } else { priv->current_index = idx; } } void bq_make_shuffle_list(BognorQueue *queue) { BognorQueuePrivate *priv = queue->priv; int playlist_len; int i, r, temp; playlist_len = g_queue_get_length(priv->play_queue); if(playlist_len > 0) { if (playlist_len != priv->shuffle_array_size) { // re-initialize shuffle list if (priv->shuffle_array == NULL) { priv->shuffle_array = g_new (int, playlist_len); } else { priv->shuffle_array = g_renew (int, priv->shuffle_array, playlist_len); } for ( i=0; ishuffle_array[i] = i; } for (i=playlist_len; i > 0; i--) { r = g_random_int_range (0, i); temp = priv->shuffle_array[i-1]; priv->shuffle_array[i-1] = priv->shuffle_array[r]; priv->shuffle_array[r] = temp; } for ( i=0; ishuffle_array[i]); } priv->shuffle_array_size = playlist_len; } } else { priv->shuffle_array_size = 0; g_free(priv->shuffle_array); priv->shuffle_array = NULL; } } GQuark bognor_queue_error_quark (void) { static GQuark quark = 0; if (G_UNLIKELY (quark == 0)) { quark = g_quark_from_static_string ("bognor-queue-error-quark"); } return quark; } static void bognor_queue_finalize (GObject *object) { BognorQueue *self = (BognorQueue *) object; G_OBJECT_CLASS (bognor_queue_parent_class)->finalize (object); } static void bognor_queue_dispose (GObject *object) { BognorQueue *self = (BognorQueue *) object; BognorQueuePrivate *priv = self->priv; if (priv->tracker) { g_object_unref (priv->tracker); priv->tracker = NULL; } G_OBJECT_CLASS (bognor_queue_parent_class)->dispose (object); } static void bognor_queue_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorQueue *self = (BognorQueue *) object; BognorQueuePrivate *priv = self->priv; switch (prop_id) { case PROP_NAME: priv->name = g_value_dup_string (value); break; case PROP_TRACKER: priv->tracker = g_value_get_object (value); break; default: break; } } static void bognor_queue_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorQueue *self = (BognorQueue *) object; switch (prop_id) { default: break; } } static void bognor_queue_class_init (BognorQueueClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bognor_queue_dispose; o_class->finalize = bognor_queue_finalize; o_class->set_property = bognor_queue_set_property; o_class->get_property = bognor_queue_get_property; g_type_class_add_private (klass, sizeof (BognorQueuePrivate)); dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), &dbus_glib_bognor_queue_object_info); g_object_class_install_property (o_class, PROP_NAME, g_param_spec_string ("name", "", "", "", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (o_class, PROP_TRACKER, g_param_spec_object ("tracker", "", "", BGR_TYPE_TRACKER_CLIENT, G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE)); signals[ADDED] = g_signal_new ("uri-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, bognor_marshal_VOID__STRING_INT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT); signals[REMOVED] = g_signal_new ("uri-removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, bognor_marshal_VOID__STRING_INT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT); signals[MOVED] = g_signal_new ("item-moved", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, bognor_marshal_VOID__INT_INT_INT, G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); signals[INDEX_CHANGED] = g_signal_new ("index-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); signals[POSITION_CHANGED] = g_signal_new ("position-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__DOUBLE, G_TYPE_NONE, 1, G_TYPE_DOUBLE); signals[STATE_CHANGED] = g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); signals[ITEM_CHANGED] = g_signal_new ("item-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, BOGNOR_TYPE_QUEUE_ITEM); } static void bognor_queue_init (BognorQueue *self) { BognorQueuePrivate *priv = GET_PRIVATE (self); self->priv = priv; priv->play_queue = g_queue_new (); priv->current_position = NULL; priv->current_index = BOGNOR_QUEUE_INDEX_END; priv->mode = BOGNOR_QUEUE_MODE_NORMAL; priv->shuffle_array = NULL; priv->shuffle_array_size = 0; } void bognor_queue_notify_unknown_format (BognorQueue *queue, BognorQueueItem *item) { NotifyNotification *notification; const char *uri; char *basename, *unesc, *message; uri = bognor_queue_item_get_uri (item); basename = g_path_get_basename (uri); unesc = g_uri_unescape_string (basename, NULL); g_free (basename); #ifdef ENABLE_HELIX message = g_strdup_printf (_("Sorry, we can't play %s, as we don't have the correct plugin."), unesc); #else message = g_strdup_printf (_("Sorry, we can't play %s, as we don't have the correct plugin. You could try searching for ❝gstreamer codecs❞ on the web."), unesc); #endif g_free (unesc); notification = notify_notification_new (_("We can't play this"), message, NULL, NULL); notify_notification_show (notification, NULL); g_object_unref (notification); g_free (message); } void bognor_queue_emit_position_changed (BognorQueue *queue, double position) { g_signal_emit (queue, signals[POSITION_CHANGED], 0, position); } gboolean bognor_queue_stop (BognorQueue *queue, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; klass->set_playing (queue, FALSE); priv->state = BOGNOR_QUEUE_STATE_STOPPED; g_signal_emit (queue, signals[STATE_CHANGED], 0, priv->state); return TRUE; } gboolean bognor_queue_play (BognorQueue *queue, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "The queue is empty"); } return FALSE; } klass->set_playing (queue, TRUE); priv->state = BOGNOR_QUEUE_STATE_PLAYING; g_signal_emit (queue, signals[STATE_CHANGED], 0, priv->state); return TRUE; } gboolean bognor_queue_next (BognorQueue *queue, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; BgrItem *item; if (priv->state != BOGNOR_QUEUE_STATE_PLAYING) { return TRUE; } if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "The queue is empty"); } return FALSE; } if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_SINGLE_REPEATING) { klass->set_item (queue, (BognorQueueItem *) priv->current_position->data); return TRUE; } if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { int shuffle_idx = ++priv->current_index; if (shuffle_idx >= priv->shuffle_array_size) { /* We've now finished the queue */ if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_REPEATING) { // repeat bognor_queue_set_index (queue, priv->shuffle_array[0], error); // current_index is changed in bognor_queue_set_index priv->current_index = 0; } else { // no repeat bognor_queue_stop (queue, error); bognor_queue_set_position (queue, 0.0, error); bognor_queue_set_index (queue, priv->shuffle_array[0], error); priv->current_index = 0; } return TRUE; } bognor_queue_set_index (queue, priv->shuffle_array[shuffle_idx], error); priv->current_index = shuffle_idx; return TRUE; } priv->current_position = priv->current_position->next; priv->current_index++; if (priv->current_position == NULL) { /* We've now finished the queue */ if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_REPEATING) { bognor_queue_set_index (queue, 0, error); return TRUE; } else { bognor_queue_stop (queue, error); bognor_queue_set_position (queue, 0.0, error); bognor_queue_set_index (queue, 0, error); return TRUE; } } klass->set_item (queue, (BognorQueueItem *) priv->current_position->data); klass->add_item_to_recent (queue, (BognorQueueItem *) priv->current_position->data); item = bognor_queue_item_get_item (priv->current_position->data); bgr_tracker_client_update_item_use_count (priv->tracker, item); g_signal_emit (queue, signals[INDEX_CHANGED], 0, priv->current_index); g_signal_emit (queue, signals[ITEM_CHANGED], 0, priv->current_position->data); return TRUE; } gboolean bognor_queue_previous (BognorQueue *queue, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; BgrItem *item; if (priv->state != BOGNOR_QUEUE_STATE_PLAYING) { return TRUE; } if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "The queue is empty"); } return FALSE; } if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_SINGLE_REPEATING) { klass->set_item (queue, (BognorQueueItem *) priv->current_position->data); return TRUE; } if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { int shuffle_idx = --priv->current_index; if (shuffle_idx < 0) { /* at the head of the queue */ if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_REPEATING) { // repeat bognor_queue_set_index (queue, priv->shuffle_array[priv->shuffle_array_size-1], error); // current_index is changed in bognor_queue_set_index priv->current_index = priv->shuffle_array_size-1; } else { // no repeat bognor_queue_stop (queue, error); bognor_queue_set_position (queue, 0.0, error); bognor_queue_set_index (queue, priv->shuffle_array[0], error); priv->current_index = 0; } return TRUE; } bognor_queue_set_index (queue, priv->shuffle_array[shuffle_idx], error); priv->current_index = shuffle_idx; return TRUE; } priv->current_position = priv->current_position->prev; priv->current_index--; if (priv->current_index < 0) { if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_REPEATING) { /* at the head of the queue */ bognor_queue_set_index (queue, g_queue_get_length(priv->play_queue) -1, error); return TRUE; } else { bognor_queue_stop (queue, error); bognor_queue_set_position (queue, 0.0, error); bognor_queue_set_index (queue, 0, error); return TRUE; } } klass->set_item (queue, (BognorQueueItem *) priv->current_position->data); klass->add_item_to_recent (queue, (BognorQueueItem *) priv->current_position->data); item = bognor_queue_item_get_item (priv->current_position->data); bgr_tracker_client_update_item_use_count (priv->tracker, item); g_signal_emit (queue, signals[INDEX_CHANGED], 0, priv->current_index); g_signal_emit (queue, signals[ITEM_CHANGED], 0, priv->current_position->data); return TRUE; } gboolean bognor_queue_set_mute (BognorQueue *queue, gboolean mute, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; if (mute) klass->set_mute(queue, TRUE); else klass->set_mute(queue, FALSE); return TRUE; } gboolean bognor_queue_get_mute (BognorQueue *queue, gboolean *mute, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; *mute = klass->get_mute (queue); return TRUE; } gboolean bognor_queue_set_volume (BognorQueue *queue, double volume, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; klass->set_volume (queue, volume); return TRUE; } gboolean bognor_queue_get_volume (BognorQueue *queue, double *volume, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; *volume = klass->get_volume(queue); return TRUE; } gboolean bognor_queue_set_position (BognorQueue *queue, double position, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "The queue is empty"); } return FALSE; } klass->set_position (queue, position); return TRUE; } gboolean bognor_queue_get_position (BognorQueue *queue, double *position, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "The queue is empty"); } *position = 0.0; return FALSE; } *position = klass->get_position (queue); return TRUE; } gboolean bognor_queue_append_uris (BognorQueue *queue, int count, const char **uris, const char **mimetypes, GError **error) { BognorQueuePrivate *priv = queue->priv; int i; for (i = 0; i < count; i++) { BgrItem *bgr; BognorQueueItem *item; g_print ("Appending %s\n", uris[i]); bgr = bgr_tracker_client_get_item (priv->tracker, uris[i]); if (bgr == NULL) { item = bognor_queue_item_new (uris[i], mimetypes[i], NULL); } else { item = bognor_queue_item_new_from_item (bgr); } g_queue_push_tail (priv->play_queue, item); /* FIXME: Should we have an "add-start" and "add-finish" set of signals around this? */ g_signal_emit (queue, signals[ADDED], 0, uris[i], g_queue_get_length (priv->play_queue) - 1); } if ((priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { bq_make_shuffle_list(queue); if (priv->state == BOGNOR_QUEUE_STATE_STOPPED) { bognor_queue_set_index (queue, priv->shuffle_array[0], error); priv->current_index = 0; } } else { if (priv->current_position == NULL) { return bognor_queue_set_index (queue, 0, error); } } return TRUE; } gboolean bognor_queue_insert_uris (BognorQueue *queue, int position, int count, const char **uris, const char **mimetypes, GError **error) { BognorQueuePrivate *priv = queue->priv; GList *nth; int i; nth = g_queue_peek_nth_link (priv->play_queue, position); if (nth == NULL) { if ( error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "%d is out of range for queue with %d items", position, g_queue_get_length (priv->play_queue)); } return FALSE; } /* FIXME: See issues in append_uris as well */ for (i = 0; i < count; i++) { BgrItem *bgr; BognorQueueItem *item; bgr = bgr_tracker_client_get_item (priv->tracker, uris[i]); if (bgr == NULL) { item = bognor_queue_item_new (uris[i], mimetypes[i], NULL); } else { item = bognor_queue_item_new_from_item (bgr); } g_print ("Insert %p (uri=%s) at position %d\n", item, uris[i], position + i); g_queue_insert_before (priv->play_queue, nth, item); g_signal_emit (queue, signals[ADDED], 0, uris[i], position + i); } if ((priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { bq_make_shuffle_list(queue); if (priv->state == BOGNOR_QUEUE_STATE_STOPPED) { bognor_queue_set_index (queue, priv->shuffle_array[0], error); priv->current_index = 0; } } else { // sync current_index, esp, insert before current_index bq_sync_current_index(queue); } return TRUE; } gboolean bognor_queue_remove_range (BognorQueue *queue, int index, int count, GError **error) { BognorQueuePrivate *priv = queue->priv; BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); int i; gboolean remove_current = FALSE; if (index >= g_queue_get_length (priv->play_queue) || index + count > g_queue_get_length (priv->play_queue)) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "%d + %d is out of range for queue with %d " "items", index, count, g_queue_get_length (priv->play_queue)); } return FALSE; } for (i = index; i < index + count; i++) { GList *nth; BognorQueueItem *item; g_print ("Removing item at position %d\n", i); nth = g_queue_pop_nth_link (priv->play_queue, index); if (nth == NULL) { g_warning ("Got NULL for item at %d\n", i); continue; } item = nth->data; /* stop the item playing if we are removing it */ if (nth == priv->current_position) { bognor_queue_stop (queue, error); remove_current = TRUE; } /* we always remove the indexth item */ g_signal_emit (queue, signals[REMOVED], 0, bognor_queue_item_get_uri (item), index); g_object_unref (item); } int queue_len = g_queue_get_length(priv->play_queue); int idx; if (queue_len == 0) { priv->current_position = NULL; priv->current_index = BOGNOR_QUEUE_INDEX_END; return TRUE; } if (remove_current == TRUE) { if (priv->current_index >= queue_len) { idx = queue_len -1; } else { idx = priv->current_index; } if ((priv->mode & 0x80) != BOGNOR_QUEUE_MODE_SHUFFLE) { bognor_queue_set_position (queue, 0.0, error); bognor_queue_set_index (queue, idx, error); } else { bq_make_shuffle_list(queue); // empty queue is handled above bognor_queue_set_index (queue, priv->shuffle_array[idx], error); priv->current_index = idx; } } else { if ((priv->mode & 0x80) != BOGNOR_QUEUE_MODE_SHUFFLE) { bq_sync_current_index(queue); } else { bq_make_shuffle_list(queue); // find current item idx = g_queue_link_index(priv->play_queue, priv->current_position); int j; for (j = 0; j < queue_len; j++) { if ( idx == priv->shuffle_array[j] ) { priv->current_index = j; break; } } } } return TRUE; } /* * The move function moves the item from old_position to new_position. Once * done we have to update the current index, update that needs to be split in * 3 cases: * * The ascii diagrams below represent a queue with with items before (left) * and after (right) the move m(x,y). The stars represent the index and its * update. * * 1/ priv->current_index == old_position --> index = new_position * * * * * 012345 012345 * 012345 m(0,4) 123405 * * 2/ old_position < current_index && new_position >= current_index --> index-- * * * * * 012345 012345 * 012345 m(0,4) 123405 * * * * * 012345 012345 * 012345 m(0,2) 120345 * * 3/ old_position > current_index && new_position <= current_index --> index++ * * * * * 012345 012345 * 012345 m(4,0) 401235 * * * * * 012345 012345 * 012345 m(3,2) 013245 * */ gboolean bognor_queue_move_item (BognorQueue *queue, int old_position, int new_position, GError **error) { BognorQueuePrivate *priv = queue->priv; GList *nth, *new; if (new_position < 0 || new_position >= g_queue_get_length (priv->play_queue)) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "new position %d is out of range for queue " "with %d items", new_position, g_queue_get_length (priv->play_queue)); } return FALSE; } /* priv->current_position is preserved by pop_nth_link / push_nth_link */ nth = g_queue_pop_nth_link (priv->play_queue, old_position); if (nth == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "old position %d is out of range for queue " "with %d items", old_position, g_queue_get_length (priv->play_queue)); } return FALSE; } g_queue_push_nth_link (priv->play_queue, new_position, nth); /* update priv->current_index if needed, see comment at the top of the * function */ if (priv->current_index == old_position) { priv->current_index = new_position; } else if (old_position < priv->current_index & new_position >= priv->current_index) { priv->current_index--; } else if (old_position > priv->current_index && new_position <= priv->current_index) { priv->current_index++; } g_signal_emit (queue, signals[MOVED], 0, old_position, new_position, priv->current_index); return TRUE; } gboolean bognor_queue_set_index (BognorQueue *queue, int index, GError **error) { BognorQueueClass *klass = BOGNOR_QUEUE_GET_CLASS (queue); BognorQueuePrivate *priv = queue->priv; BgrItem *item; g_print ("Setting index to %d\n", index); if (index == BOGNOR_QUEUE_INDEX_END) { priv->current_position = g_queue_peek_tail_link (priv->play_queue); } else { priv->current_position = g_queue_peek_nth_link (priv->play_queue, index); } if (priv->current_position == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "%d is out of range for queue with %d items", index, g_queue_get_length (priv->play_queue)); } return FALSE; } klass->set_item (queue, priv->current_position->data); klass->add_item_to_recent (queue, (BognorQueueItem *) priv->current_position->data); item = bognor_queue_item_get_item (priv->current_position->data); bgr_tracker_client_update_item_use_count (priv->tracker, item); priv->current_index = index; if (index == BOGNOR_QUEUE_INDEX_END) { index = g_queue_get_length (priv->play_queue) - 1; } g_signal_emit (queue, signals[INDEX_CHANGED], 0, index); g_signal_emit (queue, signals[ITEM_CHANGED], 0, priv->current_position->data); return TRUE; } gboolean bognor_queue_get_current_index (BognorQueue *queue, int *index, GError **error) { BognorQueuePrivate *priv = queue->priv; *index = priv->current_index; return TRUE; } gboolean bognor_queue_get_index (BognorQueue *queue, int *index, GError **error) { BognorQueuePrivate *priv = queue->priv; if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { *index = priv->shuffle_array[priv->current_index]; } else { *index = priv->current_index; } return TRUE; } gboolean bognor_queue_get_index_metadata (BognorQueue *queue, int index, char **title, char **artist, char **album, GError **error) { BognorQueuePrivate *priv = queue->priv; BognorQueueItem *item; BgrItem *bgr; const char *str; item = g_queue_peek_nth (priv->play_queue, index); if (item == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "%d is out of range for queue with %d items", index, g_queue_get_length (priv->play_queue)); } return FALSE; } bgr = bognor_queue_item_get_item(item); if(bgr) { *title = g_strdup(bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_TITLE)); *album = g_strdup(bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_ALBUM)); *artist = g_strdup(bgr_item_get_metadata (bgr, BGR_ITEM_METADATA_ARTIST)); } else { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "TRACKER: metadata is not available for item %d", index); } return FALSE; } return TRUE; } gboolean bognor_queue_get_next_metadata (BognorQueue *queue, char **title, char **artist, char **album, GError **error) { BognorQueuePrivate *priv = queue->priv; BognorQueueItem *item; int index = bognor_queue_next_index(queue); if (index == -1) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_EMPTY, "no more next"); } return FALSE; } else { return bognor_queue_get_index_metadata(queue, index, title, artist, album, error); } } gboolean bognor_queue_get_index_uri (BognorQueue *queue, int index, char **uri, char **mimetype, GError **error) { BognorQueuePrivate *priv = queue->priv; BognorQueueItem *item; item = g_queue_peek_nth (priv->play_queue, index); if (item == NULL) { if (error != NULL) { *error = g_error_new (BOGNOR_QUEUE_ERROR, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, "%d is out of range for queue with %d items", index, g_queue_get_length (priv->play_queue)); } return FALSE; } *uri = g_strdup (bognor_queue_item_get_uri (item)); *mimetype = g_strdup (bognor_queue_item_get_mimetype (item)); return TRUE; } gboolean bognor_queue_set_repeat_mode (BognorQueue *queue, int mode, GError **error) { BognorQueuePrivate *priv = queue->priv; if (((priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) && ((mode & 0x80) != BOGNOR_QUEUE_MODE_SHUFFLE) ) { if (priv->current_position != g_queue_peek_nth_link (priv->play_queue, priv->current_index)) { priv->current_index = priv->shuffle_array[priv->current_index]; } } if ((mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { bq_make_shuffle_list(queue); if (priv->state == BOGNOR_QUEUE_STATE_STOPPED && (priv->shuffle_array_size > 0)) { bognor_queue_set_index (queue, priv->shuffle_array[0], error); priv->current_index = 0; } } priv->mode = mode; return TRUE; } gboolean bognor_queue_get_repeat_mode (BognorQueue *queue, int *mode, GError **error) { BognorQueuePrivate *priv = queue->priv; *mode = priv->mode; return TRUE; } gboolean bognor_queue_get_duration (BognorQueue *queue, int *duration, GError **error) { BognorQueuePrivate *priv = queue->priv; if (priv->current_position == NULL) { *duration = 0; } else { *duration = bognor_queue_item_get_duration(priv->current_position->data); } return TRUE; } gboolean bognor_queue_list_uris (BognorQueue *queue, char ***uris, GError **error) { BognorQueuePrivate *priv = queue->priv; char **uri_array; GList *u = NULL; int n_uris, i; n_uris = g_queue_get_length (priv->play_queue); uri_array = g_new (char *, n_uris + 1); for (u = priv->play_queue->head, i = 0; u; u = u->next, i++) { BognorQueueItem *item = u->data; uri_array[i] = g_strdup (bognor_queue_item_get_uri (item)); } /* NULL terminate the array */ uri_array[n_uris] = NULL; *uris = uri_array; return TRUE; } gboolean bognor_queue_get_state (BognorQueue *queue, int *state, GError **error) { BognorQueuePrivate *priv = queue->priv; *state = priv->state; return TRUE; } gboolean bognor_queue_get_name (BognorQueue *queue, char **name, GError **error) { BognorQueuePrivate *priv = queue->priv; *name = g_strdup (priv->name); return TRUE; } int bognor_queue_get_count (BognorQueue *queue) { BognorQueuePrivate *priv = queue->priv; return g_queue_get_length(priv->play_queue); } int bognor_queue_next_index (BognorQueue *queue) { BognorQueuePrivate *priv = queue->priv; int index; if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_SINGLE_REPEATING) { if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { return priv->shuffle_array[priv->current_index]; } else { return priv->current_index; } } if (priv->current_index == (bognor_queue_get_count(queue)-1)) { // last song if ((priv->mode & 0x7f) == BOGNOR_QUEUE_MODE_NORMAL) { // play no more return -1; } else { // repeat mode if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { return priv->shuffle_array[0]; } else { return 0; } } } index = priv->current_index+1; if( (priv->mode & 0x80) == BOGNOR_QUEUE_MODE_SHUFFLE) { // shuffle return priv->shuffle_array[index]; } else { // shuffle return index; } } bognor-regis/src/bognor-upnp-cp.c0000644000175000017500000001233111533735426017175 0ustar paulliupaulliu#include #include #include #include #include #include "bognor-queue.h" #include "bognor-upnp-cp.h" #include "bognor-av-transport.h" #include "bognor-render-control.h" #include "bognor-connection-manager.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BognorUpnpCpPrivate { GUPnPContext *ctxt; GUPnPRootDevice *root; GUPnPResourceFactory *factory; GUPnPServiceInfo *render_control; GUPnPServiceInfo *connection; GUPnPServiceInfo *av_transport; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_UPNP_CP, BognorUpnpCpPrivate)) G_DEFINE_TYPE (BognorUpnpCp, bognor_upnp_cp, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0,}; static void bognor_upnp_cp_finalize (GObject *object) { BognorUpnpCp *self = (BognorUpnpCp *) object; G_OBJECT_CLASS (bognor_upnp_cp_parent_class)->finalize (object); } static void bognor_upnp_cp_dispose (GObject *object) { BognorUpnpCp *self = (BognorUpnpCp *) object; G_OBJECT_CLASS (bognor_upnp_cp_parent_class)->dispose (object); } static void bognor_upnp_cp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorUpnpCp *self = (BognorUpnpCp *) object; switch (prop_id) { default: break; } } static void bognor_upnp_cp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorUpnpCp *self = (BognorUpnpCp *) object; switch (prop_id) { default: break; } } static void bognor_upnp_cp_class_init (BognorUpnpCpClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bognor_upnp_cp_dispose; o_class->finalize = bognor_upnp_cp_finalize; o_class->set_property = bognor_upnp_cp_set_property; o_class->get_property = bognor_upnp_cp_get_property; g_type_class_add_private (klass, sizeof (BognorUpnpCpPrivate)); } static GUPnPXMLDoc * make_device_description (GUPnPContext *context, const char *base_doc) { GUPnPXMLDoc *doc; GError *error = NULL; xmlDoc *xmld; xmlNode *root; char *baseurl; doc = gupnp_xml_doc_new_from_path (base_doc, &error); if (error != NULL) { g_warning ("Error loading %s: %s", base_doc, error->message); g_error_free (error); return NULL; } /* Set the URLBase */ xmld = doc->doc; if (xmld->children) { root = xmld->children; } else { g_warning ("%s has no root node", base_doc); return; } baseurl = g_strdup_printf ("http://%s:%u", gupnp_context_get_host_ip (context), gupnp_context_get_port (context)); xmlNewTextChild (root, NULL, "URLBase", baseurl); g_free (baseurl); return doc; } static void bognor_upnp_cp_init (BognorUpnpCp *self) { BognorUpnpCpPrivate *priv = GET_PRIVATE (self); GUPnPXMLDoc *description; GError *error = NULL; self->priv = priv; priv->ctxt = gupnp_context_new (NULL, NULL, 0, &error); if (error) { g_warning ("Error creating the GUPnP context: %s", error->message); g_error_free (error); return; } priv->factory = gupnp_resource_factory_get_default (); gupnp_resource_factory_register_resource_type (priv->factory, "urn:schemas-upnp-org:service:AVTransport:1", BOGNOR_TYPE_AV_TRANSPORT); gupnp_resource_factory_register_resource_type (priv->factory, "urn:schemas-upnp-org:service:ConnectionManager:1", BOGNOR_TYPE_CONNECTION_MANAGER); gupnp_resource_factory_register_resource_type (priv->factory, "urn:schemas-upnp-org:service:RenderingControl:1", BOGNOR_TYPE_RENDER_CONTROL); description = make_device_description (priv->ctxt, SCPDDIR "/MediaRenderer2.xml"); if (description == NULL) { return; } priv->root = gupnp_root_device_new_full (priv->ctxt, priv->factory, description, "", SCPDDIR); gupnp_root_device_set_available (priv->root, TRUE); priv->av_transport = gupnp_device_info_get_service (GUPNP_DEVICE_INFO (priv->root), "urn:schemas-upnp-org:service:AVTransport"); priv->connection = gupnp_device_info_get_service (GUPNP_DEVICE_INFO (priv->root), "urn:schemas-upnp-org:service:ConnectionManager"); priv->render_control = gupnp_device_info_get_service (GUPNP_DEVICE_INFO (priv->root), "urn:schemas-upnp-org:service:RenderingControl"); } BognorUpnpCp * bognor_upnp_cp_new (BognorQueue *queue) { BognorUpnpCp *cp = g_object_new (BOGNOR_TYPE_UPNP_CP, NULL); BognorUpnpCpPrivate *priv; priv = cp->priv; if (priv->av_transport == NULL) { g_object_unref (cp); return NULL; } bognor_av_transport_set_queue (priv->av_transport, queue); return cp; } bognor-regis/src/bognor-local-queue-helix.c0000644000175000017500000002221611533735426021141 0ustar paulliupaulliu#include #include #include #include #include #include #include #include #include "bognor-local-queue.h" #include "bognor-player-bindings.h" #define HELIX_TIMEOUT 200 enum { PROP_0, }; struct _BognorLocalQueuePrivate { HXClientPlayerToken player; int audio_state; guint32 tracker_id; gint64 duration; guint32 position; guint32 length; GtkRecentManager *recent_manager; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_LOCAL_QUEUE, BognorLocalQueuePrivate)) G_DEFINE_TYPE (BognorLocalQueue, bognor_local_queue, BOGNOR_TYPE_QUEUE); static gboolean kick_helix (gpointer data) { double percent = 0.0; BognorQueue *queue = (BognorQueue *) data; BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; priv->position = ClientPlayerGetPosition (priv->player); if (priv->length > 0) percent = (double)priv->position / (double)priv->length; //g_debug ("tick %f", percent); bognor_queue_emit_position_changed (queue, percent); ClientEngineProcessXEvent(NULL); } static void OnLengthChanged(void* userInfo, UInt32 length) { BognorLocalQueue *local = (BognorLocalQueue *) userInfo; BognorLocalQueuePrivate *priv = local->priv; g_debug ("OnLengthChanged: %i", length); priv->length = length; } static void OnContentConcluded(void* userInfo) { BognorQueue *queue = (BognorQueue *) userInfo; bognor_queue_play_next (queue); } static void OnContentStateChanged(void* userInfo, int oldContentState, int newContentState) { BognorLocalQueue *local = (BognorLocalQueue *) userInfo; BognorLocalQueuePrivate *priv = local->priv; priv->audio_state = newContentState; switch (newContentState) { case kContentStateNotLoaded: g_debug ("new state > not loaded"); break; case kContentStateLoading: g_debug ("new state > loading"); break; case kContentStatePaused: g_debug ("new state > paused"); break; case kContentStateStopped: g_debug ("new state > stopped"); break; case kContentStatePlaying: g_debug ("new state > playing"); break; default: g_debug ("unexpected state: %i", newContentState); break; } } static void OnErrorOccurred(void* userInfo, UInt32 hxCode, UInt32 userCode, const char* pErrorString, const char* pUserString, const char* pMoreInfoURL) { BognorQueue *queue = (BognorQueue *) userInfo; BognorQueueItem *item; item = bognor_queue_get_current_item (queue); if (item && (hxCode == 0x80040011 || /* HXR_NO_RENDERER */ hxCode == 0x80040017) /* HXR_REQUEST_UPGRADE */) { bognor_queue_notify_unknown_format (queue, item->uri); } bognor_queue_play_next (queue); g_debug ("OnErrorOccurred: %s/%s/%s", pErrorString, pUserString, pMoreInfoURL); } static int RequestUpgrade(void* userInfo, const char* pUrl, UInt32 numOfComponents, const char* componentNames[], bool isBlocking) { BognorQueue *queue = (BognorQueue *) userInfo; BognorQueueItem *item; item = bognor_queue_get_current_item (queue); if (item) { bognor_queue_notify_unknown_format (queue, item->uri); } g_debug ("RequestUpgrade: %s %i", pUrl, numOfComponents); return FALSE; } static int HasComponent(void* userInfo, const char* componentName) { g_debug ("HasComponent: %s", componentName); return FALSE; } static void bognor_local_queue_finalize (GObject *object) { G_OBJECT_CLASS (bognor_local_queue_parent_class)->finalize (object); } static void bognor_local_queue_dispose (GObject *object) { G_OBJECT_CLASS (bognor_local_queue_parent_class)->dispose (object); } static void bognor_local_queue_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { default: break; } } static void bognor_local_queue_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { default: break; } } static gboolean add_item_to_recent (BognorQueue *queue, BognorQueueItem *item) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; GtkRecentData data; gboolean ret; /* FIXME: This should just run through bognor... */ data.display_name = NULL; data.description = NULL; data.mime_type = item->mimetype; data.app_name = "Hornsey"; data.app_exec = "hornsey %u"; data.groups = NULL; data.is_private = FALSE; ret = gtk_recent_manager_add_full (priv->recent_manager, item->uri, &data); if (ret == FALSE) { g_warning ("Error registering recent use of %s\n", item->uri); } return ret; } static gboolean set_uri (BognorQueue *queue, BognorQueueItem *item) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; gboolean ret; gint pre_audio_state; pre_audio_state = priv->audio_state; ClientPlayerStop(priv->player); ClientEngineProcessXEvent(NULL); if (item == NULL) { return TRUE; } ClientPlayerOpenURL(priv->player,item->uri, NULL); ClientEngineProcessXEvent(NULL); if (pre_audio_state == kContentStatePlaying) { ClientPlayerPlay(priv->player); ClientEngineProcessXEvent(NULL); } return TRUE; } static gboolean set_playing (BognorQueue *queue, gboolean playing) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; if (playing) { ClientPlayerPlay(priv->player); if (priv->tracker_id == 0) { priv->tracker_id = g_timeout_add (HELIX_TIMEOUT, kick_helix, queue); } } else { if (priv->tracker_id > 0) { g_source_remove (priv->tracker_id); priv->tracker_id = 0; } ClientPlayerPause(priv->player); } ClientEngineProcessXEvent(NULL); return TRUE; } static gboolean set_position (BognorQueue *queue, double position) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; gint32 new_pos = 0; gint32 curr_pos = 0; if (priv->length == 0) return FALSE; new_pos = position * priv->length; curr_pos = ClientPlayerGetPosition(priv->player); if (curr_pos - new_pos > 1000 || curr_pos - new_pos <-1000) ClientPlayerSetPosition (priv->player, new_pos); else { printf("set_position ignored due to few difference curr_pos: %d,\t new_pos: %d\n",curr_pos,new_pos); } ClientEngineProcessXEvent(NULL); return TRUE; } static gboolean get_position (BognorQueue *queue, double *position) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; if (priv->length == 0) { *position = 0; } else { guint32 current = ClientPlayerGetPosition (priv->player); *position = (double)current/(double)priv->length; } return TRUE; } static void bognor_local_queue_class_init (BognorLocalQueueClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; BognorQueueClass *q_class = (BognorQueueClass *) klass; o_class->dispose = bognor_local_queue_dispose; o_class->finalize = bognor_local_queue_finalize; o_class->set_property = bognor_local_queue_set_property; o_class->get_property = bognor_local_queue_get_property; q_class->set_uri = set_uri; q_class->set_playing = set_playing; q_class->set_position = set_position; q_class->get_position = get_position; q_class->add_item_to_recent = add_item_to_recent; g_type_class_add_private (klass, sizeof (BognorLocalQueuePrivate)); } static void bognor_local_queue_init (BognorLocalQueue *self) { BognorLocalQueuePrivate *priv; static const HXClientCallbacks callbacks = { NULL, // OnVisualStateChanged NULL, // OnIdealSizeChanged OnLengthChanged, NULL, // OnTitleChanged NULL, // OnGroupsChanged NULL, // OnGroupStarted NULL, // OnContacting NULL, // OnBuffering OnContentStateChanged, OnContentConcluded, NULL, // OnStatusChanged NULL, // OnVolumeChanged NULL, // OnMuteChanged NULL, // OnClipBandwidthChanged OnErrorOccurred, NULL, // GoToURL NULL, // RequestAuthentication RequestUpgrade, HasComponent }; bognor_queue_set_name ((BognorQueue *) self, _("Playqueue")); priv = self->priv = GET_PRIVATE (self); if (!getenv("HELIX_LIBS")) setenv("HELIX_LIBS", "/opt/real/RealPlayer"); ClientPlayerCreate(&priv->player, NULL, self, &callbacks); priv->recent_manager = gtk_recent_manager_get_default (); } BognorLocalQueue * bognor_local_queue_new (void) { BognorLocalQueue *q; q = g_object_new (BOGNOR_TYPE_LOCAL_QUEUE, NULL); return q; } bognor-regis/src/bognor-av-transport.h0000644000175000017500000000405411533735426020263 0ustar paulliupaulliu#ifndef __BOGNOR_AV_TRANSPORT_H__ #define __BOGNOR_AV_TRANSPORT_H__ #include #include "bognor-queue.h" G_BEGIN_DECLS #define BOGNOR_TYPE_AV_TRANSPORT \ (bognor_av_transport_get_type()) #define BOGNOR_AV_TRANSPORT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_AV_TRANSPORT, \ BognorAvTransport)) #define BOGNOR_AV_TRANSPORT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_AV_TRANSPORT, \ BognorAvTransportClass)) #define IS_BOGNOR_AV_TRANSPORT(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_AV_TRANSPORT)) #define IS_BOGNOR_AV_TRANSPORT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_AV_TRANSPORT)) #define BOGNOR_AV_TRANSPORT_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_AV_TRANSPORT, \ BognorAvTransportClass)) typedef struct _BognorAvTransportPrivate BognorAvTransportPrivate; typedef struct _BognorAvTransport BognorAvTransport; typedef struct _BognorAvTransportClass BognorAvTransportClass; struct _BognorAvTransport { GUPnPService parent; BognorAvTransportPrivate *priv; }; struct _BognorAvTransportClass { GUPnPServiceClass parent_class; }; GType bognor_av_transport_get_type (void) G_GNUC_CONST; void bognor_av_transport_set_queue (BognorAvTransport *transport, BognorQueue *queue); G_END_DECLS #endif /* __BOGNOR_AV_TRANSPORT_H__ */ bognor-regis/src/bognor-queue.h0000644000175000017500000002120111533735426016740 0ustar paulliupaulliu#ifndef __BOGNOR_QUEUE_H__ #define __BOGNOR_QUEUE_H__ #include #include "bognor-queue-item.h" G_BEGIN_DECLS #define BOGNOR_TYPE_QUEUE \ (bognor_queue_get_type()) #define BOGNOR_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_QUEUE, \ BognorQueue)) #define BOGNOR_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_QUEUE, \ BognorQueueClass)) #define IS_BOGNOR_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_QUEUE)) #define IS_BOGNOR_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_QUEUE)) #define BOGNOR_QUEUE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_QUEUE, \ BognorQueueClass)) #define BOGNOR_QUEUE_ERROR bognor_queue_error_quark () #define BOGNOR_QUEUE_INDEX_END -1 typedef enum { BOGNOR_QUEUE_ERROR_EMPTY, BOGNOR_QUEUE_ERROR_START, BOGNOR_QUEUE_ERROR_END, BOGNOR_QUEUE_ERROR_OUT_OF_RANGE, } BognorQueueError; typedef enum _BognorQueueState { BOGNOR_QUEUE_STATE_STOPPED, BOGNOR_QUEUE_STATE_PLAYING, BOGNOR_QUEUE_LAST_STATE } BognorQueueState; typedef enum _BognorQueueStatus { BOGNOR_QUEUE_STATUS_EMPTY, BOGNOR_QUEUE_STATUS_OK, BOGNOR_QUEUE_LAST_STATUS } BognorQueueStatus; typedef enum _BognorQueueMode { BOGNOR_QUEUE_MODE_NORMAL, BOGNOR_QUEUE_MODE_REPEATING, BOGNOR_QUEUE_MODE_SINGLE_REPEATING, BOGNOR_QUEUE_MODE_SHUFFLE = 1 << 7, BOGNOR_QUEUE_LAST_MODE } BognorQueueMode; typedef struct _BognorQueuePrivate BognorQueuePrivate; typedef struct _BognorQueue BognorQueue; typedef struct _BognorQueueClass BognorQueueClass; struct _BognorQueue { GObject parent; BognorQueuePrivate *priv; }; struct _BognorQueueClass { GObjectClass parent_class; void (*set_item) (BognorQueue *queue, BognorQueueItem *item); void (*set_playing) (BognorQueue *queue, gboolean playing); void (*set_position) (BognorQueue *queue, double position); double (*get_position) (BognorQueue *queue); void (*set_mute) (BognorQueue *queue, gboolean mute); gboolean (*get_mute) (BognorQueue *queue); void (*set_volume) (BognorQueue *queue, double volume); double (*get_volume) (BognorQueue *queue); void (*add_item_to_recent) (BognorQueue *queue, BognorQueueItem *item); }; GType bognor_queue_get_type (void) G_GNUC_CONST; void bognor_queue_notify_unknown_format (BognorQueue *queue, BognorQueueItem *item); void bognor_queue_emit_position_changed (BognorQueue *queue, double position); gboolean bognor_queue_stop (BognorQueue *queue, GError **error); gboolean bognor_queue_play (BognorQueue *queue, GError **error); gboolean bognor_queue_next (BognorQueue *queue, GError **error); gboolean bognor_queue_previous (BognorQueue *queue, GError **error); gboolean bognor_queue_set_position (BognorQueue *queue, double position, GError **error); gboolean bognor_queue_get_position (BognorQueue *queue, double *position, GError **error); gboolean bognor_queue_set_mute (BognorQueue *queue, gboolean mute, GError **error); gboolean bognor_queue_get_mute (BognorQueue *queue, gboolean *mute, GError **error); gboolean bognor_queue_set_volume (BognorQueue *queue, double volume, GError **error); gboolean bognor_queue_get_volume (BognorQueue *queue, double *volume, GError **error); gboolean bognor_queue_append_uris (BognorQueue *queue, int count, const char **uris, const char **mimetypes, GError **error); gboolean bognor_queue_insert_uris (BognorQueue *queue, int position, int count, const char **uris, const char **mimetype, GError **error); gboolean bognor_queue_remove_range (BognorQueue *queue, int index, int count, GError **error); gboolean bognor_queue_move_item (BognorQueue *queue, int old_position, int new_position, GError **error); gboolean bognor_queue_set_index (BognorQueue *queue, int index, GError **error); gboolean bognor_queue_get_current_index (BognorQueue *queue, int *index, GError **error); gboolean bognor_queue_get_index (BognorQueue *queue, int *index, GError **error); gboolean bognor_queue_get_index_metadata (BognorQueue *queue, int index, char **title, char **artist, char **album, GError **error); gboolean bognor_queue_get_next_metadata (BognorQueue *queue, char **title, char **artist, char **album, GError **error); gboolean bognor_queue_set_repeat_mode (BognorQueue *queue, int mode, GError **error); gboolean bognor_queue_get_repeat_mode (BognorQueue *queue, int *mode, GError **error); gboolean bognor_queue_get_duration (BognorQueue *queue, int *duration, GError **error); gboolean bognor_queue_get_index_uri (BognorQueue *queue, int index, char **uri, char **mimetype, GError **error); gboolean bognor_queue_list_uris (BognorQueue *queue, char ***uris, GError **error); gboolean bognor_queue_get_state (BognorQueue *queue, int *state, GError **error); gboolean bognor_queue_get_name (BognorQueue *queue, char **name, GError **error); int bognor_queue_get_count (BognorQueue *queue); int bognor_queue_next_index (BognorQueue *queue); G_END_DECLS #endif /* __BOGNOR_QUEUE_H__ */ bognor-regis/src/bognor-queue-manager.c0000644000175000017500000002265711533735426020363 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "bgr-tracker-client.h" #include "bognor-local-queue.h" #include "bognor-queue-manager.h" enum { PROP_0, PROP_TRACKER, }; enum { QUEUE_CREATED, QUEUE_DESTROYED, LAST_SIGNAL }; struct _BognorQueueManagerPrivate { DBusGConnection *connection; GList *remote_queues; BognorQueue *local_queue; BgrTrackerClient *tracker; }; #define BOGNOR_QUEUE_PATH "/org/moblin/BognorRegis/Queues/" #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_QUEUE_MANAGER, BognorQueueManagerPrivate)) G_DEFINE_TYPE (BognorQueueManager, bognor_queue_manager, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0, }; static gboolean bognor_queue_manager_list_queues (BognorQueueManager *manager, char ***queue_paths, GError **error); #include "bognor-queue-manager-glue.h" static void bognor_queue_manager_finalize (GObject *object) { BognorQueueManager *self = (BognorQueueManager *) object; g_signal_handlers_destroy (object); G_OBJECT_CLASS (bognor_queue_manager_parent_class)->finalize (object); } static void bognor_queue_manager_dispose (GObject *object) { BognorQueueManager *self = (BognorQueueManager *) object; G_OBJECT_CLASS (bognor_queue_manager_parent_class)->dispose (object); } static void bognor_queue_manager_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorQueueManager *self = (BognorQueueManager *) object; BognorQueueManagerPrivate *priv = self->priv; switch (prop_id) { case PROP_TRACKER: priv->tracker = g_value_get_object (value); break; default: break; } } static void bognor_queue_manager_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorQueueManager *self = (BognorQueueManager *) object; switch (prop_id) { default: break; } } static gboolean bognor_queue_manager_list_queues (BognorQueueManager *manager, char ***queue_paths, GError **error) { BognorQueueManagerPrivate *priv = manager->priv; char **paths; int num_queues, i; GList *q; num_queues = g_list_length (priv->remote_queues); paths = g_new (char *, num_queues + 1); for (q = priv->remote_queues, i = 0; q; q = q->next, i++) { /* FIXME: Get some paths here */ } /* NULL terminate array */ paths[num_queues - 1] = NULL; *queue_paths = paths; return TRUE; } static void bognor_queue_manager_class_init (BognorQueueManagerClass *klass) { GObjectClass *o_class = (GObjectClass *)klass; o_class->dispose = bognor_queue_manager_dispose; o_class->finalize = bognor_queue_manager_finalize; o_class->set_property = bognor_queue_manager_set_property; o_class->get_property = bognor_queue_manager_get_property; g_type_class_add_private (klass, sizeof (BognorQueueManagerPrivate)); dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), &dbus_glib_bognor_queue_manager_object_info); g_object_class_install_property (o_class, PROP_TRACKER, g_param_spec_object ("tracker", "", "", BGR_TYPE_TRACKER_CLIENT, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); signals[QUEUE_CREATED] = g_signal_new ("queue-created", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); signals[QUEUE_DESTROYED] = g_signal_new ("queue-destroyed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } static void bognor_queue_manager_init (BognorQueueManager *self) { BognorQueueManagerPrivate *priv; self->priv = GET_PRIVATE (self); priv = self->priv; } static void load_queues (BognorQueueManager *manager) { BognorQueueManagerPrivate *priv; char *bognor_queue_dir; GDir *dir; priv = manager->priv; /* Ensure the correct dir is in place */ bognor_queue_dir = g_build_filename (g_get_home_dir (), ".bognor-regis", NULL); g_mkdir_with_parents (bognor_queue_dir, 0777); #if 0 dir = g_dir_open (bognor_queue_dir, 0, &error); if (dir == NULL) { g_warning ("Error opening %s: %s", bognor_queue_dir, error->message); g_error_free (error); g_free (bognor_queue_dir); return; } while (name = g_dir_read_name (dir)) { if (g_str_has_suffix (name, ".m3u")) { char *path = g_build_filename (bognor_queue_dir, name, NULL); char *object_path; BognorQueue *q; if (g_str_equal (name, "local-queue.m3u")) { q = bognor_local_queue_new (); br->local_queue = q; } else { q = NULL; /* br->remote_queues = g_list_prepend (br->remote_queues, q); */ } /* Register Queue with DBus */ /* FIXME: Need to strip the .m3u */ object_path = g_strdup_printf ("%s%s", BOGNOR_QUEUE_PATH, g_strdelimit (name, ".-", "_")); dbus_g_connection_register_g_object (br->connection, object_path, G_OBJECT (q)); /* FIXME: Emit a new queue signal */ g_free (object_path); g_free (path); } } #endif /* We always want to have a local queue */ if (priv->local_queue == NULL) { char *object_path; priv->local_queue = (BognorQueue *) bognor_local_queue_new (priv->tracker); object_path = g_strdup_printf ("%slocal_queue", BOGNOR_QUEUE_PATH); dbus_g_connection_register_g_object (priv->connection, object_path, G_OBJECT (priv->local_queue)); /* FIXME: Should we emit a signal for the local queue... it always exists and is at a well known location */ g_free (object_path); } #if 0 g_dir_close (dir); #endif g_free (bognor_queue_dir); } BognorQueueManager * bognor_queue_manager_new (DBusGConnection *connection, BgrTrackerClient *tracker) { BognorQueueManager *manager; BognorQueueManagerPrivate *priv; manager = g_object_new (BOGNOR_TYPE_QUEUE_MANAGER, "tracker", tracker, NULL); priv = manager->priv; priv->connection = connection; /* Load our queues */ load_queues (manager); return manager; } void bognor_queue_manager_action (BognorQueueManager *manager, BognorQueueManagerAction action) { BognorQueueManagerPrivate *priv = manager->priv; switch (action) { case BOGNOR_QUEUE_MANAGER_ACTION_PLAY: bognor_queue_play (priv->local_queue, NULL); break; case BOGNOR_QUEUE_MANAGER_ACTION_PAUSE: bognor_queue_stop (priv->local_queue, NULL); break; case BOGNOR_QUEUE_MANAGER_ACTION_NEXT: bognor_queue_next (priv->local_queue, NULL); break; case BOGNOR_QUEUE_MANAGER_ACTION_PREVIOUS: break; default: break; } } BognorQueue * bognor_queue_manager_get_local_queue (BognorQueueManager *manager) { BognorQueueManagerPrivate *priv = manager->priv; return priv->local_queue; } bognor-regis/src/main.c0000644000175000017500000001347311533735426015263 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #ifdef ENABLE_GST #include #endif #include #include #include #include #include #include "bgr-tracker-client.h" #include "bognor-marshal.h" #include "bognor-queue-manager.h" #include "bognor-upnp-cp.h" typedef struct BognorRegis { DBusGConnection *connection; DBusGProxy *proxy; /* Do we need to keep this around? */ DBusGProxy *mmkeys; BgrTrackerClient *tracker; BognorQueueManager *manager; BognorUpnpCp *control_point; GMainLoop *mainloop; } BognorRegis; BognorRegis *br; #define BOGNOR_NAME "org.moblin.BognorRegis" #define BOGNOR_MANAGER_PATH "/org/moblin/BognorRegis/QueueManager" static void grab_keys (void) { if (br->mmkeys) { dbus_g_proxy_call (br->mmkeys, "GrabMediaPlayerKeys", NULL, G_TYPE_STRING, "Bognor-Regis", G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_INVALID); } } static void mmkeys_press_cb (DBusGProxy *proxy, const char *application, const char *key, gpointer userdata) { if (g_str_equal (application, "Bognor-Regis")) { BognorQueueManagerAction action; if (g_str_equal (key, "Play")) { action = BOGNOR_QUEUE_MANAGER_ACTION_PLAY; } else if (g_str_equal (key, "Stop")) { action = BOGNOR_QUEUE_MANAGER_ACTION_PAUSE; } else if (g_str_equal (key, "Next")) { action = BOGNOR_QUEUE_MANAGER_ACTION_NEXT; } else if (g_str_equal (key, "Previous")) { action = BOGNOR_QUEUE_MANAGER_ACTION_PREVIOUS; } else { return; } bognor_queue_manager_action (br->manager, action); } } static void mmkeys_destroyed_cb (DBusGProxy *proxy, gpointer userdata) { br->mmkeys = NULL; } static gboolean init_dbus (void) { guint32 request_name_ret; GError *error = NULL; bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); br->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (br->connection == NULL) { g_warning ("Error getting bus: %s", error->message); g_error_free (error); return FALSE; } br->proxy = dbus_g_proxy_new_for_name (br->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if (!org_freedesktop_DBus_request_name (br->proxy, BOGNOR_NAME, 0, &request_name_ret, &error)) { g_warning ("Error registering on DBus: %s", error->message); g_error_free (error); return FALSE; } if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { return FALSE; } br->tracker = g_object_new (BGR_TYPE_TRACKER_CLIENT, NULL); br->manager = bognor_queue_manager_new (br->connection, br->tracker); dbus_g_connection_register_g_object (br->connection, BOGNOR_MANAGER_PATH, G_OBJECT (br->manager)); br->mmkeys = dbus_g_proxy_new_for_name_owner (br->connection, "org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon/MediaKeys", "org.gnome.SettingsDaemon.MediaKeys", &error); if (error != NULL) { g_warning ("Could not setup multimedia-keys: %s", error->message); g_error_free (error); return TRUE; } g_signal_connect (br->mmkeys, "destroy", G_CALLBACK (mmkeys_destroyed_cb), br); dbus_g_object_register_marshaller (bognor_marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (br->mmkeys, "MediaPlayerKeyPressed", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (br->mmkeys, "MediaPlayerKeyPressed", G_CALLBACK (mmkeys_press_cb), br, NULL); grab_keys (); return TRUE; } static void init_upnp (void) { BognorQueue *local; local = bognor_queue_manager_get_local_queue (br->manager); br->control_point = bognor_upnp_cp_new (local); } int main (int argc, char **argv) { g_thread_init (NULL); g_type_init (); #ifdef ENABLE_GST gst_init (&argc, &argv); #endif gtk_init (&argc, &argv); br = g_new0 (BognorRegis, 1); if (init_dbus () == FALSE) { return 0; } notify_init ("Bognor-Regis Media Daemon"); init_upnp (); br->mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (br->mainloop); return 0; } bognor-regis/src/bognor-local-queue.h0000644000175000017500000000533611533735426020043 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __BOGNOR_LOCAL_QUEUE_H__ #define __BOGNOR_LOCAL_QUEUE_H__ #include "bognor-queue.h" #include "bgr-tracker-client.h" G_BEGIN_DECLS #define BOGNOR_TYPE_LOCAL_QUEUE \ (bognor_local_queue_get_type()) #define BOGNOR_LOCAL_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_LOCAL_QUEUE, \ BognorLocalQueue)) #define BOGNOR_LOCAL_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_LOCAL_QUEUE, \ BognorLocalQueueClass)) #define IS_BOGNOR_LOCAL_QUEUE(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_LOCAL_QUEUE)) #define IS_BOGNOR_LOCAL_QUEUE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_LOCAL_QUEUE)) #define BOGNOR_LOCAL_QUEUE_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_LOCAL_QUEUE, \ BognorLocalQueueClass)) typedef struct _BognorLocalQueuePrivate BognorLocalQueuePrivate; typedef struct _BognorLocalQueue BognorLocalQueue; typedef struct _BognorLocalQueueClass BognorLocalQueueClass; struct _BognorLocalQueue { BognorQueue parent; BognorLocalQueuePrivate *priv; }; struct _BognorLocalQueueClass { BognorQueueClass parent_class; }; GType bognor_local_queue_get_type (void) G_GNUC_CONST; BognorLocalQueue *bognor_local_queue_new (BgrTrackerClient *tracker); G_END_DECLS #endif /* __BOGNOR_LOCAL_QUEUE_H__ */ bognor-regis/src/Makefile.am0000644000175000017500000000567611533735426016235 0ustar paulliupaulliulibexec_PROGRAMS = bognor-regis-daemon common_sources = \ bgr-item.c \ bgr-item.h \ bgr-tracker-client.c \ bgr-tracker-client.h \ bognor-av-transport.c \ bognor-av-transport.h \ bognor-connection-manager.c \ bognor-connection-manager.h \ bognor-last-change.c \ bognor-last-change.h \ bognor-local-queue.h \ bognor-queue.c \ bognor-queue.h \ bognor-queue-item.c \ bognor-queue-item.h \ bognor-queue-manager.c \ bognor-queue-manager.h \ bognor-render-control.c \ bognor-render-control.h \ bognor-upnp-cp.c \ bognor-upnp-cp.h \ main.c if HELIX bognor_regis_daemon_CFLAGS = \ -I$(top_srcdir) \ -I$(srcdir) \ -I$(top_builddir) \ -DPKGDATADIR=\"$(pkgdatadir)/\" \ -DLOCALEDIR=\""$(localedir)"\" \ -DSCPDDIR=\""$(datadir)/bognor-regis/scpd"\" \ $(BOGNOR_CFLAGS) $(HELIX_CFLAGS) bognor_regis_daemon_LDADD = \ $(BOGNOR_LIBS) $(HELIX_LIBS) bognor_regis_daemon_SOURCES = \ $(BUILT_SOURCES) \ bognor-local-queue-helix.c \ $(common_sources) else bognor_regis_daemon_CFLAGS = \ -I$(top_srcdir) \ -I$(srcdir) \ -I$(top_builddir) \ -DPKGDATADIR=\"$(pkgdatadir)/\" \ -DLOCALEDIR=\""$(localedir)"\" \ -DSCPDDIR=\""$(datadir)/bognor-regis/scpd"\" \ $(BOGNOR_CFLAGS) $(GST_CFLAGS) bognor_regis_daemon_LDADD = \ $(BOGNOR_LIBS) $(GST_LIBS) bognor_regis_daemon_SOURCES = \ $(BUILT_SOURCES) \ bognor-local-queue-gst.c \ $(common_sources) endif BUILT_SOURCES = \ bognor-marshal.c \ bognor-marshal.h \ bognor-player-bindings.h \ bognor-queue-glue.h \ bognor-queue-manager-glue.h EXTRA_DIST = $(BUILT_SOURCES) bognor-marshal.list CLEANFILES = $(BUILT_SOURCES) \ stamp-bognor-queue-glue.h \ stamp-bognor-queue-manager-glue.h \ stamp-bognor-player-bindings.h MAINTAINTERCLEANFILES = Makefile.in %-glue.h: stamp-%-glue.h @true stamp-bognor-queue-glue.h: ../interfaces/BognorQueue.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=bognor_queue --mode=glib-server $< > xgen-$(@F) \ && (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \ && rm -f xgen-$(@F) \ && echo timestamp > $(@F) stamp-bognor-queue-manager-glue.h: ../interfaces/BognorQueueManager.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=bognor_queue_manager --mode=glib-server $< > xgen-$(@F) \ && (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \ && rm -f xgen-$(@F) \ && echo timestamp > $(@F) %-bindings.h: stamp-%-bindings.h @true stamp-bognor-player-bindings.h: ../interfaces/BognorPlayer.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=bognor_player --mode=glib-client $< > xgen-$(@F) \ && (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \ && rm -f xgen-$(@F) \ && echo timestamp > $(@F) bognor-marshal.h: bognor-marshal.list $(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=bognor_marshal > $@ bognor-marshal.c: bognor-marshal.list @echo "#include \"bognor-marshal.h\"" > $@ \ && $(GLIB_GENMARSHAL) $< --body --prefix=bognor_marshal >> $@ bognor-regis/src/bognor-av-transport.c0000644000175000017500000004367211533735426020267 0ustar paulliupaulliu#include #include "bognor-queue.h" #include "bognor-last-change.h" #include "bognor-av-transport.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BognorAvTransportPrivate { BognorQueue *queue; BognorQueueItem *item; BognorLastChange *lc; }; static const char *states[BOGNOR_QUEUE_LAST_STATE] = { "STOPPED", "PLAYING" }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_AV_TRANSPORT, BognorAvTransportPrivate)) G_DEFINE_TYPE (BognorAvTransport, bognor_av_transport, GUPNP_TYPE_SERVICE); static void bognor_av_transport_finalize (GObject *object) { BognorAvTransport *self = (BognorAvTransport *) object; G_OBJECT_CLASS (bognor_av_transport_parent_class)->finalize (object); } static void bognor_av_transport_dispose (GObject *object) { BognorAvTransport *self = (BognorAvTransport *) object; G_OBJECT_CLASS (bognor_av_transport_parent_class)->dispose (object); } static void bognor_av_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorAvTransport *self = (BognorAvTransport *) object; switch (prop_id) { default: break; } } static void bognor_av_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorAvTransport *self = (BognorAvTransport *) object; switch (prop_id) { default: break; } } static void bognor_av_transport_class_init (BognorAvTransportClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; GUPnPServiceClass *s_class = (GUPnPServiceClass *) klass; o_class->dispose = bognor_av_transport_dispose; o_class->finalize = bognor_av_transport_finalize; o_class->set_property = bognor_av_transport_set_property; o_class->get_property = bognor_av_transport_get_property; g_type_class_add_private (klass, sizeof (BognorAvTransportPrivate)); } static void query_variable_cb (GUPnPService *service, char *variable, GValue *value, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; g_print ("[AV Transport] Query %s\n", variable); if (g_str_equal (variable, "LastChange")) { BognorLastChange *lc = bognor_last_change_new (NULL); const char *event; BognorQueueState state; char *str; int idx; bognor_queue_get_state (priv->queue, (int *) &state, NULL); bognor_last_change_add (lc, "TransportState", states[state]); bognor_last_change_add (lc, "TransportStatus", "OK"); bognor_last_change_add (lc, "PlaybackStorageMedium", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "RecordStorageMedium", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "PossiblePlaybackStorageMedia", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "PossibleRecordStorageMedia", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "CurrentPlayMode", "Normal"); bognor_last_change_add (lc, "TransportPlaySpeed", "1"); bognor_last_change_add (lc, "RecordMediumWriteStatus", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "CurrentRecordQualityMode", "NOT_IMPLEMENTED"); bognor_last_change_add (lc, "PossibleRecordQualityMode", "NOT_IMPLEMENTED"); str = g_strdup_printf ("%d", bognor_queue_get_count (priv->queue)); bognor_last_change_add (lc, "NumberOfTracks", str); g_free (str); bognor_queue_get_index (priv->queue, &idx, NULL); str = g_strdup_printf ("%d", idx); bognor_last_change_add (lc, "CurrentTrack", str); g_free (str); bognor_last_change_add (lc, "CurrentTrackDuration", "0:00:00"); bognor_last_change_add (lc, "CurrentMediaDuration", "0:00:00"); if (priv->item) { bognor_last_change_add (lc, "CurrentTrackMetadata", bognor_queue_item_get_metadata (priv->item)); } else { bognor_last_change_add (lc, "CurrentTrackMetadata", ""); } if (priv->item) { bognor_last_change_add (lc, "CurrentTrackURI", bognor_queue_item_get_uri (priv->item)); } else { bognor_last_change_add (lc, "CurrentTrackURI", ""); } bognor_last_change_add (lc, "AVTransportURI", ""); bognor_last_change_add (lc, "NextAVTransportURI", ""); event = bognor_last_change_finish (lc); g_print ("LastChange: %s\n", event); g_value_init (value, G_TYPE_STRING); g_value_set_string (value, event); bognor_last_change_free (lc); } } static gboolean check_instance_id (GUPnPServiceAction *action) { int instance_id; gupnp_service_action_get (action, "InstanceID", G_TYPE_INT, &instance_id, NULL); if (instance_id != 0) { gupnp_service_action_return_error (action, 718, "Invalid InstanceID"); return FALSE; } return TRUE; } struct _set_av_transport_uri_data { BognorAvTransport *transport; GUPnPServiceAction *action; char *uri; char *metadata; }; static void set_av_transport_object_avail_cb (GUPnPDIDLLiteParser *parser, GUPnPDIDLLiteObject *object, struct _set_av_transport_uri_data *data) { BognorAvTransportPrivate *priv = data->transport->priv; GList *res; GUPnPProtocolInfo *info; const char *mimetype; const char *uris[1] = {0,}, *mimetypes[1] = {0,}; res = gupnp_didl_lite_object_get_resources (object); if (res == NULL) { gupnp_service_action_return_error (data->action, 714, "Illegal MIME type"); return; } info = gupnp_didl_lite_resource_get_protocol_info (res->data); mimetype = gupnp_protocol_info_get_mime_type (info); if (g_str_has_prefix (mimetype, "audio/") == FALSE) { gupnp_service_action_return_error (data->action, 714, "Illegal MIME type"); return; } uris[0] = data->uri; mimetypes[0] = mimetype; bognor_queue_append_uris (priv->queue, 1, uris, mimetypes, NULL); bognor_queue_set_index (priv->queue, BOGNOR_QUEUE_INDEX_END, NULL); gupnp_service_action_return (data->action); } static void set_av_transport_uri_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; struct _set_av_transport_uri_data data; GUPnPDIDLLiteParser *parser; char *uri, *metadata; GError *error = NULL; if (check_instance_id (action) == FALSE) { return; } gupnp_service_action_get (action, "CurrentURI", G_TYPE_STRING, &uri, "CurrentURIMetaData", G_TYPE_STRING, &metadata, NULL); g_print ("Uri: %s\nMetadata: %s\n", uri, metadata); data.transport = transport; data.action = action; data.uri = uri; data.metadata = metadata; parser = gupnp_didl_lite_parser_new (); g_signal_connect (parser, "object-available", G_CALLBACK (set_av_transport_object_avail_cb), &data); gupnp_didl_lite_parser_parse_didl (parser, metadata, &error); if (error != NULL) { g_warning ("Error parsing DIDL: %s\n", metadata); g_error_free (error); g_free (uri); g_free (metadata); gupnp_service_action_return_error (action, 714, "Illegal MIME type"); return; } g_free (uri); g_free (metadata); } static void get_media_info_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { if (check_instance_id (action) == FALSE) { return; } g_print ("[AV Transport] Get media info\n"); gupnp_service_action_return (action); } static void get_transport_info_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { if (check_instance_id (action) == FALSE) { return; } g_print ("[AV Transport] Get transport info\n"); gupnp_service_action_return (action); } static char * seconds_to_duration (guint seconds) { int hours, minutes; hours = seconds / 3600; seconds -= (hours * 3600); minutes = seconds / 60; seconds -= (minutes * 60); return g_strdup_printf ("%d:%02d:%02d", hours, minutes, seconds); } static void get_position_info_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; int seconds, position, idx; double p; char *duration, *pos; const char *metadata, *uri; if (check_instance_id (action) == FALSE) { return; } if (priv->item) { seconds = bognor_queue_item_get_duration (priv->item); metadata = bognor_queue_item_get_metadata (priv->item); uri = bognor_queue_item_get_uri (priv->item); } else { gupnp_service_action_return_error (action, 402, "Invalid Args"); return; } duration = seconds_to_duration (seconds); p = 0.0; bognor_queue_get_position (priv->queue, &p, NULL); position = seconds * p; pos = seconds_to_duration (position); bognor_queue_get_index (priv->queue, &idx, NULL); gupnp_service_action_set (action, "Track", G_TYPE_INT, idx, "TrackDuration", G_TYPE_STRING, duration, "TrackMetadata", G_TYPE_STRING, metadata ? metadata : "", "TrackURI", G_TYPE_STRING, uri ? uri : "", "RelTime", G_TYPE_STRING, pos, "AbsTime", G_TYPE_STRING, pos, "RelCount", G_TYPE_INT, G_MAXINT, "AbsCount", G_TYPE_INT, G_MAXINT, NULL); g_free (pos); g_free (duration); gupnp_service_action_return (action); } static void get_device_capabilities_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { if (check_instance_id (action) == FALSE) { return; } g_print ("[AV Transport] Get device capabilities\n"); gupnp_service_action_return (action); } static void get_transport_settings_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { if (check_instance_id (action) == FALSE) { return; } g_print ("[AV Transport] Get transport settings\n"); gupnp_service_action_return (action); } static void stop_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; g_print ("[AV Transport] - Stop\n"); if (check_instance_id (action) == FALSE) { return; } bognor_queue_stop (priv->queue, NULL); gupnp_service_action_return (action); } static void play_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; g_print ("[AV Transport] - Play\n"); if (check_instance_id (action) == FALSE) { return; } bognor_queue_play (priv->queue, NULL); gupnp_service_action_return (action); } static void pause_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; g_print ("[AV Transport] - Pause\n"); if (check_instance_id (action) == FALSE) { return; } bognor_queue_stop (priv->queue, NULL); gupnp_service_action_return (action); } static void seek_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; char *unit, *target; g_print ("[AV Transport] - Seek\n"); if (check_instance_id (action) == FALSE) { return; } gupnp_service_action_get (action, "Unit", G_TYPE_STRING, &unit, "Target", G_TYPE_STRING, &target, NULL); if (g_str_equal (unit, "ABS_TIME")) { int hours, minutes, seconds; int duration, position; sscanf (target, "%d:%2d:%2d*s", &hours, &minutes, &seconds); position = hours * 3600 + minutes * 60 + seconds; if (priv->item) { duration = bognor_queue_item_get_duration (priv->item); } else { duration = -1; } if (duration == -1) { gupnp_service_action_return_error (action, 710, "Seek mode not supported"); return; } bognor_queue_set_position (priv->queue, (double) position / (double) duration, NULL); } gupnp_service_action_return (action); } static void next_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; g_print ("[AV Transport] - Next\n"); if (check_instance_id (action) == FALSE) { return; } bognor_queue_next (priv->queue, NULL); gupnp_service_action_return (action); } static void previous_cb (GUPnPService *service, GUPnPServiceAction *action, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; if (check_instance_id (action) == FALSE) { return; } bognor_queue_previous (priv->queue, NULL); gupnp_service_action_return (action); } static void bognor_av_transport_init (BognorAvTransport *self) { BognorAvTransportPrivate *priv = GET_PRIVATE (self); self->priv = priv; priv->lc = bognor_last_change_new ((GUPnPService *) self); g_signal_connect (self, "query-variable", G_CALLBACK (query_variable_cb), self); g_signal_connect (self, "action-invoked::SetAVTransportURI", G_CALLBACK (set_av_transport_uri_cb), self); g_signal_connect (self, "action-invoked::GetMediaInfo", G_CALLBACK (get_media_info_cb), self); g_signal_connect (self, "action-invoked::GetTransportInfo", G_CALLBACK (get_transport_info_cb), self); g_signal_connect (self, "action-invoked::GetPositionInfo", G_CALLBACK (get_position_info_cb), self); g_signal_connect (self, "action-invoked::GetDeviceCapabilities", G_CALLBACK (get_device_capabilities_cb), self); g_signal_connect (self, "action-invoked::GetTransportSettings", G_CALLBACK (get_transport_settings_cb), self); g_signal_connect (self, "action-invoked::Stop", G_CALLBACK (stop_cb), self); g_signal_connect (self, "action-invoked::Play", G_CALLBACK (play_cb), self); g_signal_connect (self, "action-invoked::Pause", G_CALLBACK (pause_cb), self); g_signal_connect (self, "action-invoked::Seek", G_CALLBACK (seek_cb), self); g_signal_connect (self, "action-invoked::Next", G_CALLBACK (next_cb), self); g_signal_connect (self, "action-invoked::Previous", G_CALLBACK (previous_cb), self); } static void current_item_destroyed (gpointer data, GObject *dead_object) { BognorAvTransport *transport = (BognorAvTransport *) data; BognorAvTransportPrivate *priv = transport->priv; priv->item = NULL; } static void queue_item_changed (BognorQueue *queue, BognorQueueItem *item, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; if (priv->item) { g_object_weak_unref ((GObject *) priv->item, current_item_destroyed, transport); } priv->item = item; g_object_weak_ref ((GObject *) priv->item, current_item_destroyed, transport); if (priv->item) { bognor_last_change_add (priv->lc, "CurrentTrackMetadata", bognor_queue_item_get_metadata (priv->item)); } else { bognor_last_change_add (priv->lc, "CurrentTrackMetadata", ""); } if (priv->item) { bognor_last_change_add (priv->lc, "CurrentTrackURI", bognor_queue_item_get_uri (priv->item)); } else { bognor_last_change_add (priv->lc, "CurrentTrackURI", ""); } bognor_last_change_add (priv->lc, "AVTransportURI", ""); bognor_last_change_add (priv->lc, "NextAVTransportURI", ""); } static void state_changed (BognorQueue *queue, BognorQueueState state, BognorAvTransport *transport) { BognorAvTransportPrivate *priv = transport->priv; bognor_last_change_add (priv->lc, "TransportState", states[state]); } void bognor_av_transport_set_queue (BognorAvTransport *transport, BognorQueue *queue) { BognorAvTransportPrivate *priv = transport->priv; priv->queue = queue; g_signal_connect (queue, "item-changed", G_CALLBACK (queue_item_changed), transport); g_signal_connect (queue, "state-changed", G_CALLBACK (state_changed), transport); } bognor-regis/src/bognor-render-control.h0000644000175000017500000000366611533735426020570 0ustar paulliupaulliu#ifndef __BOGNOR_RENDER_CONTROL_H__ #define __BOGNOR_RENDER_CONTROL_H__ #include G_BEGIN_DECLS #define BOGNOR_TYPE_RENDER_CONTROL \ (bognor_render_control_get_type()) #define BOGNOR_RENDER_CONTROL(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_RENDER_CONTROL, \ BognorRenderControl)) #define BOGNOR_RENDER_CONTROL_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_RENDER_CONTROL, \ BognorRenderControlClass)) #define IS_BOGNOR_RENDER_CONTROL(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_RENDER_CONTROL)) #define IS_BOGNOR_RENDER_CONTROL_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_RENDER_CONTROL)) #define BOGNOR_RENDER_CONTROL_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_RENDER_CONTROL, \ BognorRenderControlClass)) typedef struct _BognorRenderControlPrivate BognorRenderControlPrivate; typedef struct _BognorRenderControl BognorRenderControl; typedef struct _BognorRenderControlClass BognorRenderControlClass; struct _BognorRenderControl { GUPnPService parent; BognorRenderControlPrivate *priv; }; struct _BognorRenderControlClass { GUPnPServiceClass parent_class; }; GType bognor_render_control_get_type (void) G_GNUC_CONST; G_END_DECLS #endif /* __BOGNOR_RENDER_CONTROL_H__ */ bognor-regis/src/bognor-source-manager.h0000644000175000017500000000411111533735426020525 0ustar paulliupaulliu#ifndef __BOGNOR_SOURCE_MANAGER_H__ #define __BOGNOR_SOURCE_MANAGER_H__ #include #include G_BEGIN_DECLS #define BOGNOR_TYPE_SOURCE_MANAGER \ (bognor_source_manager_get_type()) #define BOGNOR_SOURCE_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_SOURCE_MANAGER, \ BognorSourceManager)) #define BOGNOR_SOURCE_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_SOURCE_MANAGER, \ BognorSourceManagerClass)) #define IS_BOGNOR_SOURCE_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_SOURCE_MANAGER)) #define IS_BOGNOR_SOURCE_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_SOURCE_MANAGER)) #define BOGNOR_SOURCE_MANAGER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_SOURCE_MANAGER, \ BognorSourceManagerClass)) typedef struct _BognorSourceManagerPrivate BognorSourceManagerPrivate; typedef struct _BognorSourceManager BognorSourceManager; typedef struct _BognorSourceManagerClass BognorSourceManagerClass; struct _BognorSourceManager { GObject parent; BognorSourceManagerPrivate *priv; }; struct _BognorSourceManagerClass { GObjectClass parent_class; }; GType bognor_source_manager_get_type (void) G_GNUC_CONST; BklItem *bognor_source_manager_find_item (BognorSourceManager *self, const char *uri); G_END_DECLS #endif /* __BOGNOR_SOURCE_MANAGER_H__ */ bognor-regis/src/bognor-source-manager.c0000644000175000017500000001434111533735426020526 0ustar paulliupaulliu#include #include #include #include "bognor-source-manager.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BognorSourceManagerPrivate { BklSourceManagerClient *manager; BklSourceClient *local_source; GList *transient_sources; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_SOURCE_MANAGER, BognorSourceManagerPrivate)) G_DEFINE_TYPE (BognorSourceManager, bognor_source_manager, G_TYPE_OBJECT); static void bognor_source_manager_finalize (GObject *object) { BognorSourceManager *self = (BognorSourceManager *) object; G_OBJECT_CLASS (bognor_source_manager_parent_class)->finalize (object); } static void bognor_source_manager_dispose (GObject *object) { BognorSourceManager *self = (BognorSourceManager *) object; G_OBJECT_CLASS (bognor_source_manager_parent_class)->dispose (object); } static void bognor_source_manager_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorSourceManager *self = (BognorSourceManager *) object; switch (prop_id) { default: break; } } static void bognor_source_manager_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorSourceManager *self = (BognorSourceManager *) object; switch (prop_id) { default: break; } } static void bognor_source_manager_class_init (BognorSourceManagerClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bognor_source_manager_dispose; o_class->finalize = bognor_source_manager_finalize; o_class->set_property = bognor_source_manager_set_property; o_class->get_property = bognor_source_manager_get_property; g_type_class_add_private (klass, sizeof (BognorSourceManagerPrivate)); } static void source_ready_cb (BklSourceClient *source_client, BognorSourceManager *manager) { BognorSourceManagerPrivate *priv = manager->priv; priv->transient_sources = g_list_prepend (priv->transient_sources, source_client); } static void source_added_cb (BklSourceManagerClient *client, const char *object_path, BognorSourceManager *manager) { BklSourceClient *source; source = bkl_source_client_new (object_path); g_signal_connect (source, "ready", G_CALLBACK (source_ready_cb), manager); } static void source_removed_cb (BklSourceManagerClient *client, const char *object_path, BognorSourceManager *manager) { BognorSourceManagerPrivate *priv = manager->priv; GList *s; for (s = priv->transient_sources; s; s = s->next) { BklSourceClient *client = s->data; if (g_str_equal (object_path, bkl_source_client_get_path (client))) { g_object_unref (client); priv->transient_sources = g_list_delete_link (priv->transient_sources, s); break; } } } static void local_source_ready (BklSourceClient *client, BognorSourceManager *manager) { BognorSourceManagerPrivate *priv = manager->priv; priv->local_source = client; } static void get_sources_reply (BklSourceManagerClient *client, GList *sources, GError *error, gpointer userdata) { BognorSourceManager *manager = (BognorSourceManager *) userdata; BognorSourceManagerPrivate *priv = manager->priv; BklSourceClient *ls; GList *s; if (error != NULL) { g_warning ("Error getting sources: %s", error->message); g_error_free (error); } ls = bkl_source_client_new (BKL_LOCAL_SOURCE_PATH); g_signal_connect (ls, "ready", G_CALLBACK (local_source_ready), manager); for (s = sources; s; s = s->next) { source_added_cb (client, s->data, manager); } g_list_free (sources); } static void bkl_manager_ready_cb (BklSourceManagerClient *manager_client, BognorSourceManager *manager) { BognorSourceManagerPrivate *priv = manager->priv; bkl_source_manager_client_get_sources (priv->manager, get_sources_reply, manager); } static void bognor_source_manager_init (BognorSourceManager *self) { BognorSourceManagerPrivate *priv = GET_PRIVATE (self); self->priv = priv; priv->manager = g_object_new (BKL_TYPE_SOURCE_MANAGER_CLIENT, NULL); g_signal_connect (priv->manager, "ready", G_CALLBACK (bkl_manager_ready_cb), self); g_signal_connect (priv->manager, "source-added", G_CALLBACK (source_added_cb), self); g_signal_connect (priv->manager, "source-removed", G_CALLBACK (source_removed_cb), self); } static BklItem * find_item (BklSourceClient *client, const char *uri) { BklDB *db = bkl_source_client_get_db (client); BklItem *item = NULL; GError *error = NULL; item = bkl_db_get_item (db, uri, &error); if (error != NULL) { if (error->code != KOZO_DB_ERROR_KEY_NOT_FOUND) { g_warning ("Error getting item for %s: %s", uri, error->message); g_error_free (error); return NULL; } g_error_free (error); } return item; } BklItem * bognor_source_manager_find_item (BognorSourceManager *self, const char *uri) { BognorSourceManagerPrivate *priv = self->priv; GList *s; BklItem *item; item = find_item (priv->local_source, uri); if (item) { return item; } for (s = priv->transient_sources; s; s = s->next) { BklSourceClient *client = s->data; item = find_item (client, uri); if (item) { return item; } } return NULL; } bognor-regis/src/bgr-tracker-client.h0000644000175000017500000000377611533735426020030 0ustar paulliupaulliu#ifndef __BGR_TRACKER_CLIENT_H__ #define __BGR_TRACKER_CLIENT_H__ #include #include "bgr-item.h" G_BEGIN_DECLS #define BGR_TYPE_TRACKER_CLIENT \ (bgr_tracker_client_get_type()) #define BGR_TRACKER_CLIENT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BGR_TYPE_TRACKER_CLIENT, \ BgrTrackerClient)) #define BGR_TRACKER_CLIENT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BGR_TYPE_TRACKER_CLIENT, \ BgrTrackerClientClass)) #define IS_BGR_TRACKER_CLIENT(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BGR_TYPE_TRACKER_CLIENT)) #define IS_BGR_TRACKER_CLIENT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BGR_TYPE_TRACKER_CLIENT)) #define BGR_TRACKER_CLIENT_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BGR_TYPE_TRACKER_CLIENT, \ BgrTrackerClientClass)) typedef struct _BgrTrackerClientPrivate BgrTrackerClientPrivate; typedef struct _BgrTrackerClient BgrTrackerClient; typedef struct _BgrTrackerClientClass BgrTrackerClientClass; struct _BgrTrackerClient { GObject parent; BgrTrackerClientPrivate *priv; }; struct _BgrTrackerClientClass { GObjectClass parent_class; }; GType bgr_tracker_client_get_type (void) G_GNUC_CONST; BgrItem *bgr_tracker_client_get_item (BgrTrackerClient *client, const char *uri); G_END_DECLS #endif /* __BGR_TRACKER_CLIENT_H__ */ bognor-regis/src/bognor-marshal.list0000644000175000017500000000010411533735426017766 0ustar paulliupaulliuVOID:STRING,INT VOID:STRING,STRING VOID:INT,DOUBLE VOID:INT,INT,INT bognor-regis/src/bognor-local-queue-gst.c0000644000175000017500000003012311533735426020621 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include "bgr-tracker-client.h" #include "bognor-queue-item.h" #include "bognor-local-queue.h" #include "bognor-player-bindings.h" enum { PROP_0, }; struct _BognorLocalQueuePrivate { BognorQueueItem *current_item; GstElement *playbin; GstState audio_state; gboolean audio_set; guint32 tracker_id; double position; GtkRecentManager *recent_manager; gboolean error_occured; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_LOCAL_QUEUE, BognorLocalQueuePrivate)) G_DEFINE_TYPE (BognorLocalQueue, bognor_local_queue, BOGNOR_TYPE_QUEUE); static void make_playbin (BognorLocalQueue *queue); static void bognor_local_queue_finalize (GObject *object) { G_OBJECT_CLASS (bognor_local_queue_parent_class)->finalize (object); } static void bognor_local_queue_dispose (GObject *object) { G_OBJECT_CLASS (bognor_local_queue_parent_class)->dispose (object); } static void bognor_local_queue_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { default: break; } } static void bognor_local_queue_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { default: break; } } static void add_item_to_recent (BognorQueue *queue, BognorQueueItem *item) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; GtkRecentData data; gboolean ret; /* FIXME: This should just run through bognor... */ data.display_name = NULL; data.description = NULL; data.mime_type = (char *) bognor_queue_item_get_mimetype (item); data.app_name = "Hornsey"; data.app_exec = "hornsey %u"; data.groups = NULL; data.is_private = FALSE; ret = gtk_recent_manager_add_full (priv->recent_manager, bognor_queue_item_get_uri (item), &data); if (ret == FALSE) { g_warning ("Error registering recent use of %s\n", bognor_queue_item_get_uri (item)); } } static void set_item (BognorQueue *queue, BognorQueueItem *item) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; gboolean ret; GstState state; if (item == NULL) { priv->audio_set = FALSE; g_object_set (priv->playbin, "uri", "", NULL); if (priv->audio_state == GST_STATE_PLAYING) { gst_element_set_state (priv->playbin, GST_STATE_PAUSED); priv->audio_state = GST_STATE_PAUSED; } priv->current_item = NULL; return; } priv->current_item = item; if (priv->error_occured) { state = GST_STATE_PLAYING; priv->error_occured = FALSE; } else { gst_element_get_state (priv->playbin, &state, NULL, GST_CLOCK_TIME_NONE); } gst_element_set_state (priv->playbin, GST_STATE_READY); /* Audio is played locally */ g_object_set (priv->playbin, "uri", bognor_queue_item_get_uri (item), NULL); priv->audio_set = TRUE; gst_element_set_state (priv->playbin, state); return; } static void set_playing (BognorQueue *queue, gboolean playing) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; if (priv->audio_set == FALSE) { return; } if (playing) { if (priv->audio_state != GST_STATE_PLAYING) { gst_element_set_state (priv->playbin, GST_STATE_PLAYING); priv->audio_state = GST_STATE_PLAYING; } } else { gst_element_set_state (priv->playbin, GST_STATE_PAUSED); priv->audio_state = GST_STATE_PAUSED; } return; } static void set_mute (BognorQueue *queue, gboolean mute) { if (mute) g_print("true set mute %d\n", mute); else g_print("false set mute %d\n", mute); BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; g_object_set(G_OBJECT(priv->playbin), "mute", mute, NULL); } static gboolean get_mute (BognorQueue *queue) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; gboolean mute; g_object_get(G_OBJECT(priv->playbin), "mute", &mute, NULL); return mute; } static void set_volume (BognorQueue *queue, double volume) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; g_object_set(G_OBJECT(priv->playbin), "volume", volume, NULL); g_print("set volume %f\n", volume); } static double get_volume (BognorQueue *queue) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; double v; g_object_get(G_OBJECT(priv->playbin), "volume", &v, NULL); g_print("get volume %f\n", v); return v; } static void set_position (BognorQueue *queue, double position) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; GstFormat format = GST_FORMAT_TIME; gint64 dur; if (gst_element_query_duration (priv->playbin, &format, &dur)) { gst_element_seek_simple (priv->playbin, format, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, (gint64) (dur * position)); } else { g_warning ("Query duration failed"); } return; } static double get_position (BognorQueue *queue) { BognorLocalQueue *local = (BognorLocalQueue *) queue; BognorLocalQueuePrivate *priv = local->priv; return priv->position; } static void bognor_local_queue_class_init (BognorLocalQueueClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; BognorQueueClass *q_class = (BognorQueueClass *) klass; o_class->dispose = bognor_local_queue_dispose; o_class->finalize = bognor_local_queue_finalize; o_class->set_property = bognor_local_queue_set_property; o_class->get_property = bognor_local_queue_get_property; q_class->set_item = set_item; q_class->set_playing = set_playing; q_class->set_position = set_position; q_class->get_position = get_position; q_class->set_volume = set_volume; q_class->get_volume = get_volume; q_class->set_mute = set_mute; q_class->get_mute = get_mute; q_class->add_item_to_recent = add_item_to_recent; g_type_class_add_private (klass, sizeof (BognorLocalQueuePrivate)); } static gboolean gst_get_position (gpointer userdata) { BognorQueue *queue = (BognorQueue *) userdata; BognorLocalQueue *local = (BognorLocalQueue *) userdata; BognorLocalQueuePrivate *priv = local->priv; double position = 0.0; GstFormat format = GST_FORMAT_TIME; gint64 cur, dur = 0; if (gst_element_query_duration (priv->playbin, &format, &dur)) { if (gst_element_query_position (priv->playbin, &format, &cur)) { position = ((double) cur) / (double) dur; } else { g_warning ("Query position failed"); } } else { g_print ("Query duration failed"); } if (priv->current_item) { bognor_queue_item_set_duration (priv->current_item, dur / GST_SECOND); } priv->position = position; bognor_queue_emit_position_changed (queue, position); return TRUE; } static gboolean bus_callback (GstBus *bus, GstMessage *message, gpointer data) { BognorQueue *queue = (BognorQueue *) data; BognorLocalQueue *local = (BognorLocalQueue *) data; BognorLocalQueuePrivate *priv = local->priv; GstState oldstate, newstate; GstFormat format; int i; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR: { GError *error; char *debug; int mode; gst_message_parse_error (message, &error, &debug); g_warning ("Error while playing: %s: %s", error->message, debug); if (error->domain == g_quark_from_string ("gst-stream-error-quark") && error->code == 6 /* GST_STREAM_ERROR_CODEC_NOT_FOUND */) { if (priv->current_item) { bognor_queue_notify_unknown_format (queue, priv->current_item); } } g_error_free (error); g_free (debug); /* When there's been an error, tear down the playbin and rebuild */ gst_element_set_state (priv->playbin, GST_STATE_NULL); g_object_unref (priv->playbin); make_playbin (local); priv->audio_state = GST_STATE_READY; // bognor_queue_get_index(queue, &i, NULL); bognor_queue_next (queue, NULL); // bognor_queue_remove_range(queue, i, 1, NULL); /* remove from queue */ bognor_queue_get_current_index(queue, &i, NULL); bognor_queue_get_repeat_mode(queue, &mode, NULL); if (((mode & 0x08) != BOGNOR_QUEUE_MODE_REPEATING) && (i==0)) { } else { set_playing(queue, TRUE); } /* priv->error_occured = TRUE; */ break; } case GST_MESSAGE_EOS: /* Once the local GStreamer queue is done we want the next audio */ bognor_queue_next (queue, NULL); break; case GST_MESSAGE_STATE_CHANGED: gst_message_parse_state_changed (message, &oldstate, &newstate, NULL); if (newstate == GST_STATE_PLAYING) { if (priv->tracker_id == 0) { priv->tracker_id = g_timeout_add_seconds (1, gst_get_position, queue); } } else { if (priv->tracker_id > 0) { g_source_remove (priv->tracker_id); priv->tracker_id = 0; } } break; default: break; } return TRUE; } static void make_playbin (BognorLocalQueue *queue) { BognorLocalQueuePrivate *priv = queue->priv; GstElement *fakesink; GstBus *bus; priv->playbin = gst_element_factory_make ("playbin2", "playbin"); priv->error_occured = FALSE; priv->audio_set = FALSE; fakesink = gst_element_factory_make ("fakesink", "video_sink"); g_object_set (priv->playbin, "video-sink", fakesink, NULL); bus = gst_pipeline_get_bus (GST_PIPELINE (priv->playbin)); gst_bus_add_watch (bus, bus_callback, queue); gst_object_unref (bus); } static void bognor_local_queue_init (BognorLocalQueue *self) { BognorLocalQueuePrivate *priv; priv = self->priv = GET_PRIVATE (self); priv->recent_manager = gtk_recent_manager_get_default (); make_playbin (self); } BognorLocalQueue * bognor_local_queue_new (BgrTrackerClient *tracker) { BognorLocalQueue *q; q = g_object_new (BOGNOR_TYPE_LOCAL_QUEUE, "name", _("Playqueue"), "tracker", tracker, NULL); return q; } bognor-regis/src/.gitignore0000644000175000017500000000033211533735426016151 0ustar paulliupaulliubognor-marshal.c bognor-marshal.h bognor-player-bindings.h bognor-queue-glue.h bognor-queue-manager-glue.h bognor-regis-daemon stamp-bognor-player-bindings.h stamp-bognor-queue-glue.h stamp-bognor-queue-manager-glue.h bognor-regis/src/bognor-render-control.c0000644000175000017500000000472411533735426020557 0ustar paulliupaulliu#include "bognor-render-control.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BognorRenderControlPrivate { int dummy; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_RENDER_CONTROL, BognorRenderControlPrivate)) G_DEFINE_TYPE (BognorRenderControl, bognor_render_control, GUPNP_TYPE_SERVICE); static guint32 signals[LAST_SIGNAL] = {0,}; static void bognor_render_control_finalize (GObject *object) { BognorRenderControl *self = (BognorRenderControl *) object; G_OBJECT_CLASS (bognor_render_control_parent_class)->finalize (object); } static void bognor_render_control_dispose (GObject *object) { BognorRenderControl *self = (BognorRenderControl *) object; G_OBJECT_CLASS (bognor_render_control_parent_class)->dispose (object); } static void bognor_render_control_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorRenderControl *self = (BognorRenderControl *) object; switch (prop_id) { default: break; } } static void bognor_render_control_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorRenderControl *self = (BognorRenderControl *) object; switch (prop_id) { default: break; } } static void bognor_render_control_class_init (BognorRenderControlClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; GUPnPServiceClass *s_class = (GUPnPServiceClass *) klass; o_class->dispose = bognor_render_control_dispose; o_class->finalize = bognor_render_control_finalize; o_class->set_property = bognor_render_control_set_property; o_class->get_property = bognor_render_control_get_property; g_type_class_add_private (klass, sizeof (BognorRenderControlPrivate)); } static void query_variable_cb (GUPnPService *service, char *variable, gpointer value, BognorRenderControl *control) { g_print ("[Render Control] Query %s\n", variable); } static void bognor_render_control_init (BognorRenderControl *self) { BognorRenderControlPrivate *priv = GET_PRIVATE (self); self->priv = priv; g_signal_connect (self, "query-variable", G_CALLBACK (query_variable_cb), self); } bognor-regis/src/bognor-queue-manager.h0000644000175000017500000000647511533735426020370 0ustar paulliupaulliu/* * Bognor-Regis - a media player/queue daemon. * Copyright © 2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope 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 Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __BOGNOR_QUEUE_MANAGER_H__ #define __BOGNOR_QUEUE_MANAGER_H__ #include #include #include "bgr-tracker-client.h" #include "bognor-queue.h" G_BEGIN_DECLS #define BOGNOR_TYPE_QUEUE_MANAGER \ (bognor_queue_manager_get_type()) #define BOGNOR_QUEUE_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_QUEUE_MANAGER, \ BognorQueueManager)) #define BOGNOR_QUEUE_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_QUEUE_MANAGER, \ BognorQueueManagerClass)) #define IS_BOGNOR_QUEUE_MANAGER(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_QUEUE_MANAGER)) #define IS_BOGNOR_QUEUE_MANAGER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_QUEUE_MANAGER)) #define BOGNOR_QUEUE_MANAGER_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_QUEUE_MANAGER, \ BognorQueueManagerClass)) typedef enum _BognorQueueManagerAction { BOGNOR_QUEUE_MANAGER_ACTION_PLAY, BOGNOR_QUEUE_MANAGER_ACTION_PAUSE, BOGNOR_QUEUE_MANAGER_ACTION_NEXT, BOGNOR_QUEUE_MANAGER_ACTION_PREVIOUS } BognorQueueManagerAction; typedef struct _BognorQueueManagerPrivate BognorQueueManagerPrivate; typedef struct _BognorQueueManager BognorQueueManager; typedef struct _BognorQueueManagerClass BognorQueueManagerClass; struct _BognorQueueManager { GObject parent; BognorQueueManagerPrivate *priv; }; struct _BognorQueueManagerClass { GObjectClass parent_class; }; GType bognor_queue_manager_get_type (void) G_GNUC_CONST; BognorQueueManager *bognor_queue_manager_new (DBusGConnection *connection, BgrTrackerClient *tracker); void bognor_queue_manager_action (BognorQueueManager *manager, BognorQueueManagerAction action); BognorQueue *bognor_queue_manager_get_local_queue (BognorQueueManager *manager); G_END_DECLS #endif /* __BOGNOR_QUEUE_MANAGER_H__ */ bognor-regis/src/bognor-last-change.c0000644000175000017500000000414311533735426020003 0ustar paulliupaulliu#include #include #include "bognor-last-change.h" BognorLastChange * bognor_last_change_new (GUPnPService *service) { BognorLastChange *lc; lc = g_new0 (BognorLastChange, 1); lc->events = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); lc->builder = g_string_new (""); lc->service = service; return lc; } void bognor_last_change_free (BognorLastChange *lc) { g_hash_table_destroy (lc->events); g_string_free (lc->builder, TRUE); if (lc->limiter > 0) { g_source_remove (lc->limiter); } g_free (lc); } static gboolean emit_notify (gpointer data) { BognorLastChange *lc = (BognorLastChange *) data; char *event; event = bognor_last_change_finish (lc); gupnp_service_notify (lc->service, "LastChange", G_TYPE_STRING, event, NULL); /* Reset */ g_string_erase (lc->builder, 0, -1); g_hash_table_remove_all (lc->events); lc->limiter = 0; return FALSE; } static void ensure_timeout (BognorLastChange *lc) { if (lc->service == NULL || lc->limiter > 0) { return; } lc->limiter = g_timeout_add (200, emit_notify, lc); } void bognor_last_change_add (BognorLastChange *lc, const char *variable, const char *value) { char *log; log = g_strdup_printf ("<%s val=\"%s\"/>", variable, value); g_hash_table_replace (lc->events, g_strdup (variable), log); ensure_timeout (lc); } static void append_event (gpointer key, gpointer value, gpointer data) { BognorLastChange *lc = (BognorLastChange *) data; g_string_append (lc->builder, (char *) value); } const char * bognor_last_change_finish (BognorLastChange *lc) { g_string_append (lc->builder, ""); g_hash_table_foreach (lc->events, append_event, lc); g_string_append (lc->builder, ""); return lc->builder->str; } bognor-regis/src/bgr-tracker-client.c0000644000175000017500000001206211533735426020007 0ustar paulliupaulliu#include #include "bgr-item.h" #include "bgr-tracker-client.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BgrTrackerClientPrivate { TrackerClient *client; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BGR_TYPE_TRACKER_CLIENT, BgrTrackerClientPrivate)) G_DEFINE_TYPE (BgrTrackerClient, bgr_tracker_client, G_TYPE_OBJECT); #define URI 0 #define MIMETYPE 1 #define DATE 2 #define TITLE 3 #define ARTIST 4 #define ALBUM 5 #define TRACK 6 #define USE 7 #define ITEM_QUERY "SELECT nie:url(?uri) nie:mimeType(?uri) nie:contentCreated(?uri) nie:title(?uri) nmm:artistName(nmm:performer(?uri)) nmm:albumTitle(nmm:musicAlbum(?uri)) nmm:trackNumber(?uri) nie:usageCounter(?uri)" \ "WHERE { ?uri nie:url \"%s\" }" #define UPDATE_QUERY "DELETE { ?uri nie:usageCounter ?count } "\ " WHERE { ?uri nie:usageCounter ?count ; " \ " nie:isStoredAs ?as ." \ " ?as nie:url \"%s\" . }" \ " INSERT { ?uri nie:usageCounter %d } " \ " WHERE { ?uri nie:isStoredAs ?as ." \ " ?as nie:url \"%s\" }" static void bgr_tracker_client_finalize (GObject *object) { BgrTrackerClient *self = (BgrTrackerClient *) object; G_OBJECT_CLASS (bgr_tracker_client_parent_class)->finalize (object); } static void bgr_tracker_client_dispose (GObject *object) { BgrTrackerClient *self = (BgrTrackerClient *) object; G_OBJECT_CLASS (bgr_tracker_client_parent_class)->dispose (object); } static void bgr_tracker_client_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BgrTrackerClient *self = (BgrTrackerClient *) object; switch (prop_id) { default: break; } } static void bgr_tracker_client_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BgrTrackerClient *self = (BgrTrackerClient *) object; switch (prop_id) { default: break; } } static void bgr_tracker_client_class_init (BgrTrackerClientClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bgr_tracker_client_dispose; o_class->finalize = bgr_tracker_client_finalize; o_class->set_property = bgr_tracker_client_set_property; o_class->get_property = bgr_tracker_client_get_property; g_type_class_add_private (klass, sizeof (BgrTrackerClientPrivate)); } static void bgr_tracker_client_init (BgrTrackerClient *self) { BgrTrackerClientPrivate *priv = GET_PRIVATE (self); self->priv = priv; priv->client = tracker_client_new (FALSE, G_MAXINT); } BgrItem * bgr_tracker_client_get_item (BgrTrackerClient *client, const char *uri) { BgrTrackerClientPrivate *priv = client->priv; BgrItem *item; GError *error = NULL; GPtrArray *results; char *query; char **result; query = g_strdup_printf (ITEM_QUERY, uri); results = tracker_resources_sparql_query (priv->client, query, &error); if (error != NULL) { g_warning ("Error querying for %s: %s", uri, error->message); g_error_free (error); return NULL; } if (results == NULL) { return NULL; } if (results->len == 0) { g_ptr_array_free (results, TRUE); return NULL; } result = results->pdata[0]; item = bgr_item_new (result[URI], result[MIMETYPE]); bgr_item_set_metadata (item, BGR_ITEM_METADATA_TITLE, result[TITLE]); bgr_item_set_metadata (item, BGR_ITEM_METADATA_ARTIST, result[ARTIST]); bgr_item_set_metadata (item, BGR_ITEM_METADATA_ALBUM, result[ALBUM]); if (result[USE] == NULL || result[USE] == '\0') { bgr_item_set_metadata (item, BGR_ITEM_METADATA_USE_COUNT, "0"); } else { bgr_item_set_metadata (item, BGR_ITEM_METADATA_USE_COUNT, result[USE]); } g_strfreev (result); g_ptr_array_free (results, TRUE); return item; } void bgr_tracker_client_update_item_use_count (BgrTrackerClient *client, BgrItem *item) { BgrTrackerClientPrivate *priv = client->priv; GError *error = NULL; const char *use_count; int count; char *query; g_return_if_fail (item != NULL); use_count = bgr_item_get_metadata (item, BGR_ITEM_METADATA_USE_COUNT); if (use_count == NULL) { count = 1; } else { count = atoi (use_count) + 1; } query = g_strdup_printf (UPDATE_QUERY, bgr_item_get_uri (item), count, bgr_item_get_uri (item)); /* FIXME: async? */ tracker_resources_sparql_update (priv->client, query, &error); if (error != NULL) { g_warning ("Error updating %s: %s", bgr_item_get_uri (item), error->message); g_error_free (error); } g_free (query); } bognor-regis/src/bognor-queue-item.h0000644000175000017500000000533211533735426017703 0ustar paulliupaulliu#ifndef __BOGNOR_QUEUE_ITEM_H__ #define __BOGNOR_QUEUE_ITEM_H__ #include #include "bgr-item.h" G_BEGIN_DECLS #define BOGNOR_TYPE_QUEUE_ITEM \ (bognor_queue_item_get_type()) #define BOGNOR_QUEUE_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BOGNOR_TYPE_QUEUE_ITEM, \ BognorQueueItem)) #define BOGNOR_QUEUE_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BOGNOR_TYPE_QUEUE_ITEM, \ BognorQueueItemClass)) #define IS_BOGNOR_QUEUE_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BOGNOR_TYPE_QUEUE_ITEM)) #define IS_BOGNOR_QUEUE_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BOGNOR_TYPE_QUEUE_ITEM)) #define BOGNOR_QUEUE_ITEM_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BOGNOR_TYPE_QUEUE_ITEM, \ BognorQueueItemClass)) typedef struct _BognorQueueItemPrivate BognorQueueItemPrivate; typedef struct _BognorQueueItem BognorQueueItem; typedef struct _BognorQueueItemClass BognorQueueItemClass; struct _BognorQueueItem { GObject parent; BognorQueueItemPrivate *priv; }; struct _BognorQueueItemClass { GObjectClass parent_class; }; GType bognor_queue_item_get_type (void); G_GNUC_CONST BognorQueueItem *bognor_queue_item_new_from_item (BgrItem *bgr); BognorQueueItem *bognor_queue_item_new (const char *uri, const char *mimetype, const char *metadata); void bognor_queue_item_set_duration (BognorQueueItem *item, int duration); int bognor_queue_item_get_duration (BognorQueueItem *item); void bognor_queue_item_set_position (BognorQueueItem *item, int position); int bognor_queue_item_get_position (BognorQueueItem *item); const char *bognor_queue_item_get_uri (BognorQueueItem *item); const char *bognor_queue_item_get_mimetype (BognorQueueItem *item); const char *bognor_queue_item_get_metadata (BognorQueueItem *item); BgrItem *bognor_queue_item_get_item (BognorQueueItem *item); G_END_DECLS #endif /* __BOGNOR_QUEUE_ITEM_H__ */ bognor-regis/src/bgr-item.c0000644000175000017500000000564711533735426016051 0ustar paulliupaulliu#include "bgr-item.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BgrItemPrivate { char *uri; char *mimetype; GHashTable *metadata; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BGR_TYPE_ITEM, BgrItemPrivate)) G_DEFINE_TYPE (BgrItem, bgr_item, G_TYPE_OBJECT); static guint32 signals[LAST_SIGNAL] = {0,}; static void bgr_item_finalize (GObject *object) { BgrItem *self = (BgrItem *) object; G_OBJECT_CLASS (bgr_item_parent_class)->finalize (object); } static void bgr_item_dispose (GObject *object) { BgrItem *self = (BgrItem *) object; G_OBJECT_CLASS (bgr_item_parent_class)->dispose (object); } static void bgr_item_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BgrItem *self = (BgrItem *) object; switch (prop_id) { default: break; } } static void bgr_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BgrItem *self = (BgrItem *) object; switch (prop_id) { default: break; } } static void bgr_item_class_init (BgrItemClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; o_class->dispose = bgr_item_dispose; o_class->finalize = bgr_item_finalize; o_class->set_property = bgr_item_set_property; o_class->get_property = bgr_item_get_property; g_type_class_add_private (klass, sizeof (BgrItemPrivate)); } static void bgr_item_init (BgrItem *self) { BgrItemPrivate *priv = GET_PRIVATE (self); self->priv = priv; priv->metadata = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } BgrItem * bgr_item_new (const char *uri, const char *mimetype) { BgrItem *item; BgrItemPrivate *priv; item = g_object_new (BGR_TYPE_ITEM, NULL); priv = item->priv; g_print ("%s - %s\n-------\n", uri, mimetype); priv->uri = g_strdup (uri); priv->mimetype = g_strdup (mimetype); return item; } const char * bgr_item_get_uri (BgrItem *item) { BgrItemPrivate *priv = item->priv; return priv->uri; } const char * bgr_item_get_mimetype (BgrItem *item) { BgrItemPrivate *priv = item->priv; return priv->mimetype; } void bgr_item_set_metadata (BgrItem *item, const char *key, const char *value) { BgrItemPrivate *priv = item->priv; if (value == NULL || *value == '\0') { return; } g_print (" %s: %s\n", key, value); g_hash_table_insert (priv->metadata, g_strdup (key), g_strdup (value)); } const char * bgr_item_get_metadata (BgrItem *item, const char *key) { BgrItemPrivate *priv = item->priv; return g_hash_table_lookup (priv->metadata, key); } bognor-regis/src/bognor-connection-manager.c0000644000175000017500000001467711533735426021401 0ustar paulliupaulliu#include "bognor-connection-manager.h" enum { PROP_0, }; enum { LAST_SIGNAL, }; struct _BognorConnectionManagerPrivate { int third; }; #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BOGNOR_TYPE_CONNECTION_MANAGER, BognorConnectionManagerPrivate)) G_DEFINE_TYPE (BognorConnectionManager, bognor_connection_manager, GUPNP_TYPE_SERVICE); static guint32 signals[LAST_SIGNAL] = {0,}; /* FIXME: This should be generated by scanning GStreamer or the other one */ #if 0 /* We don't handle video yet...*/ static const char *sink_protocol_info = "http-get:*:audio/mpeg:*,http-get:*:application/ogg:*,http-get:*:audio/x-vorbis:*,http-get:*:audio/x-vorbis+ogg:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ms-asf:*,http-get:*:audio/x-flac:*,http-get:*:audio/x-mod:*,http-get:*:audio/x-wav:*,http-get:*:audio/x-ac3:*,http-get:*:audio/x-m4a:*,http-get:*:video/x-theora:*,http-get:*:video/x-dirac:*,http-get:*:video/x-wmv:*,http-get:*:video/x-wma:*,http-get:*:video/x-msvideo:*,http-get:*:video/x-3ivx:*,http-get:*:video/x-3ivx:*,http-get:*:video/x-matroska:*,http-get:*:video/mpeg:*,http-get:*:video/x-ms-asf:*,http-get:*:video/x-xvid:*,http-get:*:video/x-ms-wmv:*"; #else static const char *sink_protocol_info = "http-get:*:audio/mpeg:*,http-get:*:application/ogg:*,http-get:*:audio/x-vorbis:*,http-get:*:audio/x-vorbis+ogg:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ms-asf:*,http-get:*:audio/x-flac:*,http-get:*:audio/x-mod:*,http-get:*:audio/x-wav:*,http-get:*:audio/x-ac3:*,http-get:*:audio/x-m4a:*"; #endif static void bognor_connection_manager_finalize (GObject *object) { BognorConnectionManager *self = (BognorConnectionManager *) object; G_OBJECT_CLASS (bognor_connection_manager_parent_class)->finalize (object); } static void bognor_connection_manager_dispose (GObject *object) { BognorConnectionManager *self = (BognorConnectionManager *) object; G_OBJECT_CLASS (bognor_connection_manager_parent_class)->dispose (object); } static void bognor_connection_manager_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BognorConnectionManager *self = (BognorConnectionManager *) object; switch (prop_id) { default: break; } } static void bognor_connection_manager_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { BognorConnectionManager *self = (BognorConnectionManager *) object; switch (prop_id) { default: break; } } static void bognor_connection_manager_class_init (BognorConnectionManagerClass *klass) { GObjectClass *o_class = (GObjectClass *) klass; GUPnPServiceClass *s_class = (GUPnPServiceClass *) klass; o_class->dispose = bognor_connection_manager_dispose; o_class->finalize = bognor_connection_manager_finalize; o_class->set_property = bognor_connection_manager_set_property; o_class->get_property = bognor_connection_manager_get_property; g_type_class_add_private (klass, sizeof (BognorConnectionManagerPrivate)); } static void get_protocol_info_cb (GUPnPService *service, GUPnPServiceAction *action, BognorConnectionManager *manager) { gupnp_service_action_set (action, "Source", G_TYPE_STRING, "", "Sink", G_TYPE_STRING, sink_protocol_info, NULL); gupnp_service_action_return (action); } static void get_current_connection_ids_cb (GUPnPService *service, GUPnPServiceAction *action, BognorConnectionManager *manager) { gupnp_service_action_set (action, "ConnectionIDs", G_TYPE_STRING, "0", NULL); gupnp_service_action_return (action); } static void get_current_connection_info_cb (GUPnPService *service, GUPnPServiceAction *action, BognorConnectionManager *manager) { int connection_id; gupnp_service_action_get (action, "ConnectionID", G_TYPE_INT, &connection_id, NULL); if (connection_id != 0) { gupnp_service_action_return_error (action, 706, "Invalid connection reference"); return; } gupnp_service_action_set (action, "RcsID", G_TYPE_INT, 0, "AVTransportID", G_TYPE_INT, 0, "ProtocolInfo", G_TYPE_STRING, "", "PeerConnectionManager", G_TYPE_STRING, "", "PeerConnectionID", G_TYPE_INT, -1, "Direction", G_TYPE_STRING, "Input", "Status", G_TYPE_STRING, "Unknown", NULL); gupnp_service_action_return (action); } static void query_variable_cb (GUPnPService *service, char *variable, GValue *value, BognorConnectionManager *manager) { g_print ("[Connection Manager] Query %s\n", variable); if (g_str_equal (variable, "CurrentConnectionIDs")) { g_value_init (value, G_TYPE_STRING); g_value_set_string (value, "0"); } else if (g_str_equal (variable, "SinkProtocolInfo")) { g_value_init (value, G_TYPE_STRING); g_value_set_string (value, sink_protocol_info); } else if (g_str_equal (variable, "SourceProtocolInfo")) { g_value_init (value, G_TYPE_STRING); g_value_set_string (value, ""); } } static void bognor_connection_manager_init (BognorConnectionManager *self) { BognorConnectionManagerPrivate *priv = GET_PRIVATE (self); self->priv = priv; g_signal_connect (self, "action-invoked::GetProtocolInfo", G_CALLBACK (get_protocol_info_cb), self); g_signal_connect (self, "action-invoked::GetCurrentConnectionIDs", G_CALLBACK (get_current_connection_ids_cb), self); g_signal_connect (self, "action-invoked::GetCurrentConnectionInfo", G_CALLBACK (get_current_connection_info_cb), self); g_signal_connect (self, "query-variable", G_CALLBACK (query_variable_cb), self); } bognor-regis/src/bgr-item.h0000644000175000017500000000427211533735426016047 0ustar paulliupaulliu#ifndef __BGR_ITEM_H__ #define __BGR_ITEM_H__ #include G_BEGIN_DECLS #define BGR_TYPE_ITEM \ (bgr_item_get_type()) #define BGR_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ BGR_TYPE_ITEM, \ BgrItem)) #define BGR_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ BGR_TYPE_ITEM, \ BgrItemClass)) #define IS_BGR_ITEM(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ BGR_TYPE_ITEM)) #define IS_BGR_ITEM_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ BGR_TYPE_ITEM)) #define BGR_ITEM_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ BGR_TYPE_ITEM, \ BgrItemClass)) #define BGR_ITEM_METADATA_ARTIST "artist" #define BGR_ITEM_METADATA_ALBUM "album" #define BGR_ITEM_METADATA_TITLE "title" #define BGR_ITEM_METADATA_USE_COUNT "use-count" typedef struct _BgrItemPrivate BgrItemPrivate; typedef struct _BgrItem BgrItem; typedef struct _BgrItemClass BgrItemClass; struct _BgrItem { GObject parent; BgrItemPrivate *priv; }; struct _BgrItemClass { GObjectClass parent_class; }; GType bgr_item_get_type (void) G_GNUC_CONST; const char *bgr_item_get_uri (BgrItem *item); const char *bgr_item_get_mimetype (BgrItem *item); void bgr_item_set_metadata (BgrItem *item, const char *key, const char *value); const char *bgr_item_get_metadata (BgrItem *item, const char *key); G_END_DECLS #endif /* __BGR_ITEM_H__ */ bognor-regis/src/bognor-last-change.h0000644000175000017500000000116411533735426020010 0ustar paulliupaulliu#ifndef __BOGNOR_LAST_CHANGE_H__ #define __BOGNOR_LAST_CHANGE_H__ #include #include typedef struct _BognorLastChange { GUPnPService *service; GHashTable *events; GString *builder; guint32 limiter; } BognorLastChange; BognorLastChange *bognor_last_change_new (GUPnPService *service); void bognor_last_change_free (BognorLastChange *lc); void bognor_last_change_add (BognorLastChange *lc, const char *variable, const char *value); const char *bognor_last_change_finish (BognorLastChange *lc); #endif bognor-regis/AUTHORS0000644000175000017500000000000011533735426014432 0ustar paulliupaulliubognor-regis/COPYING.LIB0000644000175000017500000006350411533735426015044 0ustar paulliupaulliu GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! bognor-regis/examples/0000755000175000017500000000000011533735426015212 5ustar paulliupaulliubognor-regis/examples/Makefile.am0000644000175000017500000000065411533735426017253 0ustar paulliupaulliunoinst_PROGRAMS = bognor-regis AM_CFLAGS = $(BOGNOR_REGIS_CFLAGS) \ $(CLIENT_CFLAGS) \ -I$(top_srcdir)/bognor-regis \ -I$(top_srcdir) AM_LDFLAGS = $(BOGNOR_REGIS_LIBS) $(CLIENT_LIBS) $(top_builddir)/bognor-regis/libbognor-regis-@BOGNOR_MAJORMINOR@.la bognor_regis_SOURCES = bognor-regis.c bognor_regis_DEPENDENCIES = $(top_builddir)/bognor-regis/libbognor-regis-@BOGNOR_MAJORMINOR@.la MAINTAINERCLEANFILES = Makefile.in bognor-regis/examples/bognor-regis.c0000644000175000017500000001566511533735426017770 0ustar paulliupaulliu#include #include #include #include GMainLoop *mainloop; static void list_uris_cb (BrQueue *queue, const char **uris, const GError *error, gpointer userdata) { int i; if (error != NULL) { g_warning ("Error listing uris: %s", error->message); } if (uris == NULL || uris[0] == NULL) { g_print ("No tracks queued\n"); g_main_loop_quit (mainloop); return; } for (i = 0; uris[i]; i++) { g_print (" [%d] - %s\n", i, uris[i]); } g_main_loop_quit (mainloop); } static void get_int_cb(BrQueue *queue, const int value, const GError *error, gpointer userdata) { g_print("return:%d\n", value); g_main_loop_quit (mainloop); } static void get_gboolean_cb(BrQueue *queue, const gboolean value, const GError *error, gpointer userdata) { g_print("return:%d\n", value); g_main_loop_quit (mainloop); } static void get_double_cb(BrQueue *queue, const double value, const GError *error, gpointer userdata) { g_print("return:%f\n", value); g_main_loop_quit (mainloop); } static void get_uri_cb(BrQueue *queue, const char *uri, const char *mimetype, const GError *error, gpointer userdata) { g_print("return:uri: %s\n" " mimetype: %s\n", uri, mimetype); g_main_loop_quit (mainloop); } static void get_meta_cb(BrQueue *queue, const char *title, const char *artist, const char *album, const GError *error, gpointer userdata) { g_print("return:\n" " title: %s\n" " artist: %s\n" " album: %s\n", title, artist, album); g_main_loop_quit (mainloop); } int main (int argc, char **argv) { BrQueue *local_queue; GError *error = NULL; int i; g_type_init (); local_queue = br_queue_new_local (); if (argv[1] == NULL) { g_print ("Usage: bognor-regis < [uri] | play | stop | ls | list-queues | remove |\n" " get-index | get-mode | get-duration | set-mode [mode] |\n" " get-mute | set-mute | get-volume | set-volume [volume] |\n" " get-uri [index] | get-index-meta [index] | get-next-meta >\n"); /* probably also print current list */ return -1; } if (g_str_equal (argv[1], "play")) { br_queue_play (local_queue); } else if (g_str_equal (argv[1], "stop")) { br_queue_stop (local_queue); } else if (g_str_equal (argv[1], "ls")) { char **uris; br_queue_list_uris (local_queue, list_uris_cb, NULL); /* Run a mainloop to get a response */ mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "list-queues")) { g_print ("**FIXME**\n"); } else if (g_str_equal (argv[1], "set-mute")) { br_queue_set_mute(local_queue, atoi(argv[2])); } else if (g_str_equal (argv[1], "set-volume")) { br_queue_set_volume(local_queue, atof(argv[2])); } else if (g_str_equal (argv[1], "set-mode")) { br_queue_set_repeat_mode(local_queue, atoi(argv[2])); } else if (g_str_equal (argv[1], "get-mute")) { br_queue_get_mute(local_queue, get_gboolean_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-volume")) { br_queue_get_volume(local_queue, get_double_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-mode")) { br_queue_get_repeat_mode(local_queue, get_int_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-uri")) { br_queue_get_index_uri(local_queue, atoi(argv[1]), get_uri_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-index-meta")) { br_queue_get_index_metadata(local_queue, atoi(argv[2]), get_meta_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-next-meta")) { br_queue_get_next_metadata(local_queue, get_meta_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-duration")) { br_queue_get_duration(local_queue, get_int_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "get-index")) { br_queue_get_index(local_queue, get_int_cb, NULL); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return 0; } else if (g_str_equal (argv[1], "next")) { br_queue_next (local_queue); } else if (g_str_equal (argv[1], "previous")) { br_queue_previous (local_queue); } else if (g_str_equal (argv[1], "remove")) { int index, count; if (argc != 4) { g_print ("Usage: %s remove \n", argv[0]); return 0; } index = atoi (argv[2]); count = atoi (argv[3]); br_queue_remove_range (local_queue, index, count); } else { char **uris, **mimetypes; uris = g_new0 (char *, argc); mimetypes = g_new0 (char *, argc); for (i = 1; i < argc; i++) { GFile *f = g_file_new_for_commandline_arg (argv[i]); GFileInfo *info; GError *error = NULL; info = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &error); if (info == NULL) { g_warning ("Error finding mimetype for %s: %s", argv[i], error->message); g_error_free (error); g_object_unref (f); return 0; } uris[i - 1] = g_file_get_uri (f);; mimetypes[i - 1] = g_strdup (g_file_info_get_content_type (info)); g_object_unref (info); g_object_unref (f); } br_queue_append_uris (local_queue, argc - 1, (const char **) uris, (const char **) mimetypes); /* This will have leaked mimetypes[i] but we're quitting now so it doesn't matter */ } return 0; } bognor-regis/examples/.gitignore0000644000175000017500000000001511533735426017176 0ustar paulliupaulliubognor-regis