1 From e00ea44523a7f179df61bf0d4b4cb20c0570baaf Mon Sep 17 00:00:00 2001
2 From: "W. Michael Petullo" <mike@flyn.org>
3 Date: Sun, 17 Mar 2019 22:03:40 -0400
4 Subject: [PATCH] dmap: update to libdmapsharing-4.0 API
6 Signed-off-by: W. Michael Petullo <mike@flyn.org>
9 src/dmap/grl-common.c | 23 ++++++--
10 src/dmap/grl-common.h | 4 +-
11 src/dmap/grl-daap-db.c | 49 ++++++++-------
12 src/dmap/grl-daap-db.h | 22 +++----
13 src/dmap/grl-daap-record-factory.c | 16 ++---
14 src/dmap/grl-daap-record-factory.h | 18 +++---
15 src/dmap/grl-daap-record.c | 28 ++++-----
16 src/dmap/grl-daap-record.h | 22 +++----
17 src/dmap/grl-daap.c | 95 +++++++++++++++++++++---------
18 src/dmap/grl-dpap-db.c | 52 ++++++++--------
19 src/dmap/grl-dpap-db.h | 22 +++----
20 src/dmap/grl-dpap-record-factory.c | 16 ++---
21 src/dmap/grl-dpap-record-factory.h | 18 +++---
22 src/dmap/grl-dpap-record.c | 38 ++++++------
23 src/dmap/grl-dpap-record.h | 22 +++----
24 src/dmap/grl-dpap.c | 95 +++++++++++++++++++++---------
25 17 files changed, 323 insertions(+), 219 deletions(-)
27 diff --git a/meson.build b/meson.build
28 index e45c5ab..e7bcc23 100644
31 @@ -59,7 +59,7 @@ gstreamer_dep = dependency('gstreamer-1.0', required: false)
32 gthread_dep = dependency('gthread-2.0', required: false)
33 json_glib_dep = dependency('json-glib-1.0', required: false)
34 libarchive_dep = dependency('libarchive', required: false)
35 -libdmapsharing_dep = dependency('libdmapsharing-3.0', version: '>= 2.9.12', required: false)
36 +libdmapsharing_dep = dependency('libdmapsharing-4.0', version: '>= 3.9.4', required: false)
37 libgdata_dep = dependency('libgdata', version: '>= 0.9.1', required: false)
38 libmediaart_dep = dependency('libmediaart-2.0', required: false)
39 libsoup_dep = dependency('libsoup-2.4', required: false)
40 diff --git a/src/dmap/grl-common.c b/src/dmap/grl-common.c
41 index fa92df9..66d3e43 100644
42 --- a/src/dmap/grl-common.c
43 +++ b/src/dmap/grl-common.c
45 #include "grl-common.h"
48 -grl_dmap_build_url (DMAPMdnsBrowserService *service)
49 +grl_dmap_build_url (DmapMdnsService *service)
51 - return g_strdup_printf ("%s://%s:%u",
52 - service->service_name,
56 + gchar *service_name, *host;
59 + g_object_get(service, "service-name", &service_name,
61 + "port", &port, NULL);
63 + url = g_strdup_printf ("%s://%s:%u",
68 + g_free(service_name);
73 diff --git a/src/dmap/grl-common.h b/src/dmap/grl-common.h
74 index e9c8327..8e5a3a6 100644
75 --- a/src/dmap/grl-common.h
76 +++ b/src/dmap/grl-common.h
77 @@ -41,9 +41,9 @@ typedef struct {
83 } ResultCbAndArgsAndDb;
85 -gchar *grl_dmap_build_url (DMAPMdnsBrowserService *service);
86 +gchar *grl_dmap_build_url (DmapMdnsService *service);
88 #endif /* _GRL_COMMON_H_ */
89 diff --git a/src/dmap/grl-daap-db.c b/src/dmap/grl-daap-db.c
90 index 6621094..bc6a950 100644
91 --- a/src/dmap/grl-daap-db.c
92 +++ b/src/dmap/grl-daap-db.c
94 /* Media ID's start at max and go down. Container ID's start at 1 and go up. */
95 static guint nextid = G_MAXINT; /* NOTE: this should be G_MAXUINT, but iPhoto can't handle it. */
97 -struct GrlDAAPDbPrivate {
98 +struct GrlDaapDbPrivate {
99 /* Contains each album container (tracked with albums hash table) */
100 GrlMedia *albums_container;
102 @@ -95,31 +95,31 @@ container_equal (gconstpointer a, gconstpointer b)
103 return g_str_equal (grl_media_get_id (GRL_MEDIA (a)), grl_media_get_id (GRL_MEDIA (b)));
108 grl_daap_db_new (void)
110 - GrlDAAPDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL);
111 + GrlDaapDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL);
117 -grl_daap_db_lookup_by_id (const DMAPDb *db, guint id)
119 +grl_daap_db_lookup_by_id (const DmapDb *db, guint id)
121 g_error ("Not implemented");
126 -grl_daap_db_foreach (const DMAPDb *db,
129 +grl_daap_db_foreach (const DmapDb *db,
130 + DmapIdRecordFunc func,
133 g_error ("Not implemented");
137 -grl_daap_db_count (const DMAPDb *db)
138 +grl_daap_db_count (const DmapDb *db)
140 g_error ("Not implemented");
142 @@ -151,13 +151,13 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl
146 -grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
147 +grl_daap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
149 g_assert (IS_GRL_DAAP_DB (_db));
150 - g_assert (IS_DAAP_RECORD (_record));
151 + g_assert (IS_DMAP_AV_RECORD (_record));
153 - GrlDAAPDb *db = GRL_DAAP_DB (_db);
154 - DAAPRecord *record = DAAP_RECORD (_record);
155 + GrlDaapDb *db = GRL_DAAP_DB (_db);
156 + DmapAvRecord *record = DMAP_AV_RECORD (_record);
160 @@ -242,6 +242,11 @@ grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
163 g_object_unref (media);
172 @@ -253,7 +258,7 @@ same_media (GrlMedia *a, GrlMedia *b)
176 -grl_daap_db_browse (GrlDAAPDb *db,
177 +grl_daap_db_browse (GrlDaapDb *db,
181 @@ -312,7 +317,7 @@ done:
185 -grl_daap_db_search (GrlDAAPDb *db,
186 +grl_daap_db_search (GrlDaapDb *db,
190 @@ -364,7 +369,7 @@ grl_daap_db_search (GrlDAAPDb *db,
192 dmap_db_interface_init (gpointer iface, gpointer data)
194 - DMAPDbIface *daap_db = iface;
195 + DmapDbInterface *daap_db = iface;
197 g_assert (G_TYPE_FROM_INTERFACE (daap_db) == DMAP_TYPE_DB);
199 @@ -374,8 +379,8 @@ dmap_db_interface_init (gpointer iface, gpointer data)
200 daap_db->count = grl_daap_db_count;
203 -G_DEFINE_TYPE_WITH_CODE (GrlDAAPDb, grl_daap_db, G_TYPE_OBJECT,
204 - G_ADD_PRIVATE (GrlDAAPDb)
205 +G_DEFINE_TYPE_WITH_CODE (GrlDaapDb, grl_daap_db, G_TYPE_OBJECT,
206 + G_ADD_PRIVATE (GrlDaapDb)
207 G_IMPLEMENT_INTERFACE (DMAP_TYPE_DB, dmap_db_interface_init))
210 @@ -389,7 +394,7 @@ grl_daap_db_constructor (GType type, guint n_construct_params, GObjectConstructP
214 -grl_daap_db_init (GrlDAAPDb *db)
215 +grl_daap_db_init (GrlDaapDb *db)
217 db->priv = grl_daap_db_get_instance_private (db);
219 @@ -413,9 +418,9 @@ grl_daap_db_init (GrlDAAPDb *db)
221 grl_daap_db_finalize (GObject *object)
223 - GrlDAAPDb *db = GRL_DAAP_DB (object);
224 + GrlDaapDb *db = GRL_DAAP_DB (object);
226 - GRL_DEBUG ("Finalizing GrlDAAPDb");
227 + GRL_DEBUG ("Finalizing GrlDaapDb");
229 g_object_unref (db->priv->albums_container);
230 g_object_unref (db->priv->artists_container);
231 @@ -452,7 +457,7 @@ grl_daap_db_get_property (GObject *object,
235 -grl_daap_db_class_init (GrlDAAPDbClass *klass)
236 +grl_daap_db_class_init (GrlDaapDbClass *klass)
238 GObjectClass *object_class = G_OBJECT_CLASS (klass);
240 diff --git a/src/dmap/grl-daap-db.h b/src/dmap/grl-daap-db.h
241 index f52a9b5..63816d0 100644
242 --- a/src/dmap/grl-daap-db.h
243 +++ b/src/dmap/grl-daap-db.h
244 @@ -32,12 +32,12 @@ G_BEGIN_DECLS
245 #define GRL_DAAP_DB(o) \
246 (G_TYPE_CHECK_INSTANCE_CAST ((o), \
251 #define GRL_DAAP_DB_CLASS(k) \
252 (G_TYPE_CHECK_CLASS_CAST((k), \
256 #define IS_GRL_DAAP_DB(o) \
257 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
259 @@ -48,25 +48,25 @@ G_BEGIN_DECLS
260 #define GRL_DAAP_DB_GET_CLASS(o) \
261 (G_TYPE_INSTANCE_GET_CLASS((o), \
266 #define GRL_DAAP_DB_GET_PRIVATE(o) \
267 (G_TYPE_INSTANCE_GET_PRIVATE((o), \
272 -typedef struct GrlDAAPDbPrivate GrlDAAPDbPrivate;
273 +typedef struct GrlDaapDbPrivate GrlDaapDbPrivate;
277 - GrlDAAPDbPrivate *priv;
279 + GrlDaapDbPrivate *priv;
287 -void grl_daap_db_browse (GrlDAAPDb *db,
288 +void grl_daap_db_browse (GrlDaapDb *db,
292 @@ -75,7 +75,7 @@ void grl_daap_db_browse (GrlDAAPDb *db,
293 GrlSourceResultCb func,
296 -void grl_daap_db_search (GrlDAAPDb *db,
297 +void grl_daap_db_search (GrlDaapDb *db,
301 @@ -83,7 +83,7 @@ void grl_daap_db_search (GrlDAAPDb *db,
302 GrlSourceResultCb func,
305 -GrlDAAPDb *grl_daap_db_new (void);
306 +GrlDaapDb *grl_daap_db_new (void);
308 GType grl_daap_db_get_type (void);
310 diff --git a/src/dmap/grl-daap-record-factory.c b/src/dmap/grl-daap-record-factory.c
311 index e986394..7bf5ca2 100644
312 --- a/src/dmap/grl-daap-record-factory.c
313 +++ b/src/dmap/grl-daap-record-factory.c
316 - * DAAPRecord factory class
317 + * DmapAvRecord factory class
319 * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org>
322 #include "grl-daap-record-factory.h"
323 #include "grl-daap-record.h"
326 -grl_daap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data)
328 +grl_daap_record_factory_create (DmapRecordFactory *factory, gpointer user_data, GError **error)
330 return DMAP_RECORD (grl_daap_record_new ());
334 -grl_daap_record_factory_init (GrlDAAPRecordFactory *factory)
335 +grl_daap_record_factory_init (GrlDaapRecordFactory *factory)
340 -grl_daap_record_factory_class_init (GrlDAAPRecordFactoryClass *klass)
341 +grl_daap_record_factory_class_init (GrlDaapRecordFactoryClass *klass)
346 grl_daap_record_factory_interface_init (gpointer iface, gpointer data)
348 - DMAPRecordFactoryIface *factory = iface;
349 + DmapRecordFactoryInterface *factory = iface;
351 g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY);
353 factory->create = grl_daap_record_factory_create;
356 -G_DEFINE_TYPE_WITH_CODE (GrlDAAPRecordFactory, grl_daap_record_factory, G_TYPE_OBJECT,
357 +G_DEFINE_TYPE_WITH_CODE (GrlDaapRecordFactory, grl_daap_record_factory, G_TYPE_OBJECT,
358 G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD_FACTORY,
359 grl_daap_record_factory_interface_init))
361 -GrlDAAPRecordFactory *
362 +GrlDaapRecordFactory *
363 grl_daap_record_factory_new (void)
365 return SIMPLE_DAAP_RECORD_FACTORY (g_object_new (TYPE_SIMPLE_DAAP_RECORD_FACTORY, NULL));
366 diff --git a/src/dmap/grl-daap-record-factory.h b/src/dmap/grl-daap-record-factory.h
367 index 514713a..698b22c 100644
368 --- a/src/dmap/grl-daap-record-factory.h
369 +++ b/src/dmap/grl-daap-record-factory.h
372 - * GrlDAAPRecord factory class
373 + * GrlDaapRecord factory class
375 * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org>
377 @@ -31,12 +31,12 @@ G_BEGIN_DECLS
378 #define SIMPLE_DAAP_RECORD_FACTORY(o) \
379 (G_TYPE_CHECK_INSTANCE_CAST((o), \
380 TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
381 - GrlDAAPRecordFactory))
382 + GrlDaapRecordFactory))
384 #define SIMPLE_DAAP_RECORD_FACTORY_CLASS(k) \
385 (G_TYPE_CHECK_CLASS_CAST((k), \
386 TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
387 - GrlDAAPRecordFactoryClass))
388 + GrlDaapRecordFactoryClass))
390 #define IS_SIMPLE_DAAP_RECORD_FACTORY(o) \
391 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
392 @@ -49,23 +49,23 @@ G_BEGIN_DECLS
393 #define SIMPLE_DAAP_RECORD_FACTORY_GET_CLASS(o) \
394 (G_TYPE_INSTANCE_GET_CLASS((o), \
395 TYPE_SIMPLE_DAAP_RECORD_FACTORY, \
396 - GrlDAAPRecordFactoryClass))
397 + GrlDaapRecordFactoryClass))
399 -typedef struct GrlDAAPRecordFactoryPrivate GrlDAAPRecordFactoryPrivate;
400 +typedef struct GrlDaapRecordFactoryPrivate GrlDaapRecordFactoryPrivate;
404 -} GrlDAAPRecordFactory;
405 +} GrlDaapRecordFactory;
409 -} GrlDAAPRecordFactoryClass;
410 +} GrlDaapRecordFactoryClass;
412 GType grl_daap_record_factory_get_type (void);
414 -GrlDAAPRecordFactory *grl_daap_record_factory_new (void);
415 +GrlDaapRecordFactory *grl_daap_record_factory_new (void);
417 -DMAPRecord *grl_daap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
418 +DmapRecord *grl_daap_record_factory_create (DmapRecordFactory *factory, gpointer user_data, GError **error);
420 #endif /* __SIMPLE_DAAP_RECORD_FACTORY */
422 diff --git a/src/dmap/grl-daap-record.c b/src/dmap/grl-daap-record.c
423 index d1721d2..6edba33 100644
424 --- a/src/dmap/grl-daap-record.c
425 +++ b/src/dmap/grl-daap-record.c
428 #include "grl-daap-record.h"
430 -struct GrlDAAPRecordPrivate {
431 +struct GrlDaapRecordPrivate {
435 @@ -73,7 +73,7 @@ grl_daap_record_set_property (GObject *object,
439 - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
440 + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
444 @@ -155,7 +155,7 @@ grl_daap_record_get_property (GObject *object,
448 - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
449 + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
453 @@ -223,14 +223,14 @@ grl_daap_record_get_property (GObject *object,
459 grl_daap_record_new (void)
461 return SIMPLE_DAAP_RECORD (g_object_new (TYPE_SIMPLE_DAAP_RECORD, NULL));
465 -grl_daap_record_read (DAAPRecord *record, GError **error)
466 +grl_daap_record_read (DmapAvRecord *record, GError **error)
469 GInputStream *stream;
470 @@ -244,7 +244,7 @@ grl_daap_record_read (DAAPRecord *record, GError **error)
474 -grl_daap_record_init (GrlDAAPRecord *record)
475 +grl_daap_record_init (GrlDaapRecord *record)
477 record->priv = SIMPLE_DAAP_RECORD_GET_PRIVATE (record);
479 @@ -252,7 +252,7 @@ grl_daap_record_init (GrlDAAPRecord *record)
480 static void grl_daap_record_finalize (GObject *object);
483 -grl_daap_record_class_init (GrlDAAPRecordClass *klass)
484 +grl_daap_record_class_init (GrlDaapRecordClass *klass)
486 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
488 @@ -284,9 +284,9 @@ grl_daap_record_class_init (GrlDAAPRecordClass *klass)
490 grl_daap_record_daap_iface_init (gpointer iface, gpointer data)
492 - DAAPRecordIface *daap_record = iface;
493 + DmapAvRecordInterface *daap_record = iface;
495 - g_assert (G_TYPE_FROM_INTERFACE (daap_record) == DAAP_TYPE_RECORD);
496 + g_assert (G_TYPE_FROM_INTERFACE (daap_record) == DMAP_TYPE_AV_RECORD);
498 daap_record->read = grl_daap_record_read;
500 @@ -294,21 +294,21 @@ grl_daap_record_daap_iface_init (gpointer iface, gpointer data)
502 grl_daap_record_dmap_iface_init (gpointer iface, gpointer data)
504 - DMAPRecordIface *dmap_record = iface;
505 + DmapRecordInterface *dmap_record = iface;
507 g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD);
511 -G_DEFINE_TYPE_WITH_CODE (GrlDAAPRecord, grl_daap_record, G_TYPE_OBJECT,
512 - G_ADD_PRIVATE (GrlDAAPRecord)
513 - G_IMPLEMENT_INTERFACE (DAAP_TYPE_RECORD, grl_daap_record_daap_iface_init)
514 +G_DEFINE_TYPE_WITH_CODE (GrlDaapRecord, grl_daap_record, G_TYPE_OBJECT,
515 + G_ADD_PRIVATE (GrlDaapRecord)
516 + G_IMPLEMENT_INTERFACE (DMAP_TYPE_AV_RECORD, grl_daap_record_daap_iface_init)
517 G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD, grl_daap_record_dmap_iface_init))
520 grl_daap_record_finalize (GObject *object)
522 - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object);
523 + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object);
525 g_free (record->priv->location);
526 g_free (record->priv->title);
527 diff --git a/src/dmap/grl-daap-record.h b/src/dmap/grl-daap-record.h
528 index 59558c4..ee3f085 100644
529 --- a/src/dmap/grl-daap-record.h
530 +++ b/src/dmap/grl-daap-record.h
531 @@ -31,12 +31,12 @@ G_BEGIN_DECLS
532 #define SIMPLE_DAAP_RECORD(o) \
533 (G_TYPE_CHECK_INSTANCE_CAST((o), \
534 TYPE_SIMPLE_DAAP_RECORD, \
538 #define SIMPLE_DAAP_RECORD_CLASS(k) \
539 (G_TYPE_CHECK_CLASS_CAST((k), \
540 TYPE_SIMPLE_DAAP_RECORD, \
541 - GrlDAAPRecordClass))
542 + GrlDaapRecordClass))
544 #define IS_SIMPLE_DAAP_RECORD(o) \
545 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
546 @@ -49,29 +49,29 @@ G_BEGIN_DECLS
547 #define SIMPLE_DAAP_RECORD_GET_CLASS(o) \
548 (G_TYPE_INSTANCE_GET_CLASS((o), \
549 TYPE_SIMPLE_DAAP_RECORD, \
550 - GrlDAAPRecordClass))
551 + GrlDaapRecordClass))
553 #define SIMPLE_DAAP_RECORD_GET_PRIVATE(o) \
554 (G_TYPE_INSTANCE_GET_PRIVATE((o), \
555 TYPE_SIMPLE_DAAP_RECORD, \
556 - GrlDAAPRecordPrivate))
557 + GrlDaapRecordPrivate))
559 -typedef struct GrlDAAPRecordPrivate GrlDAAPRecordPrivate;
560 +typedef struct GrlDaapRecordPrivate GrlDaapRecordPrivate;
564 - GrlDAAPRecordPrivate *priv;
566 + GrlDaapRecordPrivate *priv;
571 -} GrlDAAPRecordClass;
572 +} GrlDaapRecordClass;
574 GType grl_daap_record_get_type (void);
576 -GrlDAAPRecord *grl_daap_record_new (void);
577 -GInputStream *grl_daap_record_read (DAAPRecord *record, GError **error);
578 -gint grl_daap_record_get_id (DAAPRecord *record);
579 +GrlDaapRecord *grl_daap_record_new (void);
580 +GInputStream *grl_daap_record_read (DmapAvRecord *record, GError **error);
581 +gint grl_daap_record_get_id (DmapAvRecord *record);
583 #endif /* __SIMPLE_DAAP_RECORD */
585 diff --git a/src/dmap/grl-daap.c b/src/dmap/grl-daap.c
586 index 13cc7e3..2562d08 100644
587 --- a/src/dmap/grl-daap.c
588 +++ b/src/dmap/grl-daap.c
589 @@ -52,12 +52,12 @@ GRL_LOG_DOMAIN_STATIC(daap_log_domain);
590 /* --- Grilo DAAP Private --- */
592 struct _GrlDaapSourcePrivate {
593 - DMAPMdnsBrowserService *service;
594 + DmapMdnsService *service;
597 /* --- Data types --- */
599 -static GrlDaapSource *grl_daap_source_new (DMAPMdnsBrowserService *service);
600 +static GrlDaapSource *grl_daap_source_new (DmapMdnsService *service);
602 static void grl_daap_source_finalize (GObject *object);
604 @@ -74,16 +74,16 @@ static void grl_daap_source_search (GrlSource *source,
605 GrlSourceSearchSpec *ss);
608 -static void grl_daap_service_added_cb (DMAPMdnsBrowser *browser,
609 - DMAPMdnsBrowserService *service,
610 +static void grl_daap_service_added_cb (DmapMdnsBrowser *browser,
611 + DmapMdnsService *service,
614 -static void grl_daap_service_removed_cb (DMAPMdnsBrowser *browser,
615 +static void grl_daap_service_removed_cb (DmapMdnsBrowser *browser,
616 const gchar *service_name,
619 /* ===================== Globals ======================= */
620 -static DMAPMdnsBrowser *browser;
621 +static DmapMdnsBrowser *browser;
622 /* Maps URIs to DBs */
623 static GHashTable *connections;
624 /* Map DAAP services to Grilo media sources */
625 @@ -106,7 +106,7 @@ grl_daap_plugin_init (GrlRegistry *registry,
626 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
627 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
629 - browser = dmap_mdns_browser_new (DMAP_MDNS_BROWSER_SERVICE_TYPE_DAAP);
630 + browser = dmap_mdns_browser_new (DMAP_MDNS_SERVICE_TYPE_DAAP);
631 connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
632 sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
634 @@ -153,8 +153,10 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR,
635 G_DEFINE_TYPE_WITH_PRIVATE (GrlDaapSource, grl_daap_source, GRL_TYPE_SOURCE)
637 static GrlDaapSource *
638 -grl_daap_source_new (DMAPMdnsBrowserService *service)
639 +grl_daap_source_new (DmapMdnsService *service)
642 + gchar *service_name;
646 @@ -162,12 +164,16 @@ grl_daap_source_new (DMAPMdnsBrowserService *service)
648 GRL_DEBUG ("grl_daap_source_new");
650 - source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, service->name);
651 - source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, service->name);
652 + g_object_get(service, "name", &name,
653 + "service-name", &service_name,
656 + source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name);
657 + source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name);
659 source = g_object_new (GRL_DAAP_SOURCE_TYPE,
660 "source-id", source_id,
661 - "source-name", service->name,
662 + "source-name", service_name,
663 "source-desc", source_desc,
664 "supported-media", GRL_SUPPORTED_MEDIA_AUDIO,
666 @@ -176,6 +182,8 @@ grl_daap_source_new (DMAPMdnsBrowserService *service)
668 g_free (source_desc);
670 + g_free (service_name);
675 @@ -236,7 +244,7 @@ grl_daap_do_search (ResultCbAndArgsAndDb *cb_and_db)
679 -browse_connected_cb (DMAPConnection *connection,
680 +browse_connected_cb (DmapConnection *connection,
683 ResultCbAndArgsAndDb *cb_and_db)
684 @@ -261,7 +269,7 @@ browse_connected_cb (DMAPConnection *connection,
688 -search_connected_cb (DMAPConnection *connection,
689 +search_connected_cb (DmapConnection *connection,
692 ResultCbAndArgsAndDb *cb_and_db)
693 @@ -286,8 +294,8 @@ search_connected_cb (DMAPConnection *connection,
697 -grl_daap_service_added_cb (DMAPMdnsBrowser *browser,
698 - DMAPMdnsBrowserService *service,
699 +grl_daap_service_added_cb (DmapMdnsBrowser *browser,
700 + DmapMdnsService *service,
703 GrlRegistry *registry = grl_registry_get_default ();
704 @@ -301,13 +309,16 @@ grl_daap_service_added_cb (DMAPMdnsBrowser *browser,
707 if (source != NULL) {
708 - g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source));
710 + g_object_get (service, "name", &name, NULL);
711 + g_hash_table_insert (sources, g_strdup (name), g_object_ref (source));
712 g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source);
718 -grl_daap_service_removed_cb (DMAPMdnsBrowser *browser,
719 +grl_daap_service_removed_cb (DmapMdnsBrowser *browser,
720 const gchar *service_name,
723 @@ -323,14 +334,14 @@ grl_daap_service_removed_cb (DMAPMdnsBrowser *browser,
727 -grl_daap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DMAPConnectionCallback callback)
728 +grl_daap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DmapConnectionFunc callback)
730 - DMAPRecordFactory *factory;
731 - DMAPConnection *connection;
732 + DmapRecordFactory *factory;
733 + DmapConnection *connection;
735 factory = DMAP_RECORD_FACTORY (grl_daap_record_factory_new ());
736 - connection = DMAP_CONNECTION (daap_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
737 - dmap_connection_connect (connection, (DMAPConnectionCallback) callback, cb_and_db);
738 + connection = DMAP_CONNECTION (dmap_av_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
739 + dmap_connection_start (connection, (DmapConnectionFunc) callback, cb_and_db);
743 @@ -397,15 +408,26 @@ grl_daap_source_browse (GrlSource *source,
744 browse_connected_cb (NULL, TRUE, NULL, cb_and_db);
747 + gchar *name, *host;
750 cb_and_db->db = DMAP_DB (grl_daap_db_new ());
752 - grl_daap_connect (dmap_source->priv->service->name,
753 - dmap_source->priv->service->host,
754 - dmap_source->priv->service->port,
755 + g_object_get (dmap_source->priv->service, "name", &name,
760 + grl_daap_connect (name,
764 - (DMAPConnectionCallback) browse_connected_cb);
765 + (DmapConnectionFunc) browse_connected_cb);
767 g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
774 @@ -417,7 +439,7 @@ static void grl_daap_source_search (GrlSource *source,
775 GrlDaapSource *dmap_source = GRL_DAAP_SOURCE (source);
777 ResultCbAndArgsAndDb *cb_and_db;
778 - DMAPMdnsBrowserService *service = dmap_source->priv->service;
779 + DmapMdnsService *service = dmap_source->priv->service;
780 gchar *url = grl_dmap_build_url (service);
782 cb_and_db = g_new (ResultCbAndArgsAndDb, 1);
783 @@ -435,9 +457,26 @@ static void grl_daap_source_search (GrlSource *source,
784 search_connected_cb (NULL, TRUE, NULL, cb_and_db);
787 + gchar *name, *host;
790 cb_and_db->db = DMAP_DB (grl_daap_db_new ());
791 - grl_daap_connect (service->name, service->host, service->port, cb_and_db, (DMAPConnectionCallback) search_connected_cb);
793 + g_object_get (dmap_source->priv->service, "name", &name,
798 + grl_daap_connect (name,
802 + (DmapConnectionFunc) search_connected_cb);
804 g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
811 diff --git a/src/dmap/grl-dpap-db.c b/src/dmap/grl-dpap-db.c
812 index 1f2d5ca..2c984c0 100644
813 --- a/src/dmap/grl-dpap-db.c
814 +++ b/src/dmap/grl-dpap-db.c
816 /* Media IDs start at max and go down. Container IDs start at 1 and go up. */
817 static guint nextid = G_MAXINT; /* NOTE: this should be G_MAXUINT, but iPhoto can't handle it. */
819 -struct GrlDPAPDbPrivate {
820 +struct GrlDpapDbPrivate {
821 /* Contains each picture container (tracked with photos hash table) */
822 GrlMedia *photos_container;
824 @@ -63,31 +63,31 @@ container_equal (gconstpointer a, gconstpointer b)
825 return g_str_equal (grl_media_get_id (GRL_MEDIA (a)), grl_media_get_id (GRL_MEDIA (b)));
830 grl_dpap_db_new (void)
832 - GrlDPAPDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL);
833 + GrlDpapDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL);
839 -grl_dpap_db_lookup_by_id (const DMAPDb *db, guint id)
841 +grl_dpap_db_lookup_by_id (const DmapDb *db, guint id)
843 g_warning ("Not implemented");
848 -grl_dpap_db_foreach (const DMAPDb *db,
851 +grl_dpap_db_foreach (const DmapDb *db,
852 + DmapIdRecordFunc func,
855 g_warning ("Not implemented");
859 -grl_dpap_db_count (const DMAPDb *db)
860 +grl_dpap_db_count (const DmapDb *db)
862 g_warning ("Not implemented");
864 @@ -119,20 +119,20 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl
868 -grl_dpap_db_add (DMAPDb *_db, DMAPRecord *_record)
869 +grl_dpap_db_add (DmapDb *_db, DmapRecord *_record, GError **error)
871 g_assert (IS_GRL_DPAP_DB (_db));
872 - g_assert (IS_DPAP_RECORD (_record));
873 + g_assert (IS_DMAP_IMAGE_RECORD (_record));
875 - GrlDPAPDb *db = GRL_DPAP_DB (_db);
876 - DPAPRecord *record = DPAP_RECORD (_record);
877 + GrlDpapDb *db = GRL_DPAP_DB (_db);
878 + DmapImageRecord *record = DMAP_IMAGE_RECORD (_record);
885 - GByteArray *thumbnail = NULL;
886 + GArray *thumbnail = NULL;
890 @@ -188,6 +188,12 @@ grl_dpap_db_add (DMAPDb *_db, DMAPRecord *_record)
893 g_object_unref (media);
895 + g_free (aspectratio);
898 + g_array_unref (thumbnail);
903 @@ -199,7 +205,7 @@ same_media (GrlMedia *a, GrlMedia *b)
907 -grl_dpap_db_browse (GrlDPAPDb *db,
908 +grl_dpap_db_browse (GrlDpapDb *db,
912 @@ -251,7 +257,7 @@ done:
916 -grl_dpap_db_search (GrlDPAPDb *db,
917 +grl_dpap_db_search (GrlDpapDb *db,
921 @@ -303,7 +309,7 @@ grl_dpap_db_search (GrlDPAPDb *db,
923 dmap_db_interface_init (gpointer iface, gpointer data)
925 - DMAPDbIface *dpap_db = iface;
926 + DmapDbInterface *dpap_db = iface;
928 g_assert (G_TYPE_FROM_INTERFACE (dpap_db) == DMAP_TYPE_DB);
930 @@ -313,8 +319,8 @@ dmap_db_interface_init (gpointer iface, gpointer data)
931 dpap_db->count = grl_dpap_db_count;
934 -G_DEFINE_TYPE_WITH_CODE (GrlDPAPDb, grl_dpap_db, G_TYPE_OBJECT,
935 - G_ADD_PRIVATE (GrlDPAPDb)
936 +G_DEFINE_TYPE_WITH_CODE (GrlDpapDb, grl_dpap_db, G_TYPE_OBJECT,
937 + G_ADD_PRIVATE (GrlDpapDb)
938 G_IMPLEMENT_INTERFACE (DMAP_TYPE_DB, dmap_db_interface_init))
941 @@ -328,7 +334,7 @@ grl_dpap_db_constructor (GType type, guint n_construct_params, GObjectConstructP
945 -grl_dpap_db_init (GrlDPAPDb *db)
946 +grl_dpap_db_init (GrlDpapDb *db)
948 db->priv = grl_dpap_db_get_instance_private (db);
950 @@ -346,9 +352,9 @@ grl_dpap_db_init (GrlDPAPDb *db)
952 grl_dpap_db_finalize (GObject *object)
954 - GrlDPAPDb *db = GRL_DPAP_DB (object);
955 + GrlDpapDb *db = GRL_DPAP_DB (object);
957 - GRL_DEBUG ("Finalizing GrlDPAPDb");
958 + GRL_DEBUG ("Finalizing GrlDpapDb");
960 g_object_unref (db->priv->photos_container);
962 @@ -356,7 +362,7 @@ grl_dpap_db_finalize (GObject *object)
966 -grl_dpap_db_class_init (GrlDPAPDbClass *klass)
967 +grl_dpap_db_class_init (GrlDpapDbClass *klass)
969 GObjectClass *object_class = G_OBJECT_CLASS (klass);
971 diff --git a/src/dmap/grl-dpap-db.h b/src/dmap/grl-dpap-db.h
972 index 4c17d1a..14bb447 100644
973 --- a/src/dmap/grl-dpap-db.h
974 +++ b/src/dmap/grl-dpap-db.h
975 @@ -32,12 +32,12 @@ G_BEGIN_DECLS
976 #define GRL_DPAP_DB(o) \
977 (G_TYPE_CHECK_INSTANCE_CAST ((o), \
982 #define GRL_DPAP_DB_CLASS(k) \
983 (G_TYPE_CHECK_CLASS_CAST((k), \
987 #define IS_GRL_DPAP_DB(o) \
988 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
990 @@ -48,26 +48,26 @@ G_BEGIN_DECLS
991 #define GRL_DPAP_DB_GET_CLASS(o) \
992 (G_TYPE_INSTANCE_GET_CLASS((o), \
997 #define GRL_DPAP_DB_GET_PRIVATE(o) \
998 (G_TYPE_INSTANCE_GET_PRIVATE((o), \
1000 - GrlDPAPDbPrivate))
1001 + GrlDpapDbPrivate))
1003 -typedef struct GrlDPAPDbPrivate GrlDPAPDbPrivate;
1004 +typedef struct GrlDpapDbPrivate GrlDpapDbPrivate;
1008 - GrlDPAPDbPrivate *priv;
1010 + GrlDpapDbPrivate *priv;
1014 GObjectClass parent;
1018 -GrlDPAPDb *grl_dpap_db_new (void);
1019 -void grl_dpap_db_browse (GrlDPAPDb *_db,
1020 +GrlDpapDb *grl_dpap_db_new (void);
1021 +void grl_dpap_db_browse (GrlDpapDb *_db,
1022 GrlMedia *container,
1025 @@ -75,7 +75,7 @@ void grl_dpap_db_browse (GrlDPAPDb *_db,
1027 GrlSourceResultCb func,
1028 gpointer user_data);
1029 -void grl_dpap_db_search (GrlDPAPDb *_db,
1030 +void grl_dpap_db_search (GrlDpapDb *_db,
1034 diff --git a/src/dmap/grl-dpap-record-factory.c b/src/dmap/grl-dpap-record-factory.c
1035 index 8174338..a275f7a 100644
1036 --- a/src/dmap/grl-dpap-record-factory.c
1037 +++ b/src/dmap/grl-dpap-record-factory.c
1039 #include "grl-dpap-record-factory.h"
1040 #include "grl-dpap-record.h"
1043 -grl_dpap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data)
1045 +grl_dpap_record_factory_create (DmapRecordFactory *factory,
1046 + gpointer user_data,
1049 return DMAP_RECORD (grl_dpap_record_new ());
1053 -grl_dpap_record_factory_init (GrlDPAPRecordFactory *factory)
1054 +grl_dpap_record_factory_init (GrlDpapRecordFactory *factory)
1059 -grl_dpap_record_factory_class_init (GrlDPAPRecordFactoryClass *klass)
1060 +grl_dpap_record_factory_class_init (GrlDpapRecordFactoryClass *klass)
1065 grl_dpap_record_factory_interface_init (gpointer iface, gpointer data)
1067 - DMAPRecordFactoryIface *factory = iface;
1068 + DmapRecordFactoryInterface *factory = iface;
1070 g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY);
1072 factory->create = grl_dpap_record_factory_create;
1075 -G_DEFINE_TYPE_WITH_CODE (GrlDPAPRecordFactory, grl_dpap_record_factory, G_TYPE_OBJECT,
1076 +G_DEFINE_TYPE_WITH_CODE (GrlDpapRecordFactory, grl_dpap_record_factory, G_TYPE_OBJECT,
1077 G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD_FACTORY,
1078 grl_dpap_record_factory_interface_init))
1080 -GrlDPAPRecordFactory *
1081 +GrlDpapRecordFactory *
1082 grl_dpap_record_factory_new (void)
1084 return SIMPLE_DPAP_RECORD_FACTORY (g_object_new (TYPE_SIMPLE_DPAP_RECORD_FACTORY, NULL));
1085 diff --git a/src/dmap/grl-dpap-record-factory.h b/src/dmap/grl-dpap-record-factory.h
1086 index c2106b1..a8c5eaf 100644
1087 --- a/src/dmap/grl-dpap-record-factory.h
1088 +++ b/src/dmap/grl-dpap-record-factory.h
1091 - * GrlDPAPRecord factory class
1092 + * GrlDpapRecord factory class
1094 * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org>
1096 @@ -31,12 +31,12 @@ G_BEGIN_DECLS
1097 #define SIMPLE_DPAP_RECORD_FACTORY(o) \
1098 (G_TYPE_CHECK_INSTANCE_CAST((o), \
1099 TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
1100 - GrlDPAPRecordFactory))
1101 + GrlDpapRecordFactory))
1103 #define SIMPLE_DPAP_RECORD_FACTORY_CLASS(k) \
1104 (G_TYPE_CHECK_CLASS_CAST((k), \
1105 TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
1106 - GrlDPAPRecordFactoryClass))
1107 + GrlDpapRecordFactoryClass))
1109 #define IS_SIMPLE_DPAP_RECORD_FACTORY(o) \
1110 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
1111 @@ -49,23 +49,23 @@ G_BEGIN_DECLS
1112 #define SIMPLE_DPAP_RECORD_FACTORY_GET_CLASS(o) \
1113 (G_TYPE_INSTANCE_GET_CLASS((o), \
1114 TYPE_SIMPLE_DPAP_RECORD_FACTORY, \
1115 - GrlDPAPRecordFactoryClass))
1116 + GrlDpapRecordFactoryClass))
1118 -typedef struct GrlDPAPRecordFactoryPrivate GrlDPAPRecordFactoryPrivate;
1119 +typedef struct GrlDpapRecordFactoryPrivate GrlDpapRecordFactoryPrivate;
1123 -} GrlDPAPRecordFactory;
1124 +} GrlDpapRecordFactory;
1127 GObjectClass parent;
1128 -} GrlDPAPRecordFactoryClass;
1129 +} GrlDpapRecordFactoryClass;
1131 GType grl_dpap_record_factory_get_type (void);
1133 -GrlDPAPRecordFactory *grl_dpap_record_factory_new (void);
1134 +GrlDpapRecordFactory *grl_dpap_record_factory_new (void);
1136 -DMAPRecord *grl_dpap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data);
1137 +DmapRecord *grl_dpap_record_factory_create (DmapRecordFactory *factory, gpointer user_data, GError **error);
1139 #endif /* __SIMPLE_DPAP_RECORD_FACTORY */
1141 diff --git a/src/dmap/grl-dpap-record.c b/src/dmap/grl-dpap-record.c
1142 index 6281417..1b4e58c 100644
1143 --- a/src/dmap/grl-dpap-record.c
1144 +++ b/src/dmap/grl-dpap-record.c
1147 #include "grl-dpap-record.h"
1149 -struct GrlDPAPRecordPrivate {
1150 +struct GrlDpapRecordPrivate {
1156 - GByteArray *thumbnail;
1157 + GArray *thumbnail;
1161 @@ -54,9 +54,9 @@ enum {
1162 static void grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data);
1163 static void grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data);
1165 -G_DEFINE_TYPE_WITH_CODE (GrlDPAPRecord, grl_dpap_record, G_TYPE_OBJECT,
1166 - G_ADD_PRIVATE (GrlDPAPRecord)
1167 - G_IMPLEMENT_INTERFACE (DPAP_TYPE_RECORD, grl_dpap_record_dpap_iface_init)
1168 +G_DEFINE_TYPE_WITH_CODE (GrlDpapRecord, grl_dpap_record, G_TYPE_OBJECT,
1169 + G_ADD_PRIVATE (GrlDpapRecord)
1170 + G_IMPLEMENT_INTERFACE (DMAP_TYPE_IMAGE_RECORD, grl_dpap_record_dpap_iface_init)
1171 G_IMPLEMENT_INTERFACE (DMAP_TYPE_RECORD, grl_dpap_record_dmap_iface_init))
1174 @@ -65,7 +65,7 @@ grl_dpap_record_set_property (GObject *object,
1175 const GValue *value,
1178 - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
1179 + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
1183 @@ -105,8 +105,8 @@ grl_dpap_record_set_property (GObject *object,
1185 case PROP_THUMBNAIL:
1186 if (record->priv->thumbnail)
1187 - g_byte_array_unref (record->priv->thumbnail);
1188 - record->priv->thumbnail = g_byte_array_ref (g_value_get_pointer (value));
1189 + g_array_unref (record->priv->thumbnail);
1190 + record->priv->thumbnail = g_value_get_boxed (value);
1193 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1194 @@ -120,7 +120,7 @@ grl_dpap_record_get_property (GObject *object,
1198 - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
1199 + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
1203 @@ -154,7 +154,7 @@ grl_dpap_record_get_property (GObject *object,
1204 g_value_set_static_string (value, record->priv->comments);
1206 case PROP_THUMBNAIL:
1207 - g_value_set_pointer (value, record->priv->thumbnail);
1208 + g_value_set_boxed (value, record->priv->thumbnail);
1211 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1212 @@ -162,14 +162,14 @@ grl_dpap_record_get_property (GObject *object,
1218 grl_dpap_record_new (void)
1220 return SIMPLE_DPAP_RECORD (g_object_new (TYPE_SIMPLE_DPAP_RECORD, NULL));
1224 -grl_dpap_record_read (DPAPRecord *record, GError **error)
1225 +grl_dpap_record_read (DmapImageRecord *record, GError **error)
1228 GInputStream *stream;
1229 @@ -183,7 +183,7 @@ grl_dpap_record_read (DPAPRecord *record, GError **error)
1233 -grl_dpap_record_init (GrlDPAPRecord *record)
1234 +grl_dpap_record_init (GrlDpapRecord *record)
1236 record->priv = grl_dpap_record_get_instance_private (record);
1238 @@ -191,7 +191,7 @@ grl_dpap_record_init (GrlDPAPRecord *record)
1239 static void grl_dpap_record_finalize (GObject *object);
1242 -grl_dpap_record_class_init (GrlDPAPRecordClass *klass)
1243 +grl_dpap_record_class_init (GrlDpapRecordClass *klass)
1245 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1247 @@ -215,9 +215,9 @@ grl_dpap_record_class_init (GrlDPAPRecordClass *klass)
1249 grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data)
1251 - DPAPRecordIface *dpap_record = iface;
1252 + DmapImageRecordInterface *dpap_record = iface;
1254 - g_assert (G_TYPE_FROM_INTERFACE (dpap_record) == DPAP_TYPE_RECORD);
1255 + g_assert (G_TYPE_FROM_INTERFACE (dpap_record) == DMAP_TYPE_IMAGE_RECORD);
1257 dpap_record->read = grl_dpap_record_read;
1259 @@ -225,7 +225,7 @@ grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data)
1261 grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data)
1263 - DMAPRecordIface *dmap_record = iface;
1264 + DmapRecordInterface *dmap_record = iface;
1266 g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD);
1268 @@ -233,7 +233,7 @@ grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data)
1270 grl_dpap_record_finalize (GObject *object)
1272 - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object);
1273 + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object);
1275 g_free (record->priv->location);
1276 g_free (record->priv->filename);
1277 @@ -242,7 +242,7 @@ grl_dpap_record_finalize (GObject *object)
1278 g_free (record->priv->comments);
1280 if (record->priv->thumbnail)
1281 - g_byte_array_unref (record->priv->thumbnail);
1282 + g_array_unref (record->priv->thumbnail);
1284 G_OBJECT_CLASS (grl_dpap_record_parent_class)->finalize (object);
1286 diff --git a/src/dmap/grl-dpap-record.h b/src/dmap/grl-dpap-record.h
1287 index 4441740..78a57bb 100644
1288 --- a/src/dmap/grl-dpap-record.h
1289 +++ b/src/dmap/grl-dpap-record.h
1290 @@ -31,12 +31,12 @@ G_BEGIN_DECLS
1291 #define SIMPLE_DPAP_RECORD(o) \
1292 (G_TYPE_CHECK_INSTANCE_CAST((o), \
1293 TYPE_SIMPLE_DPAP_RECORD, \
1297 #define SIMPLE_DPAP_RECORD_CLASS(k) \
1298 (G_TYPE_CHECK_CLASS_CAST((k), \
1299 TYPE_SIMPLE_DPAP_RECORD, \
1300 - GrlDPAPRecordClass))
1301 + GrlDpapRecordClass))
1303 #define IS_SIMPLE_DPAP_RECORD(o) \
1304 (G_TYPE_CHECK_INSTANCE_TYPE((o), \
1305 @@ -49,29 +49,29 @@ G_BEGIN_DECLS
1306 #define SIMPLE_DPAP_RECORD_GET_CLASS(o) \
1307 (G_TYPE_INSTANCE_GET_CLASS((o), \
1308 TYPE_SIMPLE_DPAP_RECORD, \
1309 - GrlDPAPRecordClass))
1310 + GrlDpapRecordClass))
1312 #define SIMPLE_DPAP_RECORD_GET_PRIVATE(o) \
1313 (G_TYPE_INSTANCE_GET_PRIVATE((o), \
1314 TYPE_SIMPLE_DPAP_RECORD, \
1315 - GrlDPAPRecordPrivate))
1316 + GrlDpapRecordPrivate))
1318 -typedef struct GrlDPAPRecordPrivate GrlDPAPRecordPrivate;
1319 +typedef struct GrlDpapRecordPrivate GrlDpapRecordPrivate;
1323 - GrlDPAPRecordPrivate *priv;
1325 + GrlDpapRecordPrivate *priv;
1329 GObjectClass parent;
1330 -} GrlDPAPRecordClass;
1331 +} GrlDpapRecordClass;
1333 GType grl_dpap_record_get_type (void);
1335 -GrlDPAPRecord *grl_dpap_record_new (void);
1336 -GInputStream *grl_dpap_record_read (DPAPRecord *record, GError **error);
1337 -gint grl_dpap_record_get_id (DPAPRecord *record);
1338 +GrlDpapRecord *grl_dpap_record_new (void);
1339 +GInputStream *grl_dpap_record_read (DmapImageRecord *record, GError **error);
1340 +gint grl_dpap_record_get_id (DmapImageRecord *record);
1342 #endif /* __SIMPLE_DPAP_RECORD */
1344 diff --git a/src/dmap/grl-dpap.c b/src/dmap/grl-dpap.c
1345 index 744de80..13d2323 100644
1346 --- a/src/dmap/grl-dpap.c
1347 +++ b/src/dmap/grl-dpap.c
1348 @@ -57,12 +57,12 @@ GRL_LOG_DOMAIN_STATIC(dmap_log_domain);
1349 GrlDpapSourcePrivate))
1351 struct _GrlDpapSourcePrivate {
1352 - DMAPMdnsBrowserService *service;
1353 + DmapMdnsService *service;
1356 /* --- Data types --- */
1358 -static GrlDpapSource *grl_dpap_source_new (DMAPMdnsBrowserService *service);
1359 +static GrlDpapSource *grl_dpap_source_new (DmapMdnsService *service);
1361 static void grl_dpap_source_finalize (GObject *object);
1363 @@ -79,16 +79,16 @@ static void grl_dpap_source_search (GrlSource *source,
1364 GrlSourceSearchSpec *ss);
1367 -static void grl_dpap_service_added_cb (DMAPMdnsBrowser *browser,
1368 - DMAPMdnsBrowserService *service,
1369 +static void grl_dpap_service_added_cb (DmapMdnsBrowser *browser,
1370 + DmapMdnsService *service,
1373 -static void grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
1374 +static void grl_dpap_service_removed_cb (DmapMdnsBrowser *browser,
1375 const gchar *service_name,
1378 /* ===================== Globals ======================= */
1379 -static DMAPMdnsBrowser *browser;
1380 +static DmapMdnsBrowser *browser;
1381 /* Maps URIs to DBs */
1382 static GHashTable *connections;
1383 /* Map DPAP services to Grilo media sources */
1384 @@ -111,7 +111,7 @@ grl_dpap_plugin_init (GrlRegistry *registry,
1385 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
1386 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1388 - browser = dmap_mdns_browser_new (DMAP_MDNS_BROWSER_SERVICE_TYPE_DPAP);
1389 + browser = dmap_mdns_browser_new (DMAP_MDNS_SERVICE_TYPE_DPAP);
1390 connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1391 sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
1393 @@ -158,8 +158,10 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR,
1394 G_DEFINE_TYPE_WITH_PRIVATE (GrlDpapSource, grl_dpap_source, GRL_TYPE_SOURCE)
1396 static GrlDpapSource *
1397 -grl_dpap_source_new (DMAPMdnsBrowserService *service)
1398 +grl_dpap_source_new (DmapMdnsService *service)
1401 + gchar *service_name;
1405 @@ -167,12 +169,16 @@ grl_dpap_source_new (DMAPMdnsBrowserService *service)
1407 GRL_DEBUG ("grl_dpap_source_new");
1409 - source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, service->name);
1410 - source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, service->name);
1411 + g_object_get(service, "name", &name,
1412 + "service-name", &service_name,
1415 + source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name);
1416 + source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name);
1418 source = g_object_new (GRL_DPAP_SOURCE_TYPE,
1419 "source-id", source_id,
1420 - "source-name", service->name,
1421 + "source-name", service_name,
1422 "source-desc", source_desc,
1423 "supported-media", GRL_SUPPORTED_MEDIA_IMAGE,
1425 @@ -181,6 +187,8 @@ grl_dpap_source_new (DMAPMdnsBrowserService *service)
1427 g_free (source_desc);
1429 + g_free (service_name);
1434 @@ -241,7 +249,7 @@ grl_dpap_do_search (ResultCbAndArgsAndDb *cb_and_db)
1438 -browse_connected_cb (DMAPConnection *connection,
1439 +browse_connected_cb (DmapConnection *connection,
1442 ResultCbAndArgsAndDb *cb_and_db)
1443 @@ -266,7 +274,7 @@ browse_connected_cb (DMAPConnection *connection,
1447 -search_connected_cb (DMAPConnection *connection,
1448 +search_connected_cb (DmapConnection *connection,
1451 ResultCbAndArgsAndDb *cb_and_db)
1452 @@ -291,8 +299,8 @@ search_connected_cb (DMAPConnection *connection,
1456 -grl_dpap_service_added_cb (DMAPMdnsBrowser *browser,
1457 - DMAPMdnsBrowserService *service,
1458 +grl_dpap_service_added_cb (DmapMdnsBrowser *browser,
1459 + DmapMdnsService *service,
1462 GrlRegistry *registry = grl_registry_get_default ();
1463 @@ -306,13 +314,16 @@ grl_dpap_service_added_cb (DMAPMdnsBrowser *browser,
1464 GRL_SOURCE (source),
1466 if (source != NULL) {
1467 - g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source));
1469 + g_object_get(service, "name", &name, NULL);
1470 + g_hash_table_insert (sources, g_strdup (name), g_object_ref (source));
1471 g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source);
1477 -grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
1478 +grl_dpap_service_removed_cb (DmapMdnsBrowser *browser,
1479 const gchar *service_name,
1482 @@ -328,14 +339,14 @@ grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
1486 -grl_dpap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DMAPConnectionCallback callback)
1487 +grl_dpap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DmapConnectionFunc callback)
1489 - DMAPRecordFactory *factory;
1490 - DMAPConnection *connection;
1491 + DmapRecordFactory *factory;
1492 + DmapConnection *connection;
1494 factory = DMAP_RECORD_FACTORY (grl_dpap_record_factory_new ());
1495 - connection = DMAP_CONNECTION (dpap_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
1496 - dmap_connection_connect (connection, (DMAPConnectionCallback) callback, cb_and_db);
1497 + connection = DMAP_CONNECTION (dmap_image_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory));
1498 + dmap_connection_start (connection, (DmapConnectionFunc) callback, cb_and_db);
1502 @@ -396,15 +407,26 @@ grl_dpap_source_browse (GrlSource *source,
1503 browse_connected_cb (NULL, TRUE, NULL, cb_and_db);
1506 + gchar *name, *host;
1509 cb_and_db->db = DMAP_DB (grl_dpap_db_new ());
1511 - grl_dpap_connect (dmap_source->priv->service->name,
1512 - dmap_source->priv->service->host,
1513 - dmap_source->priv->service->port,
1514 + g_object_get (dmap_source->priv->service, "name", &name,
1519 + grl_dpap_connect (name,
1523 - (DMAPConnectionCallback) browse_connected_cb);
1524 + (DmapConnectionFunc) browse_connected_cb);
1526 g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);
1533 @@ -416,7 +438,7 @@ static void grl_dpap_source_search (GrlSource *source,
1534 GrlDpapSource *dmap_source = GRL_DPAP_SOURCE (source);
1536 ResultCbAndArgsAndDb *cb_and_db;
1537 - DMAPMdnsBrowserService *service = dmap_source->priv->service;
1538 + DmapMdnsService *service = dmap_source->priv->service;
1539 gchar *url = grl_dmap_build_url (service);
1541 cb_and_db = g_new (ResultCbAndArgsAndDb, 1);
1542 @@ -434,9 +456,26 @@ static void grl_dpap_source_search (GrlSource *source,
1543 search_connected_cb (NULL, TRUE, NULL, cb_and_db);
1546 + gchar *name, *host;
1549 cb_and_db->db = DMAP_DB (grl_dpap_db_new ());
1550 - grl_dpap_connect (service->name, service->host, service->port, cb_and_db, (DMAPConnectionCallback) search_connected_cb);
1552 + g_object_get (dmap_source->priv->service, "name", &name,
1557 + grl_dpap_connect (name,
1561 + (DmapConnectionFunc) search_connected_cb);
1563 g_hash_table_insert (connections, g_strdup (url), cb_and_db->db);