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 564182 - TagLib# fails to find MPEG header in amazon mp3 file
TagLib# fails to find MPEG header in amazon mp3 file
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Metadata
git master
Other Linux
: High normal
: 1.6
Assigned To: Gabriel Burt
Banshee Maintainers
: 533689 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-12-11 21:22 UTC by Gabriel Burt
Modified: 2009-02-12 01:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example of modifying the tests to (temporarily) test the amazon mp3 (1.34 KB, text/plain)
2008-12-11 23:53 UTC, Gabriel Burt
  Details
Patch that fixes the bug (8.07 KB, patch)
2008-12-16 00:02 UTC, Gabriel Burt
committed Details | Review

Description Gabriel Burt 2008-12-11 21:22:44 UTC
Got an amazon mp3 file from a user, it imports into Banshee 1.4.1, but TagLib# isn't able to parse it (but nautilus/RB see all the metadata just fine):

[Warn  15:17:23.417] Caught an exception - MPEG audio header not found. (in `taglib-sharp')
  at TagLib.Mpeg.AudioFile.ReadStart (Int64 start, ReadStyle propertiesStyle) [0x00000] 
  at TagLib.NonContainer.File.Read (ReadStyle propertiesStyle) [0x00000] 
  at TagLib.NonContainer.File..ctor (IFileAbstraction abstraction, ReadStyle propertiesStyle) [0x00000] 
  at TagLib.Mpeg.AudioFile..ctor (IFileAbstraction abstraction, ReadStyle propertiesStyle) [0x00000]
Comment 1 Gabriel Burt 2008-12-11 21:52:51 UTC
Assigning to dekushrub - he said he'd look into it.
Comment 2 Gabriel Burt 2008-12-11 23:46:23 UTC
OK, I got the unit tests running with MonoDevelop (2.0 alpha 2) and on the command line with "make test" from either the root or tests/ directories.  svn up for the fixes
Comment 3 Gabriel Burt 2008-12-11 23:53:00 UTC
Created attachment 124471 [details]
Example of modifying the tests to (temporarily) test the amazon mp3

If you copy the file to tests/samples/amazon.mp3 and apply this patch, then run make test, you'll get the same error we're getting in Banshee.
Comment 4 Gabriel Burt 2008-12-12 00:06:51 UTC
OK, I found the problem, in Mpeg/AudioFile.cs line 232, it expects to find the header in the first 16 bytes of the file, but it's not there.
Comment 5 Gabriel Burt 2008-12-12 00:35:36 UTC
Ok, but it should really be starting it's 16KB search after the header, so it seems the value of where-does-the-header end is wrong.
Comment 6 Gabriel Burt 2008-12-12 00:59:59 UTC
OK, there are two bugs - one, it's failing to parse the id3v2 tag after detecting it's header, throws this exception (that was smothered with catch {}):
TagLib.CorruptFileException: Frame data incomplete.
  at TagLib.Id3v2.Frame.FieldData (TagLib.ByteVector frameData, Int32 offset, Byte version) [0x00125] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Frame.cs:510 
  at TagLib.Id3v2.Frame.SetData (TagLib.ByteVector data, Int32 offset, Byte version, Boolean readHeader) [0x00014] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Frame.cs:378 
  at TagLib.Id3v2.AttachedPictureFrame..ctor (TagLib.ByteVector data, Int32 offset, FrameHeader header, Byte version) [0x00012] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Frames/AttachedPictureFrame.cs:235 
  at TagLib.Id3v2.FrameFactory.CreateFrame (TagLib.ByteVector data, System.Int32& offset, Byte version) [0x00264] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/FrameFactory.cs:215 
  at TagLib.Id3v2.Tag.Parse (TagLib.ByteVector data) [0x000bc] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Tag.cs:872 
  at TagLib.Id3v2.Tag.Read (TagLib.File file, Int64 position) [0x00066] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Tag.cs:809 
  at TagLib.Id3v2.Tag..ctor (TagLib.File file, Int64 position) [0x00058] in /home/gabe/Projects/taglib-sharp/src/TagLib/Id3v2/Tag.cs:146 

The other bug was properly setting the start position counter if there was an exception like the above, so that when we then went to look for the actual MPEG header we were first scanning the (in this case) 60KB of id3v2 data (including coverart).

Fixing the second one is trivial, but it'd be nice to log these exceptions maybe, and then actually fix the first bug so we can actually get the metadata out.
Comment 7 dekushrub 2008-12-12 10:29:35 UTC
I just wanted to report that even after editing the metadata in Banshee, Banshee has problems reporting songs that experience this bug to Last.FM
Comment 8 Gabriel Burt 2008-12-16 00:02:18 UTC
Created attachment 124766 [details] [review]
Patch that fixes the bug

This patch fixes the bug for me - all my other music still imports fine, and now so does the song you sent me.
Comment 9 dekushrub 2008-12-16 00:27:11 UTC
how do you patch that file to the banshee installation?
Comment 10 Gabriel Burt 2008-12-16 00:40:28 UTC
It's a patch against taglib# - so check taglib-sharp out from svn (it's in mono svn) and apply that from the top directory with patch -p0 < my_patch.file
Comment 11 Gabriel Burt 2008-12-16 01:42:56 UTC
I committed this, marking as fixed.
Comment 12 Gabriel Burt 2009-02-12 01:30:52 UTC
*** Bug 533689 has been marked as a duplicate of this bug. ***