Re: Writing a glib/vfs id3 library/MP3s to test.
- From: Bastien Nocera <hadess hadess net>
- To: Brian Kerrick Nickel <kerrick cox net>
- Cc: Gnome Multimedia Hackers <gnome-multimedia gnome org>
- Subject: Re: Writing a glib/vfs id3 library/MP3s to test.
- Date: 24 Aug 2003 21:50:57 +0100
On Wed, 2003-08-20 at 00:14, Brian Kerrick Nickel wrote:
> > Interesting. Have you considered collaborating with Thomas Vander
> > Stichele on his media-info library?
> I probably will when I've cleaned everything up a bit.
>
> > As for using this in rb - well it would definitely be an improvement
> > over the currently very gross libid3tag.
> Maybe, or maybe not, using my core functions isn't that fun:
> gchar **strings = NULL;
> gid3frame *frame = g_id3_get_T___( tag, "TIT2", &strings, NULL );
> if( frame != NULL && strings[ 0 ] != NULL )
> title = g_strdup( strings[ 0 ] );
> else
> title = g_strdup( "Untitled" );
> if( strings )
> g_strfreev( strings );
>
> Of course the most common things will be wrapped with simple functions.
>
> > But I think it would be cleaner to have something GStreamer-based.
> Not to worry, the library itself isn't a vfs library. It is a large
> collection of functions/structs for reading from any string, be it a
> stream, a file, or anything else:
> gid3tag *tag = g_id3_tag_new( );
>
> // Some stream stuff.
>
> // buffer = 10 bytes from stream
> if( g_id3_tag_read_header( tag, buffer ) != FALSE )
> {
> // Stream read tag->size bytes from the stream directly after
> // current buffer.
>
> g_id3_tag_read( tag, new_buffer );
>
> // Do stuff with the tag.
> some_function( tag );
> }
>
> // Some more stuff.
>
> g_id3_tag_free( tag );
That looks quite awful. Take a look at the code used in libvorbis and
rhythmbox' monkey-media to get the comments:
- you virtualise open(), close(), read() and write()
- you make the code in libid3tag make use of user-supplied callbacks or
the posix fallbacks
- you write the gnome-vfs callbacks in monkey-media
- you get the changes to libid3tag accepted upstream.
Look at vorbis-stream-info-impl.c for ideas.
It's nice and clean, and you don't need to reimplement everything from
scratch.
Cheers
--
Bastien Nocera <hadess hadess net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]