Click here to Skip to main content
6,905,855 members and growing! (20,692 online)
Email Password   helpLost your password?
Multimedia » Audio and Video » Audio     Intermediate

A Wrapper Class for the libid3tag Library

By Yubo Dong

A simple wrapper class for the libid3tag to retrieve id3 tag information from a given MP3 file.
VC7.1WinXP, MFC, STL, VS.NET2003, Dev
Posted:10 Apr 2006
Views:28,146
Bookmarked:33 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 3.15 Rating: 3.73 out of 5

1
1 vote, 14.3%
2
1 vote, 14.3%
3
2 votes, 28.6%
4
3 votes, 42.9%
5

Sample Image - CMP3ID3.jpg

Introduction

libid3tag is an open source project for retriving and modifying id3 tags. It will read / modify all versions of id3 tags (id3v1.x and id3v2.x). The beauty of this library is that it puts all versions of id3 tag information into the format of the most current version id3v2.4. By doing this, you don't need to be careful about what kind of id3 version may be contained in a given MP3 file, you always get an id3v2.4 interface. Though libid3tag is a great project, it has the problem of lacking documents. To make it easy to use for those who want to manipulate id3 tags, I decided to wrap the library into a simple class so that you don't need to spend your valuable time like I do, to go into details in order to get a feel of how to use it.

This is not a document to libid3tag, but the class does introduce the basic idea of how to use the libid3tag. If you decide to make your own class, this is probably a good start.

Using the code

The class is very simply to use.

First of all, you need to insert the following files into your VS project:

  • MP3ID3.cpp
  • MP3ID3.h
  • MP3Info.h
  • Macro.h

Secondly, you need to get libid3tag library from here. The latest version is 0.15.1b that was released on February 17, 2004. Once you have download the libid3tag-0.15.1b.tar.gz file, you need to build the lib file and link that library file to your project. Or you can simply use the lib file contained in the zip file.

Finally, to use CMP3ID3:

   
  CMP3ID3 mp3ID3;
  //Prepare MP3 file in readonly mode

  mp3ID3.prepareMP3("c:\\1.mp3", true);
  
  ustring strTitle  = mp3ID3.getTitle();
  ustring strGenre  = mp3ID3.getGenre();
  ustring strArtist = mp3ID3.getArtist();
  ....
  //You can also retrieve id3tag using CMP3Info class

  CMP3Info mp3Info;
  
  mp3Info = mp3ID3.getMP3Info("c:\\1.mp3");
  //Your processing code

  mp3Info = mp3ID3.getMP3Info("c:\\2.mp3");
  //Your processing code

  mp3Info = mp3ID3.getMP3Info("c:\\3.mp3");
  //Your processing code

  ...

Compiler Setting

You might experience a symbol redefined error when you link your project to the libid3tag library, you can simply add /NODEFAULTLIB:LIBCD.LIB or /NODEFAULTLIB:LIBCMTD.LIB depending on your project.

Reference Link:

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Yubo Dong


Member
Software Developer and SQL Server DBA
Occupation: Web Developer
Location: United States United States

Other popular Audio and Video articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
GeneralA Wrapper Class for the libid3tag Library (C code) Pinmembergsan_bot19:46 9 May '09  
GeneralUString??? Pinmembergeorgeg16:22 9 May '06  
GeneralRe: UString??? PinmemberYubo Dong6:14 10 May '06  
GeneralRe: UString??? Pinmembergeorgeg17:44 12 May '06  
Generallibid3tagR.lib PinmemberHans Dietrich5:53 12 Apr '06  
GeneralRe: libid3tagR.lib PinmemberMartin Carolan0:55 14 Apr '06  
QuestionOnly Get... no Set...? PinmemberRalph3:23 12 Apr '06  
Nice wrapper class but I can't find the set...-methods. Is that correct? Or how can I modify the tags, like you've announced it in your introduction?

Thanks for your good article!
Ralph


-- modified at 8:23 Wednesday 12th April, 2006
AnswerRe: Only Get... no Set...? PinmemberYubo Dong4:37 12 Apr '06  
GeneralRe: Only Get... no Set...? PinmemberRalph6:12 12 Apr '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

PermaLink | Privacy | Terms of Use
Last Updated: 10 Apr 2006
Editor: Smitha Vijayan
Copyright 2006 by Yubo Dong
Everything else Copyright © CodeProject, 1999-2010
Web20 | Advertise on the Code Project