b3a06c8.patch 97 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870
  1. diff -Nuar a/libdleyna/renderer/async.c b/libdleyna/renderer/async.c
  2. --- a/libdleyna/renderer/async.c 2021-10-26 18:51:33.000000000 +0300
  3. +++ b/libdleyna/renderer/async.c 2022-06-03 00:20:47.000000000 +0300
  4. @@ -20,6 +20,8 @@
  5. *
  6. */
  7. +#include <config.h>
  8. +
  9. #include <libdleyna/core/error.h>
  10. #include <libdleyna/core/log.h>
  11. @@ -54,10 +56,6 @@
  12. {
  13. dlr_async_task_t *cb_data = user_data;
  14. - if (cb_data->proxy != NULL)
  15. - gupnp_service_proxy_cancel_action(cb_data->proxy,
  16. - cb_data->action);
  17. -
  18. if (!cb_data->error)
  19. cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  20. DLEYNA_ERROR_CANCELLED,
  21. diff -Nuar a/libdleyna/renderer/device.c b/libdleyna/renderer/device.c
  22. --- a/libdleyna/renderer/device.c 2021-10-26 18:51:33.000000000 +0300
  23. +++ b/libdleyna/renderer/device.c 2022-06-03 00:20:47.000000000 +0300
  24. @@ -20,6 +20,7 @@
  25. *
  26. */
  27. +#include <config.h>
  28. #include <string.h>
  29. #include <math.h>
  30. @@ -72,6 +73,7 @@
  31. struct prv_download_info_t_ {
  32. SoupSession *session;
  33. SoupMessage *msg;
  34. + GCancellable *cancellable;
  35. dlr_async_task_t *task;
  36. };
  37. @@ -105,8 +107,8 @@
  38. static gint prv_compare_rationals(const gchar *a, const gchar *b);
  39. static void prv_get_position_info(dlr_async_task_t *cb_data,
  40. - const gchar *action_name,
  41. - GUPnPServiceProxyActionCallback callback);
  42. + const gchar *action_name,
  43. + GAsyncReadyCallback callback);
  44. static void prv_unref_variant(gpointer variant)
  45. {
  46. @@ -418,7 +420,7 @@
  47. g_free(dev->rate);
  48. g_free(dev->icon.mime_type);
  49. - g_free(dev->icon.bytes);
  50. + g_bytes_unref(dev->icon.bytes);
  51. g_free(dev);
  52. }
  53. @@ -680,12 +682,12 @@
  54. GAsyncResult *res,
  55. gpointer user_data)
  56. {
  57. - gchar *result = NULL;
  58. + g_autofree gchar *result = NULL;
  59. gboolean end;
  60. GError *error = NULL;
  61. dleyna_gasync_task_t *task = NULL;
  62. prv_new_device_ct_t *priv_t = NULL;
  63. - GUPnPServiceProxyAction *action;
  64. + g_autoptr(GUPnPServiceProxyAction) action = NULL;
  65. DLEYNA_LOG_DEBUG("Enter");
  66. @@ -722,58 +724,9 @@
  67. if (task)
  68. dleyna_task_queue_task_completed (((dleyna_task_atom_t *) task)->queue_id);
  69. - if (action) {
  70. - gupnp_service_proxy_action_unref(action);
  71. - }
  72. -
  73. - if (error)
  74. - g_error_free(error);
  75. -
  76. - g_free(result);
  77. -
  78. DLEYNA_LOG_DEBUG("Exit");
  79. }
  80. -static void prv_introspection_wrap_cb (GUPnPServiceInfo *info,
  81. - GUPnPServiceIntrospection *introspection,
  82. - const GError *error,
  83. - gpointer user_data)
  84. -{
  85. - if (error != NULL) {
  86. - g_task_return_error (G_TASK (user_data),
  87. - g_error_copy (error));
  88. - } else {
  89. - g_task_return_pointer (G_TASK (user_data),
  90. - introspection,
  91. - g_object_unref);
  92. - }
  93. -
  94. - g_object_unref (G_OBJECT (user_data));
  95. -}
  96. -
  97. -void prv_introspect_async (GUPnPServiceInfo *info,
  98. - GCancellable *cancellable,
  99. - GAsyncReadyCallback callback,
  100. - gpointer user_data)
  101. -{
  102. - GTask *task = g_task_new (info, cancellable, callback, user_data);
  103. -
  104. - gupnp_service_info_get_introspection_async_full (info,
  105. - prv_introspection_wrap_cb,
  106. - cancellable,
  107. - task);
  108. -}
  109. -
  110. -static GUPnPServiceIntrospection *prv_introspect_finish
  111. - (GUPnPServiceInfo *info,
  112. - GAsyncResult *res,
  113. - GError **error)
  114. -{
  115. - g_return_val_if_fail (g_task_is_valid (res, info), NULL);
  116. -
  117. - return g_task_propagate_pointer (G_TASK (res), error);
  118. -}
  119. -
  120. static gint compare_speeds(gconstpointer a, gconstpointer b);
  121. static void prv_introspect_av_cb (GObject *target,
  122. @@ -791,7 +744,8 @@
  123. DLEYNA_LOG_DEBUG("Enter");
  124. - introspection = prv_introspect_finish (GUPNP_SERVICE_INFO (target), res, &error);
  125. + introspection = gupnp_service_info_introspect_finish(
  126. + GUPNP_SERVICE_INFO(target), res, &error);
  127. if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  128. DLEYNA_LOG_WARNING("GetProtocolInfo operation cancelled");
  129. @@ -855,7 +809,8 @@
  130. DLEYNA_LOG_DEBUG("Enter");
  131. - introspection = prv_introspect_finish (GUPNP_SERVICE_INFO (target), res, &error);
  132. + introspection = gupnp_service_info_introspect_finish(
  133. + GUPNP_SERVICE_INFO(target), res, &error);
  134. if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  135. DLEYNA_LOG_WARNING("GetProtocolInfo operation cancelled");
  136. @@ -889,38 +844,37 @@
  137. DLEYNA_LOG_DEBUG("Exit");
  138. }
  139. -static gboolean prv_get_protocol_info(
  140. - dleyna_gasync_task_t *task,
  141. - GObject *target)
  142. +static gboolean prv_get_protocol_info(dleyna_gasync_task_t *task,
  143. + GObject *target)
  144. {
  145. - GUPnPServiceProxyAction *action;
  146. + GUPnPServiceProxyAction *action;
  147. - action = gupnp_service_proxy_action_new("GetProtocolInfo", NULL);
  148. + action = gupnp_service_proxy_action_new("GetProtocolInfo", NULL);
  149. - gupnp_service_proxy_call_action_async(GUPNP_SERVICE_PROXY (target), action,
  150. - dleyna_gasync_task_get_cancellable (task),
  151. - prv_get_protocol_info_cb,
  152. - task);
  153. + gupnp_service_proxy_call_action_async(
  154. + GUPNP_SERVICE_PROXY(target), action,
  155. + dleyna_gasync_task_get_cancellable(task),
  156. + prv_get_protocol_info_cb, task);
  157. - return FALSE;
  158. + return FALSE;
  159. }
  160. static gboolean prv_introspect_av(dleyna_gasync_task_t *task, GObject *target)
  161. {
  162. - prv_introspect_async (GUPNP_SERVICE_INFO (target),
  163. - dleyna_gasync_task_get_cancellable (task),
  164. - prv_introspect_av_cb,
  165. - task);
  166. + gupnp_service_info_introspect_async(
  167. + GUPNP_SERVICE_INFO(target),
  168. + dleyna_gasync_task_get_cancellable(task), prv_introspect_av_cb,
  169. + task);
  170. return FALSE;
  171. }
  172. static gboolean prv_introspect_rc(dleyna_gasync_task_t *task, GObject *target)
  173. {
  174. - prv_introspect_async (GUPNP_SERVICE_INFO (target),
  175. - dleyna_gasync_task_get_cancellable (task),
  176. - prv_introspect_rc_cb,
  177. - task);
  178. + gupnp_service_info_introspect_async(
  179. + GUPNP_SERVICE_INFO(target),
  180. + dleyna_gasync_task_get_cancellable(task), prv_introspect_rc_cb,
  181. + task);
  182. return FALSE;
  183. }
  184. @@ -1994,32 +1948,34 @@
  185. prv_process_protocol_info(device, sink);
  186. }
  187. -static void prv_get_position_info_cb(GUPnPServiceProxy *proxy,
  188. - GUPnPServiceProxyAction *action,
  189. - gpointer user_data)
  190. +static void prv_get_position_info_cb(GObject *source, GAsyncResult *res,
  191. + gpointer user_data)
  192. {
  193. gchar *result = NULL;
  194. - const gchar *message;
  195. - gboolean end;
  196. dlr_async_task_t *cb_data = user_data;
  197. - GError *error = NULL;
  198. + g_autoptr(GError) error = NULL;
  199. GVariantBuilder *changed_props_vb;
  200. GVariant *changed_props;
  201. - end = gupnp_service_proxy_end_action(
  202. - cb_data->proxy, cb_data->action, &error,
  203. - "RelTime", G_TYPE_STRING, &result,
  204. - NULL);
  205. + g_autoptr(GUPnPServiceProxyAction) action =
  206. + gupnp_service_proxy_call_action_finish(
  207. + GUPNP_SERVICE_PROXY(source), res, &error);
  208. - if (!end || (result == NULL)) {
  209. - message = (error != NULL) ? error->message : "Invalid result";
  210. - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  211. - DLEYNA_ERROR_OPERATION_FAILED,
  212. - "GetPositionInfo operation failed: %s",
  213. - message);
  214. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  215. + // Do nothing. The task wil already be deleted by the queue
  216. + return;
  217. + }
  218. - if (error != NULL)
  219. - g_error_free(error);
  220. + if(error == NULL) {
  221. + gupnp_service_proxy_action_get_result(action, &error, "RelTime",
  222. + G_TYPE_STRING, &result,
  223. + NULL);
  224. + }
  225. +
  226. + if(error != NULL) {
  227. + cb_data->error = g_error_new(
  228. + DLEYNA_SERVER_ERROR, DLEYNA_ERROR_OPERATION_FAILED,
  229. + "GetPositionInfo operation failed: %s", error->message);
  230. goto on_error;
  231. }
  232. @@ -2045,35 +2001,38 @@
  233. on_error:
  234. (void) g_idle_add(dlr_async_task_complete, cb_data);
  235. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  236. }
  237. -static void prv_get_byte_position_info_cb(GUPnPServiceProxy *proxy,
  238. - GUPnPServiceProxyAction *action,
  239. - gpointer user_data)
  240. +static void prv_get_byte_position_info_cb(GObject *source, GAsyncResult *res,
  241. + gpointer user_data)
  242. {
  243. - gchar *result = NULL;
  244. - const gchar *message;
  245. - gboolean end;
  246. + g_autofree gchar *result = NULL;
  247. dlr_async_task_t *cb_data = user_data;
  248. - GError *error = NULL;
  249. + g_autoptr(GError) error = NULL;
  250. GVariantBuilder *changed_props_vb;
  251. GVariant *changed_props;
  252. - end = gupnp_service_proxy_end_action(
  253. - cb_data->proxy, cb_data->action, &error,
  254. - "RelByte", G_TYPE_STRING, &result,
  255. - NULL);
  256. + g_autoptr(GUPnPServiceProxyAction) action =
  257. + gupnp_service_proxy_call_action_finish(
  258. + GUPNP_SERVICE_PROXY(source), res, &error);
  259. - if (!end || (result == NULL)) {
  260. - message = (error != NULL) ? error->message : "Invalid result";
  261. - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  262. - DLEYNA_ERROR_OPERATION_FAILED,
  263. - "X_DLNA_GetBytePositionInfo operation failed: %s",
  264. - message);
  265. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  266. + // Do nothing. The task already was deleted
  267. + return;
  268. + }
  269. +
  270. + if(error == NULL) {
  271. + gupnp_service_proxy_action_get_result(action, &error, "RelByte",
  272. + G_TYPE_STRING, &result,
  273. + NULL);
  274. + }
  275. - if (error != NULL)
  276. - g_error_free(error);
  277. + if(error != NULL) {
  278. + cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  279. + DLEYNA_ERROR_OPERATION_FAILED,
  280. + "X_DLNA_GetBytePositionInfo "
  281. + "operation failed: %s",
  282. + error->message);
  283. goto on_error;
  284. }
  285. @@ -2082,48 +2041,49 @@
  286. g_strstrip(result);
  287. - prv_add_relcount(cb_data->device, result, changed_props_vb);
  288. + prv_add_reltime(cb_data->device, result, changed_props_vb);
  289. - changed_props = g_variant_ref_sink(
  290. - g_variant_builder_end(changed_props_vb));
  291. + changed_props =
  292. + g_variant_ref_sink(g_variant_builder_end(changed_props_vb));
  293. prv_emit_signal_properties_changed(cb_data->device,
  294. - DLR_INTERFACE_PLAYER,
  295. - changed_props);
  296. + DLR_INTERFACE_PLAYER, changed_props);
  297. g_variant_unref(changed_props);
  298. g_variant_builder_unref(changed_props_vb);
  299. - g_free(result);
  300. -
  301. prv_get_prop(cb_data);
  302. on_error:
  303. (void) g_idle_add(dlr_async_task_complete, cb_data);
  304. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  305. }
  306. -static void prv_get_all_position_info_cb(GUPnPServiceProxy *proxy,
  307. - GUPnPServiceProxyAction *action,
  308. - gpointer user_data)
  309. +static void prv_get_all_position_info_cb(GObject *source, GAsyncResult *res,
  310. + gpointer user_data)
  311. {
  312. gchar *result = NULL;
  313. dlr_async_task_t *cb_data = user_data;
  314. - GError *error = NULL;
  315. + g_autoptr(GError) error = NULL;
  316. dlr_device_data_t *device_data = cb_data->private;
  317. GVariantBuilder *changed_props_vb;
  318. GVariant *changed_props;
  319. + g_autoptr(GUPnPServiceProxyAction) action = NULL;
  320. - if (!gupnp_service_proxy_end_action(cb_data->proxy,
  321. - cb_data->action, &error,
  322. - "RelTime", G_TYPE_STRING, &result,
  323. - NULL)) {
  324. - if (error != NULL) {
  325. - DLEYNA_LOG_WARNING(
  326. - "GetPositionInfo operation failed: %s",
  327. - error->message);
  328. + action = gupnp_service_proxy_call_action_finish(
  329. + GUPNP_SERVICE_PROXY(source), res, &error);
  330. - g_error_free(error);
  331. - }
  332. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  333. + return;
  334. + }
  335. +
  336. + if(error == NULL) {
  337. + gupnp_service_proxy_action_get_result(action, &error, "RelTime",
  338. + G_TYPE_STRING, &result,
  339. + NULL);
  340. + }
  341. +
  342. + if(error != NULL) {
  343. + DLEYNA_LOG_WARNING("GetPositionInfo operation failed: %s",
  344. + error->message);
  345. }
  346. if (result == NULL) {
  347. @@ -2166,32 +2126,40 @@
  348. on_complete:
  349. prv_get_props(cb_data);
  350. +
  351. +on_error:
  352. (void) g_idle_add(dlr_async_task_complete, cb_data);
  353. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  354. return;
  355. }
  356. -static void prv_get_all_byte_position_info_cb(GUPnPServiceProxy *proxy,
  357. - GUPnPServiceProxyAction *action,
  358. - gpointer user_data)
  359. +static void prv_get_all_byte_position_info_cb(GObject *source,
  360. + GAsyncResult *res,
  361. + gpointer user_data)
  362. {
  363. gchar *result = NULL;
  364. dlr_async_task_t *cb_data = user_data;
  365. - GError *error = NULL;
  366. + g_autoptr(GError) error = NULL;
  367. dlr_device_data_t *device_data = cb_data->private;
  368. + g_autoptr(GUPnPServiceProxyAction) action = NULL;
  369. - if (!gupnp_service_proxy_end_action(cb_data->proxy,
  370. - cb_data->action, &error,
  371. - "RelByte", G_TYPE_STRING, &result,
  372. - NULL)) {
  373. - if (error != NULL) {
  374. - DLEYNA_LOG_WARNING(
  375. - "X_DLNA_GetBytePositionInfo operation failed: %s",
  376. - error->message);
  377. + action = gupnp_service_proxy_call_action_finish(
  378. + GUPNP_SERVICE_PROXY(source), res, &error);
  379. - g_error_free(error);
  380. - }
  381. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  382. + return;
  383. + }
  384. +
  385. + if(error == NULL) {
  386. + gupnp_service_proxy_action_get_result(action, &error, "RelByte",
  387. + G_TYPE_STRING, &result,
  388. + NULL);
  389. + }
  390. +
  391. + if(error != NULL) {
  392. + DLEYNA_LOG_WARNING(
  393. + "X_DLNA_GetBytePositionInfo operation failed: %s",
  394. + error->message);
  395. }
  396. if (result == NULL) {
  397. @@ -2204,41 +2172,33 @@
  398. device_data->ut.get_all_position.rel_cnt = result;
  399. - cb_data->action = gupnp_service_proxy_begin_action(
  400. - cb_data->proxy,
  401. - "GetPositionInfo",
  402. - prv_get_all_position_info_cb,
  403. - cb_data,
  404. - "InstanceID", G_TYPE_INT, 0,
  405. - NULL);
  406. + cb_data->action = gupnp_service_proxy_action_new(
  407. + "GetPositionInfo", "InstanceID", G_TYPE_INT, 0, NULL);
  408. - return;
  409. + gupnp_service_proxy_call_action_async(
  410. + GUPNP_SERVICE_PROXY(source), cb_data->action,
  411. + cb_data->cancellable, prv_get_all_position_info_cb, cb_data);
  412. }
  413. static void prv_get_position_info(dlr_async_task_t *cb_data,
  414. - const gchar *action_name,
  415. - GUPnPServiceProxyActionCallback callback)
  416. + const gchar *action_name,
  417. + GAsyncReadyCallback callback)
  418. {
  419. dlr_device_context_t *context;
  420. context = dlr_device_get_context(cb_data->device);
  421. - cb_data->cancel_id =
  422. - g_cancellable_connect(cb_data->cancellable,
  423. - G_CALLBACK(dlr_async_task_cancelled),
  424. - cb_data, NULL);
  425. cb_data->proxy = context->service_proxies.av_proxy;
  426. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.av_proxy)),
  427. (gpointer *)&cb_data->proxy);
  428. - cb_data->action = gupnp_service_proxy_begin_action(
  429. - cb_data->proxy,
  430. - action_name,
  431. - callback,
  432. - cb_data,
  433. - "InstanceID", G_TYPE_INT, 0,
  434. - NULL);
  435. + cb_data->action = gupnp_service_proxy_action_new(
  436. + action_name, "InstanceID", G_TYPE_INT, 0, NULL);
  437. +
  438. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  439. + cb_data->cancellable, callback,
  440. + cb_data);
  441. }
  442. /***********************************************************************/
  443. @@ -2452,7 +2412,6 @@
  444. GVariant *val;
  445. GUPnPDeviceInfo *info;
  446. dlr_device_context_t *context;
  447. - dlr_service_proxies_t *service_proxies;
  448. dlr_props_t *props = &device->props;
  449. GVariantBuilder *changed_props_vb;
  450. GVariant *changed_props;
  451. @@ -2502,29 +2461,37 @@
  452. g_variant_unref(changed_props);
  453. g_variant_builder_unref(changed_props_vb);
  454. -on_lost_device:
  455. -
  456. return device_alive;
  457. }
  458. -static void prv_simple_call_cb(GUPnPServiceProxy *proxy,
  459. - GUPnPServiceProxyAction *action,
  460. - gpointer user_data)
  461. +static void prv_simple_call_cb(GObject *source, GAsyncResult *res,
  462. + gpointer user_data)
  463. {
  464. dlr_async_task_t *cb_data = user_data;
  465. - GError *upnp_error = NULL;
  466. + g_autoptr(GError) upnp_error = NULL;
  467. - if (!gupnp_service_proxy_end_action(cb_data->proxy, cb_data->action,
  468. - &upnp_error, NULL)) {
  469. - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  470. - DLEYNA_ERROR_OPERATION_FAILED,
  471. - "Operation failed: %s",
  472. - upnp_error->message);
  473. - g_error_free(upnp_error);
  474. + g_autoptr(GUPnPServiceProxyAction) action = NULL;
  475. +
  476. + action = gupnp_service_proxy_call_action_finish(
  477. + GUPNP_SERVICE_PROXY(source), res, &upnp_error);
  478. +
  479. + if(g_error_matches(upnp_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  480. + return;
  481. + }
  482. +
  483. + // TODO: Work-around to catch SOAP errors
  484. + if(upnp_error == NULL) {
  485. + gupnp_service_proxy_action_get_result(action, &upnp_error,
  486. + NULL);
  487. + }
  488. +
  489. + if(upnp_error != NULL) {
  490. + cb_data->error = g_error_new(
  491. + DLEYNA_SERVER_ERROR, DLEYNA_ERROR_OPERATION_FAILED,
  492. + "Operation failed: %s", upnp_error->message);
  493. }
  494. (void) g_idle_add(dlr_async_task_complete, cb_data);
  495. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  496. }
  497. static void prv_set_volume(dlr_async_task_t *cb_data, GVariant *params)
  498. @@ -2536,15 +2503,14 @@
  499. DLEYNA_LOG_INFO("Set device volume to %d/%d", (guint)volume,
  500. cb_data->device->max_volume);
  501. - cb_data->action =
  502. - gupnp_service_proxy_begin_action(cb_data->proxy, "SetVolume",
  503. - prv_simple_call_cb, cb_data,
  504. - "InstanceID", G_TYPE_INT, 0,
  505. - "Channel",
  506. - G_TYPE_STRING, "Master",
  507. - "DesiredVolume",
  508. - G_TYPE_UINT, (guint) volume,
  509. - NULL);
  510. + cb_data->action = gupnp_service_proxy_action_new(
  511. + "SetVolume", "InstanceID", G_TYPE_INT, 0, "Channel",
  512. + G_TYPE_STRING, "Master", "DesiredVolume", G_TYPE_UINT,
  513. + (guint) volume, NULL);
  514. +
  515. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  516. + cb_data->cancellable,
  517. + prv_simple_call_cb, cb_data);
  518. }
  519. static void prv_set_mute(dlr_async_task_t *cb_data, GVariant *params)
  520. @@ -2555,15 +2521,14 @@
  521. DLEYNA_LOG_INFO("Set device mute state to %s", mute ? "TRUE" : "FALSE");
  522. - cb_data->action =
  523. - gupnp_service_proxy_begin_action(cb_data->proxy, "SetMute",
  524. - prv_simple_call_cb, cb_data,
  525. - "InstanceID", G_TYPE_INT, 0,
  526. - "Channel",
  527. - G_TYPE_STRING, "Master",
  528. - "DesiredMute",
  529. - G_TYPE_BOOLEAN, mute,
  530. - NULL);
  531. + cb_data->action = gupnp_service_proxy_action_new(
  532. + "SetMute", "InstanceID", G_TYPE_INT, 0, "Channel",
  533. + G_TYPE_STRING, "Master", "DesiredMute", G_TYPE_BOOLEAN, mute,
  534. + NULL);
  535. +
  536. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  537. + cb_data->cancellable,
  538. + prv_simple_call_cb, cb_data);
  539. }
  540. static GVariant *prv_get_rate_value_from_double(GVariant *params,
  541. @@ -2721,10 +2686,6 @@
  542. context = dlr_device_get_context(device);
  543. - cb_data->cancel_id =
  544. - g_cancellable_connect(cb_data->cancellable,
  545. - G_CALLBACK(dlr_async_task_cancelled),
  546. - cb_data, NULL);
  547. cb_data->proxy = context->service_proxies.rc_proxy;
  548. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.rc_proxy)),
  549. @@ -2761,7 +2722,7 @@
  550. dlr_async_task_t *cb_data = (dlr_async_task_t *)task;
  551. dlr_task_get_prop_t *get_prop = &task->ut.get_prop;
  552. const gchar *get_position_action;
  553. - GUPnPServiceProxyActionCallback get_position_cb;
  554. + GAsyncReadyCallback get_position_cb;
  555. cb_data->cb = cb;
  556. cb_data->device = device;
  557. @@ -2861,23 +2822,17 @@
  558. cb_data->cb = cb;
  559. cb_data->device = device;
  560. - cb_data->cancel_id =
  561. - g_cancellable_connect(cb_data->cancellable,
  562. - G_CALLBACK(dlr_async_task_cancelled),
  563. - cb_data, NULL);
  564. cb_data->proxy = context->service_proxies.av_proxy;
  565. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.av_proxy)),
  566. - (gpointer *)&cb_data->proxy);
  567. + (gpointer *) &cb_data->proxy);
  568. - cb_data->action =
  569. - gupnp_service_proxy_begin_action(cb_data->proxy,
  570. - "Play",
  571. - prv_simple_call_cb,
  572. - cb_data,
  573. - "InstanceID", G_TYPE_INT, 0,
  574. - "Speed", G_TYPE_STRING,
  575. - device->rate, NULL);
  576. + cb_data->action = gupnp_service_proxy_action_new(
  577. + "Play", "InstanceID", G_TYPE_INT, 0, "Speed", G_TYPE_STRING,
  578. + device->rate, NULL);
  579. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  580. + cb_data->cancellable,
  581. + prv_simple_call_cb, cb_data);
  582. }
  583. void dlr_device_play_pause(dlr_device_t *device, dlr_task_t *task,
  584. @@ -2907,22 +2862,17 @@
  585. cb_data->cb = cb;
  586. cb_data->device = device;
  587. - cb_data->cancel_id =
  588. - g_cancellable_connect(cb_data->cancellable,
  589. - G_CALLBACK(dlr_async_task_cancelled),
  590. - cb_data, NULL);
  591. cb_data->proxy = context->service_proxies.av_proxy;
  592. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.av_proxy)),
  593. (gpointer *)&cb_data->proxy);
  594. - cb_data->action =
  595. - gupnp_service_proxy_begin_action(cb_data->proxy,
  596. - command_name,
  597. - prv_simple_call_cb,
  598. - cb_data,
  599. - "InstanceID", G_TYPE_INT, 0,
  600. - NULL);
  601. + cb_data->action = gupnp_service_proxy_action_new(
  602. + command_name, "InstanceID", G_TYPE_INT, 0, NULL);
  603. +
  604. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  605. + cb_data->cancellable,
  606. + prv_simple_call_cb, cb_data);
  607. }
  608. void dlr_device_pause(dlr_device_t *device, dlr_task_t *task,
  609. @@ -3012,23 +2962,32 @@
  610. g_variant_builder_unref(changed_props_vb);
  611. }
  612. -static void prv_open_uri_cb(GUPnPServiceProxy *proxy,
  613. - GUPnPServiceProxyAction *action,
  614. - gpointer user_data)
  615. +static void prv_open_uri_cb(GObject *source, GAsyncResult *res,
  616. + gpointer user_data)
  617. {
  618. dlr_async_task_t *cb_data = user_data;
  619. - GError *upnp_error = NULL;
  620. + g_autoptr(GError) upnp_error = NULL;
  621. #if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  622. gchar *type;
  623. #endif
  624. - if (!gupnp_service_proxy_end_action(cb_data->proxy, cb_data->action,
  625. - &upnp_error, NULL)) {
  626. - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  627. - DLEYNA_ERROR_OPERATION_FAILED,
  628. - "Operation failed: %s",
  629. - upnp_error->message);
  630. - g_error_free(upnp_error);
  631. + g_autoptr(GUPnPServiceProxyAction) action =
  632. + gupnp_service_proxy_call_action_finish(
  633. + GUPNP_SERVICE_PROXY(source), res, &upnp_error);
  634. +
  635. + if(g_error_matches(upnp_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  636. + return;
  637. + }
  638. +
  639. + if(upnp_error == NULL) {
  640. + gupnp_service_proxy_action_get_result(action, &upnp_error,
  641. + NULL);
  642. + }
  643. +
  644. + if(upnp_error != NULL) {
  645. + cb_data->error = g_error_new(
  646. + DLEYNA_SERVER_ERROR, DLEYNA_ERROR_OPERATION_FAILED,
  647. + "Operation failed: %s", upnp_error->message);
  648. goto on_error;
  649. }
  650. @@ -3049,22 +3008,19 @@
  651. #endif
  652. if (cb_data->task.type == DLR_TASK_OPEN_URI) {
  653. - cb_data->action =
  654. - gupnp_service_proxy_begin_action(
  655. - cb_data->proxy,
  656. - "Play",
  657. - prv_simple_call_cb,
  658. - cb_data,
  659. - "InstanceID", G_TYPE_INT, 0,
  660. - "Speed", G_TYPE_STRING,
  661. - cb_data->device->rate, NULL);
  662. + cb_data->action = gupnp_service_proxy_action_new(
  663. + "Play", "InstanceID", G_TYPE_INT, 0, "Speed",
  664. + G_TYPE_STRING, cb_data->device->rate, NULL);
  665. + gupnp_service_proxy_call_action_async(
  666. + GUPNP_SERVICE_PROXY(source), cb_data->action,
  667. + cb_data->cancellable, prv_simple_call_cb, cb_data);
  668. +
  669. goto on_exit;
  670. }
  671. on_error:
  672. (void) g_idle_add(dlr_async_task_complete, cb_data);
  673. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  674. on_exit:
  675. return;
  676. @@ -3086,28 +3042,20 @@
  677. cb_data->cb = cb;
  678. cb_data->device = device;
  679. - cb_data->cancel_id =
  680. - g_cancellable_connect(cb_data->cancellable,
  681. - G_CALLBACK(dlr_async_task_cancelled),
  682. - cb_data, NULL);
  683. cb_data->proxy = context->service_proxies.av_proxy;
  684. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.av_proxy)),
  685. - (gpointer *)&cb_data->proxy);
  686. + (gpointer *) &cb_data->proxy);
  687. - cb_data->action =
  688. - gupnp_service_proxy_begin_action(cb_data->proxy,
  689. - open_uri_data->operation,
  690. - prv_open_uri_cb,
  691. - cb_data,
  692. - "InstanceID", G_TYPE_INT, 0,
  693. - open_uri_data->uri_type,
  694. - G_TYPE_STRING,
  695. - open_uri_data->uri,
  696. - open_uri_data->metadata_type,
  697. - G_TYPE_STRING,
  698. - metadata ? metadata : "",
  699. - NULL);
  700. + cb_data->action = gupnp_service_proxy_action_new(
  701. + open_uri_data->operation, "InstanceID", G_TYPE_INT, 0,
  702. + open_uri_data->uri_type, G_TYPE_STRING, open_uri_data->uri,
  703. + open_uri_data->metadata_type, G_TYPE_STRING,
  704. + metadata ? metadata : "", NULL);
  705. +
  706. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  707. + cb_data->cancellable,
  708. + prv_open_uri_cb, cb_data);
  709. }
  710. static void prv_device_set_position(dlr_device_t *device, dlr_task_t *task,
  711. @@ -3117,7 +3065,7 @@
  712. dlr_device_context_t *context;
  713. dlr_async_task_t *cb_data = (dlr_async_task_t *)task;
  714. dlr_task_seek_t *seek_data = &task->ut.seek;
  715. - gchar *position;
  716. + g_autofree gchar *position = NULL;
  717. context = dlr_device_get_context(device);
  718. cb_data->cb = cb;
  719. @@ -3133,27 +3081,19 @@
  720. DLEYNA_LOG_INFO("set %s position : %s", pos_type, position);
  721. - cb_data->cancel_id =
  722. - g_cancellable_connect(cb_data->cancellable,
  723. - G_CALLBACK(dlr_async_task_cancelled),
  724. - cb_data, NULL);
  725. cb_data->cancellable = cb_data->cancellable;
  726. cb_data->proxy = context->service_proxies.av_proxy;
  727. g_object_add_weak_pointer((G_OBJECT(context->service_proxies.av_proxy)),
  728. (gpointer *)&cb_data->proxy);
  729. - cb_data->action =
  730. - gupnp_service_proxy_begin_action(cb_data->proxy,
  731. - "Seek",
  732. - prv_simple_call_cb,
  733. - cb_data,
  734. - "InstanceID", G_TYPE_INT, 0,
  735. - "Unit", G_TYPE_STRING,
  736. - pos_type,
  737. - "Target",
  738. - G_TYPE_STRING, position,
  739. - NULL);
  740. + cb_data->action = gupnp_service_proxy_action_new(
  741. + "Seek", "InstanceID", G_TYPE_INT, 0, "Unit", G_TYPE_STRING,
  742. + pos_type, "Target", G_TYPE_STRING, position, NULL);
  743. +
  744. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  745. + cb_data->cancellable,
  746. + prv_simple_call_cb, cb_data);
  747. g_free(position);
  748. }
  749. @@ -3164,7 +3104,7 @@
  750. {
  751. dlr_async_task_t *cb_data = (dlr_async_task_t *)task;
  752. dlr_task_seek_t *seek_data = &task->ut.seek;
  753. - gchar *position;
  754. + g_autofree gchar *position;
  755. cb_data->cb = cb;
  756. cb_data->device = device;
  757. @@ -3177,54 +3117,48 @@
  758. DLEYNA_LOG_INFO("set %s position : %s", pos_type, position);
  759. - cb_data->action =
  760. - gupnp_service_proxy_begin_action(cb_data->proxy,
  761. - "Seek",
  762. - prv_simple_call_cb,
  763. - cb_data,
  764. - "InstanceID", G_TYPE_INT, 0,
  765. - "Unit", G_TYPE_STRING,
  766. - pos_type,
  767. - "Target",
  768. - G_TYPE_STRING, position,
  769. - NULL);
  770. + cb_data->action = gupnp_service_proxy_action_new(
  771. + "Seek", "InstanceID", G_TYPE_INT, 0, "Unit", G_TYPE_STRING,
  772. + pos_type, "Target", G_TYPE_STRING, position, NULL);
  773. - g_free(position);
  774. + gupnp_service_proxy_call_action_async(cb_data->proxy, cb_data->action,
  775. + cb_data->cancellable,
  776. + prv_simple_call_cb, cb_data);
  777. }
  778. -static void prv_complete_seek_get_position(GUPnPServiceProxy *proxy,
  779. - GUPnPServiceProxyAction *action,
  780. - gpointer user_data)
  781. +static void prv_complete_seek_get_position(GObject *source, GAsyncResult *res,
  782. + gpointer user_data)
  783. {
  784. - gchar *result = NULL;
  785. - const gchar *message;
  786. - gboolean end;
  787. - GError *error = NULL;
  788. + g_autofree gchar *result = NULL;
  789. + g_autoptr(GError) error = NULL;
  790. dlr_async_task_t *cb_data = user_data;
  791. dlr_task_t *task = &cb_data->task;
  792. dlr_task_seek_t *seek_data = &task->ut.seek;
  793. guint64 count;
  794. - end = gupnp_service_proxy_end_action(
  795. - proxy, action, &error,
  796. - (task->type == DLR_TASK_SEEK) ?
  797. - "RelTime" : "RelByte",
  798. - G_TYPE_STRING, &result,
  799. - NULL);
  800. + g_autoptr(GUPnPServiceProxyAction) action =
  801. + gupnp_service_proxy_call_action_finish(
  802. + GUPNP_SERVICE_PROXY(source), res, &error);
  803. - if (!end || (result == NULL)) {
  804. - message = (error != NULL) ? error->message : "Invalid result";
  805. - cb_data->error =
  806. - g_error_new(
  807. - DLEYNA_SERVER_ERROR,
  808. - DLEYNA_ERROR_OPERATION_FAILED,
  809. - "%s operation failed: %s",
  810. - (task->type == DLR_TASK_SEEK) ?
  811. - "GetPositionInfo" : "X_DLNA_GetBytePositionInfo",
  812. - message);
  813. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
  814. + return;
  815. + }
  816. - if (error != NULL)
  817. - g_error_free(error);
  818. + if(error == NULL) {
  819. + gupnp_service_proxy_action_get_result(
  820. + action, &error,
  821. + (task->type == DLR_TASK_SEEK) ? "RelTime" : "RelByte",
  822. + G_TYPE_STRING, &result, NULL);
  823. + }
  824. +
  825. + if(error != NULL) {
  826. + cb_data->error = g_error_new(
  827. + DLEYNA_SERVER_ERROR, DLEYNA_ERROR_OPERATION_FAILED,
  828. + "%s operation failed: %s",
  829. + (task->type == DLR_TASK_SEEK)
  830. + ? "GetPositionInfo"
  831. + : "X_DLNA_GetBytePositionInfo",
  832. + error->message);
  833. goto on_error;
  834. }
  835. @@ -3245,14 +3179,11 @@
  836. "X_DLNA_REL_BYTE", cb_data->cb);
  837. }
  838. - g_free(result);
  839. -
  840. return;
  841. on_error:
  842. (void) g_idle_add(dlr_async_task_complete, task);
  843. - g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id);
  844. }
  845. void dlr_device_seek(dlr_device_t *device, dlr_task_t *task,
  846. @@ -3338,10 +3269,10 @@
  847. {
  848. GVariant *out_p[2];
  849. - out_p[0] = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE,
  850. - device->icon.bytes,
  851. - device->icon.size,
  852. - 1);
  853. + gsize size;
  854. + gconstpointer data = g_bytes_get_data(device->icon.bytes, &size);
  855. + out_p[0] =
  856. + g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, data, size, 1);
  857. out_p[1] = g_variant_new_string(device->icon.mime_type);
  858. task->result = g_variant_ref_sink(g_variant_new_tuple(out_p, 2));
  859. }
  860. @@ -3354,41 +3285,45 @@
  861. dlr_async_task_cancelled(cancellable, download->task);
  862. if (download->msg) {
  863. - soup_session_cancel_message(download->session, download->msg,
  864. - SOUP_STATUS_CANCELLED);
  865. + g_cancellable_cancel(download->cancellable);
  866. DLEYNA_LOG_DEBUG("Cancelling device icon download");
  867. }
  868. }
  869. static void prv_free_download_info(prv_download_info_t *download)
  870. {
  871. - if (download->msg)
  872. - g_object_unref(download->msg);
  873. - g_object_unref(download->session);
  874. + g_clear_object(&download->msg);
  875. + g_clear_object(&download->session);
  876. + g_clear_object(&download->cancellable);
  877. g_free(download);
  878. }
  879. -static void prv_get_icon_session_cb(SoupSession *session,
  880. - SoupMessage *msg,
  881. - gpointer user_data)
  882. +static void prv_get_icon_session_cb(GObject *source, GAsyncResult *res,
  883. + gpointer user_data)
  884. {
  885. prv_download_info_t *download = (prv_download_info_t *)user_data;
  886. dlr_async_task_t *cb_data = (dlr_async_task_t *)download->task;
  887. dlr_device_t *device = (dlr_device_t *)cb_data->device;
  888. + g_autoptr(GError) error = NULL;
  889. + GBytes *data;
  890. - if (msg->status_code == SOUP_STATUS_CANCELLED)
  891. + data = soup_session_send_and_read_finish(SOUP_SESSION(source), res,
  892. + &error);
  893. +
  894. + if(g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
  895. goto out;
  896. - if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
  897. - device->icon.size = msg->response_body->length;
  898. - device->icon.bytes = g_malloc(device->icon.size);
  899. - memcpy(device->icon.bytes, msg->response_body->data,
  900. - device->icon.size);
  901. + SoupStatus status = soup_message_get_status(download->msg);
  902. +
  903. + if(SOUP_STATUS_IS_SUCCESSFUL(status)) {
  904. + device->icon.bytes = data;
  905. prv_build_icon_result(device, &cb_data->task);
  906. } else {
  907. DLEYNA_LOG_DEBUG("Failed to GET device icon: %s",
  908. - msg->reason_phrase);
  909. + error != NULL ? error->message
  910. + : soup_message_get_reason_phrase(
  911. + download->msg));
  912. cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  913. DLEYNA_ERROR_OPERATION_FAILED,
  914. @@ -3415,7 +3350,7 @@
  915. cb_data->cb = cb;
  916. cb_data->device = device;
  917. - if (device->icon.size != 0) {
  918. + if(device->icon.bytes != NULL) {
  919. prv_build_icon_result(device, task);
  920. goto end;
  921. }
  922. @@ -3437,6 +3372,7 @@
  923. download->session = soup_session_new();
  924. download->msg = soup_message_new(SOUP_METHOD_GET, url);
  925. download->task = cb_data;
  926. + download->cancellable = g_cancellable_new();
  927. if (!download->msg) {
  928. DLEYNA_LOG_WARNING("Invalid URL %s", url);
  929. @@ -3455,9 +3391,9 @@
  930. G_CALLBACK(prv_get_icon_cancelled),
  931. download, NULL);
  932. - g_object_ref(download->msg);
  933. - soup_session_queue_message(download->session, download->msg,
  934. - prv_get_icon_session_cb, download);
  935. + soup_session_send_and_read_async(
  936. + download->session, download->msg, G_PRIORITY_DEFAULT,
  937. + download->cancellable, prv_get_icon_session_cb, download);
  938. g_free(url);
  939. diff -Nuar a/libdleyna/renderer/device.h b/libdleyna/renderer/device.h
  940. --- a/libdleyna/renderer/device.h 2021-10-26 18:51:33.000000000 +0300
  941. +++ b/libdleyna/renderer/device.h 2022-06-03 00:20:47.000000000 +0300
  942. @@ -67,8 +67,7 @@
  943. typedef struct dlr_device_icon_t_ dlr_device_icon_t;
  944. struct dlr_device_icon_t_ {
  945. gchar *mime_type;
  946. - guchar *bytes;
  947. - gsize size;
  948. + GBytes *bytes;
  949. };
  950. struct dlr_device_t_ {
  951. diff -Nuar a/libdleyna/renderer/gasync-task.c b/libdleyna/renderer/gasync-task.c
  952. --- a/libdleyna/renderer/gasync-task.c 2021-10-26 18:51:33.000000000 +0300
  953. +++ b/libdleyna/renderer/gasync-task.c 2022-06-03 00:20:47.000000000 +0300
  954. @@ -18,6 +18,8 @@
  955. *
  956. */
  957. +#include <config.h>
  958. +
  959. #include "gasync-task.h"
  960. #include <libdleyna/core/task-processor.h>
  961. diff -Nuar a/libdleyna/renderer/host-service.c b/libdleyna/renderer/host-service.c
  962. --- a/libdleyna/renderer/host-service.c 2021-10-26 18:51:33.000000000 +0300
  963. +++ b/libdleyna/renderer/host-service.c 2022-06-03 00:20:47.000000000 +0300
  964. @@ -20,6 +20,7 @@
  965. *
  966. */
  967. +#include <config.h>
  968. #include <stdio.h>
  969. #include <stdlib.h>
  970. @@ -253,8 +254,7 @@
  971. {
  972. dlr_host_server_t *server = host_server;
  973. - if (server) {
  974. - soup_server_quit(server->soup_server);
  975. + if(server) {
  976. g_object_unref(server->soup_server);
  977. g_hash_table_unref(server->files);
  978. g_free(server);
  979. @@ -296,41 +296,49 @@
  980. }
  981. }
  982. -static void prv_soup_server_cb(SoupServer *server, SoupMessage *msg,
  983. - const char *path, GHashTable *query,
  984. - SoupClientContext *client, gpointer user_data)
  985. +static void prv_soup_server_cb(SoupServer *server, SoupServerMessage *msg,
  986. + const char *path, GHashTable *query,
  987. + gpointer user_data)
  988. {
  989. dlr_host_file_t *hf;
  990. dlr_host_server_t *hs = user_data;
  991. const gchar *file_name;
  992. const char *hdr;
  993. + const char *method = soup_server_message_get_method(msg);
  994. - if ((msg->method != SOUP_METHOD_GET) &&
  995. - (msg->method != SOUP_METHOD_HEAD)) {
  996. - soup_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED);
  997. + if((method != SOUP_METHOD_GET) && (method != SOUP_METHOD_HEAD)) {
  998. + soup_server_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED,
  999. + NULL);
  1000. goto on_error;
  1001. }
  1002. hf = prv_host_server_find_file(hs, path, &file_name);
  1003. if (!hf) {
  1004. - soup_message_set_status(msg, SOUP_STATUS_NOT_FOUND);
  1005. + soup_server_message_set_status(msg, SOUP_STATUS_NOT_FOUND,
  1006. + NULL);
  1007. goto on_error;
  1008. }
  1009. - hdr = soup_message_headers_get_one(msg->request_headers,
  1010. - "getContentFeatures.dlna.org");
  1011. + SoupMessageHeaders *request_headers =
  1012. + soup_server_message_get_request_headers(msg);
  1013. + SoupMessageHeaders *response_headers =
  1014. + soup_server_message_get_response_headers(msg);
  1015. + hdr = soup_message_headers_get_one(request_headers,
  1016. + "getContentFeatures.dlna.org");
  1017. if (hdr) {
  1018. if (strcmp(hdr, "1") != 0) {
  1019. - soup_message_set_status(msg, SOUP_STATUS_BAD_REQUEST);
  1020. + soup_server_message_set_status(
  1021. + msg, SOUP_STATUS_BAD_REQUEST, NULL);
  1022. goto on_error;
  1023. }
  1024. if ((hf->dlna_header) && strlen(hf->dlna_header) > 0)
  1025. - soup_message_headers_append(msg->response_headers,
  1026. - "contentFeatures.dlna.org",
  1027. - hf->dlna_header);
  1028. +
  1029. + soup_message_headers_append(response_headers,
  1030. + "contentFeatures.dlna.org",
  1031. + hf->dlna_header);
  1032. }
  1033. if (hf->mapped_file) {
  1034. @@ -342,33 +350,32 @@
  1035. NULL);
  1036. if (!hf->mapped_file) {
  1037. - soup_message_set_status(msg,
  1038. - SOUP_STATUS_NOT_FOUND);
  1039. + soup_server_message_set_status(
  1040. + msg, SOUP_STATUS_NOT_FOUND, NULL);
  1041. goto on_error;
  1042. }
  1043. hf->mapped_count = 1;
  1044. }
  1045. - if (msg->method == SOUP_METHOD_GET) {
  1046. + if(method == SOUP_METHOD_GET) {
  1047. g_signal_connect(msg, "finished",
  1048. G_CALLBACK(prv_soup_message_finished_cb), hf);
  1049. - soup_message_set_response(
  1050. - msg, hf->mime_type,
  1051. - SOUP_MEMORY_STATIC,
  1052. - g_mapped_file_get_contents(hf->mapped_file),
  1053. - g_mapped_file_get_length(hf->mapped_file));
  1054. + soup_server_message_set_response(
  1055. + msg, hf->mime_type, SOUP_MEMORY_STATIC,
  1056. + g_mapped_file_get_contents(hf->mapped_file),
  1057. + g_mapped_file_get_length(hf->mapped_file));
  1058. } else {
  1059. - soup_message_headers_set_content_type(msg->response_headers,
  1060. - hf->mime_type, NULL);
  1061. + soup_message_headers_set_content_type(response_headers,
  1062. + hf->mime_type, NULL);
  1063. soup_message_headers_set_content_length(
  1064. - msg->response_headers,
  1065. + response_headers,
  1066. g_mapped_file_get_length(hf->mapped_file));
  1067. }
  1068. - soup_message_set_status(msg, SOUP_STATUS_OK);
  1069. + soup_server_message_set_status(msg, SOUP_STATUS_OK, NULL);
  1070. on_error:
  1071. @@ -380,27 +387,24 @@
  1072. GError **error)
  1073. {
  1074. dlr_host_server_t *server = NULL;
  1075. - SoupAddress *addr;
  1076. -
  1077. - addr = soup_address_new(device_if, port);
  1078. -
  1079. - if (soup_address_resolve_sync(addr, NULL) != SOUP_STATUS_OK) {
  1080. - *error = g_error_new(DLEYNA_SERVER_ERROR,
  1081. - DLEYNA_ERROR_HOST_FAILED,
  1082. - "Unable to create host server on %s",
  1083. - device_if);
  1084. - goto on_error;
  1085. - }
  1086. server = g_new(dlr_host_server_t, 1);
  1087. server->files = g_hash_table_new_full(g_str_hash, g_str_equal,
  1088. g_free, prv_host_file_delete);
  1089. - server->soup_server = soup_server_new(SOUP_SERVER_INTERFACE, addr,
  1090. - NULL);
  1091. + server->soup_server = soup_server_new(NULL, NULL);
  1092. + GSocketAddress *addr =
  1093. + g_inet_socket_address_new_from_string(device_if, port);
  1094. + soup_server_listen(server->soup_server, addr,
  1095. + (SoupServerListenOptions) 0, error);
  1096. soup_server_add_handler(server->soup_server, DLR_HOST_SERVICE_ROOT,
  1097. - prv_soup_server_cb, server, NULL);
  1098. - soup_server_run_async(server->soup_server);
  1099. + prv_soup_server_cb, server, NULL);
  1100. +
  1101. + if(error != NULL && *error != NULL) {
  1102. + g_clear_object(&server->soup_server);
  1103. + goto on_error;
  1104. + }
  1105. +
  1106. server->counter = 0;
  1107. on_error:
  1108. @@ -429,6 +433,7 @@
  1109. unsigned int i;
  1110. dlr_host_file_t *hf;
  1111. gchar *str;
  1112. + g_autoslist(GUri) uris = NULL;
  1113. hf = g_hash_table_lookup(server->files, file);
  1114. @@ -449,9 +454,9 @@
  1115. g_ptr_array_add(hf->clients, g_strdup(client));
  1116. }
  1117. + uris = soup_server_get_uris(server->soup_server);
  1118. str = g_strdup_printf("http://%s:%d%s", device_if,
  1119. - soup_server_get_port(server->soup_server),
  1120. - hf->path);
  1121. + g_uri_get_port(uris->data), hf->path);
  1122. return str;
  1123. diff -Nuar a/libdleyna/renderer/manager.c b/libdleyna/renderer/manager.c
  1124. --- a/libdleyna/renderer/manager.c 2021-10-26 18:51:33.000000000 +0300
  1125. +++ b/libdleyna/renderer/manager.c 2022-06-03 00:20:47.000000000 +0300
  1126. @@ -20,12 +20,14 @@
  1127. *
  1128. */
  1129. +#include <config.h>
  1130. +
  1131. #include <glib.h>
  1132. #include <string.h>
  1133. +#include <libdleyna/core/context-filter.h>
  1134. #include <libdleyna/core/error.h>
  1135. #include <libdleyna/core/log.h>
  1136. -#include <libdleyna/core/white-list.h>
  1137. #include "async.h"
  1138. #include "manager.h"
  1139. @@ -35,14 +37,14 @@
  1140. struct dlr_manager_t_ {
  1141. dleyna_connector_id_t connection;
  1142. GUPnPContextManager *cm;
  1143. - dleyna_white_list_t *wl;
  1144. + dleyna_context_filter_t *cf;
  1145. };
  1146. -static GVariant *prv_build_wl_entries(dleyna_settings_t *settings)
  1147. +static GVariant *prv_build_cf_entries(dleyna_settings_t *settings)
  1148. {
  1149. GVariant *result;
  1150. - result = dleyna_settings_white_list_entries(settings);
  1151. + result = dleyna_settings_context_filter_entries(settings);
  1152. if (result == NULL)
  1153. result = g_variant_new("as", NULL);
  1154. @@ -57,13 +59,13 @@
  1155. dleyna_settings_is_never_quit(
  1156. settings)));
  1157. - g_variant_builder_add(vb, "{sv}", DLR_INTERFACE_PROP_WHITE_LIST_ENABLED,
  1158. - g_variant_new_boolean(
  1159. - dleyna_settings_is_white_list_enabled(
  1160. - settings)));
  1161. + g_variant_builder_add(
  1162. + vb, "{sv}", DLR_INTERFACE_PROP_WHITE_LIST_ENABLED,
  1163. + g_variant_new_boolean(
  1164. + dleyna_settings_is_context_filter_enabled(settings)));
  1165. g_variant_builder_add(vb, "{sv}", DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES,
  1166. - prv_build_wl_entries(settings));
  1167. + prv_build_cf_entries(settings));
  1168. }
  1169. static GVariant *prv_get_prop(dleyna_settings_t *settings, const gchar *prop)
  1170. @@ -79,10 +81,9 @@
  1171. settings)));
  1172. else if (!strcmp(prop, DLR_INTERFACE_PROP_WHITE_LIST_ENABLED))
  1173. retval = g_variant_ref_sink(g_variant_new_boolean(
  1174. - dleyna_settings_is_white_list_enabled(
  1175. - settings)));
  1176. + dleyna_settings_is_context_filter_enabled(settings)));
  1177. else if (!strcmp(prop, DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES))
  1178. - retval = g_variant_ref_sink(prv_build_wl_entries(settings));
  1179. + retval = g_variant_ref_sink(prv_build_cf_entries(settings));
  1180. #if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG
  1181. if (retval) {
  1182. @@ -95,9 +96,8 @@
  1183. return retval;
  1184. }
  1185. -static void prv_wl_notify_prop(dlr_manager_t *manager,
  1186. - const gchar *prop_name,
  1187. - GVariant *prop_val)
  1188. +static void prv_cf_notify_prop(dlr_manager_t *manager, const gchar *prop_name,
  1189. + GVariant *prop_val)
  1190. {
  1191. GVariant *val;
  1192. GVariantBuilder array;
  1193. @@ -122,13 +122,13 @@
  1194. GUPnPContextManager *connection_manager)
  1195. {
  1196. dlr_manager_t *manager = g_new0(dlr_manager_t, 1);
  1197. - GUPnPWhiteList *gupnp_wl;
  1198. + GUPnPContextFilter *gupnp_cf;
  1199. - gupnp_wl = gupnp_context_manager_get_white_list(connection_manager);
  1200. + gupnp_cf = gupnp_context_manager_get_context_filter(connection_manager);
  1201. manager->connection = connection;
  1202. manager->cm = connection_manager;
  1203. - manager->wl = dleyna_white_list_new(gupnp_wl);
  1204. + manager->cf = dleyna_context_filter_new(gupnp_cf);
  1205. return manager;
  1206. }
  1207. @@ -136,14 +136,14 @@
  1208. void dlr_manager_delete(dlr_manager_t *manager)
  1209. {
  1210. if (manager != NULL) {
  1211. - dleyna_white_list_delete(manager->wl);
  1212. + dleyna_context_filter_delete(manager->cf);
  1213. g_free(manager);
  1214. }
  1215. }
  1216. -dleyna_white_list_t *dlr_manager_get_white_list(dlr_manager_t *manager)
  1217. +dleyna_context_filter_t *dlr_manager_get_context_filter(dlr_manager_t *manager)
  1218. {
  1219. - return manager->wl;
  1220. + return manager->cf;
  1221. }
  1222. void dlr_manager_get_all_props(dlr_manager_t *manager,
  1223. @@ -243,9 +243,8 @@
  1224. if (*error == NULL) {
  1225. prop_val = g_variant_new_boolean(never_quit);
  1226. - prv_wl_notify_prop(manager,
  1227. - DLR_INTERFACE_PROP_NEVER_QUIT,
  1228. - prop_val);
  1229. + prv_cf_notify_prop(manager, DLR_INTERFACE_PROP_NEVER_QUIT,
  1230. + prop_val);
  1231. }
  1232. exit:
  1233. @@ -253,31 +252,30 @@
  1234. return;
  1235. }
  1236. -static void prv_set_prop_wl_enabled(dlr_manager_t *manager,
  1237. - dleyna_settings_t *settings,
  1238. - gboolean enabled,
  1239. - GError **error)
  1240. +static void prv_set_prop_cf_enabled(dlr_manager_t *manager,
  1241. + dleyna_settings_t *settings,
  1242. + gboolean enabled, GError **error)
  1243. {
  1244. GVariant *prop_val;
  1245. gboolean old_val;
  1246. DLEYNA_LOG_DEBUG("Enter %d", enabled);
  1247. - old_val = dleyna_settings_is_white_list_enabled(settings);
  1248. + old_val = dleyna_settings_is_context_filter_enabled(settings);
  1249. if (old_val == enabled)
  1250. goto exit;
  1251. /* If no error, the white list will be updated in the reload callack
  1252. */
  1253. - dleyna_settings_set_white_list_enabled(settings, enabled, error);
  1254. + dleyna_settings_set_context_filter_enabled(settings, enabled, error);
  1255. if (*error == NULL) {
  1256. - dleyna_white_list_enable(manager->wl, enabled);
  1257. + dleyna_context_filter_enable(manager->cf, enabled);
  1258. prop_val = g_variant_new_boolean(enabled);
  1259. - prv_wl_notify_prop(manager,
  1260. - DLR_INTERFACE_PROP_WHITE_LIST_ENABLED,
  1261. - prop_val);
  1262. + prv_cf_notify_prop(manager,
  1263. + DLR_INTERFACE_PROP_WHITE_LIST_ENABLED,
  1264. + prop_val);
  1265. }
  1266. exit:
  1267. @@ -285,10 +283,9 @@
  1268. return;
  1269. }
  1270. -static void prv_set_prop_wl_entries(dlr_manager_t *manager,
  1271. - dleyna_settings_t *settings,
  1272. - GVariant *entries,
  1273. - GError **error)
  1274. +static void prv_set_prop_cf_entries(dlr_manager_t *manager,
  1275. + dleyna_settings_t *settings,
  1276. + GVariant *entries, GError **error)
  1277. {
  1278. DLEYNA_LOG_DEBUG("Enter");
  1279. @@ -304,15 +301,15 @@
  1280. /* If no error, the white list will be updated in the reload callack
  1281. * callack
  1282. */
  1283. - dleyna_settings_set_white_list_entries(settings, entries, error);
  1284. + dleyna_settings_set_context_filter_entries(settings, entries, error);
  1285. if (*error == NULL) {
  1286. - dleyna_white_list_clear(manager->wl);
  1287. - dleyna_white_list_add_entries(manager->wl, entries);
  1288. + dleyna_context_filter_clear(manager->cf);
  1289. + dleyna_context_filter_add_entries(manager->cf, entries);
  1290. - prv_wl_notify_prop(manager,
  1291. - DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES,
  1292. - entries);
  1293. + prv_cf_notify_prop(manager,
  1294. + DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES,
  1295. + entries);
  1296. }
  1297. exit:
  1298. DLEYNA_LOG_DEBUG("Exit");
  1299. @@ -352,11 +349,10 @@
  1300. g_variant_get_boolean(param),
  1301. &error);
  1302. else if (!strcmp(name, DLR_INTERFACE_PROP_WHITE_LIST_ENABLED))
  1303. - prv_set_prop_wl_enabled(manager, settings,
  1304. - g_variant_get_boolean(param),
  1305. - &error);
  1306. + prv_set_prop_cf_enabled(manager, settings,
  1307. + g_variant_get_boolean(param), &error);
  1308. else if (!strcmp(name, DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES))
  1309. - prv_set_prop_wl_entries(manager, settings, param, &error);
  1310. + prv_set_prop_cf_entries(manager, settings, param, &error);
  1311. else
  1312. cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
  1313. DLEYNA_ERROR_UNKNOWN_PROPERTY,
  1314. diff -Nuar a/libdleyna/renderer/manager.h b/libdleyna/renderer/manager.h
  1315. --- a/libdleyna/renderer/manager.h 2021-10-26 18:51:33.000000000 +0300
  1316. +++ b/libdleyna/renderer/manager.h 2022-06-03 00:20:47.000000000 +0300
  1317. @@ -24,6 +24,7 @@
  1318. #define DLR_MANAGER_H__
  1319. #include <libdleyna/core/connector.h>
  1320. +#include <libdleyna/core/context-filter.h>
  1321. #include <libdleyna/core/settings.h>
  1322. #include <libgupnp/gupnp-context-manager.h>
  1323. @@ -37,7 +38,7 @@
  1324. void dlr_manager_delete(dlr_manager_t *manager);
  1325. -dleyna_white_list_t *dlr_manager_get_white_list(dlr_manager_t *manager);
  1326. +dleyna_context_filter_t *dlr_manager_get_context_filter(dlr_manager_t *manager);
  1327. void dlr_manager_get_all_props(dlr_manager_t *manager,
  1328. dleyna_settings_t *settings,
  1329. diff -Nuar a/libdleyna/renderer/server.c b/libdleyna/renderer/server.c
  1330. --- a/libdleyna/renderer/server.c 2021-10-26 18:51:33.000000000 +0300
  1331. +++ b/libdleyna/renderer/server.c 2022-06-03 00:20:47.000000000 +0300
  1332. @@ -20,6 +20,7 @@
  1333. *
  1334. */
  1335. +#include <config.h>
  1336. #include <signal.h>
  1337. #include <stdbool.h>
  1338. @@ -30,11 +31,11 @@
  1339. #include <syslog.h>
  1340. #include <libdleyna/core/connector.h>
  1341. +#include <libdleyna/core/context-filter.h>
  1342. #include <libdleyna/core/control-point.h>
  1343. #include <libdleyna/core/error.h>
  1344. #include <libdleyna/core/log.h>
  1345. #include <libdleyna/core/task-processor.h>
  1346. -#include <libdleyna/core/white-list.h>
  1347. #include "async.h"
  1348. #include "control-point-renderer.h"
  1349. @@ -138,358 +139,336 @@
  1350. static const gchar g_root_introspection[] =
  1351. "<node>"
  1352. - " <interface name='"DLEYNA_SERVER_INTERFACE_MANAGER"'>"
  1353. - " <method name='"DLR_INTERFACE_GET_VERSION"'>"
  1354. - " <arg type='s' name='"DLR_INTERFACE_VERSION"'"
  1355. + " <interface name='" DLEYNA_SERVER_INTERFACE_MANAGER "'>"
  1356. + " <method name='" DLR_INTERFACE_GET_VERSION "'>"
  1357. + " <arg type='s' name='" DLR_INTERFACE_VERSION "'"
  1358. " direction='out'/>"
  1359. " </method>"
  1360. - " <method name='"DLR_INTERFACE_RELEASE"'>"
  1361. + " <method name='" DLR_INTERFACE_RELEASE "'>"
  1362. " </method>"
  1363. - " <method name='"DLR_INTERFACE_GET_RENDERERS"'>"
  1364. - " <arg type='ao' name='"DLR_INTERFACE_RENDERERS"'"
  1365. + " <method name='" DLR_INTERFACE_GET_RENDERERS "'>"
  1366. + " <arg type='ao' name='" DLR_INTERFACE_RENDERERS "'"
  1367. " direction='out'/>"
  1368. " </method>"
  1369. - " <method name='"DLR_INTERFACE_RESCAN"'>"
  1370. + " <method name='" DLR_INTERFACE_RESCAN "'>"
  1371. " </method>"
  1372. - " <signal name='"DLR_INTERFACE_FOUND_RENDERER"'>"
  1373. - " <arg type='o' name='"DLR_INTERFACE_PATH"'/>"
  1374. + " <signal name='" DLR_INTERFACE_FOUND_RENDERER "'>"
  1375. + " <arg type='o' name='" DLR_INTERFACE_PATH "'/>"
  1376. " </signal>"
  1377. - " <signal name='"DLR_INTERFACE_LOST_RENDERER"'>"
  1378. - " <arg type='o' name='"DLR_INTERFACE_PATH"'/>"
  1379. + " <signal name='" DLR_INTERFACE_LOST_RENDERER "'>"
  1380. + " <arg type='o' name='" DLR_INTERFACE_PATH "'/>"
  1381. " </signal>"
  1382. - " <property type='as' name='"DLR_INTERFACE_PROP_NEVER_QUIT"'"
  1383. + " <property type='as' name='" DLR_INTERFACE_PROP_NEVER_QUIT "'"
  1384. " access='readwrite'/>"
  1385. - " <property type='as' name='"DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES"'"
  1386. + " <property type='as' name='" DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES
  1387. + "'"
  1388. " access='readwrite'/>"
  1389. - " <property type='b' name='"DLR_INTERFACE_PROP_WHITE_LIST_ENABLED"'"
  1390. + " <property type='b' name='" DLR_INTERFACE_PROP_WHITE_LIST_ENABLED
  1391. + "'"
  1392. " access='readwrite'/>"
  1393. " </interface>"
  1394. - " <interface name='"DLR_INTERFACE_PROPERTIES"'>"
  1395. - " <method name='"DLR_INTERFACE_GET"'>"
  1396. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1397. + " <interface name='" DLR_INTERFACE_PROPERTIES "'>"
  1398. + " <method name='" DLR_INTERFACE_GET "'>"
  1399. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1400. " direction='in'/>"
  1401. - " <arg type='s' name='"DLR_INTERFACE_PROPERTY_NAME"'"
  1402. + " <arg type='s' name='" DLR_INTERFACE_PROPERTY_NAME "'"
  1403. " direction='in'/>"
  1404. - " <arg type='v' name='"DLR_INTERFACE_VALUE"'"
  1405. + " <arg type='v' name='" DLR_INTERFACE_VALUE "'"
  1406. " direction='out'/>"
  1407. " </method>"
  1408. - " <method name='"DLR_INTERFACE_GET_ALL"'>"
  1409. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1410. + " <method name='" DLR_INTERFACE_GET_ALL "'>"
  1411. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1412. " direction='in'/>"
  1413. - " <arg type='a{sv}' name='"DLR_INTERFACE_PROPERTIES_VALUE"'"
  1414. + " <arg type='a{sv}' name='" DLR_INTERFACE_PROPERTIES_VALUE "'"
  1415. " direction='out'/>"
  1416. " </method>"
  1417. - " <method name='"DLR_INTERFACE_SET"'>"
  1418. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1419. + " <method name='" DLR_INTERFACE_SET "'>"
  1420. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1421. " direction='in'/>"
  1422. - " <arg type='s' name='"DLR_INTERFACE_PROPERTY_NAME"'"
  1423. + " <arg type='s' name='" DLR_INTERFACE_PROPERTY_NAME "'"
  1424. " direction='in'/>"
  1425. - " <arg type='v' name='"DLR_INTERFACE_VALUE"'"
  1426. + " <arg type='v' name='" DLR_INTERFACE_VALUE "'"
  1427. " direction='in'/>"
  1428. " </method>"
  1429. - " <signal name='"DLR_INTERFACE_PROPERTIES_CHANGED"'>"
  1430. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'/>"
  1431. - " <arg type='a{sv}' name='"DLR_INTERFACE_CHANGED_PROPERTIES"'/>"
  1432. - " <arg type='as' name='"
  1433. - DLR_INTERFACE_INVALIDATED_PROPERTIES"'/>"
  1434. + " <signal name='" DLR_INTERFACE_PROPERTIES_CHANGED "'>"
  1435. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'/>"
  1436. + " <arg type='a{sv}' name='" DLR_INTERFACE_CHANGED_PROPERTIES "'/>"
  1437. + " <arg type='as' name='" DLR_INTERFACE_INVALIDATED_PROPERTIES "'/>"
  1438. " </signal>"
  1439. " </interface>"
  1440. "</node>";
  1441. static const gchar g_server_introspection[] =
  1442. "<node>"
  1443. - " <interface name='"DLR_INTERFACE_PROPERTIES"'>"
  1444. - " <method name='"DLR_INTERFACE_GET"'>"
  1445. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1446. + " <interface name='" DLR_INTERFACE_PROPERTIES "'>"
  1447. + " <method name='" DLR_INTERFACE_GET "'>"
  1448. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1449. " direction='in'/>"
  1450. - " <arg type='s' name='"DLR_INTERFACE_PROPERTY_NAME"'"
  1451. + " <arg type='s' name='" DLR_INTERFACE_PROPERTY_NAME "'"
  1452. " direction='in'/>"
  1453. - " <arg type='v' name='"DLR_INTERFACE_VALUE"'"
  1454. + " <arg type='v' name='" DLR_INTERFACE_VALUE "'"
  1455. " direction='out'/>"
  1456. " </method>"
  1457. - " <method name='"DLR_INTERFACE_GET_ALL"'>"
  1458. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1459. + " <method name='" DLR_INTERFACE_GET_ALL "'>"
  1460. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1461. " direction='in'/>"
  1462. - " <arg type='a{sv}' name='"DLR_INTERFACE_PROPERTIES_VALUE"'"
  1463. + " <arg type='a{sv}' name='" DLR_INTERFACE_PROPERTIES_VALUE "'"
  1464. " direction='out'/>"
  1465. " </method>"
  1466. - " <method name='"DLR_INTERFACE_SET"'>"
  1467. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'"
  1468. + " <method name='" DLR_INTERFACE_SET "'>"
  1469. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'"
  1470. " direction='in'/>"
  1471. - " <arg type='s' name='"DLR_INTERFACE_PROPERTY_NAME"'"
  1472. + " <arg type='s' name='" DLR_INTERFACE_PROPERTY_NAME "'"
  1473. " direction='in'/>"
  1474. - " <arg type='v' name='"DLR_INTERFACE_VALUE"'"
  1475. + " <arg type='v' name='" DLR_INTERFACE_VALUE "'"
  1476. " direction='in'/>"
  1477. " </method>"
  1478. - " <signal name='"DLR_INTERFACE_PROPERTIES_CHANGED"'>"
  1479. - " <arg type='s' name='"DLR_INTERFACE_INTERFACE_NAME"'/>"
  1480. - " <arg type='a{sv}' name='"DLR_INTERFACE_CHANGED_PROPERTIES"'/>"
  1481. - " <arg type='as' name='"DLR_INTERFACE_INVALIDATED_PROPERTIES"'/>"
  1482. + " <signal name='" DLR_INTERFACE_PROPERTIES_CHANGED "'>"
  1483. + " <arg type='s' name='" DLR_INTERFACE_INTERFACE_NAME "'/>"
  1484. + " <arg type='a{sv}' name='" DLR_INTERFACE_CHANGED_PROPERTIES "'/>"
  1485. + " <arg type='as' name='" DLR_INTERFACE_INVALIDATED_PROPERTIES "'/>"
  1486. " </signal>"
  1487. " </interface>"
  1488. - " <interface name='"DLR_INTERFACE_SERVER"'>"
  1489. - " <method name='"DLR_INTERFACE_RAISE"'>"
  1490. + " <interface name='" DLR_INTERFACE_SERVER "'>"
  1491. + " <method name='" DLR_INTERFACE_RAISE "'>"
  1492. " </method>"
  1493. - " <method name='"DLR_INTERFACE_QUIT"'>"
  1494. + " <method name='" DLR_INTERFACE_QUIT "'>"
  1495. " </method>"
  1496. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_QUIT"'"
  1497. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_QUIT "'"
  1498. " access='read'/>"
  1499. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_RAISE"'"
  1500. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_RAISE "'"
  1501. " access='read'/>"
  1502. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_SET_FULLSCREEN"'"
  1503. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_SET_FULLSCREEN
  1504. + "'"
  1505. " access='read'/>"
  1506. - " <property type='b' name='"DLR_INTERFACE_PROP_HAS_TRACK_LIST"'"
  1507. + " <property type='b' name='" DLR_INTERFACE_PROP_HAS_TRACK_LIST "'"
  1508. " access='read'/>"
  1509. - " <property type='s' name='"DLR_INTERFACE_PROP_IDENTITY"'"
  1510. + " <property type='s' name='" DLR_INTERFACE_PROP_IDENTITY "'"
  1511. " access='read'/>"
  1512. - " <property type='as' name='"DLR_INTERFACE_PROP_SUPPORTED_URIS"'"
  1513. + " <property type='as' name='" DLR_INTERFACE_PROP_SUPPORTED_URIS "'"
  1514. " access='read'/>"
  1515. - " <property type='as' name='"DLR_INTERFACE_PROP_SUPPORTED_MIME"'"
  1516. + " <property type='as' name='" DLR_INTERFACE_PROP_SUPPORTED_MIME "'"
  1517. " access='read'/>"
  1518. " </interface>"
  1519. - " <interface name='"DLR_INTERFACE_PLAYER"'>"
  1520. - " <method name='"DLR_INTERFACE_PLAY"'>"
  1521. + " <interface name='" DLR_INTERFACE_PLAYER "'>"
  1522. + " <method name='" DLR_INTERFACE_PLAY "'>"
  1523. " </method>"
  1524. - " <method name='"DLR_INTERFACE_PAUSE"'>"
  1525. + " <method name='" DLR_INTERFACE_PAUSE "'>"
  1526. " </method>"
  1527. - " <method name='"DLR_INTERFACE_PLAY_PAUSE"'>"
  1528. + " <method name='" DLR_INTERFACE_PLAY_PAUSE "'>"
  1529. " </method>"
  1530. - " <method name='"DLR_INTERFACE_STOP"'>"
  1531. + " <method name='" DLR_INTERFACE_STOP "'>"
  1532. " </method>"
  1533. - " <method name='"DLR_INTERFACE_NEXT"'>"
  1534. + " <method name='" DLR_INTERFACE_NEXT "'>"
  1535. " </method>"
  1536. - " <method name='"DLR_INTERFACE_PREVIOUS"'>"
  1537. + " <method name='" DLR_INTERFACE_PREVIOUS "'>"
  1538. " </method>"
  1539. - " <method name='"DLR_INTERFACE_OPEN_URI"'>"
  1540. - " <arg type='s' name='"DLR_INTERFACE_URI"'"
  1541. + " <method name='" DLR_INTERFACE_OPEN_URI "'>"
  1542. + " <arg type='s' name='" DLR_INTERFACE_URI "'"
  1543. " direction='in'/>"
  1544. " </method>"
  1545. - " <method name='"DLR_INTERFACE_OPEN_URI_EX"'>"
  1546. - " <arg type='s' name='"DLR_INTERFACE_URI"'"
  1547. + " <method name='" DLR_INTERFACE_OPEN_URI_EX "'>"
  1548. + " <arg type='s' name='" DLR_INTERFACE_URI "'"
  1549. " direction='in'/>"
  1550. - " <arg type='s' name='"DLR_INTERFACE_METADATA"'"
  1551. + " <arg type='s' name='" DLR_INTERFACE_METADATA "'"
  1552. " direction='in'/>"
  1553. " </method>"
  1554. - " <method name='"DLR_INTERFACE_OPEN_NEXT_URI"'>"
  1555. - " <arg type='s' name='"DLR_INTERFACE_URI"'"
  1556. + " <method name='" DLR_INTERFACE_OPEN_NEXT_URI "'>"
  1557. + " <arg type='s' name='" DLR_INTERFACE_URI "'"
  1558. " direction='in'/>"
  1559. - " <arg type='s' name='"DLR_INTERFACE_METADATA"'"
  1560. + " <arg type='s' name='" DLR_INTERFACE_METADATA "'"
  1561. " direction='in'/>"
  1562. " </method>"
  1563. - " <method name='"DLR_INTERFACE_SET_URI"'>"
  1564. - " <arg type='s' name='"DLR_INTERFACE_URI"'"
  1565. + " <method name='" DLR_INTERFACE_SET_URI "'>"
  1566. + " <arg type='s' name='" DLR_INTERFACE_URI "'"
  1567. " direction='in'/>"
  1568. - " <arg type='s' name='"DLR_INTERFACE_METADATA"'"
  1569. + " <arg type='s' name='" DLR_INTERFACE_METADATA "'"
  1570. " direction='in'/>"
  1571. " </method>"
  1572. - " <method name='"DLR_INTERFACE_SEEK"'>"
  1573. - " <arg type='x' name='"DLR_INTERFACE_OFFSET"'"
  1574. + " <method name='" DLR_INTERFACE_SEEK "'>"
  1575. + " <arg type='x' name='" DLR_INTERFACE_OFFSET "'"
  1576. " direction='in'/>"
  1577. " </method>"
  1578. - " <method name='"DLR_INTERFACE_BYTE_SEEK"'>"
  1579. - " <arg type='x' name='"DLR_INTERFACE_OFFSET"'"
  1580. + " <method name='" DLR_INTERFACE_BYTE_SEEK "'>"
  1581. + " <arg type='x' name='" DLR_INTERFACE_OFFSET "'"
  1582. " direction='in'/>"
  1583. " </method>"
  1584. - " <method name='"DLR_INTERFACE_SET_POSITION"'>"
  1585. - " <arg type='o' name='"DLR_INTERFACE_TRACKID"'"
  1586. + " <method name='" DLR_INTERFACE_SET_POSITION "'>"
  1587. + " <arg type='o' name='" DLR_INTERFACE_TRACKID "'"
  1588. " direction='in'/>"
  1589. - " <arg type='x' name='"DLR_INTERFACE_POSITION"'"
  1590. + " <arg type='x' name='" DLR_INTERFACE_POSITION "'"
  1591. " direction='in'/>"
  1592. " </method>"
  1593. - " <method name='"DLR_INTERFACE_SET_BYTE_POSITION"'>"
  1594. - " <arg type='o' name='"DLR_INTERFACE_TRACKID"'"
  1595. + " <method name='" DLR_INTERFACE_SET_BYTE_POSITION "'>"
  1596. + " <arg type='o' name='" DLR_INTERFACE_TRACKID "'"
  1597. " direction='in'/>"
  1598. - " <arg type='x' name='"DLR_INTERFACE_BYTE_POSITION"'"
  1599. + " <arg type='x' name='" DLR_INTERFACE_BYTE_POSITION "'"
  1600. " direction='in'/>"
  1601. " </method>"
  1602. - " <method name='"DLR_INTERFACE_GOTO_TRACK"'>"
  1603. - " <arg type='u' name='"DLR_INTERFACE_TRACK_NUMBER"'"
  1604. + " <method name='" DLR_INTERFACE_GOTO_TRACK "'>"
  1605. + " <arg type='u' name='" DLR_INTERFACE_TRACK_NUMBER "'"
  1606. " direction='in'/>"
  1607. " </method>"
  1608. - " <property type='s' name='"DLR_INTERFACE_PROP_PLAYBACK_STATUS"'"
  1609. + " <property type='s' name='" DLR_INTERFACE_PROP_PLAYBACK_STATUS "'"
  1610. " access='read'/>"
  1611. - " <property type='d' name='"DLR_INTERFACE_PROP_RATE"'"
  1612. + " <property type='d' name='" DLR_INTERFACE_PROP_RATE "'"
  1613. " access='readwrite'/>"
  1614. - " <property type='d' name='"DLR_INTERFACE_PROP_MINIMUM_RATE"'"
  1615. + " <property type='d' name='" DLR_INTERFACE_PROP_MINIMUM_RATE "'"
  1616. " access='read'/>"
  1617. - " <property type='d' name='"DLR_INTERFACE_PROP_MAXIMUM_RATE"'"
  1618. + " <property type='d' name='" DLR_INTERFACE_PROP_MAXIMUM_RATE "'"
  1619. " access='read'/>"
  1620. " <property type='ad'"
  1621. - " name='"DLR_INTERFACE_PROP_TRANSPORT_PLAY_SPEEDS"'"
  1622. + " name='" DLR_INTERFACE_PROP_TRANSPORT_PLAY_SPEEDS "'"
  1623. " access='read'/>"
  1624. - " <property type='d' name='"DLR_INTERFACE_PROP_VOLUME"'"
  1625. + " <property type='d' name='" DLR_INTERFACE_PROP_VOLUME "'"
  1626. " access='readwrite'/>"
  1627. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_PLAY"'"
  1628. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_PLAY "'"
  1629. " access='read'/>"
  1630. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_SEEK"'"
  1631. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_SEEK "'"
  1632. " access='read'/>"
  1633. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_BYTE_SEEK"'"
  1634. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_BYTE_SEEK "'"
  1635. " access='read'/>"
  1636. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_CONTROL"'"
  1637. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_CONTROL "'"
  1638. " access='read'/>"
  1639. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_PAUSE"'"
  1640. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_PAUSE "'"
  1641. " access='read'/>"
  1642. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_NEXT"'"
  1643. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_NEXT "'"
  1644. " access='read'/>"
  1645. - " <property type='b' name='"DLR_INTERFACE_PROP_CAN_PREVIOUS"'"
  1646. + " <property type='b' name='" DLR_INTERFACE_PROP_CAN_PREVIOUS "'"
  1647. " access='read'/>"
  1648. - " <property type='x' name='"DLR_INTERFACE_PROP_POSITION"'"
  1649. + " <property type='x' name='" DLR_INTERFACE_PROP_POSITION "'"
  1650. " access='read'/>"
  1651. - " <property type='x' name='"DLR_INTERFACE_PROP_BYTE_POSITION"'"
  1652. + " <property type='x' name='" DLR_INTERFACE_PROP_BYTE_POSITION "'"
  1653. " access='read'/>"
  1654. - " <property type='a{sv}' name='"DLR_INTERFACE_PROP_METADATA"'"
  1655. + " <property type='a{sv}' name='" DLR_INTERFACE_PROP_METADATA "'"
  1656. " access='read'/>"
  1657. - " <property type='u' name='"DLR_INTERFACE_PROP_CURRENT_TRACK"'"
  1658. + " <property type='u' name='" DLR_INTERFACE_PROP_CURRENT_TRACK "'"
  1659. " access='read'/>"
  1660. - " <property type='u' name='"DLR_INTERFACE_PROP_NUMBER_OF_TRACKS"'"
  1661. + " <property type='u' name='" DLR_INTERFACE_PROP_NUMBER_OF_TRACKS "'"
  1662. " access='read'/>"
  1663. - " <property type='b' name='"DLR_INTERFACE_PROP_MUTE"'"
  1664. + " <property type='b' name='" DLR_INTERFACE_PROP_MUTE "'"
  1665. " access='readwrite'/>"
  1666. " </interface>"
  1667. - " <interface name='"DLEYNA_INTERFACE_PUSH_HOST"'>"
  1668. - " <method name='"DLR_INTERFACE_HOST_FILE"'>"
  1669. - " <arg type='s' name='"DLR_INTERFACE_PATH"'"
  1670. + " <interface name='" DLEYNA_INTERFACE_PUSH_HOST "'>"
  1671. + " <method name='" DLR_INTERFACE_HOST_FILE "'>"
  1672. + " <arg type='s' name='" DLR_INTERFACE_PATH "'"
  1673. " direction='in'/>"
  1674. - " <arg type='s' name='"DLR_INTERFACE_URI"'"
  1675. + " <arg type='s' name='" DLR_INTERFACE_URI "'"
  1676. " direction='out'/>"
  1677. " </method>"
  1678. - " <method name='"DLR_INTERFACE_REMOVE_FILE"'>"
  1679. - " <arg type='s' name='"DLR_INTERFACE_PATH"'"
  1680. + " <method name='" DLR_INTERFACE_REMOVE_FILE "'>"
  1681. + " <arg type='s' name='" DLR_INTERFACE_PATH "'"
  1682. " direction='in'/>"
  1683. " </method>"
  1684. " </interface>"
  1685. - " <interface name='"DLEYNA_SERVER_INTERFACE_RENDERER_DEVICE"'>"
  1686. - " <method name='"DLR_INTERFACE_CANCEL"'>"
  1687. + " <interface name='" DLEYNA_SERVER_INTERFACE_RENDERER_DEVICE "'>"
  1688. + " <method name='" DLR_INTERFACE_CANCEL "'>"
  1689. " </method>"
  1690. - " <method name='"DLR_INTERFACE_GET_ICON"'>"
  1691. - " <arg type='s' name='"DLR_INTERFACE_REQ_MIME_TYPE"'"
  1692. + " <method name='" DLR_INTERFACE_GET_ICON "'>"
  1693. + " <arg type='s' name='" DLR_INTERFACE_REQ_MIME_TYPE "'"
  1694. " direction='in'/>"
  1695. - " <arg type='s' name='"DLR_INTERFACE_RESOLUTION"'"
  1696. + " <arg type='s' name='" DLR_INTERFACE_RESOLUTION "'"
  1697. " direction='in'/>"
  1698. - " <arg type='ay' name='"DLR_INTERFACE_ICON_BYTES"'"
  1699. + " <arg type='ay' name='" DLR_INTERFACE_ICON_BYTES "'"
  1700. " direction='out'/>"
  1701. - " <arg type='s' name='"DLR_INTERFACE_MIME_TYPE"'"
  1702. + " <arg type='s' name='" DLR_INTERFACE_MIME_TYPE "'"
  1703. " direction='out'/>"
  1704. " </method>"
  1705. " <property type='as' "
  1706. - " name='"DLR_INTERFACE_PROP_DLNA_DEVICE_CLASSES"'"
  1707. + " name='" DLR_INTERFACE_PROP_DLNA_DEVICE_CLASSES "'"
  1708. " access='read'/>"
  1709. - " <property type='s' name='"DLR_INTERFACE_PROP_DEVICE_TYPE"'"
  1710. + " <property type='s' name='" DLR_INTERFACE_PROP_DEVICE_TYPE "'"
  1711. " access='read'/>"
  1712. - " <property type='s' name='"DLR_INTERFACE_PROP_UDN"'"
  1713. + " <property type='s' name='" DLR_INTERFACE_PROP_UDN "'"
  1714. " access='read'/>"
  1715. - " <property type='s' name='"DLR_INTERFACE_PROP_FRIENDLY_NAME"'"
  1716. + " <property type='s' name='" DLR_INTERFACE_PROP_FRIENDLY_NAME "'"
  1717. " access='read'/>"
  1718. - " <property type='s' name='"DLR_INTERFACE_PROP_ICON_URL"'"
  1719. + " <property type='s' name='" DLR_INTERFACE_PROP_ICON_URL "'"
  1720. " access='read'/>"
  1721. - " <property type='s' name='"DLR_INTERFACE_PROP_MANUFACTURER"'"
  1722. + " <property type='s' name='" DLR_INTERFACE_PROP_MANUFACTURER "'"
  1723. " access='read'/>"
  1724. - " <property type='s' name='"DLR_INTERFACE_PROP_MANUFACTURER_URL"'"
  1725. + " <property type='s' name='" DLR_INTERFACE_PROP_MANUFACTURER_URL "'"
  1726. " access='read'/>"
  1727. - " <property type='s' name='"DLR_INTERFACE_PROP_MODEL_DESCRIPTION"'"
  1728. + " <property type='s' name='" DLR_INTERFACE_PROP_MODEL_DESCRIPTION "'"
  1729. " access='read'/>"
  1730. - " <property type='s' name='"DLR_INTERFACE_PROP_MODEL_NAME"'"
  1731. + " <property type='s' name='" DLR_INTERFACE_PROP_MODEL_NAME "'"
  1732. " access='read'/>"
  1733. - " <property type='s' name='"DLR_INTERFACE_PROP_MODEL_NUMBER"'"
  1734. + " <property type='s' name='" DLR_INTERFACE_PROP_MODEL_NUMBER "'"
  1735. " access='read'/>"
  1736. - " <property type='s' name='"DLR_INTERFACE_PROP_SERIAL_NUMBER"'"
  1737. + " <property type='s' name='" DLR_INTERFACE_PROP_SERIAL_NUMBER "'"
  1738. " access='read'/>"
  1739. - " <property type='s' name='"DLR_INTERFACE_PROP_PRESENTATION_URL"'"
  1740. + " <property type='s' name='" DLR_INTERFACE_PROP_PRESENTATION_URL "'"
  1741. " access='read'/>"
  1742. - " <property type='s' name='"DLR_INTERFACE_PROP_PROTOCOL_INFO"'"
  1743. + " <property type='s' name='" DLR_INTERFACE_PROP_PROTOCOL_INFO "'"
  1744. " access='read'/>"
  1745. " </interface>"
  1746. "</node>";
  1747. static const gchar *g_manager_interfaces[DLR_MANAGER_INTERFACE_INFO_MAX] = {
  1748. /* MUST be in the exact same order as g_root_introspection */
  1749. - DLEYNA_SERVER_INTERFACE_MANAGER,
  1750. - DLR_INTERFACE_PROPERTIES
  1751. + DLEYNA_SERVER_INTERFACE_MANAGER, DLR_INTERFACE_PROPERTIES
  1752. };
  1753. static void prv_process_task(dleyna_task_atom_t *task, gpointer user_data);
  1754. -static void prv_manager_root_method_call(dleyna_connector_id_t conn,
  1755. - const gchar *sender,
  1756. - const gchar *object,
  1757. - const gchar *interface,
  1758. - const gchar *method,
  1759. - GVariant *parameters,
  1760. - dleyna_connector_msg_id_t invocation);
  1761. -
  1762. -static void prv_manager_props_method_call(dleyna_connector_id_t conn,
  1763. - const gchar *sender,
  1764. - const gchar *object,
  1765. - const gchar *interface,
  1766. - const gchar *method,
  1767. - GVariant *parameters,
  1768. - dleyna_connector_msg_id_t invocation);
  1769. +static void prv_manager_root_method_call(
  1770. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  1771. + const gchar *interface, const gchar *method, GVariant *parameters,
  1772. + dleyna_connector_msg_id_t invocation);
  1773. +
  1774. +static void prv_manager_props_method_call(
  1775. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  1776. + const gchar *interface, const gchar *method, GVariant *parameters,
  1777. + dleyna_connector_msg_id_t invocation);
  1778. static void prv_dlr_device_method_call(dleyna_connector_id_t conn,
  1779. - const gchar *sender,
  1780. - const gchar *object,
  1781. - const gchar *interface,
  1782. - const gchar *method,
  1783. - GVariant *parameters,
  1784. - dleyna_connector_msg_id_t invocation);
  1785. + const gchar *sender, const gchar *object,
  1786. + const gchar *interface,
  1787. + const gchar *method,
  1788. + GVariant *parameters,
  1789. + dleyna_connector_msg_id_t invocation);
  1790. static void prv_props_method_call(dleyna_connector_id_t conn,
  1791. - const gchar *sender,
  1792. - const gchar *object,
  1793. - const gchar *interface,
  1794. - const gchar *method,
  1795. - GVariant *parameters,
  1796. - dleyna_connector_msg_id_t invocation);
  1797. + const gchar *sender, const gchar *object,
  1798. + const gchar *interface, const gchar *method,
  1799. + GVariant *parameters,
  1800. + dleyna_connector_msg_id_t invocation);
  1801. static void prv_dlr_player_method_call(dleyna_connector_id_t conn,
  1802. - const gchar *sender,
  1803. - const gchar *object,
  1804. - const gchar *interface,
  1805. - const gchar *method,
  1806. - GVariant *parameters,
  1807. - dleyna_connector_msg_id_t invocation);
  1808. -
  1809. -static void prv_dlr_push_host_method_call(dleyna_connector_id_t conn,
  1810. - const gchar *sender,
  1811. - const gchar *object,
  1812. - const gchar *interface,
  1813. - const gchar *method,
  1814. - GVariant *parameters,
  1815. - dleyna_connector_msg_id_t invocation);
  1816. + const gchar *sender, const gchar *object,
  1817. + const gchar *interface,
  1818. + const gchar *method,
  1819. + GVariant *parameters,
  1820. + dleyna_connector_msg_id_t invocation);
  1821. +
  1822. +static void prv_dlr_push_host_method_call(
  1823. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  1824. + const gchar *interface, const gchar *method, GVariant *parameters,
  1825. + dleyna_connector_msg_id_t invocation);
  1826. static void prv_renderer_device_method_call(
  1827. - dleyna_connector_id_t conn,
  1828. - const gchar *sender,
  1829. - const gchar *object,
  1830. - const gchar *interface,
  1831. - const gchar *method,
  1832. - GVariant *parameters,
  1833. - dleyna_connector_msg_id_t invocation);
  1834. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  1835. + const gchar *interface, const gchar *method, GVariant *parameters,
  1836. + dleyna_connector_msg_id_t invocation);
  1837. static const dleyna_connector_dispatch_cb_t
  1838. - g_root_vtables[DLR_MANAGER_INTERFACE_INFO_MAX] = {
  1839. - /* MUST be in the exact same order as g_root_introspection */
  1840. - prv_manager_root_method_call,
  1841. - prv_manager_props_method_call
  1842. -};
  1843. + g_root_vtables[DLR_MANAGER_INTERFACE_INFO_MAX] = {
  1844. + /* MUST be in the exact same order as g_root_introspection */
  1845. + prv_manager_root_method_call, prv_manager_props_method_call
  1846. + };
  1847. static const dleyna_connector_dispatch_cb_t
  1848. - g_server_vtables[DLR_INTERFACE_INFO_MAX] = {
  1849. - /* MUST be in the exact same order as g_server_introspection */
  1850. - prv_props_method_call,
  1851. - prv_dlr_device_method_call,
  1852. - prv_dlr_player_method_call,
  1853. - prv_dlr_push_host_method_call,
  1854. - prv_renderer_device_method_call
  1855. -};
  1856. + g_server_vtables[DLR_INTERFACE_INFO_MAX] = {
  1857. + /* MUST be in the exact same order as g_server_introspection */
  1858. + prv_props_method_call, prv_dlr_device_method_call,
  1859. + prv_dlr_player_method_call, prv_dlr_push_host_method_call,
  1860. + prv_renderer_device_method_call
  1861. + };
  1862. static const gchar *g_server_interfaces[DLR_INTERFACE_INFO_MAX] = {
  1863. /* MUST be in the exact same order as g_server_introspection */
  1864. - DLR_INTERFACE_PROPERTIES,
  1865. - DLR_INTERFACE_SERVER,
  1866. - DLR_INTERFACE_PLAYER,
  1867. - DLEYNA_INTERFACE_PUSH_HOST,
  1868. - DLEYNA_SERVER_INTERFACE_RENDERER_DEVICE
  1869. + DLR_INTERFACE_PROPERTIES, DLR_INTERFACE_SERVER, DLR_INTERFACE_PLAYER,
  1870. + DLEYNA_INTERFACE_PUSH_HOST, DLEYNA_SERVER_INTERFACE_RENDERER_DEVICE
  1871. };
  1872. const gchar *dlr_renderer_get_interface_name(guint index)
  1873. @@ -516,10 +495,10 @@
  1874. {
  1875. GError *error;
  1876. - switch (task->type) {
  1877. + switch(task->type) {
  1878. case DLR_TASK_GET_VERSION:
  1879. - task->result = g_variant_ref_sink(g_variant_new_string(
  1880. - VERSION));
  1881. + task->result =
  1882. + g_variant_ref_sink(g_variant_new_string(VERSION));
  1883. dlr_task_complete(task);
  1884. break;
  1885. case DLR_TASK_GET_SERVERS:
  1886. @@ -533,8 +512,8 @@
  1887. case DLR_TASK_RAISE:
  1888. case DLR_TASK_QUIT:
  1889. error = g_error_new(DLEYNA_SERVER_ERROR,
  1890. - DLEYNA_ERROR_NOT_SUPPORTED,
  1891. - "Command not supported.");
  1892. + DLEYNA_ERROR_NOT_SUPPORTED,
  1893. + "Command not supported.");
  1894. dlr_task_fail(task, error);
  1895. g_error_free(error);
  1896. break;
  1897. @@ -553,7 +532,7 @@
  1898. {
  1899. DLEYNA_LOG_DEBUG("Enter");
  1900. - if (!error) {
  1901. + if(!error) {
  1902. dlr_task_complete(task);
  1903. } else {
  1904. dlr_task_fail(task, error);
  1905. @@ -567,92 +546,87 @@
  1906. static void prv_process_async_task(dlr_task_t *task)
  1907. {
  1908. - dlr_async_task_t *async_task = (dlr_async_task_t *)task;
  1909. + dlr_async_task_t *async_task = (dlr_async_task_t *) task;
  1910. DLEYNA_LOG_DEBUG("Enter");
  1911. async_task->cancellable = g_cancellable_new();
  1912. - switch (task->type) {
  1913. + switch(task->type) {
  1914. case DLR_TASK_GET_PROP:
  1915. dlr_upnp_get_prop(g_context.upnp, task,
  1916. - prv_async_task_complete);
  1917. + prv_async_task_complete);
  1918. break;
  1919. case DLR_TASK_GET_ALL_PROPS:
  1920. dlr_upnp_get_all_props(g_context.upnp, task,
  1921. - prv_async_task_complete);
  1922. + prv_async_task_complete);
  1923. break;
  1924. case DLR_TASK_SET_PROP:
  1925. dlr_upnp_set_prop(g_context.upnp, task,
  1926. - prv_async_task_complete);
  1927. + prv_async_task_complete);
  1928. break;
  1929. case DLR_TASK_PLAY:
  1930. - dlr_upnp_play(g_context.upnp, task,
  1931. - prv_async_task_complete);
  1932. + dlr_upnp_play(g_context.upnp, task, prv_async_task_complete);
  1933. break;
  1934. case DLR_TASK_PAUSE:
  1935. - dlr_upnp_pause(g_context.upnp, task,
  1936. - prv_async_task_complete);
  1937. + dlr_upnp_pause(g_context.upnp, task, prv_async_task_complete);
  1938. break;
  1939. case DLR_TASK_PLAY_PAUSE:
  1940. dlr_upnp_play_pause(g_context.upnp, task,
  1941. - prv_async_task_complete);
  1942. + prv_async_task_complete);
  1943. break;
  1944. case DLR_TASK_STOP:
  1945. - dlr_upnp_stop(g_context.upnp, task,
  1946. - prv_async_task_complete);
  1947. + dlr_upnp_stop(g_context.upnp, task, prv_async_task_complete);
  1948. break;
  1949. case DLR_TASK_NEXT:
  1950. - dlr_upnp_next(g_context.upnp, task,
  1951. - prv_async_task_complete);
  1952. + dlr_upnp_next(g_context.upnp, task, prv_async_task_complete);
  1953. break;
  1954. case DLR_TASK_PREVIOUS:
  1955. dlr_upnp_previous(g_context.upnp, task,
  1956. - prv_async_task_complete);
  1957. + prv_async_task_complete);
  1958. break;
  1959. case DLR_TASK_OPEN_URI:
  1960. case DLR_TASK_OPEN_NEXT_URI:
  1961. case DLR_TASK_SET_URI:
  1962. dlr_upnp_open_uri(g_context.upnp, task,
  1963. - prv_async_task_complete);
  1964. + prv_async_task_complete);
  1965. break;
  1966. case DLR_TASK_SEEK:
  1967. case DLR_TASK_BYTE_SEEK:
  1968. - dlr_upnp_seek(g_context.upnp, task,
  1969. - prv_async_task_complete);
  1970. + dlr_upnp_seek(g_context.upnp, task, prv_async_task_complete);
  1971. break;
  1972. case DLR_TASK_SET_POSITION:
  1973. case DLR_TASK_SET_BYTE_POSITION:
  1974. dlr_upnp_set_position(g_context.upnp, task,
  1975. - prv_async_task_complete);
  1976. + prv_async_task_complete);
  1977. break;
  1978. case DLR_TASK_GOTO_TRACK:
  1979. dlr_upnp_goto_track(g_context.upnp, task,
  1980. - prv_async_task_complete);
  1981. + prv_async_task_complete);
  1982. break;
  1983. case DLR_TASK_HOST_URI:
  1984. dlr_upnp_host_uri(g_context.upnp, task,
  1985. - prv_async_task_complete);
  1986. + prv_async_task_complete);
  1987. break;
  1988. case DLR_TASK_REMOVE_URI:
  1989. dlr_upnp_remove_uri(g_context.upnp, task,
  1990. - prv_async_task_complete);
  1991. + prv_async_task_complete);
  1992. break;
  1993. case DLR_TASK_GET_ICON:
  1994. dlr_upnp_get_icon(g_context.upnp, task,
  1995. - prv_async_task_complete);
  1996. + prv_async_task_complete);
  1997. break;
  1998. case DLR_TASK_MANAGER_GET_PROP:
  1999. dlr_manager_get_prop(g_context.manager, g_context.settings,
  2000. - task, prv_async_task_complete);
  2001. + task, prv_async_task_complete);
  2002. break;
  2003. case DLR_TASK_MANAGER_GET_ALL_PROPS:
  2004. dlr_manager_get_all_props(g_context.manager, g_context.settings,
  2005. - task, prv_async_task_complete);
  2006. + task, prv_async_task_complete);
  2007. break;
  2008. case DLR_TASK_MANAGER_SET_PROP:
  2009. dlr_manager_set_prop(g_context.manager, g_context.settings,
  2010. - task, prv_async_task_complete);
  2011. + task, prv_async_task_complete);
  2012. break;
  2013. default:
  2014. break;
  2015. @@ -663,9 +637,9 @@
  2016. static void prv_process_task(dleyna_task_atom_t *task, gpointer user_data)
  2017. {
  2018. - dlr_task_t *client_task = (dlr_task_t *)task;
  2019. + dlr_task_t *client_task = (dlr_task_t *) task;
  2020. - if (client_task->synchronous)
  2021. + if(client_task->synchronous)
  2022. prv_process_sync_task(client_task);
  2023. else
  2024. prv_process_async_task(client_task);
  2025. @@ -673,26 +647,26 @@
  2026. static void prv_cancel_task(dleyna_task_atom_t *task, gpointer user_data)
  2027. {
  2028. - dlr_task_cancel((dlr_task_t *)task);
  2029. + dlr_task_cancel((dlr_task_t *) task);
  2030. }
  2031. static void prv_delete_task(dleyna_task_atom_t *task, gpointer user_data)
  2032. {
  2033. - dlr_task_delete((dlr_task_t *)task);
  2034. + dlr_task_delete((dlr_task_t *) task);
  2035. }
  2036. static void prv_remove_client(const gchar *name)
  2037. {
  2038. dleyna_task_processor_remove_queues_for_source(g_context.processor,
  2039. - name);
  2040. + name);
  2041. dlr_upnp_lost_client(g_context.upnp, name);
  2042. - if (g_context.watchers > 0)
  2043. + if(g_context.watchers > 0)
  2044. g_context.watchers--;
  2045. - if (g_context.watchers == 0)
  2046. - if (!dleyna_settings_is_never_quit(g_context.settings))
  2047. + if(g_context.watchers == 0)
  2048. + if(!dleyna_settings_is_never_quit(g_context.settings))
  2049. dleyna_task_processor_set_quitting(g_context.processor);
  2050. }
  2051. @@ -703,8 +677,8 @@
  2052. }
  2053. static void prv_control_point_initialize(const dleyna_connector_t *connector,
  2054. - dleyna_task_processor_t *processor,
  2055. - dleyna_settings_t *settings)
  2056. + dleyna_task_processor_t *processor,
  2057. + dleyna_settings_t *settings)
  2058. {
  2059. memset(&g_context, 0, sizeof(g_context));
  2060. @@ -720,69 +694,61 @@
  2061. {
  2062. uint i;
  2063. - if (g_context.upnp) {
  2064. + if(g_context.upnp) {
  2065. dlr_upnp_unsubscribe(g_context.upnp);
  2066. dlr_upnp_delete(g_context.upnp);
  2067. g_context.upnp = NULL;
  2068. }
  2069. - if (g_context.connection) {
  2070. - for (i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++)
  2071. - if (g_context.dlr_id[i])
  2072. + if(g_context.connection) {
  2073. + for(i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++)
  2074. + if(g_context.dlr_id[i])
  2075. g_context.connector->unpublish_object(
  2076. - g_context.connection,
  2077. - g_context.dlr_id[i]);
  2078. + g_context.connection,
  2079. + g_context.dlr_id[i]);
  2080. }
  2081. }
  2082. -static void prv_control_point_free(void)
  2083. -{
  2084. -}
  2085. +static void prv_control_point_free(void) {}
  2086. static void prv_add_task(dlr_task_t *task, const gchar *source,
  2087. - const gchar *sink)
  2088. + const gchar *sink)
  2089. {
  2090. const dleyna_task_queue_key_t *queue_id;
  2091. - if (g_context.connector->watch_client(source))
  2092. + if(g_context.connector->watch_client(source))
  2093. g_context.watchers++;
  2094. queue_id = dleyna_task_processor_lookup_queue(g_context.processor,
  2095. - source, sink);
  2096. - if (!queue_id)
  2097. + source, sink);
  2098. + if(!queue_id)
  2099. queue_id = dleyna_task_processor_add_queue(
  2100. - g_context.processor,
  2101. - source,
  2102. - sink,
  2103. - DLEYNA_TASK_QUEUE_FLAG_AUTO_START,
  2104. - prv_process_task,
  2105. - prv_cancel_task,
  2106. - prv_delete_task);
  2107. + g_context.processor, source, sink,
  2108. + DLEYNA_TASK_QUEUE_FLAG_AUTO_START, prv_process_task,
  2109. + prv_cancel_task, prv_delete_task);
  2110. dleyna_task_queue_add_task(queue_id, &task->atom);
  2111. }
  2112. static void prv_manager_root_method_call(
  2113. - dleyna_connector_id_t conn,
  2114. - const gchar *sender, const gchar *object,
  2115. - const gchar *interface,
  2116. - const gchar *method, GVariant *parameters,
  2117. - dleyna_connector_msg_id_t invocation)
  2118. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  2119. + const gchar *interface, const gchar *method, GVariant *parameters,
  2120. + dleyna_connector_msg_id_t invocation)
  2121. {
  2122. dlr_task_t *task;
  2123. DLEYNA_LOG_INFO("Calling %s method", method);
  2124. - if (!strcmp(method, DLR_INTERFACE_RELEASE)) {
  2125. + if(!strcmp(method, DLR_INTERFACE_RELEASE)) {
  2126. g_context.connector->unwatch_client(sender);
  2127. prv_remove_client(sender);
  2128. g_context.connector->return_response(invocation, NULL);
  2129. } else {
  2130. - if (!strcmp(method, DLR_INTERFACE_GET_VERSION))
  2131. + if(!strcmp(method, DLR_INTERFACE_GET_VERSION))
  2132. task = dlr_task_get_version_new(invocation);
  2133. - else if (!strcmp(method, DLR_INTERFACE_GET_RENDERERS))
  2134. + else if(!strcmp(method, DLR_INTERFACE_GET_RENDERERS))
  2135. task = dlr_task_get_servers_new(invocation);
  2136. - else if (!strcmp(method, DLR_INTERFACE_RESCAN))
  2137. + else if(!strcmp(method, DLR_INTERFACE_RESCAN))
  2138. task = dlr_task_rescan_new(invocation);
  2139. else
  2140. goto finished;
  2141. @@ -795,30 +761,27 @@
  2142. return;
  2143. }
  2144. -static void prv_manager_props_method_call(dleyna_connector_id_t conn,
  2145. - const gchar *sender,
  2146. - const gchar *object,
  2147. - const gchar *interface,
  2148. - const gchar *method,
  2149. - GVariant *parameters,
  2150. - dleyna_connector_msg_id_t invocation)
  2151. +static void prv_manager_props_method_call(
  2152. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  2153. + const gchar *interface, const gchar *method, GVariant *parameters,
  2154. + dleyna_connector_msg_id_t invocation)
  2155. {
  2156. dlr_task_t *task;
  2157. GError *error = NULL;
  2158. - if (!strcmp(method, DLR_INTERFACE_GET_ALL))
  2159. + if(!strcmp(method, DLR_INTERFACE_GET_ALL))
  2160. task = dlr_task_manager_get_props_new(invocation, object,
  2161. - parameters, &error);
  2162. - else if (!strcmp(method, DLR_INTERFACE_GET))
  2163. + parameters, &error);
  2164. + else if(!strcmp(method, DLR_INTERFACE_GET))
  2165. task = dlr_task_manager_get_prop_new(invocation, object,
  2166. - parameters, &error);
  2167. - else if (!strcmp(method, DLR_INTERFACE_SET))
  2168. + parameters, &error);
  2169. + else if(!strcmp(method, DLR_INTERFACE_SET))
  2170. task = dlr_task_manager_set_prop_new(invocation, object,
  2171. - parameters, &error);
  2172. + parameters, &error);
  2173. else
  2174. goto finished;
  2175. - if (!task) {
  2176. + if(!task) {
  2177. g_context.connector->return_error(invocation, error);
  2178. g_error_free(error);
  2179. @@ -836,16 +799,16 @@
  2180. {
  2181. dlr_device_t *device;
  2182. - device = dlr_device_from_path(object,
  2183. - dlr_upnp_get_server_udn_map(g_context.upnp));
  2184. + device = dlr_device_from_path(
  2185. + object, dlr_upnp_get_server_udn_map(g_context.upnp));
  2186. -
  2187. - if (!device) {
  2188. + if(!device) {
  2189. DLEYNA_LOG_WARNING("Cannot locate device for %s", object);
  2190. *error = g_error_new(DLEYNA_SERVER_ERROR,
  2191. - DLEYNA_ERROR_OBJECT_NOT_FOUND,
  2192. - "Cannot locate device corresponding to the specified path");
  2193. + DLEYNA_ERROR_OBJECT_NOT_FOUND,
  2194. + "Cannot locate device corresponding to "
  2195. + "the specified path");
  2196. goto on_error;
  2197. }
  2198. @@ -857,30 +820,28 @@
  2199. }
  2200. static void prv_props_method_call(dleyna_connector_id_t conn,
  2201. - const gchar *sender,
  2202. - const gchar *object,
  2203. - const gchar *interface,
  2204. - const gchar *method,
  2205. - GVariant *parameters,
  2206. - dleyna_connector_msg_id_t invocation)
  2207. + const gchar *sender, const gchar *object,
  2208. + const gchar *interface, const gchar *method,
  2209. + GVariant *parameters,
  2210. + dleyna_connector_msg_id_t invocation)
  2211. {
  2212. dlr_task_t *task;
  2213. const gchar *device_id;
  2214. GError *error = NULL;
  2215. device_id = prv_get_device_id(object, &error);
  2216. - if (!device_id) {
  2217. + if(!device_id) {
  2218. g_context.connector->return_error(invocation, error);
  2219. g_error_free(error);
  2220. goto finished;
  2221. }
  2222. - if (!strcmp(method, DLR_INTERFACE_GET_ALL))
  2223. + if(!strcmp(method, DLR_INTERFACE_GET_ALL))
  2224. task = dlr_task_get_props_new(invocation, object, parameters);
  2225. - else if (!strcmp(method, DLR_INTERFACE_GET))
  2226. + else if(!strcmp(method, DLR_INTERFACE_GET))
  2227. task = dlr_task_get_prop_new(invocation, object, parameters);
  2228. - else if (!strcmp(method, DLR_INTERFACE_SET))
  2229. + else if(!strcmp(method, DLR_INTERFACE_SET))
  2230. task = dlr_task_set_prop_new(invocation, object, parameters);
  2231. else
  2232. goto finished;
  2233. @@ -893,28 +854,27 @@
  2234. }
  2235. static void prv_dlr_device_method_call(dleyna_connector_id_t conn,
  2236. - const gchar *sender,
  2237. - const gchar *object,
  2238. - const gchar *interface,
  2239. - const gchar *method,
  2240. - GVariant *parameters,
  2241. - dleyna_connector_msg_id_t invocation)
  2242. + const gchar *sender, const gchar *object,
  2243. + const gchar *interface,
  2244. + const gchar *method,
  2245. + GVariant *parameters,
  2246. + dleyna_connector_msg_id_t invocation)
  2247. {
  2248. dlr_task_t *task;
  2249. const gchar *device_id;
  2250. GError *error = NULL;
  2251. device_id = prv_get_device_id(object, &error);
  2252. - if (!device_id) {
  2253. + if(!device_id) {
  2254. g_context.connector->return_error(invocation, error);
  2255. g_error_free(error);
  2256. goto finished;
  2257. }
  2258. - if (!strcmp(method, DLR_INTERFACE_RAISE))
  2259. + if(!strcmp(method, DLR_INTERFACE_RAISE))
  2260. task = dlr_task_raise_new(invocation);
  2261. - else if (!strcmp(method, DLR_INTERFACE_QUIT))
  2262. + else if(!strcmp(method, DLR_INTERFACE_QUIT))
  2263. task = dlr_task_quit_new(invocation);
  2264. else
  2265. goto finished;
  2266. @@ -927,57 +887,56 @@
  2267. }
  2268. static void prv_dlr_player_method_call(dleyna_connector_id_t conn,
  2269. - const gchar *sender,
  2270. - const gchar *object,
  2271. - const gchar *interface,
  2272. - const gchar *method,
  2273. - GVariant *parameters,
  2274. - dleyna_connector_msg_id_t invocation)
  2275. + const gchar *sender, const gchar *object,
  2276. + const gchar *interface,
  2277. + const gchar *method,
  2278. + GVariant *parameters,
  2279. + dleyna_connector_msg_id_t invocation)
  2280. {
  2281. dlr_task_t *task;
  2282. const gchar *device_id;
  2283. GError *error = NULL;
  2284. device_id = prv_get_device_id(object, &error);
  2285. - if (!device_id) {
  2286. + if(!device_id) {
  2287. g_context.connector->return_error(invocation, error);
  2288. g_error_free(error);
  2289. goto finished;
  2290. }
  2291. - if (!strcmp(method, DLR_INTERFACE_PLAY))
  2292. + if(!strcmp(method, DLR_INTERFACE_PLAY))
  2293. task = dlr_task_play_new(invocation, object);
  2294. - else if (!strcmp(method, DLR_INTERFACE_PAUSE))
  2295. + else if(!strcmp(method, DLR_INTERFACE_PAUSE))
  2296. task = dlr_task_pause_new(invocation, object);
  2297. - else if (!strcmp(method, DLR_INTERFACE_PLAY_PAUSE))
  2298. + else if(!strcmp(method, DLR_INTERFACE_PLAY_PAUSE))
  2299. task = dlr_task_play_pause_new(invocation, object);
  2300. - else if (!strcmp(method, DLR_INTERFACE_STOP))
  2301. + else if(!strcmp(method, DLR_INTERFACE_STOP))
  2302. task = dlr_task_stop_new(invocation, object);
  2303. - else if (!strcmp(method, DLR_INTERFACE_NEXT))
  2304. + else if(!strcmp(method, DLR_INTERFACE_NEXT))
  2305. task = dlr_task_next_new(invocation, object);
  2306. - else if (!strcmp(method, DLR_INTERFACE_PREVIOUS))
  2307. + else if(!strcmp(method, DLR_INTERFACE_PREVIOUS))
  2308. task = dlr_task_previous_new(invocation, object);
  2309. - else if (!strcmp(method, DLR_INTERFACE_OPEN_URI))
  2310. + else if(!strcmp(method, DLR_INTERFACE_OPEN_URI))
  2311. task = dlr_task_open_uri_new(invocation, object, parameters);
  2312. - else if (!strcmp(method, DLR_INTERFACE_OPEN_URI_EX))
  2313. + else if(!strcmp(method, DLR_INTERFACE_OPEN_URI_EX))
  2314. task = dlr_task_open_uri_ex_new(invocation, object, parameters);
  2315. - else if (!strcmp(method, DLR_INTERFACE_OPEN_NEXT_URI))
  2316. + else if(!strcmp(method, DLR_INTERFACE_OPEN_NEXT_URI))
  2317. task = dlr_task_open_next_uri_new(invocation, object,
  2318. - parameters);
  2319. - else if (!strcmp(method, DLR_INTERFACE_SET_URI))
  2320. + parameters);
  2321. + else if(!strcmp(method, DLR_INTERFACE_SET_URI))
  2322. task = dlr_task_set_uri_new(invocation, object, parameters);
  2323. - else if (!strcmp(method, DLR_INTERFACE_SEEK))
  2324. + else if(!strcmp(method, DLR_INTERFACE_SEEK))
  2325. task = dlr_task_seek_new(invocation, object, parameters);
  2326. - else if (!strcmp(method, DLR_INTERFACE_BYTE_SEEK))
  2327. + else if(!strcmp(method, DLR_INTERFACE_BYTE_SEEK))
  2328. task = dlr_task_byte_seek_new(invocation, object, parameters);
  2329. - else if (!strcmp(method, DLR_INTERFACE_SET_POSITION))
  2330. + else if(!strcmp(method, DLR_INTERFACE_SET_POSITION))
  2331. task = dlr_task_set_position_new(invocation, object,
  2332. - parameters);
  2333. - else if (!strcmp(method, DLR_INTERFACE_SET_BYTE_POSITION))
  2334. + parameters);
  2335. + else if(!strcmp(method, DLR_INTERFACE_SET_BYTE_POSITION))
  2336. task = dlr_task_set_byte_position_new(invocation, object,
  2337. - parameters);
  2338. - else if (!strcmp(method, DLR_INTERFACE_GOTO_TRACK))
  2339. + parameters);
  2340. + else if(!strcmp(method, DLR_INTERFACE_GOTO_TRACK))
  2341. task = dlr_task_goto_track_new(invocation, object, parameters);
  2342. else
  2343. goto finished;
  2344. @@ -989,32 +948,29 @@
  2345. return;
  2346. }
  2347. -static void prv_dlr_push_host_method_call(dleyna_connector_id_t conn,
  2348. - const gchar *sender,
  2349. - const gchar *object,
  2350. - const gchar *interface,
  2351. - const gchar *method,
  2352. - GVariant *parameters,
  2353. - dleyna_connector_msg_id_t invocation)
  2354. +static void prv_dlr_push_host_method_call(
  2355. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  2356. + const gchar *interface, const gchar *method, GVariant *parameters,
  2357. + dleyna_connector_msg_id_t invocation)
  2358. {
  2359. dlr_task_t *task;
  2360. const gchar *device_id;
  2361. GError *error = NULL;
  2362. device_id = prv_get_device_id(object, &error);
  2363. - if (!device_id) {
  2364. + if(!device_id) {
  2365. g_context.connector->return_error(invocation, error);
  2366. g_error_free(error);
  2367. goto on_error;
  2368. }
  2369. - if (!strcmp(method, DLR_INTERFACE_HOST_FILE))
  2370. + if(!strcmp(method, DLR_INTERFACE_HOST_FILE))
  2371. task = dlr_task_host_uri_new(invocation, object, sender,
  2372. - parameters);
  2373. - else if (!strcmp(method, DLR_INTERFACE_REMOVE_FILE))
  2374. + parameters);
  2375. + else if(!strcmp(method, DLR_INTERFACE_REMOVE_FILE))
  2376. task = dlr_task_remove_uri_new(invocation, object, sender,
  2377. - parameters);
  2378. + parameters);
  2379. else
  2380. goto on_error;
  2381. @@ -1026,13 +982,9 @@
  2382. }
  2383. static void prv_renderer_device_method_call(
  2384. - dleyna_connector_id_t conn,
  2385. - const gchar *sender,
  2386. - const gchar *object,
  2387. - const gchar *interface,
  2388. - const gchar *method,
  2389. - GVariant *parameters,
  2390. - dleyna_connector_msg_id_t invocation)
  2391. + dleyna_connector_id_t conn, const gchar *sender, const gchar *object,
  2392. + const gchar *interface, const gchar *method, GVariant *parameters,
  2393. + dleyna_connector_msg_id_t invocation)
  2394. {
  2395. dlr_task_t *task;
  2396. const gchar *device_id = NULL;
  2397. @@ -1040,22 +992,21 @@
  2398. const dleyna_task_queue_key_t *queue_id;
  2399. device_id = prv_get_device_id(object, &error);
  2400. - if (!device_id) {
  2401. + if(!device_id) {
  2402. g_context.connector->return_error(invocation, error);
  2403. g_error_free(error);
  2404. goto finished;
  2405. }
  2406. - if (!strcmp(method, DLR_INTERFACE_CANCEL)) {
  2407. + if(!strcmp(method, DLR_INTERFACE_CANCEL)) {
  2408. queue_id = dleyna_task_processor_lookup_queue(
  2409. - g_context.processor,
  2410. - sender, device_id);
  2411. - if (queue_id)
  2412. + g_context.processor, sender, device_id);
  2413. + if(queue_id)
  2414. dleyna_task_processor_cancel_queue(queue_id);
  2415. g_context.connector->return_response(invocation, NULL);
  2416. - } else if (!strcmp(method, DLR_INTERFACE_GET_ICON)) {
  2417. + } else if(!strcmp(method, DLR_INTERFACE_GET_ICON)) {
  2418. task = dlr_task_get_icon_new(invocation, object, parameters);
  2419. prv_add_task(task, sender, device_id);
  2420. @@ -1070,75 +1021,67 @@
  2421. {
  2422. DLEYNA_LOG_INFO("New media server %s", path);
  2423. - (void) g_context.connector->notify(g_context.connection,
  2424. - DLEYNA_SERVER_OBJECT,
  2425. - DLEYNA_SERVER_INTERFACE_MANAGER,
  2426. - DLR_INTERFACE_FOUND_RENDERER,
  2427. - g_variant_new("(o)", path),
  2428. - NULL);
  2429. + (void) g_context.connector->notify(
  2430. + g_context.connection, DLEYNA_SERVER_OBJECT,
  2431. + DLEYNA_SERVER_INTERFACE_MANAGER, DLR_INTERFACE_FOUND_RENDERER,
  2432. + g_variant_new("(o)", path), NULL);
  2433. }
  2434. static void prv_lost_media_server(const gchar *path)
  2435. {
  2436. DLEYNA_LOG_INFO("Lost %s", path);
  2437. - (void) g_context.connector->notify(g_context.connection,
  2438. - DLEYNA_SERVER_OBJECT,
  2439. - DLEYNA_SERVER_INTERFACE_MANAGER,
  2440. - DLR_INTERFACE_LOST_RENDERER,
  2441. - g_variant_new("(o)", path),
  2442. - NULL);
  2443. + (void) g_context.connector->notify(
  2444. + g_context.connection, DLEYNA_SERVER_OBJECT,
  2445. + DLEYNA_SERVER_INTERFACE_MANAGER, DLR_INTERFACE_LOST_RENDERER,
  2446. + g_variant_new("(o)", path), NULL);
  2447. dleyna_task_processor_remove_queues_for_sink(g_context.processor, path);
  2448. }
  2449. -static void prv_white_list_init(void)
  2450. +static void prv_context_filter_init(void)
  2451. {
  2452. gboolean enabled;
  2453. GVariant *entries;
  2454. - dleyna_white_list_t *wl;
  2455. + dleyna_context_filter_t *cf;
  2456. DLEYNA_LOG_DEBUG("Enter");
  2457. - enabled = dleyna_settings_is_white_list_enabled(g_context.settings);
  2458. - entries = dleyna_settings_white_list_entries(g_context.settings);
  2459. + enabled = dleyna_settings_is_context_filter_enabled(g_context.settings);
  2460. + entries = dleyna_settings_context_filter_entries(g_context.settings);
  2461. - wl = dlr_manager_get_white_list(g_context.manager);
  2462. + cf = dlr_manager_get_context_filter(g_context.manager);
  2463. - dleyna_white_list_enable(wl, enabled);
  2464. - dleyna_white_list_add_entries(wl, entries);
  2465. + dleyna_context_filter_enable(cf, enabled);
  2466. + dleyna_context_filter_add_entries(cf, entries);
  2467. DLEYNA_LOG_DEBUG("Exit");
  2468. }
  2469. static gboolean prv_control_point_start_service(
  2470. - dleyna_connector_id_t connection)
  2471. + dleyna_connector_id_t connection)
  2472. {
  2473. gboolean retval = TRUE;
  2474. uint i;
  2475. g_context.connection = connection;
  2476. - for (i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++)
  2477. + for(i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++)
  2478. g_context.dlr_id[i] = g_context.connector->publish_object(
  2479. - connection,
  2480. - DLEYNA_SERVER_OBJECT,
  2481. - TRUE,
  2482. - g_manager_interfaces[i],
  2483. - g_root_vtables + i);
  2484. -
  2485. - if (g_context.dlr_id[DLR_MANAGER_INTERFACE_MANAGER]) {
  2486. - g_context.upnp = dlr_upnp_new(connection,
  2487. - dleyna_settings_port(g_context.settings),
  2488. - dleyna_settings_push_host_port(g_context.settings),
  2489. - g_server_vtables,
  2490. - prv_found_media_server,
  2491. - prv_lost_media_server);
  2492. -
  2493. - g_context.manager = dlr_manager_new(connection,
  2494. - dlr_upnp_get_context_manager(
  2495. - g_context.upnp));
  2496. - prv_white_list_init();
  2497. + connection, DLEYNA_SERVER_OBJECT, TRUE,
  2498. + g_manager_interfaces[i], g_root_vtables + i);
  2499. +
  2500. + if(g_context.dlr_id[DLR_MANAGER_INTERFACE_MANAGER]) {
  2501. + g_context.upnp = dlr_upnp_new(
  2502. + connection, dleyna_settings_port(g_context.settings),
  2503. + dleyna_settings_push_host_port(g_context.settings),
  2504. + g_server_vtables, prv_found_media_server,
  2505. + prv_lost_media_server);
  2506. +
  2507. + g_context.manager = dlr_manager_new(
  2508. + connection,
  2509. + dlr_upnp_get_context_manager(g_context.upnp));
  2510. + prv_context_filter_init();
  2511. } else {
  2512. retval = FALSE;
  2513. }
  2514. diff -Nuar a/libdleyna/renderer/task.c b/libdleyna/renderer/task.c
  2515. --- a/libdleyna/renderer/task.c 2021-10-26 18:51:33.000000000 +0300
  2516. +++ b/libdleyna/renderer/task.c 2022-06-03 00:20:47.000000000 +0300
  2517. @@ -20,6 +20,8 @@
  2518. *
  2519. */
  2520. +#include <config.h>
  2521. +
  2522. #include <libdleyna/core/error.h>
  2523. #include <libdleyna/core/task-processor.h>
  2524. diff -Nuar a/libdleyna/renderer/upnp.c b/libdleyna/renderer/upnp.c
  2525. --- a/libdleyna/renderer/upnp.c 2021-10-26 18:51:33.000000000 +0300
  2526. +++ b/libdleyna/renderer/upnp.c 2022-06-03 00:20:47.000000000 +0300
  2527. @@ -20,6 +20,8 @@
  2528. *
  2529. */
  2530. +#include <config.h>
  2531. +
  2532. #include <string.h>
  2533. #include <libgssdp/gssdp-resource-browser.h>
  2534. @@ -162,7 +164,7 @@
  2535. udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy);
  2536. ip_address = gssdp_client_get_host_ip(
  2537. - GSSDP_CLIENT(gupnp_control_point_get_context(cp)));
  2538. + gssdp_resource_browser_get_client(GSSDP_RESOURCE_BROWSER(cp)));
  2539. if (!udn || !ip_address)
  2540. goto on_error;
  2541. @@ -244,7 +246,7 @@
  2542. udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy);
  2543. ip_address = gssdp_client_get_host_ip(
  2544. - GSSDP_CLIENT(gupnp_control_point_get_context(cp)));
  2545. + gssdp_resource_browser_get_client(GSSDP_RESOURCE_BROWSER(cp)));
  2546. if (!udn || !ip_address)
  2547. goto on_error;
  2548. diff -Nuar a/meson.build b/meson.build
  2549. --- a/meson.build 2021-10-26 18:51:33.000000000 +0300
  2550. +++ b/meson.build 2022-06-03 00:20:47.000000000 +0300
  2551. @@ -70,12 +70,12 @@
  2552. glib = dependency('glib-2.0', version: '>= 2.28')
  2553. gio = dependency('gio-2.0', version: '>=2.28')
  2554. -gssdp = dependency('gssdp-1.2', version: '>= 1.2.0')
  2555. -gupnp = dependency('gupnp-1.2', version: '>= 1.2.0')
  2556. +gssdp = dependency('gssdp-1.6', version: '>= 1.4.0')
  2557. +gupnp = dependency('gupnp-1.6', version: '>= 1.4.0')
  2558. gupnp_av = dependency('gupnp-av-1.0', version: '>= 0.12.9')
  2559. gupnp_dlna = dependency('gupnp-dlna-2.0', version: '>= 0.9.4')
  2560. -soup = dependency('libsoup-2.4', version: '>= 2.42.0')
  2561. -dleyna_core = dependency('dleyna-core-1.0', version: '>= 0.6.0', fallback: 'dleyna-core-1.0')
  2562. +soup = dependency('libsoup-3.0', version: '>= 3.0')
  2563. +dleyna_core = dependency('dleyna-core-1.0', version: '>= 0.8.0', fallback: 'dleyna-core-1.0')
  2564. cc = meson.get_compiler('c')
  2565. math = cc.find_library('m', required: false)
  2566. diff -Nuar a/server/daemon.c b/server/daemon.c
  2567. --- a/server/daemon.c 2021-10-26 18:51:33.000000000 +0300
  2568. +++ b/server/daemon.c 2022-06-03 00:20:47.000000000 +0300
  2569. @@ -21,6 +21,8 @@
  2570. *
  2571. */
  2572. +#include <config.h>
  2573. +
  2574. #include <glib.h>
  2575. #include <glib-unix.h>