hi, can taglib_c read or write picture data in mp3 file 's tag

View: New views
4 Messages — Rating Filter:   Alert me  

hi, can taglib_c read or write picture data in mp3 file 's tag

by zhangze :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


hi, i am developing a music player on linux platform using clutter
library in C language. clutter is a 3D library. i want to get attached
picture in music file tag, and put it on software interface. so i want
to know if taglib library can retrieve and save picutrue data in MP3's
tag.thanks

_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel

Re: hi, can taglib_c read or write picture data in mp3 file 's tag

by zhangze :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the music player is developed in C language, so i must use C bindings of
taglib, thereis nothing about picture reading and writing
in /usr/include/taglib_c.h header file.

在 2009-10-09五的 18:57 +0800,zhangze写道:
> hi, i am developing a music player on linux platform using clutter
> library in C language. clutter is a 3D library. i want to get attached
> picture in music file tag, and put it on software interface. so i want
> to know if taglib library can retrieve and save picutrue data in MP3's
> tag.thanks

_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel

Re: hi, can taglib_c read or write picture data in mp3 file 's tag

by Dudy Kohen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I started a project in sourceforge named tacci that will eventually contain interfaces to all of taglib.
Currently it's a patch for taglib_c.
You are more than welcome to help me in making the automation scripts.
http://tacci.sourceforge.net/

On Fri, Oct 9, 2009 at 12:59 PM, zhangze <zhangze@...> wrote:
the music player is developed in C language, so i must use C bindings of
taglib, thereis nothing about picture reading and writing
in /usr/include/taglib_c.h header file.

在 2009-10-09五的 18:57 +0800,zhangze写道:
> hi, i am developing a music player on linux platform using clutter
> library in C language. clutter is a 3D library. i want to get attached
> picture in music file tag, and put it on software interface. so i want
> to know if taglib library can retrieve and save picutrue data in MP3's
> tag.thanks

_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel


_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel

Re: hi, can taglib_c read or write picture data in mp3 file 's tag

by jon bird :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In article <1255085970.3477.14.camel@zhangze-desktop>, zhangze
<zhangze@...> writes
>the music player is developed in C language, so i must use C bindings
>of
>taglib, thereis nothing about picture reading and writing
>in /usr/include/taglib_c.h header file.

If you're conversant in 'C' and you're prepared to persevere then you
should be able to cobble together a bit of C++ code and put a 'C'
wrapper around it (just 'extern 'C' it). I'm not that familiar with the
intricacies of C++ and it was a bit painful going but I've managed to do
just that in order to interface it back to my main C code. If it helps,
this is the basis of the code I use to extract cover art:

static const char *IdPicture = "APIC" ;

// get raw bitmap (rgb) of attached cover art image held in tag
DLLEXPORT void *AttachedCoverArtFromId3Tag ( const char *FileName, int
*Width, int *Height )
{
  MPEG::File TagFile( FileName, false ) ;
  ID3v2::Tag *id3v2tag = TagFile.ID3v2Tag();
  TagLib::ID3v2::FrameList Frame ;
  TagLib::ID3v2::AttachedPictureFrame *PicFrame ;
  void *RetImage = NULL, *SrcImage ;
  unsigned long Size ;

  if ( id3v2tag )
  {
    // picture frame
    Frame = id3v2tag->frameListMap()[IdPicture] ;

    if (!Frame.isEmpty() )
    {
      // find cover art
      for(ID3v2::FrameList::ConstIterator it = Frame.begin(); it !=
Frame.end(); ++it)
      {
        PicFrame = (ID3v2::AttachedPictureFrame *)(*it) ;
        if ( PicFrame->type() ==
TagLib::ID3v2::AttachedPictureFrame::FrontCover )
        {
          // extract image (in it's compressed form)
          Size = PicFrame->picture().size() ;
          SrcImage = malloc ( Size ) ;
          if ( SrcImage )
          {
            memcpy ( SrcImage, PicFrame->picture().data(), Size ) ;

            // pass image to appropriate decompressor
            if ( !_stricmp ( PicFrame->mimeType().toCString(),
"image/jpeg" ) )
              RetImage = JpegImageToRaw ( SrcImage, Size, Width, Height
) ;
            else if ( !_stricmp ( PicFrame->mimeType().toCString(),
"image/png" ) )
              RetImage = PngImageToRaw ( SrcImage, Size, Width, Height )
;

            free ( SrcImage ) ;
          }
          if ( RetImage )
            break ;
        }
      }
    }
  }

  return RetImage ;
}

Any C++ purists out there, feel free to point and laugh....


Rgs,


Jon.

--
== jon bird - software engineer
== <reply to address _may_ be invalid, real mail below>
== <reduce rsi, stop using the shift key>
== posted as: news 'at' onastick 'dot' clara.co.uk

_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel