Alax.Info ATL/WTL Utilities is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

Commit 111

User picture
  • Author: alax
  • 2009-03-01 15:57 (about 5 years ago)

fix to compile on standard SDK, ATL, WTL headers, without unpublished Alax.Info headers

Files Affected

 
110111
8
#include <qedit.h>
8
#include <qedit.h>
9
#import "libid:4C03D3C8-13AD-451F-9363-FAD08EF94A91" no_namespace named_guids // Acquisition
9
#import "libid:4C03D3C8-13AD-451F-9363-FAD08EF94A91" no_namespace named_guids // Acquisition
10
#import "libid:A05217D4-890A-41E6-85A4-7C66EB09DB67" no_namespace named_guids // CodingI
10
#import "libid:A05217D4-890A-41E6-85A4-7C66EB09DB67" no_namespace named_guids // CodingI
 
 
11
#if defined(_ALAXINFO)
11
#include "rodshow.h"
12
#include "rodshow.h"
12
#include "rodmo.h"
13
#include "rodmo.h"
 
 
14
#else
 
 
15
#include <dshow.h>
 
 
16
#include <atlsync.h>
 
 
17
#include <atlcoll.h>
 
 
18
#pragma comment(lib, "strmiids.lib")
 
 
19
#endif // defined(_ALAXINFO)
13
 
20
 
 
 
21
////////////////////////////////////////////////////////////
 
 
22
// Goodies
 
 
23
 
 
 
24
#pragma region Replacement for Alax.Info header files so that the project compiles with standard SDK, ATL and WTL headers
 
 
25
#if !defined(_ALAXINFO)
 
 
26
 
 
 
27
#define DIM            _countof
 
 
28
 
 
 
29
#define _A            ATLASSERT
 
 
30
#define _V(x)        ATLVERIFY(SUCCEEDED(x))
 
 
31
#define _W            ATLVERIFY
 
 
32
#define __C            ATLENSURE_SUCCEEDED
 
 
33
#define __D            ATLENSURE_THROW
 
 
34
#define _Z4            ATLTRACE
 
 
35
 
 
 
36
#define E_UNNAMED    E_FAIL
 
 
37
 
 
 
38
typedef CComAutoCriticalSection CRoCriticalSection;
 
 
39
typedef CComCritSecLock<CComAutoCriticalSection> CRoCriticalSectionLock;
 
 
40
 
 
 
41
inline BOOL IsMultiThreadedApartment() throw()
 
 
42
{
 
 
43
    return TRUE;
 
 
44
}
 
 
45
 
 
 
46
inline CString AtlFormatString(LPCTSTR pszFormat, ...)
 
 
47
{
 
 
48
    return _T("...");
 
 
49
}
 
 
50
 
 
 
51
inline CString AtlFormatSystemMessage(DWORD nCode)
 
 
52
{
 
 
53
    return _T("...");
 
 
54
}
 
 
55
 
 
 
56
class _FilterGraphHelper
 
 
57
{
 
 
58
public:
 
 
59
// _FilterGraphHelper
 
 
60
    static SIZE_T GetFilterPins(IBaseFilter* pBaseFilter, CAtlArray<CComPtr<IPin> >& PinArray)
 
 
61
    {
 
 
62
        _A(pBaseFilter);
 
 
63
        _A(PinArray.IsEmpty());
 
 
64
        CComPtr<IEnumPins> pEnumPins;
 
 
65
        _V(pBaseFilter->EnumPins(&pEnumPins));
 
 
66
        CComPtr<IPin> pPin;
 
 
67
        while(pEnumPins->Next(1, &pPin, NULL) == S_OK)
 
 
68
        {
 
 
69
            _A(pPin);
 
 
70
            _W(PinArray.Add(pPin) >= 0);
 
 
71
            pPin = NULL;
 
 
72
        }
 
 
73
        return PinArray.GetCount();
 
 
74
    }
 
 
75
    static SIZE_T GetFilterPins(IBaseFilter* pBaseFilter, PIN_DIRECTION PinDirection, CAtlArray<CComPtr<IPin> >& PinArray)
 
 
76
    {
 
 
77
        _A(pBaseFilter);
 
 
78
        _A(PinArray.IsEmpty());
 
 
79
        CComPtr<IEnumPins> pEnumPins;
 
 
80
        _V(pBaseFilter->EnumPins(&pEnumPins));
 
 
81
        CComPtr<IPin> pPin;
 
 
82
        while(pEnumPins->Next(1, &pPin, NULL) == S_OK)
 
 
83
        {
 
 
84
            _A(pPin);
 
 
85
            PIN_DIRECTION CurrentPinDirection = (PIN_DIRECTION) -1;
 
 
86
            _V(pPin->QueryDirection(&CurrentPinDirection));
 
 
87
            if(CurrentPinDirection == PinDirection)
 
 
88
                _W(PinArray.Add(pPin) >= 0);
 
 
89
            pPin = NULL;
 
 
90
        }
 
 
91
        return PinArray.GetCount();
 
 
92
    }
 
 
93
    static CComPtr<IPin> GetFilterPin(IBaseFilter* pBaseFilter, SIZE_T nIndex = 0)
 
 
94
    {
 
 
95
        CAtlArray<CComPtr<IPin> > PinArray;
 
 
96
        if(nIndex >= GetFilterPins(pBaseFilter, PinArray))
 
 
97
            return NULL;
 
 
98
        _A(nIndex < PinArray.GetCount());
 
 
99
        return PinArray[nIndex];
 
 
100
    }
 
 
101
    static CComPtr<IPin> GetFilterPin(IBaseFilter* pBaseFilter, PIN_DIRECTION PinDirection, SIZE_T nIndex = 0)
 
 
102
    {
 
 
103
        CAtlArray<CComPtr<IPin> > PinArray;
 
 
104
        if(nIndex >= GetFilterPins(pBaseFilter, PinDirection, PinArray))
 
 
105
            return NULL;
 
 
106
        _A(nIndex < PinArray.GetCount());
 
 
107
        return PinArray[nIndex];
 
 
108
    }
 
 
109
};
 
 
110
 
 
 
