qint64 QWmpPlayerControl::duration() const { double duration = 0.; IWMPMedia *media = 0; if (m_controls && m_controls->get_currentItem(&media) == S_OK) { media->get_duration(&duration); media->Release(); } return duration * 1000; }
QMediaTimeRange QWmpPlayerControl::availablePlaybackRanges() const { QMediaTimeRange ranges; IWMPMedia *media = 0; if (m_controls && m_controls->get_currentItem(&media) == S_OK) { double duration = 0; media->get_duration(&duration); media->Release(); if(duration > 0) ranges.addInterval(0, duration * 1000); } return ranges; }
int CWmp_scrobbler::GetTrackLength() { double dDuration = -1; IWMPMedia* pMedia = NULL; if(m_spCore) { m_spCore->get_currentMedia(&pMedia); if(pMedia != NULL) { pMedia->get_duration(&dDuration); } } return (int)dDuration; }