Changeset 769 for trunk/src/3rdparty/phonon/mmf
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 18 edited
- 12 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
r651 r769 21 21 #include "abstractaudioeffect.h" 22 22 #include "audioplayer.h" 23 #include "mmf_videoplayer.h"24 23 25 24 QT_BEGIN_NAMESPACE -
trunk/src/3rdparty/phonon/mmf/abstractaudioeffect.h
r651 r769 29 29 #include "effectparameter.h" 30 30 #include "mmf_medianode.h" 31 #include "mmf_videoplayer.h"32 31 33 32 class CMdaAudioOutputStream; -
trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
r561 r769 49 49 : AbstractPlayer(player) 50 50 , m_parent(parent) 51 , m_p layPending(false)51 , m_pending(NothingPending) 52 52 , m_positionTimer(new QTimer(this)) 53 53 , m_bufferStatusTimer(new QTimer(this)) … … 75 75 76 76 case LoadingState: 77 m_playPending = true;77 setPending(PlayPending); 78 78 break; 79 79 80 80 case StoppedState: 81 81 case PausedState: 82 doPlay(); 83 startPositionTimer(); 84 changeState(PlayingState); 82 startPlayback(); 85 83 break; 86 84 … … 104 102 TRACE_ENTRY("state %d", privateState()); 105 103 106 m_playPending = false;107 104 stopTimers(); 108 105 … … 110 107 case GroundState: 111 108 case LoadingState: 109 case StoppedState: 110 setPending(PausePending); 111 break; 112 112 113 case PausedState: 113 case StoppedState:114 114 // Do nothing 115 115 break; … … 136 136 TRACE_ENTRY("state %d", privateState()); 137 137 138 m_playPending = false;138 setPending(NothingPending); 139 139 stopTimers(); 140 140 … … 366 366 } 367 367 368 void MMF::AbstractMediaPlayer::loadingComplete(int error) 369 { 370 Q_ASSERT(Phonon::LoadingState == state()); 371 372 if (KErrNone == error) { 373 updateMetaData(); 374 changeState(StoppedState); 375 } else { 376 setError(tr("Loading clip failed"), error); 377 } 378 } 379 368 380 void MMF::AbstractMediaPlayer::playbackComplete(int error) 369 381 { 370 382 stopTimers(); 371 383 384 if (KErrNone == error && !m_aboutToFinishSent) { 385 const qint64 total = totalTime(); 386 emit MMF::AbstractPlayer::tick(total); 387 m_aboutToFinishSent = true; 388 emit aboutToFinish(); 389 } 390 372 391 if (KErrNone == error) { 373 changeState( StoppedState);392 changeState(PausedState); 374 393 375 394 // MediaObject::switchToNextSource deletes the current player, so we … … 380 399 else { 381 400 setError(tr("Playback complete"), error); 401 emit finished(); 382 402 } 383 403 } … … 394 414 void MMF::AbstractMediaPlayer::positionTick() 395 415 { 396 emitMarksIfReached();397 398 416 const qint64 current = currentTime(); 417 emitMarksIfReached(current); 399 418 emit MMF::AbstractPlayer::tick(current); 400 419 } 401 420 402 void MMF::AbstractMediaPlayer::emitMarksIfReached() 403 { 404 const qint64 current = currentTime(); 421 void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) 422 { 405 423 const qint64 total = totalTime(); 406 424 const qint64 remaining = total - current; … … 436 454 } 437 455 456 void MMF::AbstractMediaPlayer::setPending(Pending pending) 457 { 458 const Phonon::State oldState = state(); 459 m_pending = pending; 460 const Phonon::State newState = state(); 461 if (newState != oldState) 462 emit stateChanged(newState, oldState); 463 } 464 465 void MMF::AbstractMediaPlayer::startPlayback() 466 { 467 doPlay(); 468 startPositionTimer(); 469 changeState(PlayingState); 470 } 471 438 472 void MMF::AbstractMediaPlayer::bufferStatusTick() 439 473 { 440 474 emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); 475 } 476 477 Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const 478 { 479 Phonon::State result = AbstractPlayer::phononState(state); 480 481 if (PausePending == m_pending) { 482 Q_ASSERT(Phonon::StoppedState == result || Phonon::LoadingState == result); 483 result = Phonon::PausedState; 484 } 485 486 return result; 441 487 } 442 488 … … 448 494 const Phonon::State newPhononState = phononState(newState); 449 495 450 // TODO: add some invariants to check that the transition is valid451 AbstractPlayer::changeState(newState);452 453 496 if (LoadingState == oldPhononState && StoppedState == newPhononState) { 454 // Ensure initial volume is set on MMF API before starting playback 455 doVolumeChanged(); 456 457 // Check whether play() was called while clip was being loaded. If so, 458 // playback should be started now 459 if (m_playPending) { 460 TRACE_0("play was called while loading; starting playback now"); 461 m_playPending = false; 462 play(); 463 } 497 switch (m_pending) { 498 case NothingPending: 499 AbstractPlayer::changeState(newState); 500 break; 501 502 case PlayPending: 503 changeState(PlayingState); // necessary in order to apply initial volume 504 doVolumeChanged(); 505 startPlayback(); 506 break; 507 508 case PausePending: 509 AbstractPlayer::changeState(PausedState); 510 break; 511 } 512 513 setPending(NothingPending); 514 } else { 515 AbstractPlayer::changeState(newState); 464 516 } 465 517 } -
trunk/src/3rdparty/phonon/mmf/abstractmediaplayer.h
r561 r769 61 61 // AbstractPlayer 62 62 virtual void doSetTickInterval(qint32 interval); 63 virtual Phonon::State phononState(PrivateState state) const; 64 virtual void changeState(PrivateState newState); 63 65 64 66 virtual void doPlay() = 0; … … 71 73 virtual int bufferStatus() const = 0; 72 74 virtual void close() = 0; 73 virtual void changeState(PrivateState newState);74 75 75 76 void updateMetaData(); … … 81 82 void bufferingComplete(); 82 83 void maxVolumeChanged(int maxVolume); 84 void loadingComplete(int error); 83 85 void playbackComplete(int error); 84 86 … … 92 94 void stopTimers(); 93 95 void doVolumeChanged(); 94 void emitMarksIfReached( );96 void emitMarksIfReached(qint64 position); 95 97 void resetMarksIfRewound(); 98 void startPlayback(); 99 100 enum Pending { 101 NothingPending, 102 PausePending, 103 PlayPending 104 }; 105 106 void setPending(Pending pending); 96 107 97 108 private Q_SLOTS: … … 102 113 MediaObject *const m_parent; 103 114 104 /** 105 * This flag is set to true if play is called when the object is 106 * in a Loading state. Once loading is complete, playback will 107 * be started. 108 */ 109 bool m_playPending; 115 Pending m_pending; 110 116 111 117 QScopedPointer<QTimer> m_positionTimer; -
trunk/src/3rdparty/phonon/mmf/abstractplayer.cpp
r561 r769 49 49 m_transitionTime = player->m_transitionTime; 50 50 m_prefinishMark = player->m_prefinishMark; 51 52 // This is to prevent unwanted state transitions occurring as a result 53 // of MediaObject::switchToNextSource() during playlist playback. 54 if (StoppedState == player->m_state) 55 m_state = player->m_state; 51 56 } 52 57 } … … 97 102 //----------------------------------------------------------------------------- 98 103 99 void MMF::AbstractPlayer::setVideoOutput( VideoOutput* videoOutput)104 void MMF::AbstractPlayer::setVideoOutput(AbstractVideoOutput* videoOutput) 100 105 { 101 106 m_videoOutput = videoOutput; … … 142 147 } 143 148 144 Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) 149 Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) const 145 150 { 146 151 const Phonon::State phononState = -
trunk/src/3rdparty/phonon/mmf/abstractplayer.h
r651 r769 25 25 #include <QObject> 26 26 27 #include " videooutput.h"27 #include "abstractvideooutput.h" 28 28 29 29 class RFile; … … 35 35 namespace MMF 36 36 { 37 class VideoOutput;38 37 39 38 /** … … 80 79 virtual void volumeChanged(qreal volume); 81 80 82 void setVideoOutput( VideoOutput*videoOutput);81 void setVideoOutput(AbstractVideoOutput *videoOutput); 83 82 84 83 /** … … 135 134 * Converts PrivateState into the corresponding Phonon::State 136 135 */ 137 static Phonon::State phononState(PrivateState state);136 virtual Phonon::State phononState(PrivateState state) const; 138 137 139 138 virtual void videoOutputChanged(); … … 157 156 protected: 158 157 // Not owned 159 VideoOutput*m_videoOutput;158 AbstractVideoOutput* m_videoOutput; 160 159 161 160 qreal m_volume; -
trunk/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp
r561 r769 19 19 #include "ancestormovemonitor.h" 20 20 #include "utils.h" 21 #include "videooutput.h" 21 22 #include "videooutput_dsa.h" 22 23 23 24 #include <QCoreApplication> … … 60 61 //----------------------------------------------------------------------------- 61 62 62 void AncestorMoveMonitor::registerTarget( VideoOutput *target)63 void AncestorMoveMonitor::registerTarget(DsaVideoOutput *target) 63 64 { 64 65 TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal); … … 94 95 } 95 96 96 void AncestorMoveMonitor::unRegisterTarget( VideoOutput *target)97 void AncestorMoveMonitor::unRegisterTarget(DsaVideoOutput *target) 97 98 { 98 99 TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal); … … 127 128 if(it != m_hash.end()) { 128 129 const TargetList& targetList = it.value(); 129 VideoOutput* target = 0;130 DsaVideoOutput* target = 0; 130 131 foreach(target, targetList) { 131 132 switch (event->type()) { … … 167 168 TRACE("ancestor 0x%08x", ancestor); 168 169 const TargetList& targetList = it.value(); 169 VideoOutput* target = 0;170 DsaVideoOutput* target = 0; 170 171 foreach(target, targetList) { 171 172 TRACE(" target 0x%08x", target); … … 175 176 } 176 177 177 178 179 178 QT_END_NAMESPACE 180 179 -
trunk/src/3rdparty/phonon/mmf/ancestormovemonitor.h
r561 r769 30 30 namespace MMF 31 31 { 32 class VideoOutput;32 class DsaVideoOutput; 33 33 34 34 class AncestorMoveMonitor : public QObject … … 50 50 * the target receives a ParentChange event. 51 51 */ 52 void registerTarget( VideoOutput *target);52 void registerTarget(DsaVideoOutput *target); 53 53 54 54 /** … … 58 58 * delivered to its ancestors. 59 59 */ 60 void unRegisterTarget( VideoOutput *target);60 void unRegisterTarget(DsaVideoOutput *target); 61 61 62 62 protected: … … 78 78 * efficiency of iteration. 79 79 */ 80 typedef QList< VideoOutput *> TargetList;80 typedef QList<DsaVideoOutput *> TargetList; 81 81 82 82 /** … … 93 93 QT_END_NAMESPACE 94 94 95 #endif 95 #endif // !PHONON_MMF_ANCESTORMOVEMONITOR_H -
trunk/src/3rdparty/phonon/mmf/audioplayer.cpp
r561 r769 100 100 #if !defined(__SERIES60_31__) 101 101 const int err = m_player->SetVolume(mmfVolume); 102 if (QSysInfo::s60Version() >= QSysInfo::SV_S60_ 5_0)102 if (QSysInfo::s60Version() >= QSysInfo::SV_S60_3_2) 103 103 return err; 104 104 else … … 204 204 m_totalTime = toMilliSeconds(m_player->Duration()); 205 205 emit totalTimeChanged(m_totalTime); 206 updateMetaData();207 changeState(StoppedState);208 } else {209 setError(tr("Opening clip failed"), aError);210 206 } 207 208 loadingComplete(aError); 211 209 212 210 TRACE_EXIT_0(); -
trunk/src/3rdparty/phonon/mmf/backend.cpp
r651 r769 25 25 26 26 #include "abstractaudioeffect.h" 27 #include "ancestormovemonitor.h"28 27 #include "audiooutput.h" 29 28 #include "audioplayer.h" … … 45 44 Backend::Backend(QObject *parent) 46 45 : QObject(parent) 46 #ifndef PHONON_MMF_VIDEO_SURFACES 47 47 , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) 48 #endif 48 49 , m_effectFactory(new EffectFactory(this)) 49 50 { … … 87 88 return m_effectFactory->createAudioEffect(type, parent); 88 89 } 90 89 91 case VideoWidgetClass: 90 result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent)); 92 { 93 VideoWidget *widget = new VideoWidget(qobject_cast<QWidget *>(parent)); 94 #ifndef PHONON_MMF_VIDEO_SURFACES 95 widget->setAncestorMoveMonitor(m_ancestorMoveMonitor.data()); 96 #endif 97 result = widget; 98 } 91 99 break; 92 100 -
trunk/src/3rdparty/phonon/mmf/backend.h
r651 r769 20 20 #define PHONON_MMF_BACKEND_H 21 21 22 #ifndef PHONON_MMF_VIDEO_SURFACES 22 23 #include "ancestormovemonitor.h" 24 #endif 25 23 26 #include "effectfactory.h" 24 27 … … 54 57 55 58 private: 59 #ifndef PHONON_MMF_VIDEO_SURFACES 56 60 QScopedPointer<AncestorMoveMonitor> m_ancestorMoveMonitor; 61 #endif 57 62 QScopedPointer<EffectFactory> m_effectFactory; 58 63 -
trunk/src/3rdparty/phonon/mmf/defs.h
r561 r769 36 36 MediaTypeVideo 37 37 }; 38 39 enum VideoParameter { 40 WindowHandle = 0x1, 41 WindowScreenRect = 0x2, 42 ScaleFactors = 0x4 43 }; 44 Q_DECLARE_FLAGS(VideoParameters, VideoParameter) 45 Q_DECLARE_OPERATORS_FOR_FLAGS(VideoParameters) 46 38 47 } 39 48 } -
trunk/src/3rdparty/phonon/mmf/mediaobject.cpp
r651 r769 23 23 #include "utils.h" 24 24 #include "utils.h" 25 #include "mmf_videoplayer.h" 25 26 #ifdef PHONON_MMF_VIDEO_SURFACES 27 #include "videoplayer_surface.h" 28 #else 29 #include "videoplayer_dsa.h" 30 #endif 31 26 32 #include "videowidget.h" 27 33 … … 294 300 295 301 case MediaTypeVideo: 296 newPlayer = new VideoPlayer(this, oldPlayer); 302 #ifdef PHONON_MMF_VIDEO_SURFACES 303 newPlayer = SurfaceVideoPlayer::create(this, oldPlayer); 304 #else 305 newPlayer = DsaVideoPlayer::create(this, oldPlayer); 306 #endif 297 307 break; 298 308 } … … 314 324 connect(m_player.data(), SIGNAL(stateChanged(Phonon::State,Phonon::State)), SIGNAL(stateChanged(Phonon::State,Phonon::State))); 315 325 connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); 316 connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));317 326 connect(m_player.data(), SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int))); 318 327 connect(m_player.data(), SIGNAL(metaDataChanged(QMultiMap<QString,QString>)), SIGNAL(metaDataChanged(QMultiMap<QString,QString>))); 319 328 connect(m_player.data(), SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); 320 connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(tick(qint32))); 329 connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(prefinishMarkReached(qint32))); 330 connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SLOT(handlePrefinishMarkReached(qint32))); 331 connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); 321 332 322 333 // We need to call setError() after doing the connects, otherwise the … … 384 395 //----------------------------------------------------------------------------- 385 396 386 void MMF::MediaObject::setVideoOutput( VideoOutput* videoOutput)397 void MMF::MediaObject::setVideoOutput(AbstractVideoOutput* videoOutput) 387 398 { 388 399 m_player->setVideoOutput(videoOutput); … … 405 416 switchToSource(m_nextSource); 406 417 play(); 407 } 408 } 418 } else { 419 emit finished(); 420 } 421 } 422 423 //----------------------------------------------------------------------------- 424 // Other private functions 425 //----------------------------------------------------------------------------- 426 427 void MMF::MediaObject::handlePrefinishMarkReached(qint32 time) 428 { 429 emit tick(time); 430 } 431 409 432 410 433 QT_END_NAMESPACE -
trunk/src/3rdparty/phonon/mmf/mediaobject.h
r651 r769 39 39 { 40 40 class AbstractPlayer; 41 class VideoOutput;41 class AbstractVideoOutput; 42 42 43 43 /** … … 86 86 AbstractPlayer *abstractPlayer() const; 87 87 88 void setVideoOutput( VideoOutput* videoOutput);88 void setVideoOutput(AbstractVideoOutput* videoOutput); 89 89 90 90 public Q_SLOTS: … … 107 107 void finished(); 108 108 void tick(qint64 time); 109 110 private Q_SLOTS: 111 void handlePrefinishMarkReached(qint32); 109 112 110 113 private: -
trunk/src/3rdparty/phonon/mmf/utils.cpp
r561 r769 53 53 } 54 54 55 56 static const TInt KMimePrefixLength = 6; // either "audio/" or "video/"57 55 _LIT(KMimePrefixAudio, "audio/"); 58 56 _LIT(KMimePrefixVideo, "video/"); 57 _LIT(KMimeSDP, "application/sdp"); 58 59 enum ConstantStringLengths { 60 KMimePrefixLength = 6, // either "audio/" or "video/", 61 KMimeSDPLength = 15 // "application/sdp" 62 }; 59 63 60 64 MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) 61 65 { 62 MediaType result = MediaTypeUnknown;63 64 66 if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) { 65 re sult =MediaTypeAudio;66 } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0 ) {67 result = MediaTypeVideo;68 }69 70 return result;67 return MediaTypeAudio; 68 } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0 || 69 mimeType.Left(KMimeSDPLength).Compare(KMimeSDP) == 0) { 70 return MediaTypeVideo; 71 } else 72 return MediaTypeUnknown; 71 73 } 72 74 -
trunk/src/3rdparty/phonon/mmf/videowidget.cpp
r561 r769 19 19 #include "mediaobject.h" 20 20 #include "utils.h" 21 #include "videooutput.h"22 21 23 22 #include "videowidget.h" 23 24 #ifdef PHONON_MMF_VIDEO_SURFACES 25 #include "videooutput_surface.h" 26 #else 27 #include "videooutput_dsa.h" 28 #endif 24 29 25 30 QT_BEGIN_NAMESPACE … … 46 51 //----------------------------------------------------------------------------- 47 52 48 MMF::VideoWidget::VideoWidget 49 (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) 53 MMF::VideoWidget::VideoWidget(QWidget *parent) 50 54 : MediaNode(parent) 51 , m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent)) 55 #ifdef PHONON_MMF_VIDEO_SURFACES 56 , m_videoOutput(new SurfaceVideoOutput(parent)) 57 #else 58 , m_videoOutput(new DsaVideoOutput(parent)) 59 #endif 52 60 , m_brightness(DefaultBrightness) 53 61 , m_contrast(DefaultContrast) … … 68 76 TRACE_EXIT_0(); 69 77 } 78 79 #ifndef PHONON_MMF_VIDEO_SURFACES 80 void MMF::VideoWidget::setAncestorMoveMonitor(AncestorMoveMonitor *monitor) 81 { 82 static_cast<DsaVideoOutput *>(m_videoOutput.data())->setAncestorMoveMonitor(monitor); 83 } 84 #endif 70 85 71 86 … … 109 124 { 110 125 TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); 111 TRACE("setScaleMode %d", s etScaleMode);126 TRACE("setScaleMode %d", scaleMode); 112 127 113 128 m_videoOutput->setScaleMode(scaleMode); -
trunk/src/3rdparty/phonon/mmf/videowidget.h
r651 r769 20 20 #define PHONON_MMF_VIDEOWIDGET_H 21 21 22 #include "abstractvideooutput.h" 22 23 #include "mmf_medianode.h" 23 #include "videooutput.h"24 24 25 25 #include <QtGui/QWidget> … … 33 33 namespace MMF 34 34 { 35 #ifndef PHONON_MMF_VIDEO_SURFACES 35 36 class AncestorMoveMonitor; 36 class VideoOutput; 37 #endif 37 38 38 39 class VideoWidget : public MediaNode … … 43 44 44 45 public: 45 VideoWidget( AncestorMoveMonitor* ancestorMoveMonitor,QWidget* parent);46 VideoWidget(QWidget* parent); 46 47 ~VideoWidget(); 48 49 #ifndef PHONON_MMF_VIDEO_SURFACES 50 void setAncestorMoveMonitor(AncestorMoveMonitor *ancestorMoveMonitor); 51 #endif 47 52 48 53 // VideoWidgetInterface … … 67 72 68 73 private: 69 QScopedPointer< VideoOutput>m_videoOutput;74 QScopedPointer<AbstractVideoOutput> m_videoOutput; 70 75 71 76 qreal m_brightness;
Note:
See TracChangeset
for help on using the changeset viewer.