void MediaObject::setSource(const Phonon::MediaSource &source) { m_nextSourceReadyToStart = false; m_prefinishMarkSent = false; m_aboutToFinishSent = false; m_oldHasVideo = currentGraph()->hasVideo(); setState(Phonon::LoadingState); //After loading we go into stopped state m_nextState = Phonon::StoppedState; catchComError(currentGraph()->loadSource(source)); emit currentSourceChanged(source); }
void MediaObject::loadingFinished(MediaGraph *mg) { if (mg == currentGraph()) { #ifndef QT_NO_PHONON_MEDIACONTROLLER //Title interface m_currentTitle = 0; setTitles(currentGraph()->titles()); #endif //QT_NO_PHONON_MEDIACONTROLLER HRESULT hr = mg->renderResult(); if (catchComError(hr)) { return; } if (m_oldHasVideo != currentGraph()->hasVideo()) { emit hasVideoChanged(currentGraph()->hasVideo()); } #ifndef QT_NO_PHONON_VIDEO if (currentGraph()->hasVideo()) { updateVideoGeometry(); } #endif //QT_NO_PHONON_VIDEO emit metaDataChanged(currentGraph()->metadata()); emit totalTimeChanged(totalTime()); //let's put the next state switch(m_nextState) { case Phonon::PausedState: pause(); break; case Phonon::PlayingState: play(); break; case Phonon::ErrorState: setState(Phonon::ErrorState); break; case Phonon::StoppedState: default: stop(); break; } } }
void MediaObject::switchToNextSource() { m_prefinishMarkSent = false; m_aboutToFinishSent = false; m_nextSourceReadyToStart = false; m_oldHasVideo = currentGraph()->hasVideo(); qSwap(m_graphs[0], m_graphs[1]); //swap the graphs if (m_transitionTime >= 0) m_graphs[1]->stop(); //make sure we stop the previous graph if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid && catchComError(currentGraph()->renderResult())) { setState(Phonon::ErrorState); return; } //we need to play the next media play(); //we tell the video widgets to switch now to the new source #ifndef QT_NO_PHONON_VIDEO for (int i = 0; i < m_videoWidgets.count(); ++i) { m_videoWidgets.at(i)->setCurrentGraph(currentGraph()->index()); } #endif //QT_NO_PHONON_VIDEO emit currentSourceChanged(currentGraph()->mediaSource()); emit metaDataChanged(currentGraph()->metadata()); if (nextGraph()->hasVideo() != currentGraph()->hasVideo()) { emit hasVideoChanged(currentGraph()->hasVideo()); } emit tick(0); emit totalTimeChanged(totalTime()); #ifndef QT_NO_PHONON_MEDIACONTROLLER setTitles(currentGraph()->titles()); #endif //QT_NO_PHONON_MEDIACONTROLLER }