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