diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2007-10-19 23:30:02 +0400 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2007-10-19 23:30:02 +0400 |
commit | afe04861df6403e0164e96c4550fd8553f0cf65b (patch) | |
tree | 79e2c7855556dafe3c1a11c48fbb91433b87f698 /src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp | |
parent | f2bf4131f191423c9580aa2629baa54dece52fea (diff) |
NEW : Support for FLV4, VP5 and VP6 video using ffmpeg codec
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@316 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp')
-rw-r--r-- | src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp b/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp new file mode 100644 index 000000000..d312158a3 --- /dev/null +++ b/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp @@ -0,0 +1,99 @@ +#include "stdafx.h"
+#include "VideoDecOutputPin.h"
+#include "VideoDecDXVAAllocator.h"
+#include "MPCVideoDecFilter.h"
+
+CVideoDecOutputPin::CVideoDecOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
+ : CBaseVideoOutputPin(pObjectName, pFilter, phr, pName)
+{
+ m_pVideoDecFilter = (CMPCVideoDecFilter*) pFilter;
+ m_pDXVAAllocator = NULL;
+}
+
+CVideoDecOutputPin::~CVideoDecOutputPin(void)
+{
+}
+
+
+HRESULT CVideoDecOutputPin::InitAllocator(IMemAllocator **ppAlloc)
+{
+ TRACE("CVideoDecOutputPin::InitAllocator");
+ if (m_pVideoDecFilter->UseDXVA2())
+ {
+ HRESULT hr = S_FALSE;
+ m_pDXVAAllocator = new CVideoDecDXVAAllocator(m_pVideoDecFilter, &hr);
+ if (!m_pDXVAAllocator)
+ {
+ return E_OUTOFMEMORY;
+ }
+ if (FAILED(hr))
+ {
+ delete m_pDXVAAllocator;
+ return hr;
+ }
+ // Return the IMemAllocator interface.
+ return m_pDXVAAllocator->QueryInterface(__uuidof(IMemAllocator), (void **)ppAlloc);
+ }
+ else
+ return __super::InitAllocator(ppAlloc);
+}
+
+
+HRESULT CVideoDecOutputPin::DecideAllocator(IMemInputPin *pPin, IMemAllocator **ppAlloc)
+{
+ if (m_pVideoDecFilter->UseDXVA2())
+ {
+ HRESULT hr = NOERROR;
+ *ppAlloc = NULL;
+
+ // get downstream prop request
+ // the derived class may modify this in DecideBufferSize, but
+ // we assume that he will consistently modify it the same way,
+ // so we only get it once
+ ALLOCATOR_PROPERTIES prop;
+ ZeroMemory(&prop, sizeof(prop));
+
+ // whatever he returns, we assume prop is either all zeros
+ // or he has filled it out.
+ pPin->GetAllocatorRequirements(&prop);
+
+ // if he doesn't care about alignment, then set it to 1
+ if (prop.cbAlign == 0) {
+ prop.cbAlign = 1;
+ }
+
+ /* If the GetAllocator failed we may not have an interface */
+
+ if (*ppAlloc) {
+ (*ppAlloc)->Release();
+ *ppAlloc = NULL;
+ }
+
+ /* Try the output pin's allocator by the same method */
+
+ hr = InitAllocator(ppAlloc);
+ if (SUCCEEDED(hr)) {
+
+ // note - the properties passed here are in the same
+ // structure as above and may have been modified by
+ // the previous call to DecideBufferSize
+ hr = DecideBufferSize(*ppAlloc, &prop);
+ if (SUCCEEDED(hr)) {
+ hr = pPin->NotifyAllocator(*ppAlloc, FALSE);
+ if (SUCCEEDED(hr)) {
+ return NOERROR;
+ }
+ }
+ }
+
+ /* Likewise we may not have an interface to release */
+
+ if (*ppAlloc) {
+ (*ppAlloc)->Release();
+ *ppAlloc = NULL;
+ }
+ return hr;
+ }
+ else
+ return __super::DecideAllocator(pPin, ppAlloc);
+}
|