]>
Commit | Line | Data |
---|---|---|
5d180b42 JB |
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 | |
5 | ||
6 | Signed-off-by: W. Michael Petullo <mike@flyn.org> | |
7 | --- | |
8 | meson.build | 2 +- | |
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(-) | |
26 | ||
27 | diff --git a/meson.build b/meson.build | |
28 | index e45c5ab..e7bcc23 100644 | |
29 | --- a/meson.build | |
30 | +++ b/meson.build | |
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 | |
44 | @@ -36,10 +36,23 @@ | |
45 | #include "grl-common.h" | |
46 | ||
47 | gchar * | |
48 | -grl_dmap_build_url (DMAPMdnsBrowserService *service) | |
49 | +grl_dmap_build_url (DmapMdnsService *service) | |
50 | { | |
51 | - return g_strdup_printf ("%s://%s:%u", | |
52 | - service->service_name, | |
53 | - service->host, | |
54 | - service->port); | |
55 | + gchar *url = NULL; | |
56 | + gchar *service_name, *host; | |
57 | + guint port; | |
58 | + | |
59 | + g_object_get(service, "service-name", &service_name, | |
60 | + "host", &host, | |
61 | + "port", &port, NULL); | |
62 | + | |
63 | + url = g_strdup_printf ("%s://%s:%u", | |
64 | + service_name, | |
65 | + host, | |
66 | + port); | |
67 | + | |
68 | + g_free(service_name); | |
69 | + g_free(host); | |
70 | + | |
71 | + return url; | |
72 | } | |
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 { | |
78 | ||
79 | typedef struct { | |
80 | ResultCbAndArgs cb; | |
81 | - DMAPDb *db; | |
82 | + DmapDb *db; | |
83 | } ResultCbAndArgsAndDb; | |
84 | ||
85 | -gchar *grl_dmap_build_url (DMAPMdnsBrowserService *service); | |
86 | +gchar *grl_dmap_build_url (DmapMdnsService *service); | |
87 | ||
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 | |
93 | @@ -66,7 +66,7 @@ | |
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. */ | |
96 | ||
97 | -struct GrlDAAPDbPrivate { | |
98 | +struct GrlDaapDbPrivate { | |
99 | /* Contains each album container (tracked with albums hash table) */ | |
100 | GrlMedia *albums_container; | |
101 | ||
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))); | |
104 | } | |
105 | ||
106 | -GrlDAAPDb * | |
107 | +GrlDaapDb * | |
108 | grl_daap_db_new (void) | |
109 | { | |
110 | - GrlDAAPDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL); | |
111 | + GrlDaapDb *db = g_object_new (TYPE_GRL_DAAP_DB, NULL); | |
112 | ||
113 | return db; | |
114 | } | |
115 | ||
116 | -static DMAPRecord * | |
117 | -grl_daap_db_lookup_by_id (const DMAPDb *db, guint id) | |
118 | +static DmapRecord * | |
119 | +grl_daap_db_lookup_by_id (const DmapDb *db, guint id) | |
120 | { | |
121 | g_error ("Not implemented"); | |
122 | return NULL; | |
123 | } | |
124 | ||
125 | static void | |
126 | -grl_daap_db_foreach (const DMAPDb *db, | |
127 | - GHFunc func, | |
128 | - gpointer data) | |
129 | +grl_daap_db_foreach (const DmapDb *db, | |
130 | + DmapIdRecordFunc func, | |
131 | + gpointer data) | |
132 | { | |
133 | g_error ("Not implemented"); | |
134 | } | |
135 | ||
136 | static gint64 | |
137 | -grl_daap_db_count (const DMAPDb *db) | |
138 | +grl_daap_db_count (const DmapDb *db) | |
139 | { | |
140 | g_error ("Not implemented"); | |
141 | return 0; | |
142 | @@ -151,13 +151,13 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl | |
143 | } | |
144 | ||
145 | static guint | |
146 | -grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record) | |
147 | +grl_daap_db_add (DmapDb *_db, DmapRecord *_record, GError **error) | |
148 | { | |
149 | g_assert (IS_GRL_DAAP_DB (_db)); | |
150 | - g_assert (IS_DAAP_RECORD (_record)); | |
151 | + g_assert (IS_DMAP_AV_RECORD (_record)); | |
152 | ||
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); | |
157 | ||
158 | gint duration = 0; | |
159 | gint32 bitrate = 0, | |
160 | @@ -242,6 +242,11 @@ grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record) | |
161 | ||
162 | g_free (id_s); | |
163 | g_object_unref (media); | |
164 | + g_free (album); | |
165 | + g_free (artist); | |
166 | + g_free (genre); | |
167 | + g_free (title); | |
168 | + g_free (url); | |
169 | ||
170 | return --nextid; | |
171 | } | |
172 | @@ -253,7 +258,7 @@ same_media (GrlMedia *a, GrlMedia *b) | |
173 | } | |
174 | ||
175 | void | |
176 | -grl_daap_db_browse (GrlDAAPDb *db, | |
177 | +grl_daap_db_browse (GrlDaapDb *db, | |
178 | GrlMedia *container, | |
179 | GrlSource *source, | |
180 | guint op_id, | |
181 | @@ -312,7 +317,7 @@ done: | |
182 | } | |
183 | ||
184 | void | |
185 | -grl_daap_db_search (GrlDAAPDb *db, | |
186 | +grl_daap_db_search (GrlDaapDb *db, | |
187 | GrlSource *source, | |
188 | guint op_id, | |
189 | GHRFunc predicate, | |
190 | @@ -364,7 +369,7 @@ grl_daap_db_search (GrlDAAPDb *db, | |
191 | static void | |
192 | dmap_db_interface_init (gpointer iface, gpointer data) | |
193 | { | |
194 | - DMAPDbIface *daap_db = iface; | |
195 | + DmapDbInterface *daap_db = iface; | |
196 | ||
197 | g_assert (G_TYPE_FROM_INTERFACE (daap_db) == DMAP_TYPE_DB); | |
198 | ||
199 | @@ -374,8 +379,8 @@ dmap_db_interface_init (gpointer iface, gpointer data) | |
200 | daap_db->count = grl_daap_db_count; | |
201 | } | |
202 | ||
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)) | |
208 | ||
209 | static GObject* | |
210 | @@ -389,7 +394,7 @@ grl_daap_db_constructor (GType type, guint n_construct_params, GObjectConstructP | |
211 | } | |
212 | ||
213 | static void | |
214 | -grl_daap_db_init (GrlDAAPDb *db) | |
215 | +grl_daap_db_init (GrlDaapDb *db) | |
216 | { | |
217 | db->priv = grl_daap_db_get_instance_private (db); | |
218 | ||
219 | @@ -413,9 +418,9 @@ grl_daap_db_init (GrlDAAPDb *db) | |
220 | static void | |
221 | grl_daap_db_finalize (GObject *object) | |
222 | { | |
223 | - GrlDAAPDb *db = GRL_DAAP_DB (object); | |
224 | + GrlDaapDb *db = GRL_DAAP_DB (object); | |
225 | ||
226 | - GRL_DEBUG ("Finalizing GrlDAAPDb"); | |
227 | + GRL_DEBUG ("Finalizing GrlDaapDb"); | |
228 | ||
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, | |
232 | ||
233 | ||
234 | static void | |
235 | -grl_daap_db_class_init (GrlDAAPDbClass *klass) | |
236 | +grl_daap_db_class_init (GrlDaapDbClass *klass) | |
237 | { | |
238 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | |
239 | ||
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), \ | |
247 | TYPE_GRL_DAAP_DB, \ | |
248 | - GrlDAAPDb)) | |
249 | + GrlDaapDb)) | |
250 | ||
251 | #define GRL_DAAP_DB_CLASS(k) \ | |
252 | (G_TYPE_CHECK_CLASS_CAST((k), \ | |
253 | TYPE_GRL_DAAP_DB, \ | |
254 | - GrlDAAPDbClass)) | |
255 | + GrlDaapDbClass)) | |
256 | #define IS_GRL_DAAP_DB(o) \ | |
257 | (G_TYPE_CHECK_INSTANCE_TYPE((o), \ | |
258 | TYPE_GRL_DAAP_DB)) | |
259 | @@ -48,25 +48,25 @@ G_BEGIN_DECLS | |
260 | #define GRL_DAAP_DB_GET_CLASS(o) \ | |
261 | (G_TYPE_INSTANCE_GET_CLASS((o), \ | |
262 | TYPE_GRL_DAAP_DB, \ | |
263 | - GrlDAAPDbClass)) | |
264 | + GrlDaapDbClass)) | |
265 | ||
266 | #define GRL_DAAP_DB_GET_PRIVATE(o) \ | |
267 | (G_TYPE_INSTANCE_GET_PRIVATE((o), \ | |
268 | TYPE_GRL_DAAP_DB, \ | |
269 | - GrlDAAPDbPrivate)) | |
270 | + GrlDaapDbPrivate)) | |
271 | ||
272 | -typedef struct GrlDAAPDbPrivate GrlDAAPDbPrivate; | |
273 | +typedef struct GrlDaapDbPrivate GrlDaapDbPrivate; | |
274 | ||
275 | typedef struct { | |
276 | GObject parent; | |
277 | - GrlDAAPDbPrivate *priv; | |
278 | -} GrlDAAPDb; | |
279 | + GrlDaapDbPrivate *priv; | |
280 | +} GrlDaapDb; | |
281 | ||
282 | typedef struct { | |
283 | GObjectClass parent; | |
284 | -} GrlDAAPDbClass; | |
285 | +} GrlDaapDbClass; | |
286 | ||
287 | -void grl_daap_db_browse (GrlDAAPDb *db, | |
288 | +void grl_daap_db_browse (GrlDaapDb *db, | |
289 | GrlMedia *container, | |
290 | GrlSource *source, | |
291 | guint op_id, | |
292 | @@ -75,7 +75,7 @@ void grl_daap_db_browse (GrlDAAPDb *db, | |
293 | GrlSourceResultCb func, | |
294 | gpointer user_data); | |
295 | ||
296 | -void grl_daap_db_search (GrlDAAPDb *db, | |
297 | +void grl_daap_db_search (GrlDaapDb *db, | |
298 | GrlSource *source, | |
299 | guint op_id, | |
300 | GHRFunc predicate, | |
301 | @@ -83,7 +83,7 @@ void grl_daap_db_search (GrlDAAPDb *db, | |
302 | GrlSourceResultCb func, | |
303 | gpointer user_data); | |
304 | ||
305 | -GrlDAAPDb *grl_daap_db_new (void); | |
306 | +GrlDaapDb *grl_daap_db_new (void); | |
307 | ||
308 | GType grl_daap_db_get_type (void); | |
309 | ||
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 | |
314 | @@ -1,5 +1,5 @@ | |
315 | /* | |
316 | - * DAAPRecord factory class | |
317 | + * DmapAvRecord factory class | |
318 | * | |
319 | * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org> | |
320 | * | |
321 | @@ -21,37 +21,37 @@ | |
322 | #include "grl-daap-record-factory.h" | |
323 | #include "grl-daap-record.h" | |
324 | ||
325 | -DMAPRecord * | |
326 | -grl_daap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data) | |
327 | +DmapRecord * | |
328 | +grl_daap_record_factory_create (DmapRecordFactory *factory, gpointer user_data, GError **error) | |
329 | { | |
330 | return DMAP_RECORD (grl_daap_record_new ()); | |
331 | } | |
332 | ||
333 | static void | |
334 | -grl_daap_record_factory_init (GrlDAAPRecordFactory *factory) | |
335 | +grl_daap_record_factory_init (GrlDaapRecordFactory *factory) | |
336 | { | |
337 | } | |
338 | ||
339 | static void | |
340 | -grl_daap_record_factory_class_init (GrlDAAPRecordFactoryClass *klass) | |
341 | +grl_daap_record_factory_class_init (GrlDaapRecordFactoryClass *klass) | |
342 | { | |
343 | } | |
344 | ||
345 | static void | |
346 | grl_daap_record_factory_interface_init (gpointer iface, gpointer data) | |
347 | { | |
348 | - DMAPRecordFactoryIface *factory = iface; | |
349 | + DmapRecordFactoryInterface *factory = iface; | |
350 | ||
351 | g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY); | |
352 | ||
353 | factory->create = grl_daap_record_factory_create; | |
354 | } | |
355 | ||
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)) | |
360 | ||
361 | -GrlDAAPRecordFactory * | |
362 | +GrlDaapRecordFactory * | |
363 | grl_daap_record_factory_new (void) | |
364 | { | |
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 | |
370 | @@ -1,5 +1,5 @@ | |
371 | /* | |
372 | - * GrlDAAPRecord factory class | |
373 | + * GrlDaapRecord factory class | |
374 | * | |
375 | * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org> | |
376 | * | |
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)) | |
383 | ||
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)) | |
389 | ||
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)) | |
398 | ||
399 | -typedef struct GrlDAAPRecordFactoryPrivate GrlDAAPRecordFactoryPrivate; | |
400 | +typedef struct GrlDaapRecordFactoryPrivate GrlDaapRecordFactoryPrivate; | |
401 | ||
402 | typedef struct { | |
403 | GObject parent; | |
404 | -} GrlDAAPRecordFactory; | |
405 | +} GrlDaapRecordFactory; | |
406 | ||
407 | typedef struct { | |
408 | GObjectClass parent; | |
409 | -} GrlDAAPRecordFactoryClass; | |
410 | +} GrlDaapRecordFactoryClass; | |
411 | ||
412 | GType grl_daap_record_factory_get_type (void); | |
413 | ||
414 | -GrlDAAPRecordFactory *grl_daap_record_factory_new (void); | |
415 | +GrlDaapRecordFactory *grl_daap_record_factory_new (void); | |
416 | ||
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); | |
419 | ||
420 | #endif /* __SIMPLE_DAAP_RECORD_FACTORY */ | |
421 | ||
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 | |
426 | @@ -22,7 +22,7 @@ | |
427 | ||
428 | #include "grl-daap-record.h" | |
429 | ||
430 | -struct GrlDAAPRecordPrivate { | |
431 | +struct GrlDaapRecordPrivate { | |
432 | guint64 filesize; | |
433 | char *location; | |
434 | char *format; | |
435 | @@ -73,7 +73,7 @@ grl_daap_record_set_property (GObject *object, | |
436 | const GValue *value, | |
437 | GParamSpec *pspec) | |
438 | { | |
439 | - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object); | |
440 | + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object); | |
441 | ||
442 | switch (prop_id) { | |
443 | case PROP_LOCATION: | |
444 | @@ -155,7 +155,7 @@ grl_daap_record_get_property (GObject *object, | |
445 | GValue *value, | |
446 | GParamSpec *pspec) | |
447 | { | |
448 | - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object); | |
449 | + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object); | |
450 | ||
451 | switch (prop_id) { | |
452 | case PROP_LOCATION: | |
453 | @@ -223,14 +223,14 @@ grl_daap_record_get_property (GObject *object, | |
454 | } | |
455 | } | |
456 | ||
457 | -GrlDAAPRecord * | |
458 | +GrlDaapRecord * | |
459 | grl_daap_record_new (void) | |
460 | { | |
461 | return SIMPLE_DAAP_RECORD (g_object_new (TYPE_SIMPLE_DAAP_RECORD, NULL)); | |
462 | } | |
463 | ||
464 | GInputStream * | |
465 | -grl_daap_record_read (DAAPRecord *record, GError **error) | |
466 | +grl_daap_record_read (DmapAvRecord *record, GError **error) | |
467 | { | |
468 | GFile *file; | |
469 | GInputStream *stream; | |
470 | @@ -244,7 +244,7 @@ grl_daap_record_read (DAAPRecord *record, GError **error) | |
471 | } | |
472 | ||
473 | static void | |
474 | -grl_daap_record_init (GrlDAAPRecord *record) | |
475 | +grl_daap_record_init (GrlDaapRecord *record) | |
476 | { | |
477 | record->priv = SIMPLE_DAAP_RECORD_GET_PRIVATE (record); | |
478 | } | |
479 | @@ -252,7 +252,7 @@ grl_daap_record_init (GrlDAAPRecord *record) | |
480 | static void grl_daap_record_finalize (GObject *object); | |
481 | ||
482 | static void | |
483 | -grl_daap_record_class_init (GrlDAAPRecordClass *klass) | |
484 | +grl_daap_record_class_init (GrlDaapRecordClass *klass) | |
485 | { | |
486 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | |
487 | ||
488 | @@ -284,9 +284,9 @@ grl_daap_record_class_init (GrlDAAPRecordClass *klass) | |
489 | static void | |
490 | grl_daap_record_daap_iface_init (gpointer iface, gpointer data) | |
491 | { | |
492 | - DAAPRecordIface *daap_record = iface; | |
493 | + DmapAvRecordInterface *daap_record = iface; | |
494 | ||
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); | |
497 | ||
498 | daap_record->read = grl_daap_record_read; | |
499 | } | |
500 | @@ -294,21 +294,21 @@ grl_daap_record_daap_iface_init (gpointer iface, gpointer data) | |
501 | static void | |
502 | grl_daap_record_dmap_iface_init (gpointer iface, gpointer data) | |
503 | { | |
504 | - DMAPRecordIface *dmap_record = iface; | |
505 | + DmapRecordInterface *dmap_record = iface; | |
506 | ||
507 | g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD); | |
508 | } | |
509 | ||
510 | ||
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)) | |
518 | ||
519 | static void | |
520 | grl_daap_record_finalize (GObject *object) | |
521 | { | |
522 | - GrlDAAPRecord *record = SIMPLE_DAAP_RECORD (object); | |
523 | + GrlDaapRecord *record = SIMPLE_DAAP_RECORD (object); | |
524 | ||
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, \ | |
535 | - GrlDAAPRecord)) | |
536 | + GrlDaapRecord)) | |
537 | ||
538 | #define SIMPLE_DAAP_RECORD_CLASS(k) \ | |
539 | (G_TYPE_CHECK_CLASS_CAST((k), \ | |
540 | TYPE_SIMPLE_DAAP_RECORD, \ | |
541 | - GrlDAAPRecordClass)) | |
542 | + GrlDaapRecordClass)) | |
543 | ||
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)) | |
552 | ||
553 | #define SIMPLE_DAAP_RECORD_GET_PRIVATE(o) \ | |
554 | (G_TYPE_INSTANCE_GET_PRIVATE((o), \ | |
555 | TYPE_SIMPLE_DAAP_RECORD, \ | |
556 | - GrlDAAPRecordPrivate)) | |
557 | + GrlDaapRecordPrivate)) | |
558 | ||
559 | -typedef struct GrlDAAPRecordPrivate GrlDAAPRecordPrivate; | |
560 | +typedef struct GrlDaapRecordPrivate GrlDaapRecordPrivate; | |
561 | ||
562 | typedef struct { | |
563 | GObject parent; | |
564 | - GrlDAAPRecordPrivate *priv; | |
565 | -} GrlDAAPRecord; | |
566 | + GrlDaapRecordPrivate *priv; | |
567 | +} GrlDaapRecord; | |
568 | ||
569 | typedef struct { | |
570 | GObjectClass parent; | |
571 | -} GrlDAAPRecordClass; | |
572 | +} GrlDaapRecordClass; | |
573 | ||
574 | GType grl_daap_record_get_type (void); | |
575 | ||
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); | |
582 | ||
583 | #endif /* __SIMPLE_DAAP_RECORD */ | |
584 | ||
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 --- */ | |
591 | ||
592 | struct _GrlDaapSourcePrivate { | |
593 | - DMAPMdnsBrowserService *service; | |
594 | + DmapMdnsService *service; | |
595 | }; | |
596 | ||
597 | /* --- Data types --- */ | |
598 | ||
599 | -static GrlDaapSource *grl_daap_source_new (DMAPMdnsBrowserService *service); | |
600 | +static GrlDaapSource *grl_daap_source_new (DmapMdnsService *service); | |
601 | ||
602 | static void grl_daap_source_finalize (GObject *object); | |
603 | ||
604 | @@ -74,16 +74,16 @@ static void grl_daap_source_search (GrlSource *source, | |
605 | GrlSourceSearchSpec *ss); | |
606 | ||
607 | ||
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, | |
612 | GrlPlugin *plugin); | |
613 | ||
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, | |
617 | GrlPlugin *plugin); | |
618 | ||
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"); | |
628 | ||
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); | |
633 | ||
634 | @@ -153,8 +153,10 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR, | |
635 | G_DEFINE_TYPE_WITH_PRIVATE (GrlDaapSource, grl_daap_source, GRL_TYPE_SOURCE) | |
636 | ||
637 | static GrlDaapSource * | |
638 | -grl_daap_source_new (DMAPMdnsBrowserService *service) | |
639 | +grl_daap_source_new (DmapMdnsService *service) | |
640 | { | |
641 | + gchar *name; | |
642 | + gchar *service_name; | |
643 | gchar *source_desc; | |
644 | gchar *source_id; | |
645 | ||
646 | @@ -162,12 +164,16 @@ grl_daap_source_new (DMAPMdnsBrowserService *service) | |
647 | ||
648 | GRL_DEBUG ("grl_daap_source_new"); | |
649 | ||
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, | |
654 | + NULL); | |
655 | + | |
656 | + source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name); | |
657 | + source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name); | |
658 | ||
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, | |
665 | NULL); | |
666 | @@ -176,6 +182,8 @@ grl_daap_source_new (DMAPMdnsBrowserService *service) | |
667 | ||
668 | g_free (source_desc); | |
669 | g_free (source_id); | |
670 | + g_free (service_name); | |
671 | + g_free (name); | |
672 | ||
673 | return source; | |
674 | } | |
675 | @@ -236,7 +244,7 @@ grl_daap_do_search (ResultCbAndArgsAndDb *cb_and_db) | |
676 | } | |
677 | ||
678 | static void | |
679 | -browse_connected_cb (DMAPConnection *connection, | |
680 | +browse_connected_cb (DmapConnection *connection, | |
681 | gboolean result, | |
682 | const char *reason, | |
683 | ResultCbAndArgsAndDb *cb_and_db) | |
684 | @@ -261,7 +269,7 @@ browse_connected_cb (DMAPConnection *connection, | |
685 | } | |
686 | ||
687 | static void | |
688 | -search_connected_cb (DMAPConnection *connection, | |
689 | +search_connected_cb (DmapConnection *connection, | |
690 | gboolean result, | |
691 | const char *reason, | |
692 | ResultCbAndArgsAndDb *cb_and_db) | |
693 | @@ -286,8 +294,8 @@ search_connected_cb (DMAPConnection *connection, | |
694 | } | |
695 | ||
696 | static void | |
697 | -grl_daap_service_added_cb (DMAPMdnsBrowser *browser, | |
698 | - DMAPMdnsBrowserService *service, | |
699 | +grl_daap_service_added_cb (DmapMdnsBrowser *browser, | |
700 | + DmapMdnsService *service, | |
701 | GrlPlugin *plugin) | |
702 | { | |
703 | GrlRegistry *registry = grl_registry_get_default (); | |
704 | @@ -301,13 +309,16 @@ grl_daap_service_added_cb (DMAPMdnsBrowser *browser, | |
705 | GRL_SOURCE (source), | |
706 | NULL); | |
707 | if (source != NULL) { | |
708 | - g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source)); | |
709 | + gchar *name; | |
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); | |
713 | + g_free (name); | |
714 | } | |
715 | } | |
716 | ||
717 | static void | |
718 | -grl_daap_service_removed_cb (DMAPMdnsBrowser *browser, | |
719 | +grl_daap_service_removed_cb (DmapMdnsBrowser *browser, | |
720 | const gchar *service_name, | |
721 | GrlPlugin *plugin) | |
722 | { | |
723 | @@ -323,14 +334,14 @@ grl_daap_service_removed_cb (DMAPMdnsBrowser *browser, | |
724 | } | |
725 | ||
726 | static void | |
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) | |
729 | { | |
730 | - DMAPRecordFactory *factory; | |
731 | - DMAPConnection *connection; | |
732 | + DmapRecordFactory *factory; | |
733 | + DmapConnection *connection; | |
734 | ||
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); | |
740 | } | |
741 | ||
742 | static gboolean | |
743 | @@ -397,15 +408,26 @@ grl_daap_source_browse (GrlSource *source, | |
744 | browse_connected_cb (NULL, TRUE, NULL, cb_and_db); | |
745 | } else { | |
746 | /* Connect */ | |
747 | + gchar *name, *host; | |
748 | + guint port; | |
749 | + | |
750 | cb_and_db->db = DMAP_DB (grl_daap_db_new ()); | |
751 | ||
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, | |
756 | + "host", &host, | |
757 | + "port", &port, | |
758 | + NULL); | |
759 | + | |
760 | + grl_daap_connect (name, | |
761 | + host, | |
762 | + port, | |
763 | cb_and_db, | |
764 | - (DMAPConnectionCallback) browse_connected_cb); | |
765 | + (DmapConnectionFunc) browse_connected_cb); | |
766 | ||
767 | g_hash_table_insert (connections, g_strdup (url), cb_and_db->db); | |
768 | + | |
769 | + g_free (name); | |
770 | + g_free (host); | |
771 | } | |
772 | ||
773 | g_free (url); | |
774 | @@ -417,7 +439,7 @@ static void grl_daap_source_search (GrlSource *source, | |
775 | GrlDaapSource *dmap_source = GRL_DAAP_SOURCE (source); | |
776 | ||
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); | |
781 | ||
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); | |
785 | } else { | |
786 | /* Connect */ | |
787 | + gchar *name, *host; | |
788 | + guint port; | |
789 | + | |
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); | |
792 | + | |
793 | + g_object_get (dmap_source->priv->service, "name", &name, | |
794 | + "host", &host, | |
795 | + "port", &port, | |
796 | + NULL); | |
797 | + | |
798 | + grl_daap_connect (name, | |
799 | + host, | |
800 | + port, | |
801 | + cb_and_db, | |
802 | + (DmapConnectionFunc) search_connected_cb); | |
803 | + | |
804 | g_hash_table_insert (connections, g_strdup (url), cb_and_db->db); | |
805 | + | |
806 | + g_free (name); | |
807 | + g_free (host); | |
808 | } | |
809 | ||
810 | g_free (url); | |
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 | |
815 | @@ -38,7 +38,7 @@ | |
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. */ | |
818 | ||
819 | -struct GrlDPAPDbPrivate { | |
820 | +struct GrlDpapDbPrivate { | |
821 | /* Contains each picture container (tracked with photos hash table) */ | |
822 | GrlMedia *photos_container; | |
823 | ||
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))); | |
826 | } | |
827 | ||
828 | -GrlDPAPDb * | |
829 | +GrlDpapDb * | |
830 | grl_dpap_db_new (void) | |
831 | { | |
832 | - GrlDPAPDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL); | |
833 | + GrlDpapDb *db = g_object_new (TYPE_GRL_DPAP_DB, NULL); | |
834 | ||
835 | return db; | |
836 | } | |
837 | ||
838 | -static DMAPRecord * | |
839 | -grl_dpap_db_lookup_by_id (const DMAPDb *db, guint id) | |
840 | +static DmapRecord * | |
841 | +grl_dpap_db_lookup_by_id (const DmapDb *db, guint id) | |
842 | { | |
843 | g_warning ("Not implemented"); | |
844 | return NULL; | |
845 | } | |
846 | ||
847 | static void | |
848 | -grl_dpap_db_foreach (const DMAPDb *db, | |
849 | - GHFunc func, | |
850 | - gpointer data) | |
851 | +grl_dpap_db_foreach (const DmapDb *db, | |
852 | + DmapIdRecordFunc func, | |
853 | + gpointer data) | |
854 | { | |
855 | g_warning ("Not implemented"); | |
856 | } | |
857 | ||
858 | static gint64 | |
859 | -grl_dpap_db_count (const DMAPDb *db) | |
860 | +grl_dpap_db_count (const DmapDb *db) | |
861 | { | |
862 | g_warning ("Not implemented"); | |
863 | return 0; | |
864 | @@ -119,20 +119,20 @@ set_insert (GHashTable *category, const char *category_name, char *set_name, Grl | |
865 | } | |
866 | ||
867 | static guint | |
868 | -grl_dpap_db_add (DMAPDb *_db, DMAPRecord *_record) | |
869 | +grl_dpap_db_add (DmapDb *_db, DmapRecord *_record, GError **error) | |
870 | { | |
871 | g_assert (IS_GRL_DPAP_DB (_db)); | |
872 | - g_assert (IS_DPAP_RECORD (_record)); | |
873 | + g_assert (IS_DMAP_IMAGE_RECORD (_record)); | |
874 | ||
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); | |
879 | ||
880 | gint height = 0, | |
881 | width = 0, | |
882 | largefilesize = 0, | |
883 | creationdate = 0, | |
884 | rating = 0; | |
885 | - GByteArray *thumbnail = NULL; | |
886 | + GArray *thumbnail = NULL; | |
887 | gchar *id_s = NULL, | |
888 | *filename = NULL, | |
889 | *aspectratio = NULL, | |
890 | @@ -188,6 +188,12 @@ grl_dpap_db_add (DMAPDb *_db, DMAPRecord *_record) | |
891 | ||
892 | g_free (id_s); | |
893 | g_object_unref (media); | |
894 | + g_free (filename); | |
895 | + g_free (aspectratio); | |
896 | + g_free (format); | |
897 | + g_free (comments); | |
898 | + g_array_unref (thumbnail); | |
899 | + g_free (url); | |
900 | ||
901 | return --nextid; | |
902 | } | |
903 | @@ -199,7 +205,7 @@ same_media (GrlMedia *a, GrlMedia *b) | |
904 | } | |
905 | ||
906 | void | |
907 | -grl_dpap_db_browse (GrlDPAPDb *db, | |
908 | +grl_dpap_db_browse (GrlDpapDb *db, | |
909 | GrlMedia *container, | |
910 | GrlSource *source, | |
911 | guint op_id, | |
912 | @@ -251,7 +257,7 @@ done: | |
913 | } | |
914 | ||
915 | void | |
916 | -grl_dpap_db_search (GrlDPAPDb *db, | |
917 | +grl_dpap_db_search (GrlDpapDb *db, | |
918 | GrlSource *source, | |
919 | guint op_id, | |
920 | GHRFunc predicate, | |
921 | @@ -303,7 +309,7 @@ grl_dpap_db_search (GrlDPAPDb *db, | |
922 | static void | |
923 | dmap_db_interface_init (gpointer iface, gpointer data) | |
924 | { | |
925 | - DMAPDbIface *dpap_db = iface; | |
926 | + DmapDbInterface *dpap_db = iface; | |
927 | ||
928 | g_assert (G_TYPE_FROM_INTERFACE (dpap_db) == DMAP_TYPE_DB); | |
929 | ||
930 | @@ -313,8 +319,8 @@ dmap_db_interface_init (gpointer iface, gpointer data) | |
931 | dpap_db->count = grl_dpap_db_count; | |
932 | } | |
933 | ||
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)) | |
939 | ||
940 | static GObject* | |
941 | @@ -328,7 +334,7 @@ grl_dpap_db_constructor (GType type, guint n_construct_params, GObjectConstructP | |
942 | } | |
943 | ||
944 | static void | |
945 | -grl_dpap_db_init (GrlDPAPDb *db) | |
946 | +grl_dpap_db_init (GrlDpapDb *db) | |
947 | { | |
948 | db->priv = grl_dpap_db_get_instance_private (db); | |
949 | ||
950 | @@ -346,9 +352,9 @@ grl_dpap_db_init (GrlDPAPDb *db) | |
951 | static void | |
952 | grl_dpap_db_finalize (GObject *object) | |
953 | { | |
954 | - GrlDPAPDb *db = GRL_DPAP_DB (object); | |
955 | + GrlDpapDb *db = GRL_DPAP_DB (object); | |
956 | ||
957 | - GRL_DEBUG ("Finalizing GrlDPAPDb"); | |
958 | + GRL_DEBUG ("Finalizing GrlDpapDb"); | |
959 | ||
960 | g_object_unref (db->priv->photos_container); | |
961 | ||
962 | @@ -356,7 +362,7 @@ grl_dpap_db_finalize (GObject *object) | |
963 | } | |
964 | ||
965 | static void | |
966 | -grl_dpap_db_class_init (GrlDPAPDbClass *klass) | |
967 | +grl_dpap_db_class_init (GrlDpapDbClass *klass) | |
968 | { | |
969 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | |
970 | ||
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), \ | |
978 | TYPE_GRL_DPAP_DB, \ | |
979 | - GrlDPAPDb)) | |
980 | + GrlDpapDb)) | |
981 | ||
982 | #define GRL_DPAP_DB_CLASS(k) \ | |
983 | (G_TYPE_CHECK_CLASS_CAST((k), \ | |
984 | TYPE_GRL_DPAP_DB, \ | |
985 | - GrlDPAPDbClass)) | |
986 | + GrlDpapDbClass)) | |
987 | #define IS_GRL_DPAP_DB(o) \ | |
988 | (G_TYPE_CHECK_INSTANCE_TYPE((o), \ | |
989 | TYPE_GRL_DPAP_DB)) | |
990 | @@ -48,26 +48,26 @@ G_BEGIN_DECLS | |
991 | #define GRL_DPAP_DB_GET_CLASS(o) \ | |
992 | (G_TYPE_INSTANCE_GET_CLASS((o), \ | |
993 | TYPE_GRL_DPAP_DB, \ | |
994 | - GrlDPAPDbClass)) | |
995 | + GrlDpapDbClass)) | |
996 | ||
997 | #define GRL_DPAP_DB_GET_PRIVATE(o) \ | |
998 | (G_TYPE_INSTANCE_GET_PRIVATE((o), \ | |
999 | TYPE_GRL_DPAP_DB, \ | |
1000 | - GrlDPAPDbPrivate)) | |
1001 | + GrlDpapDbPrivate)) | |
1002 | ||
1003 | -typedef struct GrlDPAPDbPrivate GrlDPAPDbPrivate; | |
1004 | +typedef struct GrlDpapDbPrivate GrlDpapDbPrivate; | |
1005 | ||
1006 | typedef struct { | |
1007 | GObject parent; | |
1008 | - GrlDPAPDbPrivate *priv; | |
1009 | -} GrlDPAPDb; | |
1010 | + GrlDpapDbPrivate *priv; | |
1011 | +} GrlDpapDb; | |
1012 | ||
1013 | typedef struct { | |
1014 | GObjectClass parent; | |
1015 | -} GrlDPAPDbClass; | |
1016 | +} GrlDpapDbClass; | |
1017 | ||
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, | |
1023 | GrlSource *source, | |
1024 | guint op_id, | |
1025 | @@ -75,7 +75,7 @@ void grl_dpap_db_browse (GrlDPAPDb *_db, | |
1026 | guint count, | |
1027 | GrlSourceResultCb func, | |
1028 | gpointer user_data); | |
1029 | -void grl_dpap_db_search (GrlDPAPDb *_db, | |
1030 | +void grl_dpap_db_search (GrlDpapDb *_db, | |
1031 | GrlSource *source, | |
1032 | guint op_id, | |
1033 | GHRFunc predicate, | |
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 | |
1038 | @@ -21,37 +21,39 @@ | |
1039 | #include "grl-dpap-record-factory.h" | |
1040 | #include "grl-dpap-record.h" | |
1041 | ||
1042 | -DMAPRecord * | |
1043 | -grl_dpap_record_factory_create (DMAPRecordFactory *factory, gpointer user_data) | |
1044 | +DmapRecord * | |
1045 | +grl_dpap_record_factory_create (DmapRecordFactory *factory, | |
1046 | + gpointer user_data, | |
1047 | + GError **error) | |
1048 | { | |
1049 | return DMAP_RECORD (grl_dpap_record_new ()); | |
1050 | } | |
1051 | ||
1052 | static void | |
1053 | -grl_dpap_record_factory_init (GrlDPAPRecordFactory *factory) | |
1054 | +grl_dpap_record_factory_init (GrlDpapRecordFactory *factory) | |
1055 | { | |
1056 | } | |
1057 | ||
1058 | static void | |
1059 | -grl_dpap_record_factory_class_init (GrlDPAPRecordFactoryClass *klass) | |
1060 | +grl_dpap_record_factory_class_init (GrlDpapRecordFactoryClass *klass) | |
1061 | { | |
1062 | } | |
1063 | ||
1064 | static void | |
1065 | grl_dpap_record_factory_interface_init (gpointer iface, gpointer data) | |
1066 | { | |
1067 | - DMAPRecordFactoryIface *factory = iface; | |
1068 | + DmapRecordFactoryInterface *factory = iface; | |
1069 | ||
1070 | g_assert (G_TYPE_FROM_INTERFACE (factory) == DMAP_TYPE_RECORD_FACTORY); | |
1071 | ||
1072 | factory->create = grl_dpap_record_factory_create; | |
1073 | } | |
1074 | ||
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)) | |
1079 | ||
1080 | -GrlDPAPRecordFactory * | |
1081 | +GrlDpapRecordFactory * | |
1082 | grl_dpap_record_factory_new (void) | |
1083 | { | |
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 | |
1089 | @@ -1,5 +1,5 @@ | |
1090 | /* | |
1091 | - * GrlDPAPRecord factory class | |
1092 | + * GrlDpapRecord factory class | |
1093 | * | |
1094 | * Copyright (C) 2008 W. Michael Petullo <mike@flyn.org> | |
1095 | * | |
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)) | |
1102 | ||
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)) | |
1108 | ||
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)) | |
1117 | ||
1118 | -typedef struct GrlDPAPRecordFactoryPrivate GrlDPAPRecordFactoryPrivate; | |
1119 | +typedef struct GrlDpapRecordFactoryPrivate GrlDpapRecordFactoryPrivate; | |
1120 | ||
1121 | typedef struct { | |
1122 | GObject parent; | |
1123 | -} GrlDPAPRecordFactory; | |
1124 | +} GrlDpapRecordFactory; | |
1125 | ||
1126 | typedef struct { | |
1127 | GObjectClass parent; | |
1128 | -} GrlDPAPRecordFactoryClass; | |
1129 | +} GrlDpapRecordFactoryClass; | |
1130 | ||
1131 | GType grl_dpap_record_factory_get_type (void); | |
1132 | ||
1133 | -GrlDPAPRecordFactory *grl_dpap_record_factory_new (void); | |
1134 | +GrlDpapRecordFactory *grl_dpap_record_factory_new (void); | |
1135 | ||
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); | |
1138 | ||
1139 | #endif /* __SIMPLE_DPAP_RECORD_FACTORY */ | |
1140 | ||
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 | |
1145 | @@ -22,13 +22,13 @@ | |
1146 | ||
1147 | #include "grl-dpap-record.h" | |
1148 | ||
1149 | -struct GrlDPAPRecordPrivate { | |
1150 | +struct GrlDpapRecordPrivate { | |
1151 | char *location; | |
1152 | gint largefilesize; | |
1153 | gint creationdate; | |
1154 | gint rating; | |
1155 | char *filename; | |
1156 | - GByteArray *thumbnail; | |
1157 | + GArray *thumbnail; | |
1158 | char *aspectratio; | |
1159 | gint height; | |
1160 | gint width; | |
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); | |
1164 | ||
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)) | |
1172 | ||
1173 | static void | |
1174 | @@ -65,7 +65,7 @@ grl_dpap_record_set_property (GObject *object, | |
1175 | const GValue *value, | |
1176 | GParamSpec *pspec) | |
1177 | { | |
1178 | - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object); | |
1179 | + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object); | |
1180 | ||
1181 | switch (prop_id) { | |
1182 | case PROP_LOCATION: | |
1183 | @@ -105,8 +105,8 @@ grl_dpap_record_set_property (GObject *object, | |
1184 | break; | |
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); | |
1191 | break; | |
1192 | default: | |
1193 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | |
1194 | @@ -120,7 +120,7 @@ grl_dpap_record_get_property (GObject *object, | |
1195 | GValue *value, | |
1196 | GParamSpec *pspec) | |
1197 | { | |
1198 | - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object); | |
1199 | + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object); | |
1200 | ||
1201 | switch (prop_id) { | |
1202 | case PROP_LOCATION: | |
1203 | @@ -154,7 +154,7 @@ grl_dpap_record_get_property (GObject *object, | |
1204 | g_value_set_static_string (value, record->priv->comments); | |
1205 | break; | |
1206 | case PROP_THUMBNAIL: | |
1207 | - g_value_set_pointer (value, record->priv->thumbnail); | |
1208 | + g_value_set_boxed (value, record->priv->thumbnail); | |
1209 | break; | |
1210 | default: | |
1211 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | |
1212 | @@ -162,14 +162,14 @@ grl_dpap_record_get_property (GObject *object, | |
1213 | } | |
1214 | } | |
1215 | ||
1216 | -GrlDPAPRecord * | |
1217 | +GrlDpapRecord * | |
1218 | grl_dpap_record_new (void) | |
1219 | { | |
1220 | return SIMPLE_DPAP_RECORD (g_object_new (TYPE_SIMPLE_DPAP_RECORD, NULL)); | |
1221 | } | |
1222 | ||
1223 | GInputStream * | |
1224 | -grl_dpap_record_read (DPAPRecord *record, GError **error) | |
1225 | +grl_dpap_record_read (DmapImageRecord *record, GError **error) | |
1226 | { | |
1227 | GFile *file; | |
1228 | GInputStream *stream; | |
1229 | @@ -183,7 +183,7 @@ grl_dpap_record_read (DPAPRecord *record, GError **error) | |
1230 | } | |
1231 | ||
1232 | static void | |
1233 | -grl_dpap_record_init (GrlDPAPRecord *record) | |
1234 | +grl_dpap_record_init (GrlDpapRecord *record) | |
1235 | { | |
1236 | record->priv = grl_dpap_record_get_instance_private (record); | |
1237 | } | |
1238 | @@ -191,7 +191,7 @@ grl_dpap_record_init (GrlDPAPRecord *record) | |
1239 | static void grl_dpap_record_finalize (GObject *object); | |
1240 | ||
1241 | static void | |
1242 | -grl_dpap_record_class_init (GrlDPAPRecordClass *klass) | |
1243 | +grl_dpap_record_class_init (GrlDpapRecordClass *klass) | |
1244 | { | |
1245 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | |
1246 | ||
1247 | @@ -215,9 +215,9 @@ grl_dpap_record_class_init (GrlDPAPRecordClass *klass) | |
1248 | static void | |
1249 | grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data) | |
1250 | { | |
1251 | - DPAPRecordIface *dpap_record = iface; | |
1252 | + DmapImageRecordInterface *dpap_record = iface; | |
1253 | ||
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); | |
1256 | ||
1257 | dpap_record->read = grl_dpap_record_read; | |
1258 | } | |
1259 | @@ -225,7 +225,7 @@ grl_dpap_record_dpap_iface_init (gpointer iface, gpointer data) | |
1260 | static void | |
1261 | grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data) | |
1262 | { | |
1263 | - DMAPRecordIface *dmap_record = iface; | |
1264 | + DmapRecordInterface *dmap_record = iface; | |
1265 | ||
1266 | g_assert (G_TYPE_FROM_INTERFACE (dmap_record) == DMAP_TYPE_RECORD); | |
1267 | } | |
1268 | @@ -233,7 +233,7 @@ grl_dpap_record_dmap_iface_init (gpointer iface, gpointer data) | |
1269 | static void | |
1270 | grl_dpap_record_finalize (GObject *object) | |
1271 | { | |
1272 | - GrlDPAPRecord *record = SIMPLE_DPAP_RECORD (object); | |
1273 | + GrlDpapRecord *record = SIMPLE_DPAP_RECORD (object); | |
1274 | ||
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); | |
1279 | ||
1280 | if (record->priv->thumbnail) | |
1281 | - g_byte_array_unref (record->priv->thumbnail); | |
1282 | + g_array_unref (record->priv->thumbnail); | |
1283 | ||
1284 | G_OBJECT_CLASS (grl_dpap_record_parent_class)->finalize (object); | |
1285 | } | |
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, \ | |
1294 | - GrlDPAPRecord)) | |
1295 | + GrlDpapRecord)) | |
1296 | ||
1297 | #define SIMPLE_DPAP_RECORD_CLASS(k) \ | |
1298 | (G_TYPE_CHECK_CLASS_CAST((k), \ | |
1299 | TYPE_SIMPLE_DPAP_RECORD, \ | |
1300 | - GrlDPAPRecordClass)) | |
1301 | + GrlDpapRecordClass)) | |
1302 | ||
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)) | |
1311 | ||
1312 | #define SIMPLE_DPAP_RECORD_GET_PRIVATE(o) \ | |
1313 | (G_TYPE_INSTANCE_GET_PRIVATE((o), \ | |
1314 | TYPE_SIMPLE_DPAP_RECORD, \ | |
1315 | - GrlDPAPRecordPrivate)) | |
1316 | + GrlDpapRecordPrivate)) | |
1317 | ||
1318 | -typedef struct GrlDPAPRecordPrivate GrlDPAPRecordPrivate; | |
1319 | +typedef struct GrlDpapRecordPrivate GrlDpapRecordPrivate; | |
1320 | ||
1321 | typedef struct { | |
1322 | GObject parent; | |
1323 | - GrlDPAPRecordPrivate *priv; | |
1324 | -} GrlDPAPRecord; | |
1325 | + GrlDpapRecordPrivate *priv; | |
1326 | +} GrlDpapRecord; | |
1327 | ||
1328 | typedef struct { | |
1329 | GObjectClass parent; | |
1330 | -} GrlDPAPRecordClass; | |
1331 | +} GrlDpapRecordClass; | |
1332 | ||
1333 | GType grl_dpap_record_get_type (void); | |
1334 | ||
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); | |
1341 | ||
1342 | #endif /* __SIMPLE_DPAP_RECORD */ | |
1343 | ||
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)) | |
1350 | ||
1351 | struct _GrlDpapSourcePrivate { | |
1352 | - DMAPMdnsBrowserService *service; | |
1353 | + DmapMdnsService *service; | |
1354 | }; | |
1355 | ||
1356 | /* --- Data types --- */ | |
1357 | ||
1358 | -static GrlDpapSource *grl_dpap_source_new (DMAPMdnsBrowserService *service); | |
1359 | +static GrlDpapSource *grl_dpap_source_new (DmapMdnsService *service); | |
1360 | ||
1361 | static void grl_dpap_source_finalize (GObject *object); | |
1362 | ||
1363 | @@ -79,16 +79,16 @@ static void grl_dpap_source_search (GrlSource *source, | |
1364 | GrlSourceSearchSpec *ss); | |
1365 | ||
1366 | ||
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, | |
1371 | GrlPlugin *plugin); | |
1372 | ||
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, | |
1376 | GrlPlugin *plugin); | |
1377 | ||
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"); | |
1387 | ||
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); | |
1392 | ||
1393 | @@ -158,8 +158,10 @@ GRL_PLUGIN_DEFINE (GRL_MAJOR, | |
1394 | G_DEFINE_TYPE_WITH_PRIVATE (GrlDpapSource, grl_dpap_source, GRL_TYPE_SOURCE) | |
1395 | ||
1396 | static GrlDpapSource * | |
1397 | -grl_dpap_source_new (DMAPMdnsBrowserService *service) | |
1398 | +grl_dpap_source_new (DmapMdnsService *service) | |
1399 | { | |
1400 | + gchar *name; | |
1401 | + gchar *service_name; | |
1402 | gchar *source_desc; | |
1403 | gchar *source_id; | |
1404 | ||
1405 | @@ -167,12 +169,16 @@ grl_dpap_source_new (DMAPMdnsBrowserService *service) | |
1406 | ||
1407 | GRL_DEBUG ("grl_dpap_source_new"); | |
1408 | ||
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, | |
1413 | + NULL); | |
1414 | + | |
1415 | + source_desc = g_strdup_printf (SOURCE_DESC_TEMPLATE, name); | |
1416 | + source_id = g_strdup_printf (SOURCE_ID_TEMPLATE, name); | |
1417 | ||
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, | |
1424 | NULL); | |
1425 | @@ -181,6 +187,8 @@ grl_dpap_source_new (DMAPMdnsBrowserService *service) | |
1426 | ||
1427 | g_free (source_desc); | |
1428 | g_free (source_id); | |
1429 | + g_free (service_name); | |
1430 | + g_free (name); | |
1431 | ||
1432 | return source; | |
1433 | } | |
1434 | @@ -241,7 +249,7 @@ grl_dpap_do_search (ResultCbAndArgsAndDb *cb_and_db) | |
1435 | } | |
1436 | ||
1437 | static void | |
1438 | -browse_connected_cb (DMAPConnection *connection, | |
1439 | +browse_connected_cb (DmapConnection *connection, | |
1440 | gboolean result, | |
1441 | const char *reason, | |
1442 | ResultCbAndArgsAndDb *cb_and_db) | |
1443 | @@ -266,7 +274,7 @@ browse_connected_cb (DMAPConnection *connection, | |
1444 | } | |
1445 | ||
1446 | static void | |
1447 | -search_connected_cb (DMAPConnection *connection, | |
1448 | +search_connected_cb (DmapConnection *connection, | |
1449 | gboolean result, | |
1450 | const char *reason, | |
1451 | ResultCbAndArgsAndDb *cb_and_db) | |
1452 | @@ -291,8 +299,8 @@ search_connected_cb (DMAPConnection *connection, | |
1453 | } | |
1454 | ||
1455 | static void | |
1456 | -grl_dpap_service_added_cb (DMAPMdnsBrowser *browser, | |
1457 | - DMAPMdnsBrowserService *service, | |
1458 | +grl_dpap_service_added_cb (DmapMdnsBrowser *browser, | |
1459 | + DmapMdnsService *service, | |
1460 | GrlPlugin *plugin) | |
1461 | { | |
1462 | GrlRegistry *registry = grl_registry_get_default (); | |
1463 | @@ -306,13 +314,16 @@ grl_dpap_service_added_cb (DMAPMdnsBrowser *browser, | |
1464 | GRL_SOURCE (source), | |
1465 | NULL); | |
1466 | if (source != NULL) { | |
1467 | - g_hash_table_insert (sources, g_strdup (service->name), g_object_ref (source)); | |
1468 | + gchar *name; | |
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); | |
1472 | + g_free(name); | |
1473 | } | |
1474 | } | |
1475 | ||
1476 | static void | |
1477 | -grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser, | |
1478 | +grl_dpap_service_removed_cb (DmapMdnsBrowser *browser, | |
1479 | const gchar *service_name, | |
1480 | GrlPlugin *plugin) | |
1481 | { | |
1482 | @@ -328,14 +339,14 @@ grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser, | |
1483 | } | |
1484 | ||
1485 | static void | |
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) | |
1488 | { | |
1489 | - DMAPRecordFactory *factory; | |
1490 | - DMAPConnection *connection; | |
1491 | + DmapRecordFactory *factory; | |
1492 | + DmapConnection *connection; | |
1493 | ||
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); | |
1499 | } | |
1500 | ||
1501 | static gboolean | |
1502 | @@ -396,15 +407,26 @@ grl_dpap_source_browse (GrlSource *source, | |
1503 | browse_connected_cb (NULL, TRUE, NULL, cb_and_db); | |
1504 | } else { | |
1505 | /* Connect */ | |
1506 | + gchar *name, *host; | |
1507 | + guint port; | |
1508 | + | |
1509 | cb_and_db->db = DMAP_DB (grl_dpap_db_new ()); | |
1510 | ||
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, | |
1515 | + "host", &host, | |
1516 | + "port", &port, | |
1517 | + NULL); | |
1518 | + | |
1519 | + grl_dpap_connect (name, | |
1520 | + host, | |
1521 | + port, | |
1522 | cb_and_db, | |
1523 | - (DMAPConnectionCallback) browse_connected_cb); | |
1524 | + (DmapConnectionFunc) browse_connected_cb); | |
1525 | ||
1526 | g_hash_table_insert (connections, g_strdup (url), cb_and_db->db); | |
1527 | + | |
1528 | + g_free (name); | |
1529 | + g_free (host); | |
1530 | } | |
1531 | ||
1532 | g_free (url); | |
1533 | @@ -416,7 +438,7 @@ static void grl_dpap_source_search (GrlSource *source, | |
1534 | GrlDpapSource *dmap_source = GRL_DPAP_SOURCE (source); | |
1535 | ||
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); | |
1540 | ||
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); | |
1544 | } else { | |
1545 | /* Connect */ | |
1546 | + gchar *name, *host; | |
1547 | + guint port; | |
1548 | + | |
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); | |
1551 | + | |
1552 | + g_object_get (dmap_source->priv->service, "name", &name, | |
1553 | + "host", &host, | |
1554 | + "port", &port, | |
1555 | + NULL); | |
1556 | + | |
1557 | + grl_dpap_connect (name, | |
1558 | + host, | |
1559 | + port, | |
1560 | + cb_and_db, | |
1561 | + (DmapConnectionFunc) search_connected_cb); | |
1562 | + | |
1563 | g_hash_table_insert (connections, g_strdup (url), cb_and_db->db); | |
1564 | + | |
1565 | + g_free (name); | |
1566 | + g_free (host); | |
1567 | } | |
1568 | ||
1569 | g_free (url); | |
1570 | -- | |
1571 | 2.18.1 | |
1572 |