After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 366217 - Add QTIF image support
Add QTIF image support
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 366145 366156
 
 
Reported: 2006-10-28 11:13 UTC by Bastien Nocera
Modified: 2010-07-10 04:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
QTIF format loader (16.86 KB, patch)
2008-08-11 10:52 UTC, Kevin Peng
reviewed Details | Review
Some configuration patch to enable QTIF loader (2.85 KB, patch)
2008-08-11 11:13 UTC, Kevin Peng
committed Details | Review
GdkPixbuf loader for QTIF format (19.68 KB, patch)
2008-08-13 13:47 UTC, Kevin Peng
committed Details | Review

Description Bastien Nocera 2006-10-28 11:13:36 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.
Comment 2 Bastien Nocera 2006-10-29 22:04:18 UTC
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?
Comment 3 Bastien Nocera 2007-01-05 11:39:41 UTC
Fix the blocker being the wrong way around.
Comment 4 Bastien Nocera 2007-08-12 12:16:06 UTC
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()
Comment 5 Kevin Peng 2008-08-11 10:52:04 UTC
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.
Comment 6 Bastien Nocera 2008-08-11 11:06:28 UTC
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?
Comment 7 Kevin Peng 2008-08-11 11:13:59 UTC
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 8 Johan (not receiving bugmail) Dahlin 2008-08-11 11:24:08 UTC
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?
Comment 9 Bastien Nocera 2008-08-11 11:25:36 UTC
I probably need to add QTIF files to shared-mime-info now...
Comment 10 Johan (not receiving bugmail) Dahlin 2008-08-11 11:38:22 UTC
(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.
Comment 11 Kevin Peng 2008-08-11 14:32:52 UTC
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.

Comment 12 Matthias Clasen 2008-08-11 15:35:00 UTC
(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. 
Comment 13 Kevin Peng 2008-08-13 13:47:44 UTC
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.
Comment 14 Matthias Clasen 2008-08-14 05:28:05 UTC
We should get this in once 2.15 opens up.
Comment 15 Matthias Clasen 2009-04-18 19:24:27 UTC
Make this 2.17..
Please commit to master.
Comment 16 Matthias Clasen 2009-05-04 02:46:44 UTC
Do you have an few example qtif images ?
Comment 17 Kevin Peng 2009-05-04 10:18:38 UTC
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 18 Javier Jardón (IRC: jjardon) 2009-10-25 23:08:39 UTC
Comment on attachment 116331 [details] [review]
Some configuration patch to enable QTIF loader

commit 4b22b461b6ece49563fef808ff8d3b2fe6660713
Comment 19 Javier Jardón (IRC: jjardon) 2009-10-25 23:09:40 UTC
Comment on attachment 116501 [details] [review]
GdkPixbuf loader for QTIF format

committed as part of commit 4b22b461b6ece49563fef808ff8d3b2fe6660713