GNOME Bugzilla – Bug 366217
Add QTIF image support
Last modified: 2010-07-10 04:04:30 UTC
+++ This bug was initially created as a clone of Bug #366156 +++ Another problem on www.expressen.se: Before being redirected to a page explaining that i don't have Quicktime 6+ installed (bug 366145) the browser-plugin tries to play a "video" anyway and fails because there is no support for application/x-extension-qtif. This "video"/"image" can't be opened by anything i have, including Totem. URL: http://expressen.se/webb-tv/apelogo.qtif Examples "parsers": http://darwinsource.opendarwin.org/Current/xnu-792.6.61/osfmk/console/panic_ui/genimage.c and http://darwinsource.opendarwin.org/Current/xnu-792.6.61/osfmk/console/panic_ui/qtif2kraw.c The file in question is simply JPEG data inside a QTIF container.
Apple docs at: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFAppenA/chapter_7_section_1.html
Is there any way to feed the data from the QTIF file to one of the other decoders without going into the public API? Ie. is it possible to make use of the JPEG decoder's code internally to the QTIF decoder?
Fix the blocker being the wrong way around.
Updated links: http://fxr.watson.org/fxr/source/osfmk/console/panic_ui/genimage.c?v=xnu-792 http://fxr.watson.org/fxr/source/osfmk/console/panic_ui/qtif2kraw.c?v=xnu-792 The ani loader uses the ICO loader for some image types, using gdk_pixbuf_loader_new_with_type()
Created attachment 116328 [details] [review] QTIF format loader GDK pixbuf loader module for QTIF (quicktime still image) format. It extracts only the "idat" section of binary data and attempts to construct a GdkPixbuf * using GdkPixbufLoader.
I like the patch :) But I don't like that: case 0x69646174u: /* "idat" data atom. */ You could copy GStreamer's GST_MAKE_FOURCC() instead. In /usr/include/gstreamer-0.10/gst/gstvalue.h: #define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24) Rest looks good to me. Any chance you could provide a patch against the current GTK+ instead?
Created attachment 116331 [details] [review] Some configuration patch to enable QTIF loader This is a "svn diff ." in my gtk working directory against rev 21051. Patch and loader are tested using gtk_image_new_from_file() to load the provided "apelogo.qtif" image file. I also find myself a need to update the mime database to include lines like "image/x-quicktime:*.qtif" in /usr/share/mime/globs while testing. I am not sure whether this is how we want it done. It has been two years and nothing much seems to be going around this topic. Hope this is at least something we can enjoy for while. :)
Comment on attachment 116328 [details] [review] QTIF format loader >/* -*- mode: C; c-file-style: "linux" -*- */ Gtk uses the GNU coding style, please update to confirm to that. >#include "config.h" Protect this by a HAVE_CONFIG_H >/*** > * Definitions > */ >/* GdkPixbufLoader seems better at guessing image type out of byte data. */ >#define USE_GDK_PIXBUF_LOADER TRUE Is this really necessary, can't just one code path be provided? >/* Borrowed from gdk-pixbuf-io.c. */ >#define SNIFF_BUFFER_SIZE 4096 Maybe put this in a private header file which can be shared between both? >/*** > * Function definitions. > */ > /* Loading QTIF from a file descriptor. */ >static GdkPixbuf *gdk_pixbuf__qtif_image_load (FILE *f, GError **error) descriptor -> handle? >MODULE_ENTRY (fill_info) (GdkPixbufFormat *info) >{ > static GdkPixbufModulePattern signature[] = { > { "abcdidsc", "xxxx ", 100 }, > { "abcdidat", "xxxx ", 100 }, xxxx? It would be useful to have the changes necessary to build this included. Could GIO be used here, or would that require more infrastructure changes in gdk-pixbuf itself first?
I probably need to add QTIF files to shared-mime-info now...
(In reply to comment #8) [..] > >#include "config.h" > > Protect this by a HAVE_CONFIG_H Tor tells me that this is no longer necessary so ignore this comment.
Thanks for the feedback. The incremental loading part still has various potential bugs and will be updated. (In reply to comment #6) > case 0x69646174u: /* "idat" data atom. */ > You could copy GStreamer's GST_MAKE_FOURCC() instead. This is probably better replaced by QTIF_TAG_IDATA? The introduced macro will only be used to create 'idat'. Even 'idsc' will go. Funny to realize today that I don't actually have gstreamer installed at all... (In reply to comment #8) > (From update of attachment 116328 [details] [review] [edit]) > >/*** > > * Definitions > > */ > >/* GdkPixbufLoader seems better at guessing image type out of byte data. */ > >#define USE_GDK_PIXBUF_LOADER TRUE > > Is this really necessary, can't just one code path be provided? > >/* Borrowed from gdk-pixbuf-io.c. */ > >#define SNIFF_BUFFER_SIZE 4096 > > Maybe put this in a private header file which can be shared between both? This section of code is absolutely not necessary. If it works: 1. It is simpler and shares code. 2. "load" function in loader modules will be available. Problem is: 1. It doesn't work. It is struggling to get the correct mime-type from only binary data. 2. Other loaders may be fseek()ing across atom boundary and yelling "somebody stop me!" 3. 4kb is quite a sniff... It sounds more like a problem. > >/*** > > * Function definitions. > > */ > > /* Loading QTIF from a file descriptor. */ > >static GdkPixbuf *gdk_pixbuf__qtif_image_load (FILE *f, GError **error) > > descriptor -> handle? Ah, I see. So my carefully planned trick word has failed to sneak out before your eyes. Very well, let's change it back then. > >MODULE_ENTRY (fill_info) (GdkPixbufFormat *info) > >{ > > static GdkPixbufModulePattern signature[] = { > > { "abcdidsc", "xxxx ", 100 }, > > { "abcdidat", "xxxx ", 100 }, > > xxxx? > > > It would be useful to have the changes necessary to build this included. > > Could GIO be used here, or would that require more infrastructure changes in > gdk-pixbuf itself first? The only obvious pattern of QTIF will be the TAG inside its header, hecen attempting to match "....idat" or "....idsc". gdk-pixbuf is already making use of GIO's g_content_type_guess() instead of the above module pattern. It is all fun and I honestly spent more time getting the execution to the QTIF loader than actually debugging it... The experience is truly amazing when setting like a dozen breakpoints and they all miss.
(In reply to comment #8) > (From update of attachment 116328 [details] [review] [edit]) > >/* -*- mode: C; c-file-style: "linux" -*- */ > > Gtk uses the GNU coding style, please update to confirm to that. but gdk-pixbuf does not. > >#include "config.h" > > Protect this by a HAVE_CONFIG_H No, we don't use HAVE_CONFIG_H in gtk or gdk-pixbuf.
Created attachment 116501 [details] [review] GdkPixbuf loader for QTIF format Updated according to review suggestions. Removed unnecessary code in "load" function. Changed incremental load functions with better error handling.
We should get this in once 2.15 opens up.
Make this 2.17.. Please commit to master.
Do you have an few example qtif images ?
You got me. Google gives thousand sites talking about QTIF format, but hardly one containing a QTIF image file. Here is another one wrapping a PNG image in it: http://ia311208.us.archive.org/0/items/ASamplePictureFromAppleInc.ForQuicktime/sample.qtif (from http://www.archive.org/details/ASamplePictureFromAppleInc.ForQuicktime)
Comment on attachment 116331 [details] [review] Some configuration patch to enable QTIF loader commit 4b22b461b6ece49563fef808ff8d3b2fe6660713
Comment on attachment 116501 [details] [review] GdkPixbuf loader for QTIF format committed as part of commit 4b22b461b6ece49563fef808ff8d3b2fe6660713