From dac07a84363f1b245dac60f33842abbb9583ae01 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 21 Sep 2014 18:56:51 +0200 Subject: [PATCH] cover support for getmetainfo Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/53be1b06b8ad664e1175933328f0a90a681d9d2b Author: TangoCash Date: 2014-09-21 (Sun, 21 Sep 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3/input.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libeplayer3/input.cpp b/libeplayer3/input.cpp index 8f42bc8..bfac6df 100644 --- a/libeplayer3/input.cpp +++ b/libeplayer3/input.cpp @@ -657,7 +657,6 @@ bool Input::GetMetadata(std::vector &keys, std::vector if (avfc) { AVDictionaryEntry *tag = NULL; - if (avfc->metadata) while ((tag = av_dict_get(avfc->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { keys.push_back(tag->key); @@ -675,6 +674,20 @@ bool Input::GetMetadata(std::vector &keys, std::vector keys.push_back(tag->key); values.push_back(tag->value); } + + // find the first attached picture, if available + for(unsigned int i = 0; i < avfc->nb_streams; i++) { + if (avfc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC) { + AVPacket *pkt = &avfc->streams[i]->attached_pic; + FILE *cover_art = fopen("/tmp/cover.jpg", "wb"); + if (cover_art) { + fwrite(pkt->data, pkt->size, 1, cover_art); + fclose(cover_art); + } + av_free_packet(pkt); + break; + } + } } return true; }