Re: [Rhythmbox-devel] DACP (iTunes remote) support added



On Fri, Oct 29, 2010 at 10:39 AM, Peter wrote:
>>Peter wrote:
>>> The DACP remote expects PNG, and passing JPEG or some
>>> other format might cause trouble. A simple check in the non
>>> gdk-pixbuf code branch can prevent this (tell the remote we
>>> have no cover rather than sending non-PNG data).
>
> Before making a firm choice we should perhaps test sending larger
> than requested PNG files, and also JPEG files, to the Apple Remote
> application (ideally v1 and v2) to see what happens. It may be more
> flexible than we are assuming.

Hi all,

It turns out that with Apple Remote v2.0.1 (229) which is the latest
version, sending JPEG instead of PNG works, as does sending larger
than requested covers (although obviously that wastes network
bandwidth).

This means that the current libdmapsharing code when lacking
gdkpixbuf actually works fine as it is :)

I haven't tried with Remote v1 yet (I had to downgrade it which is a
pain), but I guess few people will still be using it now so it isn't critical.

Peter

--

Here is the patch I was using for testing this, if anyone wants to
try it for themselves:

diff --git a/libdmapsharing/dacp-share.c b/libdmapsharing/dacp-share.c
index 05c1b0b..cf9c6c6 100644
--- a/libdmapsharing/dacp-share.c
+++ b/libdmapsharing/dacp-share.c
@@ -826,30 +826,14 @@ dacp_share_ctrl_int (DMAPShare *share,
                        soup_message_set_status (message,
SOUP_STATUS_NOT_FOUND);
                        return;
                }
-#ifdef HAVE_GDKPIXBUF
-               GdkPixbuf *artwork = gdk_pixbuf_new_from_file_at_scale
(artwork_filename, width, height, TRUE, NULL);
-               if (!artwork) {
-                       g_debug ("Error loading image file");
-                       g_free (artwork_filename);
-                       soup_message_set_status (message,
SOUP_STATUS_INTERNAL_SERVER_ERROR);
-                       return;
-               }
-               if (!gdk_pixbuf_save_to_buffer (artwork, &buffer,
&buffer_len, "png", NULL, NULL)) {
-                       g_debug ("Error saving artwork to PNG");
-                       g_object_unref (artwork);
-                       g_free (artwork_filename);
-                       soup_message_set_status (message,
SOUP_STATUS_INTERNAL_SERVER_ERROR);
-                       return;
-               }
-               g_object_unref (artwork);
-#else
+               /* removed the code when HAVE_GDKPIXBUF is set for testing. */
+               g_debug ("Sending %s as cover (as is)", artwork_filename);
                if (!g_file_get_contents (artwork_filename, &buffer,
&buffer_len, NULL)) {
                        g_debug ("Error getting artwork data");
                        g_free (artwork_filename);
                        soup_message_set_status (message,
SOUP_STATUS_INTERNAL_SERVER_ERROR);
                        return;
                }
-#endif
                g_free (artwork_filename);
                soup_message_set_status (message, SOUP_STATUS_OK);
                soup_message_set_response (message, "image/png",
SOUP_MEMORY_TAKE, buffer, buffer_len);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]