mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
audioplayer, ffmpegdec: embedded cover support
Conflicts: src/gui/audioplayer.cpp
This commit is contained in:
@@ -184,6 +184,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, const CFile::FileType ft, int /
|
|||||||
RetCode Status=OK;
|
RetCode Status=OK;
|
||||||
is_stream = fseek((FILE *)in, 0, SEEK_SET);
|
is_stream = fseek((FILE *)in, 0, SEEK_SET);
|
||||||
|
|
||||||
|
unlink ("/tmp/cover.jpg");
|
||||||
if (!SetMetaData((FILE *)in, ft, _meta_data)) {
|
if (!SetMetaData((FILE *)in, ft, _meta_data)) {
|
||||||
DeInit();
|
DeInit();
|
||||||
Status=DATA_ERR;
|
Status=DATA_ERR;
|
||||||
@@ -425,9 +426,19 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CFile::FileType ft, CAudioMetaData* m)
|
|||||||
|
|
||||||
bitrate = 0;
|
bitrate = 0;
|
||||||
total_time = 0;
|
total_time = 0;
|
||||||
for(unsigned int i = 0; i < avc->nb_streams; i++)
|
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
||||||
if (avc->streams[i]->codec->bit_rate > 0)
|
if (avc->streams[i]->codec->bit_rate > 0)
|
||||||
bitrate += avc->streams[i]->codec->bit_rate;
|
bitrate += avc->streams[i]->codec->bit_rate;
|
||||||
|
if (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC) {
|
||||||
|
FILE *cover = fopen("/tmp/cover.jpg", "wb");
|
||||||
|
if (cover) {
|
||||||
|
AVPacket *pkt = &avc->streams[i]->attached_pic;
|
||||||
|
fwrite(pkt->data, pkt->size, 1, cover);
|
||||||
|
fclose(cover);
|
||||||
|
}
|
||||||
|
m->cover = "/tmp/cover.jpg";
|
||||||
|
}
|
||||||
|
}
|
||||||
if(m->filesize && bitrate)
|
if(m->filesize && bitrate)
|
||||||
total_time = 8 * m->filesize / bitrate;
|
total_time = 8 * m->filesize / bitrate;
|
||||||
|
|
||||||
|
@@ -2171,6 +2171,25 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver)
|
|||||||
m_curr_audiofile.MetaData.album = meta.sc_station;
|
m_curr_audiofile.MetaData.album = meta.sc_station;
|
||||||
updateLcd = true;
|
updateLcd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg";
|
||||||
|
|
||||||
|
if (!meta.cover.empty())
|
||||||
|
cover = meta.cover;
|
||||||
|
|
||||||
|
if ((access(cover.c_str(), F_OK) == 0) && !screen_saver)
|
||||||
|
{
|
||||||
|
g_PicViewer->DisplayImage(cover, m_x + 2, m_y + 2, m_title_height - 14, m_title_height - 14, m_frameBuffer->TM_NONE);
|
||||||
|
|
||||||
|
if(g_settings.rounded_corners)
|
||||||
|
{
|
||||||
|
//repaint frame to cover up the corners of the cover; FIXME
|
||||||
|
if (!m_show_playlist)
|
||||||
|
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
||||||
|
else
|
||||||
|
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//if (CAudioPlayer::getInstance()->getScBuffered() != 0)
|
//if (CAudioPlayer::getInstance()->getScBuffered() != 0)
|
||||||
if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0)
|
if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0)
|
||||||
|
Reference in New Issue
Block a user