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

Alexandre Rosenfeld

On Thu, Oct 28, 2010 at 17:55, Peter <rhythmbox-devel maubp freeserve co uk> wrote:
I know that, but I wasn't sure there was an inexpensive way
to check for PNG format without a library dependency - can
we just read the first few bytes as Alex suggests?

> But, I have already stated that in the case of no gdk-pixbuf,
> it is acceptable to me that libdmapsharing may assume that
> the data is PNG.

I think that is unwise.

If I am writing a tool using libdmapsharing I have no way to
know if it was compiled with or without gdk-pixbuf (do I?)
but in one case I can send PNG or JPEG files to it, but in
the later you only expect PNG files (as things stand).

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).

Hm, I see what you mean now and it's tricky. The application would have two choices, either export the right format and the right size to libdmapsharing so that it will always support cover art no matter how libdmapsharing was compiled or send libdmapsharing any kind of image it gets and let libdmapsharing take responsibility for it. 
The first is not very good because we would be duplicating the same code in the application and in libdmapsharing, with the chance that maybe libdmapsharing will not re-convert the image (I would say the chance of libdmapsharing not being built with gdk-pixbuf to be quite small. Actually, in terms of usage inside Rhythmbox, it will probably always include support for gdk-pixbuf, because that is a Rhythmbox dependency).
The second choice will have to check indeed if the file is a valid PNG (using the great suggestion from Bastien to use g_content_type_guess, but we still wont be able to figure out the dimensions of the image) and so will create a chance that certain covers will not show in the client, even if available in the host.

I believe the best solution is to make the application make the decision. As with Rhythmbox, there is no need to duplicate code, it requires Gtk which requires gdk-pixbuf, so in that context libdmapsharing will probably have pixbuf support already, so just throw any image to libdmapsharing and let it handle it. Any application without a dependency on gdk-pixbuf will have to make a decision about what to support.

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