Bug 75570 - Accept id3-tags in flac-plugin
Summary: Accept id3-tags in flac-plugin
Status: RESOLVED WORKSFORME
Alias: None
Product: k3b
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-19 00:34 UTC by Nicolas Dietrich
Modified: 2004-02-23 23:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
UNTESTED patch to read id3tags from FLAC files (2.73 KB, patch)
2004-02-20 14:45 UTC, toojays
Details
tested/good patch to read ID3 tags of FLAC files (8.52 KB, patch)
2004-02-22 04:38 UTC, toojays
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Dietrich 2004-02-19 00:34:27 UTC
Version:           0.11 (using KDE KDE 3.2.0)
Installed from:    RedHat RPMs
OS:          Linux

Currently, the flac-plugin works with flac files without tags or with vorbis style tags, but not with id3-tags!

Unfortunately, a lot of programs like grip and easytag don't support vorbis style tags, and add id3-tags instead. For grip there's a workaround using command-line arguments. The easytag main developer says they will support vorbis style tags in the next release (0.31 or so).

But nevertheless, there is still some justification to have id3-tags in flac files:
- other programs might only support id3-tags
- some portable players only support id3-tags (but play flac & ogg).
- the flac specification allows it (see http://flac.sourceforge.net/format.html) - "A FLAC bitstream may be appended with ID3V1 data or prepended with ID3V2 data. FLAC has no knowledge of such data, but the reference decoder knows how to skip an ID3 tag."

So i think it would be nice if the k3b-flac-plugin would accept id3-tags as well (and use them if the file doesn't contain vorbis style comments).
Comment 1 toojays 2004-02-20 14:45:30 UTC
Created attachment 4798 [details]
UNTESTED patch to read id3tags from FLAC files

This patch shows what I how I would use id3lib to resolve this bug. I emerged
easytag and created a couple of test cases, but it's no good, because the mp3
decoder is putting its hand up to decode these files before the flac decoder
gets a chance to look at them.

Sebastian, any ideas? Perhaps the mp3 decoder can check for an MP3 magic number
in addition to reading the tag?
Comment 2 toojays 2004-02-22 04:38:04 UTC
Created attachment 4832 [details]
tested/good patch to read ID3 tags of FLAC files

Okay, here is a patch which will do what we want. The mad decoder will now
check for the MP3 sync bytes which follow the ID3 tag. Thus FLAC files with ID3
tags will no longer be misidentified as MP3 files.

The FLAC decoder factory will now correctly identify FLAC files with ID3
headers. If a file has no Vorbis tags, the FLAC decoder will use id3lib to try
and get the track info from ID3 tags.

Just a couple of technical/stylistic notes: First, I don't know if you feel
strongly about tabs, but I don't like them, so I removed them from the FLAC
decoder. This results in a couple of extra/useless lines in the patch, sorry. I
left them in the mad decoder, because maybe you're a big fan of tabs, I don't
know. :)

Second, I removed some calls to QFile.close() which are were in the canDecode()
methods of both plugins. My understanding is that since the QFile is created on
the stack in these methods, the QFile destructor will close the file when
canDecode() returns. Explicitly closing the file for such a short piece of code
only seems to mess up the code for no good reason (since we have so many exit
points).
Comment 3 Nicolas Dietrich 2004-02-23 23:33:11 UTC
The patch works fine (and is already integrated in k3b-0.11.5).
I don't know what tabs you removed from the FLAC decoder, but i don't miss them.

Okay, thanks, John! This bug is RESOLVED!