Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 2c9d30f3cf217a6cae41860ebc0d6704 > files > 237

libid3lib3.8_0-devel-3.8.0-0.pre2.1.1mdk.i586.rpm

// $Id: get_pic.cpp,v 1.6 2000/10/29 01:37:28 eldamitri Exp $

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <iostream.h>
#include <stdlib.h>

#include <id3/tag.h>
#include <id3/misc_support.h>

int main( int argc, char *argv[])
{
  if (argc != 3)
  {
    cout << "Usage: get_pic <tagfile> <picfilename>" << endl;
    return 1;
  }
  
  ID3_Tag tag(argv[1]);
  const ID3_Frame* frame = tag.Find(ID3FID_PICTURE);
  if (frame && frame->Contains(ID3FN_DATA))
  {
    cout << "*** extracting picture to file \"" << argv[2] << "\"...";
    frame->Field(ID3FN_DATA).ToFile(argv[2]);
    cout << " done!" << endl;
  }
  else
  {
    cout << "*** no picture frame found in \"" << argv[1] << "\"" << endl;
    return 1;
  }

  return 0;
}