Bug 14501 - flac+ogg files are not well identified using the "magic" tag
Summary: flac+ogg files are not well identified using the "magic" tag
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-14 13:17 UTC by Andrés Gómez García
Modified: 2008-04-09 09:25 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Sample flac+ogg audio file (972.64 KB, application/x-gzip)
2008-02-14 13:23 UTC, Andrés Gómez García
Details
Simple program to guess a file mime type using GnomeVFS (4.46 KB, text/x-csrc)
2008-02-14 13:28 UTC, Andrés Gómez García
Details
Patch that fixes the mime guessing through the magic tag for flac+ogg files (439 bytes, patch)
2008-02-14 13:30 UTC, Andrés Gómez García
Details | Splinter Review
Patch that fixes the mime guessing through the magic tag for flac+ogg files (483 bytes, patch)
2008-02-21 14:06 UTC, Andrés Gómez García
Details | Splinter Review

Description Andrés Gómez García 2008-02-14 13:17:16 UTC
Predonditions:
* Have a flac+ogg file -> my_flac.ogg


Expected behavior:

Using GnomeVFS to guess the mimetype of a flac+ogg file using the magic number says "audio/x-flac+ogg"


Current behavior:

Using GnomeVFS to guess the mimetype of a flac+ogg file using the magic number says "application/ogg"
Comment 1 Andrés Gómez García 2008-02-14 13:23:41 UTC
Created attachment 14317 [details]
Sample flac+ogg audio file
Comment 2 Andrés Gómez García 2008-02-14 13:28:15 UTC
Created attachment 14318 [details]
Simple program to guess a file mime type using GnomeVFS
Comment 3 Andrés Gómez García 2008-02-14 13:30:29 UTC
Created attachment 14319 [details] [review]
Patch that fixes the mime guessing through the magic tag for flac+ogg files

The offset should be 37, not 28.

See http://flac.sourceforge.net/ogg_mapping.html
Comment 4 Tim Müller 2008-02-21 07:54:36 UTC
I think it would be better to check at offset 28 for the

 0x7f FLAC

marker instead (so "\177FLAC" I guess?) (IIRC there are also other flac-in-ogg variants with slightly incorrect mapping out there, some of them with just a 4-byte 'fLaC' as the first ogg packet/page; this is just from memory, but seems to match what's currently checked for).

In short: you should probably check for both if you want to be on the safe side.
Comment 5 Andrés Gómez García 2008-02-21 14:06:16 UTC
Created attachment 14485 [details] [review]
Patch that fixes the mime guessing through the magic tag for flac+ogg files

In the end, I think you are right, probably, checking for the "\177FLAC" with an offset of 28 would make the same and should be a little bit faster, and keeping the old one would be good for backward compatibility, so this is a new version of the proposed patch.

Thanks for your tips!! :)
Comment 6 Bastien Nocera 2008-04-09 08:56:44 UTC
(In reply to comment #5)
> Created an attachment (id=14485) [details]
> Patch that fixes the mime guessing through the magic tag for flac+ogg files
> 
> In the end, I think you are right, probably, checking for the "\177FLAC" with
> an offset of 28 would make the same and should be a little bit faster, and
> keeping the old one would be good for backward compatibility, so this is a new
> version of the proposed patch.

Patches should be against the .in file, not the generated file...

* freedesktop.org.xml.in: Add another magic pattern for FLAC files
inside Ogg, patch by Andrés Gómez García <agomez@igalia.com>
(Closes: #14501)
Comment 7 Andrés Gómez García 2008-04-09 09:25:50 UTC
My fault, next time I will remember ;)

Thanks for the advice!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.