diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2016-01-05 10:27:52 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2016-01-05 10:27:52 +0000 |
| commit | 23f8516346fb3823b018653b8e35042f1b3369af (patch) | |
| tree | 33aad3a7f6d5399ed5dfab72895249cd362567d1 /src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp | |
| parent | d74cceddfdc0d0bc802ffd340589dfd525608767 (diff) | |
| download | qmmp-23f8516346fb3823b018653b8e35042f1b3369af.tar.gz qmmp-23f8516346fb3823b018653b8e35042f1b3369af.tar.bz2 qmmp-23f8516346fb3823b018653b8e35042f1b3369af.zip | |
ffmpeg: added support for m4a embedded album art
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@5974 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp')
| -rw-r--r-- | src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp index 3f38be4be..0049c80f1 100644 --- a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp +++ b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2014 by Ilya Kotov * + * Copyright (C) 2009-2015 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include <stdint.h> #include "ffmpegmetadatamodel.h" FFmpegMetaDataModel::FFmpegMetaDataModel(const QString &path, QObject *parent) : MetaDataModel(parent) @@ -47,10 +48,10 @@ QHash<QString, QString> FFmpegMetaDataModel::audioProperties() ap.insert(tr("Bitrate"), QString("%1 "+tr("kbps")).arg(m_in->bit_rate/1000)); AVCodecContext *c = 0; - uint wma_idx; - for (wma_idx = 0; wma_idx < m_in->nb_streams; wma_idx++) + uint idx; + for (idx = 0; idx < m_in->nb_streams; idx++) { - c = m_in->streams[wma_idx]->codec; + c = m_in->streams[idx]->codec; if (c->codec_type == AVMEDIA_TYPE_AUDIO) break; } @@ -61,3 +62,23 @@ QHash<QString, QString> FFmpegMetaDataModel::audioProperties() } return ap; } + +QPixmap FFmpegMetaDataModel::cover() +{ + AVCodecContext *c = 0; + for (uint idx = 0; idx < m_in->nb_streams; idx++) + { + c = m_in->streams[idx]->codec; + if (c->codec_type == AVMEDIA_TYPE_VIDEO && c->codec_id == AV_CODEC_ID_MJPEG) + break; + } + if (c) + { + AVPacket pkt; + av_read_frame(m_in, &pkt); + QPixmap pix; + pix.loadFromData(QByteArray((const char*)pkt.data, pkt.size)); + return pix; + } + return QPixmap(); +} |
