Accessing artwork image data from libVLC

This forum is about all development around libVLC.
neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Accessing artwork image data from libVLC

Postby neosettler » 15 May 2022 19:54

Greetings,

After parsing a media, libVLC libvlc_media_get_meta does returns libvlc_meta_ArtworkURL as :

attachment://picture0.jpg.

Could someone help shed some light on how to extract the image data to let say, export the image data as an external file? I'm simply interested on how to access the image data here.

Thank you,

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Accessing artwork image data from libVLC

Postby Rémi Denis-Courmont » 16 May 2022 09:36

That is a placeholder URL for data embedded into the media source.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Accessing artwork image data from libVLC

Postby unidan » 16 May 2022 14:19

There's nothing in VLC 3 that can help you. In VLC 4, you'll be able to get a libvlc_picture_t as event from the media player for that. You can check how the medialibrary is doing it: https://code.videolan.org/videolan/medi ... e.cpp#L110

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Accessing artwork image data from libVLC

Postby neosettler » 09 Jun 2022 05:26

Thank you for your support, I'm a bit confused here, there is no trace of VLCMetadataService::onAttachedThumbnailsFound inside the 4.0 source code snapshot. Is there a comprehensive example on how to use this feature we can chew on?

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Accessing artwork image data from libVLC

Postby neosettler » 18 Jun 2022 20:40

As of 2022-05-19, while a jpg format picture is valid, libvlc_picture_get_width and libvlc_picture_get_height returns 0. Log doesn't say anything special. Here's a code snippet:

Code: Select all

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #if ZEN_SUPPORT_VLC4 void ZVideoVLC::SetThumbnail(libvlc_picture_t *in_picture) { ZenValidate(in_picture); UInt l_w = libvlc_picture_get_width(in_picture); UInt l_h = libvlc_picture_get_height(in_picture); if (l_w == 0 || l_h == 0) { ZenError("Invalid thumbnail size."); return; } size_t l_size; const UChar *l_buffer = libvlc_picture_get_buffer(in_picture, &l_size); libvlc_picture_type_t l_type = libvlc_picture_type(in_picture); e_PixelFormats l_format = l_type == libvlc_picture_type_t::libvlc_picture_Argb ? ZEN_RGBA8 : ZEN_RGB8; m_Thumbnail = new ZImage(l_w, l_h, l_format); m_Thumbnail->SetPixels((UChar *)l_buffer); libvlc_picture_release(in_picture); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void ZVideoVLC::CallbackThumbnailsFound(const libvlc_event_t *in_event, void *in_data) { ZenValidate(in_event->type == libvlc_MediaAttachedThumbnailsFound); libvlc_picture_list_t *l_thumbnails = in_event->u.media_attached_thumbnails_found.thumbnails; Int64 l_count = libvlc_picture_list_count(l_thumbnails); ZenValidate(l_count > 0); ZVideoVLC *l_video = static_cast<ZVideoVLC *>(in_data); l_video->SetThumbnail(libvlc_picture_list_at(l_thumbnails, 0)); } #endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Bool ZVideoVLC::ParseMedia(libvlc_media_t *in_media, const libvlc_media_parse_flag_t &in_flags) { std::mutex l_mutex; std::condition_variable l_cv; std::unique_lock<std::mutex> l_lock(l_mutex); #if ZEN_SUPPORT_VLC4 libvlc_event_attach(m_MediaEventManager, libvlc_MediaAttachedThumbnailsFound, CallbackThumbnailsFound, this); #endif Int l_return = libvlc_media_parse_with_options(in_media, in_flags, -1); l_cv.wait(l_lock); #if ZEN_SUPPORT_VLC4 libvlc_event_detach(m_MediaEventManager, libvlc_MediaAttachedThumbnailsFound, CallbackThumbnailsFound, this); #endif OnMediaParsedEvent(); return l_return == 0; }
Any ideas what's missing?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests