[199] | 1 | //////////////////////////////////////////////////////////// |
---|
[376] | 2 | // Copyright (C) Roman Ryltsov, 2008-2015 |
---|
[276] | 3 | // Created by Roman Ryltsov roman@alax.info, http://alax.info |
---|
[267] | 4 | // |
---|
| 5 | // This source code is published to complement DirectShowSpy developer powertoy |
---|
| 6 | // and demonstrate the internal use of APIs and tricks powering the tool. It is |
---|
[276] | 7 | // allowed to freely re-use the portions of the code in other projects, commercial |
---|
| 8 | // or otherwise (provided that you dont pretend that you wrote the original tool). |
---|
[267] | 9 | // |
---|
| 10 | // Please keep in mind that DirectShowSpy is a developer tool, it is strongly recommended |
---|
[276] | 11 | // that it is not shipped with release grade software. It is allowed to distribute |
---|
| 12 | // DirectShowSpy if only it is not registered with Windows by default and either |
---|
| 13 | // used privately, or registered on specific throubleshooting request. The advice applies |
---|
| 14 | // to hooking methods used by DirectShowSpy in general as well. |
---|
[199] | 15 | |
---|
| 16 | #include "stdafx.h" |
---|
| 17 | #include "resource.h" |
---|
| 18 | #include "FilterGraphHelper.h" |
---|
[231] | 19 | |
---|
| 20 | //////////////////////////////////////////////////////////// |
---|
| 21 | // Test |
---|
| 22 | |
---|
| 23 | #if _DEVELOPMENT |
---|
| 24 | |
---|
| 25 | COMPILER_MESSAGE("Development: CFilterGraphHelper::DoPropertyFrameModal as Test") |
---|
| 26 | |
---|
| 27 | #if defined(_WIN64) |
---|
| 28 | extern "C" __declspec(dllexport) |
---|
| 29 | #else |
---|
| 30 | #pragma comment(linker, "/EXPORT:Test=_Test@0,PRIVATE") |
---|
| 31 | extern "C" // __declspec(dllexport) |
---|
| 32 | #endif // defined(_WIN64) |
---|
| 33 | |
---|
| 34 | HRESULT STDMETHODCALLTYPE Test() throw() |
---|
| 35 | { |
---|
| 36 | _ATLTRY |
---|
| 37 | { |
---|
| 38 | CSingleThreadedApartment SingleThreadedApartment; |
---|
| 39 | CGenericFilterGraph FilterGraph; |
---|
| 40 | FilterGraph.CoCreateInstance(); |
---|
| 41 | __C(FilterGraph.m_pFilterGraph->RenderFile(_T("E:\\Media\\Robotica_1080.wmv"), NULL)); |
---|
[242] | 42 | _ATLTRY |
---|
| 43 | { |
---|
| 44 | const CComQIPtr<ISpy> pSpy = FilterGraph.m_pFilterGraph; |
---|
| 45 | if(pSpy) |
---|
| 46 | __C(pSpy->put_FriendlyName(CComBSTR(_T("Test")))); |
---|
| 47 | } |
---|
| 48 | _ATLCATCHALL() |
---|
| 49 | { |
---|
| 50 | _Z_EXCEPTION(); |
---|
| 51 | } |
---|
[231] | 52 | CLocalObjectPtr<CFilterGraphHelper> pHelper; |
---|
| 53 | pHelper->SetFilterGraph(FilterGraph.m_pFilterGraph); |
---|
| 54 | pHelper->DoPropertyFrameModal(0); |
---|
| 55 | } |
---|
| 56 | _ATLCATCH(Exception) |
---|
| 57 | { |
---|
| 58 | _C(Exception); |
---|
| 59 | } |
---|
| 60 | return S_OK; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | #endif // _DEVELOPMENT |
---|