diff options
author | Christian Strømme <christian.stromme@qt.io> | 2016-11-10 17:55:15 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2017-01-27 13:27:15 +0000 |
commit | 57a4cabd78aba3d6c1dd4802b0e3baf5ed3e4758 (patch) | |
tree | fc329fb425258fee98c727691c3310ec706beb29 /src/plugins/directshow/player/directshowiosource.cpp | |
parent | 47c672cdd67853658a2f86688ec72eb9b4d8c1ca (diff) |
DirectShow: Sanitize DirectShowMediaType
The DirectShowMediaType is now a thin data wrapper around AM_MEDIA_TYPE
and will for the most look and work the same way, with the exception
that it cleans up after itself. All utility functions are now static,
except clear() which, for convenience, is also provided as a non-static
member function.
In addition to the changes mentioned above, duplicated methods were
removed, conversion for ARGB32 was added, and an attempt to make
the usage of AM_MEDIA_TYPE and DirectShowMediaType was made more
consistent.
Change-Id: Iad32fb8eeabd9d4183e9bd10426cac3963e5d99a
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/plugins/directshow/player/directshowiosource.cpp')
-rw-r--r-- | src/plugins/directshow/player/directshowiosource.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp index 3c44dd1ed..96b4b14bf 100644 --- a/src/plugins/directshow/player/directshowiosource.cpp +++ b/src/plugins/directshow/player/directshowiosource.cpp @@ -82,7 +82,7 @@ DirectShowIOSource::DirectShowIOSource(DirectShowEventLoop *loop) // The filter works in pull mode, the downstream filter is responsible for requesting // samples from this one. // - AM_MEDIA_TYPE type = + AM_MEDIA_TYPE type { MEDIATYPE_Stream, // majortype MEDIASUBTYPE_NULL, // subtype @@ -99,7 +99,7 @@ DirectShowIOSource::DirectShowIOSource(DirectShowEventLoop *loop) for (int i = 0; i < count; ++i) { type.subtype = directshow_subtypes[i]; - m_supportedMediaTypes.append(type); + m_supportedMediaTypes.append(DirectShowMediaType(type)); } } @@ -371,12 +371,12 @@ HRESULT DirectShowIOSource::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) hr = pReceivePin->ReceiveConnection(this, pmt); // Update the media type for the current connection. if (SUCCEEDED(hr)) - m_connectionMediaType = *pmt; + DirectShowMediaType::copy(&m_connectionMediaType, pmt); } else if (pmt && pmt->subtype == MEDIATYPE_NULL) { // - Partial type (Stream, but no subtype specified). - m_connectionMediaType = *pmt; + DirectShowMediaType::copy(&m_connectionMediaType, pmt); // Check if the receiving pin accepts any of the streaming subtypes. for (const DirectShowMediaType &t : qAsConst(m_supportedMediaTypes)) { - m_connectionMediaType.subtype = t.subtype; + m_connectionMediaType->subtype = t->subtype; hr = pReceivePin->ReceiveConnection(this, &m_connectionMediaType); if (SUCCEEDED(hr)) break; @@ -477,7 +477,7 @@ HRESULT DirectShowIOSource::ConnectionMediaType(AM_MEDIA_TYPE *pmt) return VFW_E_NOT_CONNECTED; } else { - DirectShowMediaType::copy(pmt, m_connectionMediaType); + DirectShowMediaType::copy(pmt, &m_connectionMediaType); return S_OK; } |