GNOME Bugzilla – Bug 106448
[0.6.1] [PATCH] vorbis plugin detection fix
Last modified: 2004-12-22 21:47:04 UTC
This patch fixes detection of bad oggs with ID3 tags, which is ofcourse no good but it happens quite a lot. The patch is fairly obvious, the old detection is still there (if it sais '\x01vorbis' at the start) i left it in there as fast solution for non id3tagged oggs (most of them), then it proceeds over the full sniff buffer to see if the identification header is somewhere further on (which happens if there's an id3 tag placed in front) and in all other cases it returns NULL. For me this fixes playing/detection of these files in nautilus-audio-view, rhythmbox from cvs and metadate in nautilus properties tab.
Created attachment 14421 [details] [review] ogg with id3 tag detection fix
2 comments: 1) This typefind misses the oligatory check "if (size < sizeof (gulong)) return NULL;" at the beginning. 2) I believe this code is too general, because it scans the whole buffer for the text "vorbis" which could easily be included in other files. (iE an mp3 wih iDv2 Title "vorbis speech" or some such) The right way would be to write it the way that the IDv2 stuff at the beginning of the file is skipped and you look exactly after that. I believe Mp3 typefinding already does this.
1) That wasn't there in the first place.. 2) It scans vor the vorbis identification header which is '\0x01vorbis', i think that should be good enough. The initial check actually only checks if it is an ogg container and only checks for the string 'OggS' at the start, which is even more general. I don't think the id3 header is of a known length, so it might take more time than this trick. And what the mp3 typefinder does is of no relevance here.
Created attachment 15509 [details] [review] this does do the above - any better?
Created attachment 15510 [details] [review] oops - try#2
This one: * fixes indenting * makes sure size is big enough * uses guint32 instead of gulong (we *want* 32bits here) Anything else needed for this to be applied?
Applied to 0.6.1 CVS.