diff options
Diffstat (limited to 'src/plugins/wmf')
-rw-r--r-- | src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp | 25 | ||||
-rw-r--r-- | src/plugins/wmf/player/mfplayerservice.cpp | 4 | ||||
-rw-r--r-- | src/plugins/wmf/player/mfplayersession.cpp | 24 | ||||
-rw-r--r-- | src/plugins/wmf/player/mfvideorenderercontrol.cpp | 10 |
4 files changed, 40 insertions, 23 deletions
diff --git a/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp b/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp index d0aed239a..e3d1ebde1 100644 --- a/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp +++ b/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp @@ -195,17 +195,6 @@ void MFAudioDecoderControl::handleMediaSourceReady() if (mediaType) { m_sourceOutputFormat = m_audioFormat; QAudioFormat af = m_audioFormat; - GUID subType; - if (SUCCEEDED(mediaType->GetGUID(MF_MT_SUBTYPE, &subType))) { - if (subType == MFAudioFormat_Float) { - m_sourceOutputFormat.setSampleType(QAudioFormat::Float); - } else { - m_sourceOutputFormat.setSampleType(QAudioFormat::SignedInt); - } - } - if (m_sourceOutputFormat.sampleType() != QAudioFormat::Float) { - m_sourceOutputFormat.setByteOrder(QAudioFormat::LittleEndian); - } UINT32 val = 0; if (SUCCEEDED(mediaType->GetUINT32(MF_MT_AUDIO_NUM_CHANNELS, &val))) { @@ -218,6 +207,20 @@ void MFAudioDecoderControl::handleMediaSourceReady() m_sourceOutputFormat.setSampleSize(int(val)); } + GUID subType; + if (SUCCEEDED(mediaType->GetGUID(MF_MT_SUBTYPE, &subType))) { + if (subType == MFAudioFormat_Float) { + m_sourceOutputFormat.setSampleType(QAudioFormat::Float); + } else if (m_sourceOutputFormat.sampleSize() == 8) { + m_sourceOutputFormat.setSampleType(QAudioFormat::UnSignedInt); + } else { + m_sourceOutputFormat.setSampleType(QAudioFormat::SignedInt); + } + } + if (m_sourceOutputFormat.sampleType() != QAudioFormat::Float) { + m_sourceOutputFormat.setByteOrder(QAudioFormat::LittleEndian); + } + if (m_audioFormat.sampleType() != QAudioFormat::Float && m_audioFormat.sampleType() != QAudioFormat::SignedInt) { af.setSampleType(m_sourceOutputFormat.sampleType()); diff --git a/src/plugins/wmf/player/mfplayerservice.cpp b/src/plugins/wmf/player/mfplayerservice.cpp index e9f611b4a..4e88b0498 100644 --- a/src/plugins/wmf/player/mfplayerservice.cpp +++ b/src/plugins/wmf/player/mfplayerservice.cpp @@ -50,7 +50,7 @@ MFPlayerService::MFPlayerService(QObject *parent) : QMediaService(parent) , m_session(0) -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) , m_videoWindowControl(0) #endif , m_videoRendererControl(0) @@ -65,7 +65,7 @@ MFPlayerService::~MFPlayerService() { m_session->close(); -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) if (m_videoWindowControl) delete m_videoWindowControl; #endif diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index 677d248b2..283853def 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -43,7 +43,7 @@ #include <QtCore/qbuffer.h> #include "mfplayercontrol.h" -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) #include "evr9videowindowcontrol.h" #endif #include "mfvideorenderercontrol.h" @@ -140,7 +140,7 @@ void MFPlayerSession::close() if (m_playerService->videoRendererControl()) { m_playerService->videoRendererControl()->releaseActivate(); -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (m_playerService->videoWindowControl()) { m_playerService->videoWindowControl()->releaseActivate(); #endif @@ -404,7 +404,7 @@ IMFTopologyNode* MFPlayerSession::addOutputNode(IMFStreamDescriptor *streamDesc, mediaType = Video; if (m_playerService->videoRendererControl()) { activate = m_playerService->videoRendererControl()->createActivate(); -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (m_playerService->videoWindowControl()) { activate = m_playerService->videoWindowControl()->createActivate(); #endif @@ -556,7 +556,10 @@ QAudioFormat MFPlayerSession::audioFormatForMFMediaType(IMFMediaType *mediaType) format.setSampleSize(wfx->wBitsPerSample); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleType(QAudioFormat::SignedInt); + if (format.sampleSize() == 8) + format.setSampleType(QAudioFormat::UnSignedInt); + else + format.setSampleType(QAudioFormat::SignedInt); CoTaskMemFree(wfx); return format; @@ -1577,7 +1580,7 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent) } updatePendingCommands(CmdStart); -#ifndef Q_WS_SIMULATOR +#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) // playback started, we can now set again the procAmpValues if they have been // changed previously (these are lost when loading a new media) if (m_playerService->videoWindowControl()) { @@ -1721,10 +1724,17 @@ void MFPlayerSession::updatePendingCommands(Command command) if (m_state.command != command || m_pendingState == NoPending) return; - // The current pending command has completed. + // Seek while paused completed if (m_pendingState == SeekPending && m_state.prevCmd == CmdPause) { m_pendingState = NoPending; - m_state.setCommand(CmdPause); + // A seek operation actually restarts playback. If scrubbing is possible, playback rate + // is set to 0.0 at this point and we just need to reset the current state to Pause. + // If scrubbing is not possible, the playback rate was not changed and we explicitly need + // to re-pause playback. + if (!canScrub()) + pause(); + else + m_state.setCommand(CmdPause); } m_pendingState = NoPending; diff --git a/src/plugins/wmf/player/mfvideorenderercontrol.cpp b/src/plugins/wmf/player/mfvideorenderercontrol.cpp index 94271d4e1..32806a852 100644 --- a/src/plugins/wmf/player/mfvideorenderercontrol.cpp +++ b/src/plugins/wmf/player/mfvideorenderercontrol.cpp @@ -813,7 +813,7 @@ namespace case QVideoFrame::Format_RGB32: mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32); break; - case QVideoFrame::Format_RGB24: + case QVideoFrame::Format_BGR24: // MFVideoFormat_RGB24 has a BGR layout mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB24); break; case QVideoFrame::Format_RGB565: @@ -842,8 +842,11 @@ namespace mediaType->Release(); continue; } - m_pixelFormats.push_back(format); - m_mediaTypes.push_back(mediaType); + // QAbstractVideoSurface::supportedPixelFormats() returns formats in descending + // order of preference, while IMFMediaTypeHandler is supposed to return supported + // formats in ascending order of preference. We need to reverse the list. + m_pixelFormats.prepend(format); + m_mediaTypes.prepend(mediaType); } } @@ -1082,6 +1085,7 @@ namespace return format.frameWidth() * 4; // 24 bpp packed formats. case QVideoFrame::Format_RGB24: + case QVideoFrame::Format_BGR24: return PAD_TO_DWORD(format.frameWidth() * 3); // 16 bpp packed formats. case QVideoFrame::Format_RGB565: |