diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-12 14:11:35 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-12 14:11:35 +0100 |
commit | c6ec402d257dfc49a98d2f88989b6dfee7bc4e8a (patch) | |
tree | 92a278d08342bb85e2fe18d2ea78d66530984aca /src/plugins/directshow | |
parent | 7a02bcaad18d7aa133944a23f863c2f9efcbf5fe (diff) | |
parent | db7f7cc5654ddec60297259bc9f86f5f777749cd (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ie93615076177662e75d46f3d13beeb88d424b4a6
Diffstat (limited to 'src/plugins/directshow')
-rw-r--r-- | src/plugins/directshow/camera/dscamerasession.cpp | 40 | ||||
-rw-r--r-- | src/plugins/directshow/camera/dscamerasession.h | 2 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 6b474e898..1ecc368e7 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -173,6 +173,8 @@ public: DSCameraSession::DSCameraSession(QObject *parent) : QObject(parent) ,m_currentImageId(0) + , needsHorizontalMirroring(false) + , needsVerticalMirroring(true) { pBuild = NULL; pGraph = NULL; @@ -581,7 +583,7 @@ void DSCameraSession::captureFrame() mutex.lock(); image = QImage(frames.at(0)->buffer,m_windowSize.width(),m_windowSize.height(), - QImage::Format_RGB888).rgbSwapped().mirrored(true); + QImage::Format_RGB888).rgbSwapped().mirrored(needsHorizontalMirroring, needsVerticalMirroring); QVideoFrame frame(image); frame.setStartTime(frames.at(0)->time); @@ -595,7 +597,7 @@ void DSCameraSession::captureFrame() mutex.lock(); image = QImage(frames.at(0)->buffer,m_windowSize.width(),m_windowSize.height(), - QImage::Format_RGB32).mirrored(true); + QImage::Format_RGB32).mirrored(needsHorizontalMirroring, needsVerticalMirroring); QVideoFrame frame(image); frame.setStartTime(frames.at(0)->time); @@ -805,7 +807,39 @@ void DSCameraSession::updateProperties() types.clear(); resolutions.clear(); - + IAMVideoControl *pVideoControl = 0; + hr = pBuild->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,pCap, + IID_IAMVideoControl, (void**)&pVideoControl); + if (FAILED(hr)) { + qWarning() << "Failed to get the video control"; + } else { + IPin *pPin = 0; + if (pCap) { + hr = getPin(pCap, PINDIR_OUTPUT, &pPin); + if (FAILED(hr)) { + qWarning() << "Failed to get the pin for the video control"; + } else { + long supportedModes; + hr = pVideoControl->GetCaps(pPin, &supportedModes); + if (FAILED(hr)) { + qWarning() << "Failed to get the supported modes of the video control"; + } else if (supportedModes & VideoControlFlag_FlipHorizontal || supportedModes & VideoControlFlag_FlipVertical) { + long mode; + hr = pVideoControl->GetMode(pPin, &mode); + if (FAILED(hr)) { + qWarning() << "Failed to get the mode of the video control"; + } else { + if (supportedModes & VideoControlFlag_FlipHorizontal) + needsHorizontalMirroring = (mode & VideoControlFlag_FlipHorizontal); + if (supportedModes & VideoControlFlag_FlipVertical) + needsVerticalMirroring = (mode & VideoControlFlag_FlipVertical); + } + } + pPin->Release(); + } + } + pVideoControl->Release(); + } for (int iIndex = 0; iIndex < iCount; iIndex++) { hr = pConfig->GetStreamCaps(iIndex, &pmt, reinterpret_cast<BYTE*>(&scc)); if (hr == S_OK) { diff --git a/src/plugins/directshow/camera/dscamerasession.h b/src/plugins/directshow/camera/dscamerasession.h index e78358a5f..0fe12dec3 100644 --- a/src/plugins/directshow/camera/dscamerasession.h +++ b/src/plugins/directshow/camera/dscamerasession.h @@ -188,6 +188,8 @@ private: QString m_snapshot; int m_currentImageId; + bool needsHorizontalMirroring; + bool needsVerticalMirroring; protected: HRESULT getPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin); bool createFilterGraph(); |