Re: GLib file magics
- From: Tim Janik <timj gtk org>
- To: Maciej Stachowiak <mjs eazel com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>,Manish Singh <yosh gimp org>
- Subject: Re: GLib file magics
- Date: Fri, 28 Jul 2000 06:43:26 +0200 (CEST)
On 27 Jul 2000, Maciej Stachowiak wrote:
> Tim Janik <timj@gtk.org> writes:
>
> > hi all,
> >
> > some while back, i was looking for a solution to maintain
> > soundfile->loader_module lookups in BSE.
> > i decided to go for magic matches, like the gimp had done
> > before, as introduced with system V as file(1) and magic(5).
> >
> > for that, i took a long look at the gimp code and while
> > it covers most of what's needed for an image loader, it's
> > code has issues with endianess and implements some
> > extensions of which some obscure ones are still unused.
> > also it's code is inherently tied to the PDB and other
> > code portions, so for BSE i went for a reimplementation.
> >
> > gimp could benefit from the new version, and after talking
> > to hp and jrb, it's probably also suitable for pixbuf
> > loader matches, so i'm herewith proposing the addition
> > of magic match facilities to glib.
> > for those that want to look at the current code:
> > in cvs module beast, bse/bsemagic.[hc] cover the implementation
> > and bsemagictest.c gets compiled into a small testprogram
> > ./bsemagic to work file(1) alike on command line args.
>
> So, um, there's a mime type sniffer in libgnome, and it'sm since been
> moved to gnome-vfs and enhanced in various ways (this will be the
> standard version for GNOME 2.0). It's not the greatest API in the
> world, but you could consider at least looking at it before
> reimplementing the whole thing.
>
> At the very least I reccomend having the results of the matcher be
> mime types instead of arbitrary strings.
the result is a user supplied gpointer data; if you care to look at the API ;)
besides, the magic matching code is required by BSE (depends on glib only),
gimp (doesn't depend on gnome-vfs (yet)) and gdk-pixbuf (doesn't have
gnome-vfs around either).
but it's pretty orthogonal to that anyways, you could even use it to
1) validate your mime type lookups from pure file extensions
2) figure mime matches for files where extension matches failed.
>
> - Maciej
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]