diff options
| author | j-leungyy <[email protected]> | 2021-05-25 09:06:09 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-25 09:06:09 -0700 |
| commit | 4fe5787f122fdfc45253b45f9fad3983f53d86df (patch) | |
| tree | a11e06f8951d4b7b847f6f5a708f86df87d637db /general/SimpleMediaSource/MediaSource/pch.h | |
| parent | 53afd12aadb8aff15097f1546d4f80c6074e0bdc (diff) | |
update simplemediasource sample (#614)
* update simplemediasource wrl to winrtcpp COM, add mediatype NV12 (SimpleFrameGenerator), fix Mediatype missing attribute (bitrate), add IMFActivate, IMFSampleAllocator interface and implementation, update hardcode arg with named variables, cleanup sample for StreamIndex and StreamId, add sample KSControl
* address PR-it1 comments
* address comment from PR-it2, replace manual define of IKSControl by ksproxy.h
* remove unuse header
* address comment from PR
* fix sdk to latest, add driversign algorithm
* remove nudget, use submodule
Diffstat (limited to 'general/SimpleMediaSource/MediaSource/pch.h')
| -rw-r--r-- | general/SimpleMediaSource/MediaSource/pch.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/general/SimpleMediaSource/MediaSource/pch.h b/general/SimpleMediaSource/MediaSource/pch.h new file mode 100644 index 00000000..dc59629c --- /dev/null +++ b/general/SimpleMediaSource/MediaSource/pch.h @@ -0,0 +1,82 @@ +// pch.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once +// Windows Header Files: +#include <unknwn.h> +#include <windows.h> +#include <propvarutil.h> +#include <ole2.h> +#include <initguid.h> +#include <ks.h> +#include <ksproxy.h> +#include <ksmedia.h> +#include <mfapi.h> +#include <mferror.h> +#include <mfidl.h> +#include <mfreadwrite.h> +#include <nserror.h> +#include <winmeta.h> +#include <d3d9types.h> + +#define RESULT_DIAGNOSTICS_LEVEL 4 // include function name + +#include <wil\cppwinrt.h> // must be before the first C++ WinRT header, ref:https://github.com/Microsoft/wil/wiki/Error-handling-helpers +#include <wil\result.h> +#include <wil\com.h> + +#include "SimpleFrameGenerator.h" +#include "SimpleMediaStream.h" +#include "SimpleMediaSource.h" +#include "SimpleMediaSourceActivate.h" + +inline void DebugPrint(LPCWSTR szFormat, ...) +{ + WCHAR szBuffer[MAX_PATH] = { 0 }; + + va_list pArgs; + va_start(pArgs, szFormat); + StringCbVPrintf(szBuffer, sizeof(szBuffer), szFormat, pArgs); + va_end(pArgs); + OutputDebugStringW(szBuffer); +} + +#define DEBUG_MSG(msg,...) \ +{\ + DebugPrint(L"[%s@%d] ", TEXT(__FUNCTION__), __LINE__);\ + DebugPrint(msg, __VA_ARGS__);\ + DebugPrint(L"\n");\ +}\ + +namespace wilEx +{ + //template <typename T> + //using make_unique_cotaskmem_array = unique_any_array_ptr<typename details::element_traits<T>::type>; + + template<typename T> + wil::unique_cotaskmem_array_ptr<T> make_unique_cotaskmem_array(size_t numOfElements) + { + wil::unique_cotaskmem_array_ptr<T> arr; + size_t cb = sizeof(wil::details::element_traits<T>::type) * numOfElements; + void* ptr = ::CoTaskMemAlloc(cb); + if (ptr != nullptr) + { + ZeroMemory(ptr, cb); + arr.reset(reinterpret_cast<typename wil::details::element_traits<T>::type*>(ptr), numOfElements); + } + return arr; + } +}; + +namespace winrt +{ + template<> bool is_guid_of<IMFMediaSourceEx>(guid const& id) noexcept; + + template<> bool is_guid_of<IMFMediaStream2>(guid const& id) noexcept; + + template<> bool is_guid_of<IMFActivate>(guid const& id) noexcept; +}; + + |
