Bug 109598 - konqi needs to be a bit tolerant with theora headers
Summary: konqi needs to be a bit tolerant with theora headers
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-25 16:14 UTC by Harald Sitter
Modified: 2006-04-17 00:57 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2005-07-25 16:14:56 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    SuSE RPMs

Well, the theora spec says that the first header has to be the theora and the second the vorbis. But sometimes an applications mixes them, as GStreamer does it (according to this BR http://bugzilla.gnome.org/show_bug.cgi?id=311486). 

So it would be a good idea, if Konqueror would not only look at the 1st header of an ogg. This would avoid that a theora file, whose theora header is on the 2nd position, is shown as a vorbis file.

And of course it would save me the time of splitting and re-merging the file ... to get it shown as a theora file ;)
Comment 1 Nicolas Goutte 2005-07-27 15:43:44 UTC
Can the theora header be found at a fixed position too if it is in the wrong place? If it is not in a fixed position, then we cannot use the magic file to find it and this bug could not be fixed.

Have a nice day!
Comment 2 Tim-Philipp M 2005-07-27 16:07:41 UTC
Well, all stream types have fixed-size bos packets (I think), so yes, the theora header would be at one of multiple fixed offsets, depending on how many possible stream/format combinations you want to take into account (I can think of speex/vorbis/flac for audio, and possible MNG/writ in future fur subtitles and the like) (assuming the Ogg encapsulation is of constant length in this part of the stream, which I think it is).

Here's what I think is the most common combination though:

00000000  4f 67 67 53 00 02 00 00  00 00 00 00 00 00 b7 fb  |OggS............|
00000010  bd 72 00 00 00 00 91 84  99 a5 01 1e 01 76 6f 72  |.r...........vor|
00000020  62 69 73 00 00 00 00 02  44 ac 00 00 ff ff ff ff  |bis.....D.......|
00000030  00 f4 01 00 ff ff ff ff  b8 01 4f 67 67 53 00 02  |..........OggS..|
00000040  00 00 00 00 00 00 00 00  53 13 75 5c 00 00 00 00  |........S.u\....|
00000050  03 01 fa d9 01 2a 80 74  68 65 6f 72 61 03 02 00  |.....*.theora...|

So, adding a pattern that matches 'OggS' at the start and 'theora' at offset 0x57 might do the trick.

 Cheers
  -Tim
Comment 3 Thiago Macieira 2005-07-30 02:27:15 UTC
This workaronud is only necessary to support other people's buggy code. Better to fix it and not add the workaround.
Comment 4 Tim-Philipp M 2005-07-30 12:36:49 UTC
This is not only "a workaround for other people's buggy code". That code will be fixed, there's no question about it. However, I doubt it's the only piece of code that produces files like this.

In my mind, the issue is simply whether you want to correctly recognise media files as they exist in the real world or not, to the benefit of your users.

 Cheers
  -Tim
Comment 5 Nicolas Goutte 2005-07-30 21:00:35 UTC
On Saturday 30 July 2005 02:27, Thiago Macieira wrote:
(...)
> Additional Comments From thiago kde org  2005-07-30 02:27 -------
> This workaronud is only necessary to support other people's buggy code.
> Better to fix it and not add the workaround.


Personally I do not think that a line more in the magic file is so bad if the 
particular buggy format can be read by some programs and that there are not 
tons of uch variants. (However as KDE was just branched, I am a little "out 
of order" for now or this fix would have already be comitted.)

Have a nice day!
Comment 6 Nicolas Goutte 2005-07-31 20:38:56 UTC
SVN commit 441716 by goutte:

Detect theora files that were written by GStreamer (out of specification)
(Backport of revision 441605; not tested)
CCBUG:109598


 M  +2 -0      magic  


--- branches/KDE/3.5/kdelibs/kio/magic #441715:441716
@@ -61,10 +61,12 @@
 0	string		.RMF		application/vnd.rn-realmedia
 
 # OGG files
+# For theora at position 87, see bug #109598
 0	string		OggS		application/ogg
 >28	string		\x01vorbis	audio/vorbis
 >28	string		fLaC		audio/x-oggflac
 >28	string		\x80theora	video/x-theora

+>87	string		\x80theora	video/x-theora
 >28	string		Speex\ \ 	audio/x-speex
 >29	string		video		video/x-ogm
 >29	string		FLAC		audio/x-oggflac

Comment 7 Harald Sitter 2006-04-17 00:57:30 UTC
*** Bug has been marked as fixed ***.