Re: libid3 documentation

Rob Leslie <[email protected]> Tue, 22 Jun 2004 16:11:01 -0700
Newsgroups gmane.comp.audio.mad.user
Message-ID <[email protected]>
[ For the sake of the non-developers on this list, I ask again that 
developer-related messages please be sent to the mad-dev mailing list 
and not this one; note Reply-To: header. Thanks. ]

On Jun 22, 2004, at 11:50 AM, tj wrote:
> Where can I find out how to use libid3tag library?

You can find out how to use the library primarily by examining the 
interface header file, id3tag.h, but also by asking questions and 
reviewing the existing source code that makes use of the library.

> All I wnat to do is open an mp3 file, see if it has or hasn't a tag. 
> If it does, get song and artist and el me where the start of mp3 audio 
> is.. If no id3v2, let me know so I know the audio is at the front of 
> the file.

The id3_tag_query() function may be helpful. If you pass it at least 
ID3_TAG_QUERYSIZE bytes of data from the beginning of your file, it 
will tell you whether an ID3 tag lives there, and if so, its length. 
The start of MP3 audio should therefore (usually) be found after this 
length from the beginning of the file.

To parse the tag and get song and artist info, you can either read the 
tag data yourself and pass the data block to id3_tag_parse(), or you 
can use the id3_file_* interface to read the tag(s) automatically. The 
latter interface will check for both v1 and v2 ID3 tags in all their 
myriad possible locations (beginning, end, middle of the file) and 
properly chain multiple ID3v2 tags, providing a single coherent view of 
the relevant tag information.

On Jun 22, 2004, at 2:48 PM, tj wrote:
> In trying to learn how to use libid3, since there sems to be no 
> documentatio. I am looking at soure trying to figure out how to use 
> it. The first problem is the practically every call uses a pointer to 
> a "struct id3_file" . Now, the problem is that there is no definition 
> for id3_file structure in any .h file. I finally found it in file.c, a 
> source file. How the hell are you supposed to use it in your app when 
> the prototype is in a package source file?

It's not in any public interface header file because it's not a public 
interface. You don't need the structure's definition to receive and 
pass around pointers to it; you obtain a pointer by calling 
id3_file_open() or id3_file_fdopen().

-- 
Rob Leslie
[email protected]