Help - Search - Members - Calendar
Full Version: album_art embed
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
rabbit99
I want to embed a cover image in mp3 file. The cover image is stored in memory buffer. I tried the following routine:

CODE
        album_art_data_ptr destdata = album_art_data_impl::g_create(/* memory buffer */, /* the size of memory buffer */);
        service_ptr_t<album_art_editor> editor;
        if (album_art_editor::g_get_interface(editor, victimpath)) {
            album_art_editor_instance_ptr artwork = editor->open(0, victimpath, abortcallback);
            artwork->set(album_art_ids::cover_front, destdata, abortcallback);
        }


I noticed that the "if" branch is not taken. Although the comment of album_art_editor states I need to register my own implementation, I thought foobar2000 already implemented album_art_editor for mp3 files. Could somebody give me any idea why my code is wrong? All I want is to embed a cover image in mp3 files.

Thanks!
foosion
Support for album_art_editor is not yet implemented, only for album_art_extractor. So you can read embedded album art, but not write it at the moment.
rabbit99
Thank you for your quick answer. Now, I wonder if that is planned to be implemented in near future. Also, I wonder if there is an easy way for me to implement that.

QUOTE (foosion @ Jul 23 2009, 12:19) *
Support for album_art_editor is not yet implemented, only for album_art_extractor. So you can read embedded album art, but not write it at the moment.

foosion
QUOTE (rabbit99 @ Jul 23 2009, 20:56) *
Now, I wonder if that is planned to be implemented in near future.
I don't know Peter's plans.

QUOTE (rabbit99 @ Jul 23 2009, 20:56) *
Also, I wonder if there is an easy way for me to implement that.
The album_art_editor service for a specific format should (only) be implemented by the component implemented the corresponding input and album_art_extractor service. So for the formats that are supported by default, the album_art_editor has to be added by Peter in foo_input_std.

If you really want to add your own album art writing routines, you should not expose them as album_art_editor implementations. In order to make your code future-proof, you could structure it like this:
CODE
if (album_art_editor::g_get_interface(editor, path))
{
  // Update embedded album art using album_art_editor server.
}
else
{
  // Try to update embedded album art using private routines.
}

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.