111
#endif // defined(_ALAXINFO)
 
 
112
#pragma endregion 
 
 
113
 
 
 
114
////////////////////////////////////////////////////////////
 
 
115
// CModule
 
 
116
 
14
class CModule :
117
class CModule :
15
    public CAtlExeModuleT<CModule>
118
    public CAtlExeModuleT<CModule>
16
{
119
{
...
 
...
 
64
public:
167
public:
65
    CString sLocation;
168
    CString sLocation;
66
    CComPtr<IGraphBuilder> pGraphBuilder;
169
    CComPtr<IGraphBuilder> pGraphBuilder;
67
    _FilterGraphHelper::CRotRunningFilterGraph RunningFilterGraph;
170
    //_FilterGraphHelper::CRotRunningFilterGraph RunningFilterGraph;
68
    CComPtr<IJpegFrameDecoderFilter> pJpegFrameDecoderFilter;
171
    CComPtr<IJpegFrameDecoderFilter> pJpegFrameDecoderFilter;
69
    CJpegFrameDecoderFilterEvents JpegFrameDecoderFilterEvents;
172
    CJpegFrameDecoderFilterEvents JpegFrameDecoderFilterEvents;
70
 
173
 
...
 
...
 
74
    {
177
    {
75
        _A(!pGraphBuilder);
178
        _A(!pGraphBuilder);
76
        __C(pGraphBuilder.CoCreateInstance(CLSID_FilterGraph));
179
        __C(pGraphBuilder.CoCreateInstance(CLSID_FilterGraph));
77
        RunningFilterGraph.SetFilterGraph(pGraphBuilder);
180
        //RunningFilterGraph.SetFilterGraph(pGraphBuilder);
78
        _ATLTRY
181
        _ATLTRY
79
        {
182
        {
80
            static const BOOL g_bUseJpegFrameDecoderFilter = TRUE;
183
            static const BOOL g_bUseJpegFrameDecoderFilter = TRUE;
...
 
...
 
161
    {
264
    {
162
        // ASSU: JpegFrameDecoderFilterEvents already unadvised
265
        // ASSU: JpegFrameDecoderFilterEvents already unadvised
163
        pJpegFrameDecoderFilter = NULL;
266
        pJpegFrameDecoderFilter = NULL;
164
        RunningFilterGraph.SetFilterGraph(NULL);;
267
        //RunningFilterGraph.SetFilterGraph(NULL);;
165
        pGraphBuilder = NULL;
268
        pGraphBuilder = NULL;
166
        CComPtr<IJpegFrameDecoderFilter> ;
269
        CComPtr<IJpegFrameDecoderFilter> ;
167
    }
270
    }
110111
114
            />
114
            />
115
            <Tool
115
            <Tool
116
                Name="VCCLCompilerTool"
116
                Name="VCCLCompilerTool"
117
                Optimization="2"
117
                Optimization="3"
 
 
118
                InlineFunctionExpansion="2"
118
                EnableIntrinsicFunctions="true"
119
                EnableIntrinsicFunctions="true"
 
 
120
                FavorSizeOrSpeed="2"
 
 
121
                OmitFramePointers="true"
 
 
122
                EnableFiberSafeOptimizations="true"
119
                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
123
                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
120
                RuntimeLibrary="2"
124
                StringPooling="true"
121
                EnableFunctionLevelLinking="true"
125
                ExceptionHandling="2"
 
 
126
                RuntimeLibrary="0"
122
                UsePrecompiledHeader="2"
127
                UsePrecompiledHeader="2"
123
                WarningLevel="3"
128
                WarningLevel="3"
124
                DebugInformationFormat="3"
129
                DebugInformationFormat="3"
...
 
...
 
135
            <Tool
140
            <Tool
136
                Name="VCLinkerTool"
141
                Name="VCLinkerTool"
137
                LinkIncremental="1"
142
                LinkIncremental="1"
 
 
143
                DelayLoadDLLs="dbghelp.dll"
138
                GenerateDebugInformation="true"
144
                GenerateDebugInformation="true"
139
                SubSystem="1"
145
                SubSystem="1"
140
                OptimizeReferences="2"
146
                OptimizeReferences="2"
110111
6
 
6
 
7
#pragma once
7
#pragma once
8
 
8
 
 
 
9
//#define _ALAXINFO
 
 
10
 
9
////////////////////////////////////////////////////////////
11
////////////////////////////////////////////////////////////
10
// Windows definitions
12
// Windows definitions
11
 
13
 
...
 
...
 
25
#define _ATL_ALL_WARNINGS
27
#define _ATL_ALL_WARNINGS
26
//#define _ATL_ATTRIBUTES
28
//#define _ATL_ATTRIBUTES
27
 
29
 
 
 
30
#if defined(_ALAXINFO)
28
#include "roatltrace.h" // Replacement for <atltrace.h>
31
#include "roatltrace.h" // Replacement for <atltrace.h>
 
 
32
#else
 
 
33
#include <atltrace.h>
 
 
34
#endif // defined(_ALAXINFO)
29
#include <atlbase.h>
35
#include <atlbase.h>
30
#include <atlstr.h>
36
#include <atlstr.h>
31
#include <atlpath.h>
37
#include <atlpath.h>
...
 
...
 
34
using namespace ATL::ATLPath;
40
using namespace ATL::ATLPath;
35
 
41
 
36
////////////////////////////////////////////////////////////
42
////////////////////////////////////////////////////////////
 
 
43
// WTL
 
 
44
 
 
 
45
#define _WTL_NO_CSTRING
 
 
46
#if defined(_ALAXINFO)
 
 
47
#define _WTL_NO_WTYPES
 
 
48
#endif // defined(_ALAXINFO)
 
 
49
#define _WTL_NO_UNION_CLASSES
 
 
50
#define _WTL_NEW_PAGE_NOTIFY_HANDLERS
 
 
51
 
 
 
52
#include <atlapp.h>
 
 
53
#include <atlgdi.h>
 
 
54
#include <atluser.h>
 
 
55
//#include <atlcrack.h>
 
 
56
//#include <atlctrls.h>
 
 
57
//#include <atlctrlx.h>
 
 
58
#include <atlmisc.h>
 
 
59
#include <atlframe.h>
 
 
60
//#include <atldlgs.h>
 
 
61
 
 
 
62
using namespace WTL;
 
 
63
 
 
 
64
////////////////////////////////////////////////////////////
37
// Alax.Info ATL/WTL
65
// Alax.Info ATL/WTL
38
 
66
 
39
#define REGISTRY_PRODUCTROOT    _T("SOFTWARE\\Alax.Info\\Media Tools")
67
#define REGISTRY_PRODUCTROOT    _T("SOFTWARE\\Alax.Info\\Media Tools")
...
 
...
 
40
#define REGISTRY_FILEROOT        REGISTRY_PRODUCTROOT _T("\\Samples")
68
#define REGISTRY_FILEROOT        REGISTRY_PRODUCTROOT _T("\\Samples")
41
#define REGISTRY_ROOT            REGISTRY_FILEROOT
69
#define REGISTRY_ROOT            REGISTRY_FILEROOT
42
 
70
 
 
 
71
#if defined(_ALAXINFO)
43
#include "roatlbase.h"
72
#include "roatlbase.h"
44
#include "roatlvariants.h"
73
#include "roatlvariants.h"
45
#include "roatlcom.h"
74
#include "roatlcom.h"
...
 
...
 
50
//#include "rowtlcrack.h"
79
//#include "rowtlcrack.h"
51
#include "rodialogs.h"
80
#include "rodialogs.h"
52
//#include "rocontrols.h"
81
//#include "rocontrols.h"
 
 
82
#else
 
 
83
#include <atlcom.h>
 
 
84
#endif // defined(_ALAXINFO)