[grilo-plugins] Revert "dmap: add support for password-protected DAAP and DPAP shares"
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] Revert "dmap: add support for password-protected DAAP and DPAP shares"
- Date: Fri, 8 Nov 2019 19:27:18 +0000 (UTC)
commit 984cb46d777dc5772a264e31438a40787587d7ed
Author: W. Michael Petullo <mike flyn org>
Date: Fri Nov 8 14:25:41 2019 -0500
Revert "dmap: add support for password-protected DAAP and DPAP shares"
This reverts commit df4038cd3bf55ac111b933488adf9a9b018f7b99. The reverted
commit bore the wrong Git message, and it requires review.
Signed-off-by: W. Michael Petullo <mike flyn org>
meson.build | 2 +-
src/dmap/grl-common.c | 23 ++-------
src/dmap/grl-common.h | 4 +-
src/dmap/grl-daap-db.c | 49 +++++++++-----------
src/dmap/grl-daap-db.h | 22 ++++-----
src/dmap/grl-daap-record-factory.c | 16 +++----
src/dmap/grl-daap-record-factory.h | 18 ++++----
src/dmap/grl-daap-record.c | 28 +++++------
src/dmap/grl-daap-record.h | 22 ++++-----
src/dmap/grl-daap.c | 95 +++++++++++---------------------------
src/dmap/grl-dpap-db.c | 52 +++++++++------------
src/dmap/grl-dpap-db.h | 22 ++++-----
src/dmap/grl-dpap-record-factory.c | 16 +++----
src/dmap/grl-dpap-record-factory.h | 18 ++++----
src/dmap/grl-dpap-record.c | 38 +++++++--------
src/dmap/grl-dpap-record.h | 22 ++++-----
src/dmap/grl-dpap.c | 95 +++++++++++---------------------------
17 files changed, 219 insertions(+), 323 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9f88e0f5..5efbeebc 100644
--- a/meson.build
+++ b/meson.build
@@ -62,7 +62,7 @@ gstreamer_dep = dependency('gstreamer-1.0', required: false)
gthread_dep = dependency('gthread-2.0', required: false)
json_glib_dep = dependency('json-glib-1.0', required: false)
libarchive_dep = dependency('libarchive', required: false)
-libdmapsharing_dep = dependency('libdmapsharing-4.0', version: '>= 3.9.4', required: false)
+libdmapsharing_dep = dependency('libdmapsharing-3.0', version: '>= 2.9.12', required: false)
libgdata_dep = dependency('libgdata', version: '>= 0.9.1', required: false)
libmediaart_dep = dependency('libmediaart-2.0', required: false)
libsoup_dep = dependency('libsoup-2.4', required: false)
diff --git a/src/dmap/grl-common.c b/src/dmap/grl-common.c
index 66d3e43a..fa92df9c 100644
--- a/src/dmap/grl-common.c
+++ b/src/dmap/grl-common.c
@@ -36,23 +36,10 @@
#include "grl-common.h"
gchar *
-grl_dmap_build_url (DmapMdnsService *service)
+grl_dmap_build_url (DMAPMdnsBrowserService *service)
{
- gchar *url = NULL;
- gchar *service_name, *host;
- guint port;
-
- g_object_get(service, "service-name", &service_name,
- "host", &host,
- "port", &port, NULL);
-
- url = g_strdup_printf ("%s://%s:%u",
- service_name,
- host,
- port);
-
- g_free(service_name);
- g_free(host);
-
- return url;
+ return g_strdup_printf ("%s://%s:%u",
+ service->service_name,
+ service->host,
+ service->port);
}
diff --git a/src/dmap/grl-common.h b/src/dmap/grl-common.h
index 8e5a3a66..e9c83278 100644
--- a/src/dmap/grl-common.h
+++ b/src/dmap/grl-common.h
@@ -41,9 +41,9 @@ typedef struct {
typedef struct {
ResultCbAndArgs cb;
- DmapDb *db;
+ DMAPDb *db;
} ResultCbAndArgsAndDb;
-gchar *grl_dmap_build_url (DmapMdnsService *service);
+gchar *grl_dmap_build_url (DMAPMdnsBrowserService *service);
#endif /* _GRL_COMMON_H_ */
diff --git a/src/dmap/grl-daap-db.c b/src/dmap/grl-daap-db.c
index bc6a9500..66210945 100644
--- a/src/dmap/grl-daap-db.c
+++ b/src/dmap/grl-daap-db.c
@@ -66,7 +66,7 @@
/* Media ID's start at max and go down. Container ID's start at 1 and go up. */
static guint nextid = G_MAXINT; /* NOTE: this should be G_MAXUINT, but iPhoto can't handle it. */
-struct GrlDaapDbPrivate {
+struct GrlDAAPDbPrivate {
/* Contains each album container (tracked with albums hash table) */
GrlMedia *albums_container;
@@ -95,31 +95,31 @@ container_equal (gconstpointer a, gconstpointer b)
return g_str_equal (grl_media_get_id (GRL_MEDIA (a)), grl_media_get_id (GRL_MEDIA (b)));
}
-GrlDaapDb *
+GrlDAAPDb *
grl_daap_db_new (void)
{
- GrlDaapDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL);
+ GrlDAAPDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL);
return db;
}
-static DmapRecord *
-grl_daap_db_lookup_by_id (const DmapDb *db, guint id)
+static DMAPRecord *
+grl_daap_db_lookup_by_id (const DMAPDb *db, guint id)
{
g_error ("Not implemented");
return NULL;
}
static void
-grl_daap_db_foreach (const DmapDb *db,
- DmapIdRecordFunc func,
- gpointer data)
+grl_daap_db_foreach (const DMAPDb *db,
+ GHFunc func,
+ gpointer data)
{
g_error ("Not implemented");
}
static gint64
-grl_daap_db_count (const DmapDb *db)
+grl_daap_db_count (const DMAPDb *db)
{
g_error ("Not implemented");
return 0;
@@ -151,13 +151,13 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl
}
static guint
-grl_daap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
+grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
{
g_assert (IS_GRL_DAAP_DB (_db));
- g_assert (IS_DMAP_AV_RECORD (_record));
+ g_assert (IS_DAAP_RECORD (_record));
- GrlDaapDb *db = GRL_DAAP_DB (_db);
- DmapAvRecord *record = DMAP_AV_RECORD (_record);
+ GrlDAAPDb *db = GRL_DAAP_DB (_db);
+ DAAPRecord *record = DAAP_RECORD (_record);
gint duration = 0;
gint32 bitrate = 0,
@@ -242,11 +242,6 @@ grl_daap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
g_free (id_s);
g_object_unref (media);
- g_free (album);
- g_free (artist);
- g_free (genre);
- g_free (title);
- g_free (url);
return --nextid;
}
@@ -258,7 +253,7 @@ same_media (GrlMedia *a, GrlMedia *b)
}
void
-grl_daap_db_browse (GrlDaapDb *db,
+grl_daap_db_browse (GrlDAAPDb *db,
GrlMedia *container,
GrlSource *source,
guint op_id,
@@ -317,7 +312,7 @@ done:
}
void
-grl_daap_db_search (GrlDaapDb *db,
+grl_daap_db_search (GrlDAAPDb *db,
GrlSource *source,
guint op_id,
GHRFunc predicate,
@@ -369,7 +364,7 @@ grl_daap_db_search (GrlDaapDb *db,
static void
dmap_db_interface_init (gpointer iface, gpointer data)
{
- DmapDbInterface *daap_db = iface;
+ DMAPDbIface *daap_db = iface;
g_assert (G_TYPE_FROM_INTERFACE (daap_db) == DMAP_TYPE_DB);
@@ -379,8 +374,8 @@ dmap_db_interface_init (gpointer iface, gpointer data)
daap_db->count = grl_daap_db_count;
}
-G_DEFINE_TYPE_WITH_CODE (GrlDaapDb, grl_daap_db, G_TYPE_OBJECT,
- G_ADD_PRIVATE (GrlDaapDb)
+G_DEFINE_TYPE_WITH_CODE (GrlDAAPDb, grl_daap_db, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GrlDAAPDb)
G_IMPLEMENT_INTERFACE (DMAP_TYPE_DB, dmap_db_interface_init))
static GObject*
@@ -394,7 +389,7 @@ grl_daap_db_constructor (GType type, guint n_construct_params, GObjectConstructP
}
static void
-grl_daap_db_init (GrlDaapDb *db)
+grl_daap_db_init (GrlDAAPDb *db)
{
db->priv = grl_daap_db_get_instance_private (db);
@@ -418,9 +413,9 @@ grl_daap_db_init (GrlDaapDb *db)
static void
grl_daap_db_finalize (GObject *object)
{
- GrlDaapDb *db = GRL_DAAP_DB (object);
+ GrlDAAPDb *db = GRL_DAAP_DB (object);
- GRL_DEBUG ("Finalizing GrlDaapDb");
+ GRL_DEBUG ("Finalizing GrlDAAPDb");
g_object_unref (db->priv->albums_container);
g_object_unref (db->priv->artists_container);
@@ -457,7 +452,7 @@ grl_daap_db_get_property (GObject *object,
static void
-grl_daap_db_class_init (GrlDaapDbClass *klass)
+grl_daap_db_class_init (GrlDAAPDbClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
diff --git a/src/dmap/grl-daap-db.h b/src/dmap/grl-daap-db.h
index 63816d09..f52a9b5f 100644
--- a/src/dmap/grl-daap-db.h
+++ b/src/dmap/grl-daap-db.h
@@ -32,12 +32,12 @@ G_BEGIN_DECLS
#define GRL_DAAP_DB(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_GRL_DAAP_DB, \
- GrlDaapDb))
+ GrlDAAPDb))
#define GRL_DAAP_DB_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_GRL_DAAP_DB, \
- GrlDaapDbClass))
+ GrlDAAPDbClass))
#define IS_GRL_DAAP_DB(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
TYPE_GRL_DAAP_DB))
@@ -48,25 +48,25 @@ G_BEGIN_DECLS
#define GRL_DAAP_DB_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_GRL_DAAP_DB, \
- GrlDaapDbClass))
+ GrlDAAPDbClass))
#define GRL_DAAP_DB_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
TYPE_GRL_DAAP_DB, \
- GrlDaapDbPrivate))
+ GrlDAAPDbPrivate))
-typedef struct GrlDaapDbPrivate GrlDaapDbPrivate;
+typedef struct GrlDAAPDbPrivate GrlDAAPDbPrivate;
typedef struct {
GObject parent;
- GrlDaapDbPrivate *priv;
-} GrlDaapDb;
+ GrlDAAPDbPrivate *priv;
+} GrlDAAPDb;
typedef struct {
GObjectClass parent;
-} GrlDaapDbClass;
+} GrlDAAPDbClass;
-void grl_daap_db_browse (GrlDaapDb *db,
+void grl_daap_db_browse (GrlDAAPDb *db,
GrlMedia *container,
GrlSource *source,
guint op_id,
@@ -75,7 +75,7 @@ void grl_daap_db_browse (GrlDaapDb *db,
GrlSourceResultCb func,
gpointer user_data);
-void grl_daap_db_search (GrlDaapDb *db,
+void grl_daap_db_search (GrlDAAPDb *db,
GrlSource *source,
guint op_id,
GHRFunc predicate,
@@ -83,7 +83,7 @@ void grl_daap_db_search (GrlDaapDb *db,
GrlSourceResultCb func,
gpointer user_data);
-GrlDaapDb *grl_daap_db_new (void);
+GrlDAAPDb *grl_daap_db_new (void);
GType grl_daap_db_get_type (void);
diff --git a/src/dmap/grl-daap-record-factory.c b/src/dmap/grl-daap-record-factory.c
index 7bf5ca28..e986394b 100644
--- a/src/dmap/grl-daap-record-factory.c
+++ b/src/dmap/grl-daap-record-factory.c
@@ -1,5 +1,5 @@
/*
- * DmapAvRecord factory class
+ * DAAPRecord factory class
*
* Copyright (C) 2008 W. Michael Petullo <mike flyn org>
*
@@ -21,37 +21,37 @@
#include "grl-daap-record-factory.h"
#include "grl-daap-record.h"
-DmapRecord *
-grl_daap_record_factory_create (DmapRecordFactory *factory, gpointer user_data, GError **error)
+DMAPRecord *
+grl_daap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data)
{
return DMAP_RECORD (grl_daap_record_new ());
}
static void
-grl_daap_record_factory_init (GrlDaapRecordFactory *factory)
+grl_daap_record_factory_init (GrlDAAPRecordFactory *factory)
{
}
static void
-grl_daap_record_factory_class_init (GrlDaapRecordFactoryClass *klass)
+grl_daap_record_factory_class_init (GrlDAAPRecordFactoryClass *klass)
{
}
static void
grl_daap_record_factory_interface_init (gpointer iface, gpointer data)
{
- DmapRecordFactoryInterface *factory = iface;
+ DMAPRecordFactoryIface *factory = iface;
g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY);
factory->create = grl_daap_record_factory_create;
}
-G_DEFINE_TYPE_WITH_CODE (GrlDaapRecordFactory, grl_daap_record_factory, G_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (GrlDAAPRecordFactory, grl_daap_record_factory, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD_FACTORY,
grl_daap_record_factory_interface_init))
-GrlDaapRecordFactory *
+GrlDAAPRecordFactory *
grl_daap_record_factory_new (void)
{
return SIMPLE_DAAP_RECORD_FACTORY (g_object_new (TYPE_SIMPLE_DAAP_RECORD_FACTORY, NULL));
diff --git a/src/dmap/grl-daap-record-factory.h b/src/dmap/grl-daap-record-factory.h
index 698b22c6..514713a8 100644
--- a/src/dmap/grl-daap-record-factory.h
+++ b/src/dmap/grl-daap-record-factory.h
@@ -1,5 +1,5 @@
/*
- * GrlDaapRecord factory class
+ * GrlDAAPRecord factory class
*
* Copyright (C) 2008 W. Michael Petullo <mike flyn org>
*
@@ -31,12 +31,12 @@ G_BEGIN_DECLS
#define SIMPLE_DAAP_RECORD_FACTORY(o) \
(G_TYPE_CHECK_INSTANCE_CAST((o), \
TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
- GrlDaapRecordFactory))
+ GrlDAAPRecordFactory))
#define SIMPLE_DAAP_RECORD_FACTORY_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
- GrlDaapRecordFactoryClass))
+ GrlDAAPRecordFactoryClass))
#define IS_SIMPLE_DAAP_RECORD_FACTORY(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
@@ -49,23 +49,23 @@ G_BEGIN_DECLS
#define SIMPLE_DAAP_RECORD_FACTORY_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
- GrlDaapRecordFactoryClass))
+ GrlDAAPRecordFactoryClass))
-typedef struct GrlDaapRecordFactoryPrivate GrlDaapRecordFactoryPrivate;
+typedef struct GrlDAAPRecordFactoryPrivate GrlDAAPRecordFactoryPrivate;
typedef struct {
GObject parent;
-} GrlDaapRecordFactory;
+} GrlDAAPRecordFactory;
typedef struct {
GObjectClass parent;
-} GrlDaapRecordFactoryClass;
+} GrlDAAPRecordFactoryClass;
GType grl_daap_record_factory_get_type (void);
-GrlDaapRecordFactory *grl_daap_record_factory_new (void);
+GrlDAAPRecordFactory *grl_daap_record_factory_new (void);
-DmapRecord *grl_daap_record_factory_create (DmapRecordFactory *factory, gpointer user_data,
GError **error);
+DMAPRecord *grl_daap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
#endif /* __SIMPLE_DAAP_RECORD_FACTORY */
diff --git a/src/dmap/grl-daap-record.c b/src/dmap/grl-daap-record.c
index 6edba331..d1721d21 100644
--- a/src/dmap/grl-daap-record.c
+++ b/src/dmap/grl-daap-record.c
@@ -22,7 +22,7 @@
#include "grl-daap-record.h"
-struct GrlDaapRecordPrivate {
+struct GrlDAAPRecordPrivate {
guint64 filesize;
char *location;
char *format;
@@ -73,7 +73,7 @@ grl_daap_record_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
+ GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
switch (prop_id) {
case PROP_LOCATION:
@@ -155,7 +155,7 @@ grl_daap_record_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
+ GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
switch (prop_id) {
case PROP_LOCATION:
@@ -223,14 +223,14 @@ grl_daap_record_get_property (GObject *object,
}
}
-GrlDaapRecord *
+GrlDAAPRecord *
grl_daap_record_new (void)
{
return SIMPLE_DAAP_RECORD (g_object_new (TYPE_SIMPLE_DAAP_RECORD, NULL));
}
GInputStream *
-grl_daap_record_read (DmapAvRecord *record, GError **error)
+grl_daap_record_read (DAAPRecord *record, GError **error)
{
GFile *file;
GInputStream *stream;
@@ -244,7 +244,7 @@ grl_daap_record_read (DmapAvRecord *record, GError **error)
}
static void
-grl_daap_record_init (GrlDaapRecord *record)
+grl_daap_record_init (GrlDAAPRecord *record)
{
record->priv = SIMPLE_DAAP_RECORD_GET_PRIVATE (record);
}
@@ -252,7 +252,7 @@ grl_daap_record_init (GrlDaapRecord *record)
static void grl_daap_record_finalize (GObject *object);
static void
-grl_daap_record_class_init (GrlDaapRecordClass *klass)
+grl_daap_record_class_init (GrlDAAPRecordClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -284,9 +284,9 @@ grl_daap_record_class_init (GrlDaapRecordClass *klass)
static void
grl_daap_record_daap_iface_init (gpointer iface, gpointer data)
{
- DmapAvRecordInterface *daap_record = iface;
+ DAAPRecordIface *daap_record = iface;
- g_assert (G_TYPE_FROM_INTERFACE (daap_record) == DMAP_TYPE_AV_RECORD);
+ g_assert (G_TYPE_FROM_INTERFACE (daap_record) == DAAP_TYPE_RECORD);
daap_record->read = grl_daap_record_read;
}
@@ -294,21 +294,21 @@ grl_daap_record_daap_iface_init (gpointer iface, gpointer data)
static void
grl_daap_record_dmap_iface_init (gpointer iface, gpointer data)
{
- DmapRecordInterface *dmap_record = iface;
+ DMAPRecordIface *dmap_record = iface;
g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD);
}
-G_DEFINE_TYPE_WITH_CODE (GrlDaapRecord, grl_daap_record, G_TYPE_OBJECT,
- G_ADD_PRIVATE (GrlDaapRecord)
- G_IMPLEMENT_INTERFACE (DMAP_TYPE_AV_RECORD, grl_daap_record_daap_iface_init)
+G_DEFINE_TYPE_WITH_CODE (GrlDAAPRecord, grl_daap_record, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GrlDAAPRecord)
+ G_IMPLEMENT_INTERFACE (DAAP_TYPE_RECORD, grl_daap_record_daap_iface_init)
G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD, grl_daap_record_dmap_iface_init))
static void
grl_daap_record_finalize (GObject *object)
{
- GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
+ GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
g_free (record->priv->location);
g_free (record->priv->title);
diff --git a/src/dmap/grl-daap-record.h b/src/dmap/grl-daap-record.h
index ee3f0854..59558c4f 100644
--- a/src/dmap/grl-daap-record.h
+++ b/src/dmap/grl-daap-record.h
@@ -31,12 +31,12 @@ G_BEGIN_DECLS
#define SIMPLE_DAAP_RECORD(o) \
(G_TYPE_CHECK_INSTANCE_CAST((o), \
TYPE_SIMPLE_DAAP_RECORD, \
- GrlDaapRecord))
+ GrlDAAPRecord))
#define SIMPLE_DAAP_RECORD_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_SIMPLE_DAAP_RECORD, \
- GrlDaapRecordClass))
+ GrlDAAPRecordClass))
#define IS_SIMPLE_DAAP_RECORD(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
@@ -49,29 +49,29 @@ G_BEGIN_DECLS
#define SIMPLE_DAAP_RECORD_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_SIMPLE_DAAP_RECORD, \
- GrlDaapRecordClass))
+ GrlDAAPRecordClass))
#define SIMPLE_DAAP_RECORD_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
TYPE_SIMPLE_DAAP_RECORD, \
- GrlDaapRecordPrivate))
+ GrlDAAPRecordPrivate))
-typedef struct GrlDaapRecordPrivate GrlDaapRecordPrivate;
+typedef struct GrlDAAPRecordPrivate GrlDAAPRecordPrivate;
typedef struct {
GObject parent;
- GrlDaapRecordPrivate *priv;
-} GrlDaapRecord;
+ GrlDAAPRecordPrivate *priv;
+} GrlDAAPRecord;
typedef struct {
GObjectClass parent;
-} GrlDaapRecordClass;
+} GrlDAAPRecordClass;
GType grl_daap_record_get_type (void);
-GrlDaapRecord *grl_daap_record_new (void);
-GInputStream *grl_daap_record_read (DmapAvRecord *record, GError **error);
-gint grl_daap_record_get_id (DmapAvRecord *record);
+GrlDAAPRecord *grl_daap_record_new (void);
+GInputStream *grl_daap_record_read (DAAPRecord *record, GError **error);
+gint grl_daap_record_get_id (DAAPRecord *record);
#endif /* __SIMPLE_DAAP_RECORD */
diff --git a/src/dmap/grl-daap.c b/src/dmap/grl-daap.c
index 2562d080..13cc7e36 100644
--- a/src/dmap/grl-daap.c
+++ b/src/dmap/grl-daap.c
@@ -52,12 +52,12 @@ GRL_LOG_DOMAIN_STATIC(daap_log_domain);
/* --- Grilo DAAP Private --- */
struct _GrlDaapSourcePrivate {
- DmapMdnsService *service;
+ DMAPMdnsBrowserService *service;
};
/* --- Data types --- */
-static GrlDaapSource *grl_daap_source_new (DmapMdnsService *service);
+static GrlDaapSource *grl_daap_source_new (DMAPMdnsBrowserService *service);
static void grl_daap_source_finalize (GObject *object);
@@ -74,16 +74,16 @@ static void grl_daap_source_search (GrlSource *source,
GrlSourceSearchSpec *ss);
-static void grl_daap_service_added_cb (DmapMdnsBrowser *browser,
- DmapMdnsService *service,
+static void grl_daap_service_added_cb (DMAPMdnsBrowser *browser,
+ DMAPMdnsBrowserService *service,
GrlPlugin *plugin);
-static void grl_daap_service_removed_cb (DmapMdnsBrowser *browser,
+static void grl_daap_service_removed_cb (DMAPMdnsBrowser *browser,
const gchar *service_name,
GrlPlugin *plugin);
/* ===================== Globals ======================= */
-static DmapMdnsBrowser *browser;
+static DMAPMdnsBrowser *browser;
/* Maps URIs to DBs */
static GHashTable *connections;
/* Map DAAP services to Grilo media sources */
@@ -106,7 +106,7 @@ grl_daap_plugin_init (GrlRegistry *registry,
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- browser = dmap_mdns_browser_new (DMAP_MDNS_SERVICE_TYPE_DAAP);
+ browser = dmap_mdns_browser_new (DMAP_MDNS_BROWSER_SERVICE_TYPE_DAAP);
connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
@@ -153,10 +153,8 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR,
G_DEFINE_TYPE_WITH_PRIVATE (GrlDaapSource, grl_daap_source, GRL_TYPE_SOURCE)
static GrlDaapSource *
-grl_daap_source_new (DmapMdnsService *service)
+grl_daap_source_new (DMAPMdnsBrowserService *service)
{
- gchar *name;
- gchar *service_name;
gchar *source_desc;
gchar *source_id;
@@ -164,16 +162,12 @@ grl_daap_source_new (DmapMdnsService *service)
GRL_DEBUG ("grl_daap_source_new");
- g_object_get(service, "name", &name,
- "service-name", &service_name,
- NULL);
-
- source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name);
- source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name);
+ source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, service->name);
+ source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, service->name);
source = g_object_new (GRL_DAAP_SOURCE_TYPE,
"source-id", source_id,
- "source-name", service_name,
+ "source-name", service->name,
"source-desc", source_desc,
"supported-media", GRL_SUPPORTED_MEDIA_AUDIO,
NULL);
@@ -182,8 +176,6 @@ grl_daap_source_new (DmapMdnsService *service)
g_free (source_desc);
g_free (source_id);
- g_free (service_name);
- g_free (name);
return source;
}
@@ -244,7 +236,7 @@ grl_daap_do_search (ResultCbAndArgsAndDb *cb_and_db)
}
static void
-browse_connected_cb (DmapConnection *connection,
+browse_connected_cb (DMAPConnection *connection,
gboolean result,
const char *reason,
ResultCbAndArgsAndDb *cb_and_db)
@@ -269,7 +261,7 @@ browse_connected_cb (DmapConnection *connection,
}
static void
-search_connected_cb (DmapConnection *connection,
+search_connected_cb (DMAPConnection *connection,
gboolean result,
const char *reason,
ResultCbAndArgsAndDb *cb_and_db)
@@ -294,8 +286,8 @@ search_connected_cb (DmapConnection *connection,
}
static void
-grl_daap_service_added_cb (DmapMdnsBrowser *browser,
- DmapMdnsService *service,
+grl_daap_service_added_cb (DMAPMdnsBrowser *browser,
+ DMAPMdnsBrowserService *service,
GrlPlugin *plugin)
{
GrlRegistry *registry = grl_registry_get_default ();
@@ -309,16 +301,13 @@ grl_daap_service_added_cb (DmapMdnsBrowser *browser,
GRL_SOURCE (source),
NULL);
if (source != NULL) {
- gchar *name;
- g_object_get (service, "name", &name, NULL);
- g_hash_table_insert (sources, g_strdup (name), g_object_ref (source));
+ g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source));
g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source);
- g_free (name);
}
}
static void
-grl_daap_service_removed_cb (DmapMdnsBrowser *browser,
+grl_daap_service_removed_cb (DMAPMdnsBrowser *browser,
const gchar *service_name,
GrlPlugin *plugin)
{
@@ -334,14 +323,14 @@ grl_daap_service_removed_cb (DmapMdnsBrowser *browser,
}
static void
-grl_daap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DmapConnectionFunc
callback)
+grl_daap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db,
DMAPConnectionCallback callback)
{
- DmapRecordFactory *factory;
- DmapConnection *connection;
+ DMAPRecordFactory *factory;
+ DMAPConnection *connection;
factory = DMAP_RECORD_FACTORY (grl_daap_record_factory_new ());
- connection = DMAP_CONNECTION (dmap_av_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
- dmap_connection_start (connection, (DmapConnectionFunc) callback, cb_and_db);
+ connection = DMAP_CONNECTION (daap_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
+ dmap_connection_connect (connection, (DMAPConnectionCallback) callback, cb_and_db);
}
static gboolean
@@ -408,26 +397,15 @@ grl_daap_source_browse (GrlSource *source,
browse_connected_cb (NULL, TRUE, NULL, cb_and_db);
} else {
/* Connect */
- gchar *name, *host;
- guint port;
-
cb_and_db->db = DMAP_DB (grl_daap_db_new ());
- g_object_get (dmap_source->priv->service, "name", &name,
- "host", &host,
- "port", &port,
- NULL);
-
- grl_daap_connect (name,
- host,
- port,
+ grl_daap_connect (dmap_source->priv->service->name,
+ dmap_source->priv->service->host,
+ dmap_source->priv->service->port,
cb_and_db,
- (DmapConnectionFunc) browse_connected_cb);
+ (DMAPConnectionCallback) browse_connected_cb);
g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
-
- g_free (name);
- g_free (host);
}
g_free (url);
@@ -439,7 +417,7 @@ static void grl_daap_source_search (GrlSource *source,
GrlDaapSource *dmap_source = GRL_DAAP_SOURCE (source);
ResultCbAndArgsAndDb *cb_and_db;
- DmapMdnsService *service = dmap_source->priv->service;
+ DMAPMdnsBrowserService *service = dmap_source->priv->service;
gchar *url = grl_dmap_build_url (service);
cb_and_db = g_new (ResultCbAndArgsAndDb, 1);
@@ -457,26 +435,9 @@ static void grl_daap_source_search (GrlSource *source,
search_connected_cb (NULL, TRUE, NULL, cb_and_db);
} else {
/* Connect */
- gchar *name, *host;
- guint port;
-
cb_and_db->db = DMAP_DB (grl_daap_db_new ());
-
- g_object_get (dmap_source->priv->service, "name", &name,
- "host", &host,
- "port", &port,
- NULL);
-
- grl_daap_connect (name,
- host,
- port,
- cb_and_db,
- (DmapConnectionFunc) search_connected_cb);
-
+ grl_daap_connect (service->name, service->host, service->port, cb_and_db, (DMAPConnectionCallback)
search_connected_cb);
g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
-
- g_free (name);
- g_free (host);
}
g_free (url);
diff --git a/src/dmap/grl-dpap-db.c b/src/dmap/grl-dpap-db.c
index 2c984c00..1f2d5ca2 100644
--- a/src/dmap/grl-dpap-db.c
+++ b/src/dmap/grl-dpap-db.c
@@ -38,7 +38,7 @@
/* Media IDs start at max and go down. Container IDs start at 1 and go up. */
static guint nextid = G_MAXINT; /* NOTE: this should be G_MAXUINT, but iPhoto can't handle it. */
-struct GrlDpapDbPrivate {
+struct GrlDPAPDbPrivate {
/* Contains each picture container (tracked with photos hash table) */
GrlMedia *photos_container;
@@ -63,31 +63,31 @@ container_equal (gconstpointer a, gconstpointer b)
return g_str_equal (grl_media_get_id (GRL_MEDIA (a)), grl_media_get_id (GRL_MEDIA (b)));
}
-GrlDpapDb *
+GrlDPAPDb *
grl_dpap_db_new (void)
{
- GrlDpapDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL);
+ GrlDPAPDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL);
return db;
}
-static DmapRecord *
-grl_dpap_db_lookup_by_id (const DmapDb *db, guint id)
+static DMAPRecord *
+grl_dpap_db_lookup_by_id (const DMAPDb *db, guint id)
{
g_warning ("Not implemented");
return NULL;
}
static void
-grl_dpap_db_foreach (const DmapDb *db,
- DmapIdRecordFunc func,
- gpointer data)
+grl_dpap_db_foreach (const DMAPDb *db,
+ GHFunc func,
+ gpointer data)
{
g_warning ("Not implemented");
}
static gint64
-grl_dpap_db_count (const DmapDb *db)
+grl_dpap_db_count (const DMAPDb *db)
{
g_warning ("Not implemented");
return 0;
@@ -119,20 +119,20 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl
}
static guint
-grl_dpap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
+grl_dpap_db_add (DMAPDb *_db, DMAPRecord *_record)
{
g_assert (IS_GRL_DPAP_DB (_db));
- g_assert (IS_DMAP_IMAGE_RECORD (_record));
+ g_assert (IS_DPAP_RECORD (_record));
- GrlDpapDb *db = GRL_DPAP_DB (_db);
- DmapImageRecord *record = DMAP_IMAGE_RECORD (_record);
+ GrlDPAPDb *db = GRL_DPAP_DB (_db);
+ DPAPRecord *record = DPAP_RECORD (_record);
gint height = 0,
width = 0,
largefilesize = 0,
creationdate = 0,
rating = 0;
- GArray *thumbnail = NULL;
+ GByteArray *thumbnail = NULL;
gchar *id_s = NULL,
*filename = NULL,
*aspectratio = NULL,
@@ -188,12 +188,6 @@ grl_dpap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
g_free (id_s);
g_object_unref (media);
- g_free (filename);
- g_free (aspectratio);
- g_free (format);
- g_free (comments);
- g_array_unref (thumbnail);
- g_free (url);
return --nextid;
}
@@ -205,7 +199,7 @@ same_media (GrlMedia *a, GrlMedia *b)
}
void
-grl_dpap_db_browse (GrlDpapDb *db,
+grl_dpap_db_browse (GrlDPAPDb *db,
GrlMedia *container,
GrlSource *source,
guint op_id,
@@ -257,7 +251,7 @@ done:
}
void
-grl_dpap_db_search (GrlDpapDb *db,
+grl_dpap_db_search (GrlDPAPDb *db,
GrlSource *source,
guint op_id,
GHRFunc predicate,
@@ -309,7 +303,7 @@ grl_dpap_db_search (GrlDpapDb *db,
static void
dmap_db_interface_init (gpointer iface, gpointer data)
{
- DmapDbInterface *dpap_db = iface;
+ DMAPDbIface *dpap_db = iface;
g_assert (G_TYPE_FROM_INTERFACE (dpap_db) == DMAP_TYPE_DB);
@@ -319,8 +313,8 @@ dmap_db_interface_init (gpointer iface, gpointer data)
dpap_db->count = grl_dpap_db_count;
}
-G_DEFINE_TYPE_WITH_CODE (GrlDpapDb, grl_dpap_db, G_TYPE_OBJECT,
- G_ADD_PRIVATE (GrlDpapDb)
+G_DEFINE_TYPE_WITH_CODE (GrlDPAPDb, grl_dpap_db, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GrlDPAPDb)
G_IMPLEMENT_INTERFACE (DMAP_TYPE_DB, dmap_db_interface_init))
static GObject*
@@ -334,7 +328,7 @@ grl_dpap_db_constructor (GType type, guint n_construct_params, GObjectConstructP
}
static void
-grl_dpap_db_init (GrlDpapDb *db)
+grl_dpap_db_init (GrlDPAPDb *db)
{
db->priv = grl_dpap_db_get_instance_private (db);
@@ -352,9 +346,9 @@ grl_dpap_db_init (GrlDpapDb *db)
static void
grl_dpap_db_finalize (GObject *object)
{
- GrlDpapDb *db = GRL_DPAP_DB (object);
+ GrlDPAPDb *db = GRL_DPAP_DB (object);
- GRL_DEBUG ("Finalizing GrlDpapDb");
+ GRL_DEBUG ("Finalizing GrlDPAPDb");
g_object_unref (db->priv->photos_container);
@@ -362,7 +356,7 @@ grl_dpap_db_finalize (GObject *object)
}
static void
-grl_dpap_db_class_init (GrlDpapDbClass *klass)
+grl_dpap_db_class_init (GrlDPAPDbClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
diff --git a/src/dmap/grl-dpap-db.h b/src/dmap/grl-dpap-db.h
index 14bb4470..4c17d1a3 100644
--- a/src/dmap/grl-dpap-db.h
+++ b/src/dmap/grl-dpap-db.h
@@ -32,12 +32,12 @@ G_BEGIN_DECLS
#define GRL_DPAP_DB(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), \
TYPE_GRL_DPAP_DB, \
- GrlDpapDb))
+ GrlDPAPDb))
#define GRL_DPAP_DB_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_GRL_DPAP_DB, \
- GrlDpapDbClass))
+ GrlDPAPDbClass))
#define IS_GRL_DPAP_DB(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
TYPE_GRL_DPAP_DB))
@@ -48,26 +48,26 @@ G_BEGIN_DECLS
#define GRL_DPAP_DB_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_GRL_DPAP_DB, \
- GrlDpapDbClass))
+ GrlDPAPDbClass))
#define GRL_DPAP_DB_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
TYPE_GRL_DPAP_DB, \
- GrlDpapDbPrivate))
+ GrlDPAPDbPrivate))
-typedef struct GrlDpapDbPrivate GrlDpapDbPrivate;
+typedef struct GrlDPAPDbPrivate GrlDPAPDbPrivate;
typedef struct {
GObject parent;
- GrlDpapDbPrivate *priv;
-} GrlDpapDb;
+ GrlDPAPDbPrivate *priv;
+} GrlDPAPDb;
typedef struct {
GObjectClass parent;
-} GrlDpapDbClass;
+} GrlDPAPDbClass;
-GrlDpapDb *grl_dpap_db_new (void);
-void grl_dpap_db_browse (GrlDpapDb *_db,
+GrlDPAPDb *grl_dpap_db_new (void);
+void grl_dpap_db_browse (GrlDPAPDb *_db,
GrlMedia *container,
GrlSource *source,
guint op_id,
@@ -75,7 +75,7 @@ void grl_dpap_db_browse (GrlDpapDb *_db,
guint count,
GrlSourceResultCb func,
gpointer user_data);
-void grl_dpap_db_search (GrlDpapDb *_db,
+void grl_dpap_db_search (GrlDPAPDb *_db,
GrlSource *source,
guint op_id,
GHRFunc predicate,
diff --git a/src/dmap/grl-dpap-record-factory.c b/src/dmap/grl-dpap-record-factory.c
index a275f7a8..81743384 100644
--- a/src/dmap/grl-dpap-record-factory.c
+++ b/src/dmap/grl-dpap-record-factory.c
@@ -21,39 +21,37 @@
#include "grl-dpap-record-factory.h"
#include "grl-dpap-record.h"
-DmapRecord *
-grl_dpap_record_factory_create (DmapRecordFactory *factory,
- gpointer user_data,
- GError **error)
+DMAPRecord *
+grl_dpap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data)
{
return DMAP_RECORD (grl_dpap_record_new ());
}
static void
-grl_dpap_record_factory_init (GrlDpapRecordFactory *factory)
+grl_dpap_record_factory_init (GrlDPAPRecordFactory *factory)
{
}
static void
-grl_dpap_record_factory_class_init (GrlDpapRecordFactoryClass *klass)
+grl_dpap_record_factory_class_init (GrlDPAPRecordFactoryClass *klass)
{
}
static void
grl_dpap_record_factory_interface_init (gpointer iface, gpointer data)
{
- DmapRecordFactoryInterface *factory = iface;
+ DMAPRecordFactoryIface *factory = iface;
g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY);
factory->create = grl_dpap_record_factory_create;
}
-G_DEFINE_TYPE_WITH_CODE (GrlDpapRecordFactory, grl_dpap_record_factory, G_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (GrlDPAPRecordFactory, grl_dpap_record_factory, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD_FACTORY,
grl_dpap_record_factory_interface_init))
-GrlDpapRecordFactory *
+GrlDPAPRecordFactory *
grl_dpap_record_factory_new (void)
{
return SIMPLE_DPAP_RECORD_FACTORY (g_object_new (TYPE_SIMPLE_DPAP_RECORD_FACTORY, NULL));
diff --git a/src/dmap/grl-dpap-record-factory.h b/src/dmap/grl-dpap-record-factory.h
index a8c5eaf8..c2106b16 100644
--- a/src/dmap/grl-dpap-record-factory.h
+++ b/src/dmap/grl-dpap-record-factory.h
@@ -1,5 +1,5 @@
/*
- * GrlDpapRecord factory class
+ * GrlDPAPRecord factory class
*
* Copyright (C) 2008 W. Michael Petullo <mike flyn org>
*
@@ -31,12 +31,12 @@ G_BEGIN_DECLS
#define SIMPLE_DPAP_RECORD_FACTORY(o) \
(G_TYPE_CHECK_INSTANCE_CAST((o), \
TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
- GrlDpapRecordFactory))
+ GrlDPAPRecordFactory))
#define SIMPLE_DPAP_RECORD_FACTORY_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
- GrlDpapRecordFactoryClass))
+ GrlDPAPRecordFactoryClass))
#define IS_SIMPLE_DPAP_RECORD_FACTORY(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
@@ -49,23 +49,23 @@ G_BEGIN_DECLS
#define SIMPLE_DPAP_RECORD_FACTORY_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
- GrlDpapRecordFactoryClass))
+ GrlDPAPRecordFactoryClass))
-typedef struct GrlDpapRecordFactoryPrivate GrlDpapRecordFactoryPrivate;
+typedef struct GrlDPAPRecordFactoryPrivate GrlDPAPRecordFactoryPrivate;
typedef struct {
GObject parent;
-} GrlDpapRecordFactory;
+} GrlDPAPRecordFactory;
typedef struct {
GObjectClass parent;
-} GrlDpapRecordFactoryClass;
+} GrlDPAPRecordFactoryClass;
GType grl_dpap_record_factory_get_type (void);
-GrlDpapRecordFactory *grl_dpap_record_factory_new (void);
+GrlDPAPRecordFactory *grl_dpap_record_factory_new (void);
-DmapRecord *grl_dpap_record_factory_create (DmapRecordFactory *factory, gpointer user_data,
GError **error);
+DMAPRecord *grl_dpap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
#endif /* __SIMPLE_DPAP_RECORD_FACTORY */
diff --git a/src/dmap/grl-dpap-record.c b/src/dmap/grl-dpap-record.c
index 1b4e58c5..6281417a 100644
--- a/src/dmap/grl-dpap-record.c
+++ b/src/dmap/grl-dpap-record.c
@@ -22,13 +22,13 @@
#include "grl-dpap-record.h"
-struct GrlDpapRecordPrivate {
+struct GrlDPAPRecordPrivate {
char *location;
gint largefilesize;
gint creationdate;
gint rating;
char *filename;
- GArray *thumbnail;
+ GByteArray *thumbnail;
char *aspectratio;
gint height;
gint width;
@@ -54,9 +54,9 @@ enum {
static void grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data);
static void grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data);
-G_DEFINE_TYPE_WITH_CODE (GrlDpapRecord, grl_dpap_record, G_TYPE_OBJECT,
- G_ADD_PRIVATE (GrlDpapRecord)
- G_IMPLEMENT_INTERFACE (DMAP_TYPE_IMAGE_RECORD, grl_dpap_record_dpap_iface_init)
+G_DEFINE_TYPE_WITH_CODE (GrlDPAPRecord, grl_dpap_record, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GrlDPAPRecord)
+ G_IMPLEMENT_INTERFACE (DPAP_TYPE_RECORD, grl_dpap_record_dpap_iface_init)
G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD, grl_dpap_record_dmap_iface_init))
static void
@@ -65,7 +65,7 @@ grl_dpap_record_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
+ GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
switch (prop_id) {
case PROP_LOCATION:
@@ -105,8 +105,8 @@ grl_dpap_record_set_property (GObject *object,
break;
case PROP_THUMBNAIL:
if (record->priv->thumbnail)
- g_array_unref (record->priv->thumbnail);
- record->priv->thumbnail = g_value_get_boxed (value);
+ g_byte_array_unref (record->priv->thumbnail);
+ record->priv->thumbnail = g_byte_array_ref (g_value_get_pointer (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -120,7 +120,7 @@ grl_dpap_record_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
+ GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
switch (prop_id) {
case PROP_LOCATION:
@@ -154,7 +154,7 @@ grl_dpap_record_get_property (GObject *object,
g_value_set_static_string (value, record->priv->comments);
break;
case PROP_THUMBNAIL:
- g_value_set_boxed (value, record->priv->thumbnail);
+ g_value_set_pointer (value, record->priv->thumbnail);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -162,14 +162,14 @@ grl_dpap_record_get_property (GObject *object,
}
}
-GrlDpapRecord *
+GrlDPAPRecord *
grl_dpap_record_new (void)
{
return SIMPLE_DPAP_RECORD (g_object_new (TYPE_SIMPLE_DPAP_RECORD, NULL));
}
GInputStream *
-grl_dpap_record_read (DmapImageRecord *record, GError **error)
+grl_dpap_record_read (DPAPRecord *record, GError **error)
{
GFile *file;
GInputStream *stream;
@@ -183,7 +183,7 @@ grl_dpap_record_read (DmapImageRecord *record, GError **error)
}
static void
-grl_dpap_record_init (GrlDpapRecord *record)
+grl_dpap_record_init (GrlDPAPRecord *record)
{
record->priv = grl_dpap_record_get_instance_private (record);
}
@@ -191,7 +191,7 @@ grl_dpap_record_init (GrlDpapRecord *record)
static void grl_dpap_record_finalize (GObject *object);
static void
-grl_dpap_record_class_init (GrlDpapRecordClass *klass)
+grl_dpap_record_class_init (GrlDPAPRecordClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -215,9 +215,9 @@ grl_dpap_record_class_init (GrlDpapRecordClass *klass)
static void
grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data)
{
- DmapImageRecordInterface *dpap_record = iface;
+ DPAPRecordIface *dpap_record = iface;
- g_assert (G_TYPE_FROM_INTERFACE (dpap_record) == DMAP_TYPE_IMAGE_RECORD);
+ g_assert (G_TYPE_FROM_INTERFACE (dpap_record) == DPAP_TYPE_RECORD);
dpap_record->read = grl_dpap_record_read;
}
@@ -225,7 +225,7 @@ grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data)
static void
grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data)
{
- DmapRecordInterface *dmap_record = iface;
+ DMAPRecordIface *dmap_record = iface;
g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD);
}
@@ -233,7 +233,7 @@ grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data)
static void
grl_dpap_record_finalize (GObject *object)
{
- GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
+ GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
g_free (record->priv->location);
g_free (record->priv->filename);
@@ -242,7 +242,7 @@ grl_dpap_record_finalize (GObject *object)
g_free (record->priv->comments);
if (record->priv->thumbnail)
- g_array_unref (record->priv->thumbnail);
+ g_byte_array_unref (record->priv->thumbnail);
G_OBJECT_CLASS (grl_dpap_record_parent_class)->finalize (object);
}
diff --git a/src/dmap/grl-dpap-record.h b/src/dmap/grl-dpap-record.h
index 78a57bba..4441740b 100644
--- a/src/dmap/grl-dpap-record.h
+++ b/src/dmap/grl-dpap-record.h
@@ -31,12 +31,12 @@ G_BEGIN_DECLS
#define SIMPLE_DPAP_RECORD(o) \
(G_TYPE_CHECK_INSTANCE_CAST((o), \
TYPE_SIMPLE_DPAP_RECORD, \
- GrlDpapRecord))
+ GrlDPAPRecord))
#define SIMPLE_DPAP_RECORD_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), \
TYPE_SIMPLE_DPAP_RECORD, \
- GrlDpapRecordClass))
+ GrlDPAPRecordClass))
#define IS_SIMPLE_DPAP_RECORD(o) \
(G_TYPE_CHECK_INSTANCE_TYPE((o), \
@@ -49,29 +49,29 @@ G_BEGIN_DECLS
#define SIMPLE_DPAP_RECORD_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS((o), \
TYPE_SIMPLE_DPAP_RECORD, \
- GrlDpapRecordClass))
+ GrlDPAPRecordClass))
#define SIMPLE_DPAP_RECORD_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
TYPE_SIMPLE_DPAP_RECORD, \
- GrlDpapRecordPrivate))
+ GrlDPAPRecordPrivate))
-typedef struct GrlDpapRecordPrivate GrlDpapRecordPrivate;
+typedef struct GrlDPAPRecordPrivate GrlDPAPRecordPrivate;
typedef struct {
GObject parent;
- GrlDpapRecordPrivate *priv;
-} GrlDpapRecord;
+ GrlDPAPRecordPrivate *priv;
+} GrlDPAPRecord;
typedef struct {
GObjectClass parent;
-} GrlDpapRecordClass;
+} GrlDPAPRecordClass;
GType grl_dpap_record_get_type (void);
-GrlDpapRecord *grl_dpap_record_new (void);
-GInputStream *grl_dpap_record_read (DmapImageRecord *record, GError **error);
-gint grl_dpap_record_get_id (DmapImageRecord *record);
+GrlDPAPRecord *grl_dpap_record_new (void);
+GInputStream *grl_dpap_record_read (DPAPRecord *record, GError **error);
+gint grl_dpap_record_get_id (DPAPRecord *record);
#endif /* __SIMPLE_DPAP_RECORD */
diff --git a/src/dmap/grl-dpap.c b/src/dmap/grl-dpap.c
index 13d2323b..744de80a 100644
--- a/src/dmap/grl-dpap.c
+++ b/src/dmap/grl-dpap.c
@@ -57,12 +57,12 @@ GRL_LOG_DOMAIN_STATIC(dmap_log_domain);
GrlDpapSourcePrivate))
struct _GrlDpapSourcePrivate {
- DmapMdnsService *service;
+ DMAPMdnsBrowserService *service;
};
/* --- Data types --- */
-static GrlDpapSource *grl_dpap_source_new (DmapMdnsService *service);
+static GrlDpapSource *grl_dpap_source_new (DMAPMdnsBrowserService *service);
static void grl_dpap_source_finalize (GObject *object);
@@ -79,16 +79,16 @@ static void grl_dpap_source_search (GrlSource *source,
GrlSourceSearchSpec *ss);
-static void grl_dpap_service_added_cb (DmapMdnsBrowser *browser,
- DmapMdnsService *service,
+static void grl_dpap_service_added_cb (DMAPMdnsBrowser *browser,
+ DMAPMdnsBrowserService *service,
GrlPlugin *plugin);
-static void grl_dpap_service_removed_cb (DmapMdnsBrowser *browser,
+static void grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
const gchar *service_name,
GrlPlugin *plugin);
/* ===================== Globals ======================= */
-static DmapMdnsBrowser *browser;
+static DMAPMdnsBrowser *browser;
/* Maps URIs to DBs */
static GHashTable *connections;
/* Map DPAP services to Grilo media sources */
@@ -111,7 +111,7 @@ grl_dpap_plugin_init (GrlRegistry *registry,
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- browser = dmap_mdns_browser_new (DMAP_MDNS_SERVICE_TYPE_DPAP);
+ browser = dmap_mdns_browser_new (DMAP_MDNS_BROWSER_SERVICE_TYPE_DPAP);
connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
@@ -158,10 +158,8 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR,
G_DEFINE_TYPE_WITH_PRIVATE (GrlDpapSource, grl_dpap_source, GRL_TYPE_SOURCE)
static GrlDpapSource *
-grl_dpap_source_new (DmapMdnsService *service)
+grl_dpap_source_new (DMAPMdnsBrowserService *service)
{
- gchar *name;
- gchar *service_name;
gchar *source_desc;
gchar *source_id;
@@ -169,16 +167,12 @@ grl_dpap_source_new (DmapMdnsService *service)
GRL_DEBUG ("grl_dpap_source_new");
- g_object_get(service, "name", &name,
- "service-name", &service_name,
- NULL);
-
- source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name);
- source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name);
+ source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, service->name);
+ source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, service->name);
source = g_object_new (GRL_DPAP_SOURCE_TYPE,
"source-id", source_id,
- "source-name", service_name,
+ "source-name", service->name,
"source-desc", source_desc,
"supported-media", GRL_SUPPORTED_MEDIA_IMAGE,
NULL);
@@ -187,8 +181,6 @@ grl_dpap_source_new (DmapMdnsService *service)
g_free (source_desc);
g_free (source_id);
- g_free (service_name);
- g_free (name);
return source;
}
@@ -249,7 +241,7 @@ grl_dpap_do_search (ResultCbAndArgsAndDb *cb_and_db)
}
static void
-browse_connected_cb (DmapConnection *connection,
+browse_connected_cb (DMAPConnection *connection,
gboolean result,
const char *reason,
ResultCbAndArgsAndDb *cb_and_db)
@@ -274,7 +266,7 @@ browse_connected_cb (DmapConnection *connection,
}
static void
-search_connected_cb (DmapConnection *connection,
+search_connected_cb (DMAPConnection *connection,
gboolean result,
const char *reason,
ResultCbAndArgsAndDb *cb_and_db)
@@ -299,8 +291,8 @@ search_connected_cb (DmapConnection *connection,
}
static void
-grl_dpap_service_added_cb (DmapMdnsBrowser *browser,
- DmapMdnsService *service,
+grl_dpap_service_added_cb (DMAPMdnsBrowser *browser,
+ DMAPMdnsBrowserService *service,
GrlPlugin *plugin)
{
GrlRegistry *registry = grl_registry_get_default ();
@@ -314,16 +306,13 @@ grl_dpap_service_added_cb (DmapMdnsBrowser *browser,
GRL_SOURCE (source),
NULL);
if (source != NULL) {
- gchar *name;
- g_object_get(service, "name", &name, NULL);
- g_hash_table_insert (sources, g_strdup (name), g_object_ref (source));
+ g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source));
g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source);
- g_free(name);
}
}
static void
-grl_dpap_service_removed_cb (DmapMdnsBrowser *browser,
+grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
const gchar *service_name,
GrlPlugin *plugin)
{
@@ -339,14 +328,14 @@ grl_dpap_service_removed_cb (DmapMdnsBrowser *browser,
}
static void
-grl_dpap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DmapConnectionFunc
callback)
+grl_dpap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db,
DMAPConnectionCallback callback)
{
- DmapRecordFactory *factory;
- DmapConnection *connection;
+ DMAPRecordFactory *factory;
+ DMAPConnection *connection;
factory = DMAP_RECORD_FACTORY (grl_dpap_record_factory_new ());
- connection = DMAP_CONNECTION (dmap_image_connection_new (name, host, port, DMAP_DB (cb_and_db->db),
factory));
- dmap_connection_start (connection, (DmapConnectionFunc) callback, cb_and_db);
+ connection = DMAP_CONNECTION (dpap_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
+ dmap_connection_connect (connection, (DMAPConnectionCallback) callback, cb_and_db);
}
static gboolean
@@ -407,26 +396,15 @@ grl_dpap_source_browse (GrlSource *source,
browse_connected_cb (NULL, TRUE, NULL, cb_and_db);
} else {
/* Connect */
- gchar *name, *host;
- guint port;
-
cb_and_db->db = DMAP_DB (grl_dpap_db_new ());
- g_object_get (dmap_source->priv->service, "name", &name,
- "host", &host,
- "port", &port,
- NULL);
-
- grl_dpap_connect (name,
- host,
- port,
+ grl_dpap_connect (dmap_source->priv->service->name,
+ dmap_source->priv->service->host,
+ dmap_source->priv->service->port,
cb_and_db,
- (DmapConnectionFunc) browse_connected_cb);
+ (DMAPConnectionCallback) browse_connected_cb);
g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
-
- g_free (name);
- g_free (host);
}
g_free (url);
@@ -438,7 +416,7 @@ static void grl_dpap_source_search (GrlSource *source,
GrlDpapSource *dmap_source = GRL_DPAP_SOURCE (source);
ResultCbAndArgsAndDb *cb_and_db;
- DmapMdnsService *service = dmap_source->priv->service;
+ DMAPMdnsBrowserService *service = dmap_source->priv->service;
gchar *url = grl_dmap_build_url (service);
cb_and_db = g_new (ResultCbAndArgsAndDb, 1);
@@ -456,26 +434,9 @@ static void grl_dpap_source_search (GrlSource *source,
search_connected_cb (NULL, TRUE, NULL, cb_and_db);
} else {
/* Connect */
- gchar *name, *host;
- guint port;
-
cb_and_db->db = DMAP_DB (grl_dpap_db_new ());
-
- g_object_get (dmap_source->priv->service, "name", &name,
- "host", &host,
- "port", &port,
- NULL);
-
- grl_dpap_connect (name,
- host,
- port,
- cb_and_db,
- (DmapConnectionFunc) search_connected_cb);
-
+ grl_dpap_connect (service->name, service->host, service->port, cb_and_db, (DMAPConnectionCallback)
search_connected_cb);
g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
-
- g_free (name);
- g_free (host);
}
g_free (url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]