diff options
Diffstat (limited to 'src/3rdparty/phonon/qt7/quicktimemetadata.mm')
-rw-r--r-- | src/3rdparty/phonon/qt7/quicktimemetadata.mm | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/3rdparty/phonon/qt7/quicktimemetadata.mm b/src/3rdparty/phonon/qt7/quicktimemetadata.mm index 2dcc152..4ae3e2c 100644 --- a/src/3rdparty/phonon/qt7/quicktimemetadata.mm +++ b/src/3rdparty/phonon/qt7/quicktimemetadata.mm @@ -15,7 +15,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#include <QtCore/QFileInfo> +#import <QTKit/QTMovie.h> + #include "quicktimemetadata.h" #include "quicktimevideoplayer.h" @@ -26,14 +27,19 @@ namespace Phonon namespace QT7 { -QuickTimeMetaData::QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer) +QuickTimeMetaData::QuickTimeMetaData() { - m_videoPlayer = videoPlayer; + m_videoPlayer = 0; m_movieChanged = false; } -void QuickTimeMetaData::update() +QuickTimeMetaData::~QuickTimeMetaData() +{ +} + +void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer) { + m_videoPlayer = videoPlayer; m_movieChanged = true; m_metaData.clear(); } @@ -141,22 +147,14 @@ void QuickTimeMetaData::readFormattedData(QTMetaDataRef metaDataRef, OSType form #endif // QUICKTIME_C_API_AVAILABLE -void QuickTimeMetaData::guessMetaDataForCD() -{ - QString album = QFileInfo(m_videoPlayer->movieCompactDiscPath()).fileName(); - QString title = QFileInfo(m_videoPlayer->currentTrackPath()).fileName(); - title = title.left(title.lastIndexOf('.')); - m_metaData.insert(QLatin1String("ALBUM"), album); - m_metaData.insert(QLatin1String("TITLE"), title); - m_metaData.insert(QLatin1String("TRACKNUMBER"), QString::number(m_videoPlayer->currentTrack())); -} - -void QuickTimeMetaData::readMetaDataFromMovie() +void QuickTimeMetaData::readMetaData() { + if (!m_videoPlayer) + return; QMultiMap<QString, QString> metaMap; - + #ifdef QUICKTIME_C_API_AVAILABLE - QTMetaDataRef metaDataRef; + QTMetaDataRef metaDataRef; OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef); BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR) @@ -177,17 +175,6 @@ void QuickTimeMetaData::readMetaDataFromMovie() m_metaData.insert(QLatin1String("DESCRIPTION"), metaMap.value(QLatin1String("des"))); } -void QuickTimeMetaData::readMetaData() -{ - if (!m_videoPlayer) - return; - - if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc) - guessMetaDataForCD(); - else - readMetaDataFromMovie(); -} - QMultiMap<QString, QString> QuickTimeMetaData::metaData() { if (m_videoPlayer && m_videoPlayer->hasMovie() && m_movieChanged) |