[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

ID3v2.3 ID32.4 tags

Ok I downloaded and used the following

http://www.torry.net/vcl/mmedia/audio/id3v2.zip

and sometimes it works and sometimes it just passes strings like ÿþA. However some freeware tag readers I am using do show the text like the Title, Artist etc. on the same files that the above afore mentioned code shows the ÿþA. I haven't been able to find Delphi code that reads the files appropriately. Also the afore mention code in the zip file doesn't seem to show the Album Artist or Images or things like Track # of Tracks or Disc # of Discs.
0
CrazyOne
Asked:
CrazyOne
  • 6
  • 5
1 Solution
 
pivarCommented:
Hi,

The problem is that your component can't handle unicode. ÿþ (or FF FE) is the unicode startmarker and the text ends after A since there is a null in the second byte in unicode with normal ascii characters.


/peter
0
 
CrazyOneAuthor Commented:
How do I rectify that?
0
 
pivarCommented:
Since the component can't handle it I'm afraid you have to find another component. This is a very simple component, which only supports the same info as ID3v1. But perhaps you can extend it with the features you're missing? You may find info about the id3 standard at http://www.id3.org/.

I know only of .NET components (have made one myself).


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
CrazyOneAuthor Commented:
Well I am looking for code. I did go to that web site but I don't quite understand what I am suppose to do.
0
 
pivarCommented:
You don't find any code there, just the standards so you could write your own code.
0
 
CrazyOneAuthor Commented:
Yeah I realize that but need help in figuring it out
0
 
pivarCommented:
ID3 tags are structured as frames, with a header of ten bytes and then data. There is also one header before the frames. If you decide too extend the component you got, you'll need to add support for the frames with the info you're missing, image and disc#, that is APIC and TPOS. Artist and track# are supported by your component.
What you have to do is add the frame ids 'APIC' and 'TPOS' to the array ID3V2_FRAME, add functions/properties to handle the frames (compare for example the FSetArtist function, and the property Artist).
If you wan't to support unicode, you have to check the first byte of the data in the frames that supports different encodings. Is it 0 then it's the ISO-8859-1 character set, if it's 1 then the text will be in 16 bit unicode with BOM (0xfffe or 0xfeff depening on order). Also you have think about changing the variabletype for the textframe-variables (Artist, Title etc) to byte arrays or convert from unicode before assigning the value, but then you will lose those characters not supported by ISO-8859-1.

By the way the component supports ID3 v2.3 not v2.4.
0
 
CrazyOneAuthor Commented:
Ok well i just need a little help in getting started if u could show me code on how to read the frame TIT2 [#TIT2 Title/songname/content description] then I can take it from there. I never done unicode before
0
 
pivarCommented:
Here's a starter. This will convert unicode to ansi, un-convertable characters will be shown as ?s. If you like to see them, you have to change FTitle to WideString. In delphi 5 at least there's also the problem that the ordinary components like TEditBox wont show unicode.

procedure TID3v2.FSetTitle(const NewTitle: string);
begin
  { Set song title }
  if (NewTitle[1] = #0) then begin
    FTitle := Trim(NewTitle);
  end else if (NewTitle[1] = #1) then begin
    FTitle := Trim(PWideChar(@NewTitle[4]));
  end;
end;

And also in the ReadFromFile function assign the data like

Title := Tag.Frame[1];


I'm not that familiar with unicode and delphi either, and I only have delphi 5 to test on.

0
 
CrazyOneAuthor Commented:
I have that code but it doesn't read Unicode
0
 
CrazyOneAuthor Commented:
Oops soory I didnt mean to post that comment for this Q

I will take your code sample and see what I can do with it
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now