winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one...
[wine/multimedia.git] / dlls / qcap / qcap_main.c
blobddacd62beae290ec0bebaaea4bb7e8bc3a6aa3c9
1 /*
2 * Qcap implementation, dllentry points
4 * Copyright (C) 2003 Dominik Strasser
5 * Copyright (C) 2005 Rolf Kalbermatter
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <assert.h>
24 #include <stdio.h>
25 #include <stdarg.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winerror.h"
33 #include "objbase.h"
34 #include "uuids.h"
35 #include "strmif.h"
37 #include "qcap_main.h"
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(qcap);
44 static LONG objects_ref = 0;
46 static const WCHAR wAudioCaptureFilter[] =
47 {'A','u','d','i','o',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',0};
48 static const WCHAR wAVICompressor[] =
49 {'A','V','I',' ','C','o','m','p','r','e','s','s','o','r',0};
50 static const WCHAR wVFWCaptFilter[] =
51 {'V','F','W',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',0};
52 static const WCHAR wVFWCaptFilterProp[] =
53 {'V','F','W',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',' ',
54 'P','r','o','p','e','r','t','y',' ','P','a','g','e',0};
55 static const WCHAR wAVIMux[] =
56 {'A','V','I',' ','m','u','x',0};
57 static const WCHAR wAVIMuxPropPage[] =
58 {'A','V','I',' ','m','u','x',' ','P','r','o','p','e','r','t','y',' ','P','a','g','e',0};
59 static const WCHAR wAVIMuxPropPage1[] =
60 {'A','V','I',' ','m','u','x',' ','P','r','o','p','e','r','t','y',' ','P','a','g','e','1',0};
61 static const WCHAR wFileWriter[] =
62 {'F','i','l','e',' ','W','r','i','t','e','r',0};
63 static const WCHAR wCaptGraphBuilder[] =
64 {'C','a','p','t','u','r','e',' ','G','r','a','p','h',' ','B','u','i','l','d','e','r',0};
65 static const WCHAR wCaptGraphBuilder2[] =
66 {'C','a','p','t','u','r','e',' ','G','r','a','p','h',' ','B','u','i','l','d','e','r','2',0};
67 static const WCHAR wInfPinTeeFilter[] =
68 {'I','n','f','i','n','i','t','e',' ','P','i','n',' ','T','e','e',' ','F','i',
69 'l','t','e','r',0};
70 static const WCHAR wSmartTeeFilter[] =
71 {'S','m','a','r','t',' ','T','e','e',' ','F','i','l','t','e','r',0};
72 static const WCHAR wAudioInMixerProp[] =
73 {'A','u','d','i','o','I','n','p','u','t','M','i','x','e','r',' ','P','r','o',
74 'p','e','r','t','y',' ','P','a','g','e',0};
76 FactoryTemplate const g_Templates[] = {
78 wAudioCaptureFilter,
79 &CLSID_AudioRecord,
80 NULL, /* FIXME: Implement QCAP_createAudioCaptureFilter */
81 NULL
82 },{
83 wAVICompressor,
84 &CLSID_AVICo,
85 QCAP_createAVICompressor,
86 NULL
87 },{
88 wVFWCaptFilter,
89 &CLSID_VfwCapture,
90 QCAP_createVFWCaptureFilter,
91 NULL
92 },{
93 wVFWCaptFilterProp,
94 &CLSID_CaptureProperties,
95 NULL, /* FIXME: Implement QCAP_createVFWCaptureFilterPropertyPage */
96 NULL
97 },{
98 wAVIMux,
99 &CLSID_AviDest,
100 QCAP_createAVIMux,
101 NULL
103 wAVIMuxPropPage,
104 &CLSID_AviMuxProptyPage,
105 NULL, /* FIXME: Implement QCAP_createAVIMuxPropertyPage */
106 NULL
108 wAVIMuxPropPage1,
109 &CLSID_AviMuxProptyPage1,
110 NULL, /* FIXME: Implement QCAP_createAVIMuxPropertyPage1 */
111 NULL
113 wFileWriter,
114 &CLSID_FileWriter,
115 NULL, /* FIXME: Implement QCAP_createFileWriter */
116 NULL
118 wCaptGraphBuilder,
119 &CLSID_CaptureGraphBuilder,
120 QCAP_createCaptureGraphBuilder2,
121 NULL
123 wCaptGraphBuilder2,
124 &CLSID_CaptureGraphBuilder2,
125 QCAP_createCaptureGraphBuilder2,
126 NULL
128 wInfPinTeeFilter,
129 &CLSID_InfTee,
130 NULL, /* FIXME: Implement QCAP_createInfinitePinTeeFilter */
131 NULL
133 wSmartTeeFilter,
134 &CLSID_SmartTee,
135 NULL, /* FIXME: Implement QCAP_createSmartTeeFilter */
136 NULL
138 wAudioInMixerProp,
139 &CLSID_AudioInputMixerProperties,
140 NULL, /* FIXME: Implement QCAP_createAudioInputMixerPropertyPage */
141 NULL
145 int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
147 /***********************************************************************
148 * Dll EntryPoint (QCAP.@)
150 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
152 return STRMBASE_DllMain(hInstDLL,fdwReason,lpv);
155 /***********************************************************************
156 * DllGetClassObject
158 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
160 return STRMBASE_DllGetClassObject( rclsid, riid, ppv );
163 /***********************************************************************
164 * DllRegisterServer (QCAP.@)
166 HRESULT WINAPI DllRegisterServer(void)
168 TRACE("()\n");
169 return AMovieDllRegisterServer2(TRUE);
172 /***********************************************************************
173 * DllUnregisterServer (QCAP.@)
175 HRESULT WINAPI DllUnregisterServer(void)
177 TRACE("\n");
178 return AMovieDllRegisterServer2(FALSE);
181 /***********************************************************************
182 * DllCanUnloadNow (QCAP.@)
184 HRESULT WINAPI DllCanUnloadNow(void)
186 TRACE("\n");
188 if (STRMBASE_DllCanUnloadNow() && objects_ref == 0)
189 return S_OK;
190 return S_FALSE;
193 DWORD ObjectRefCount(BOOL increment)
195 if (increment)
196 return InterlockedIncrement(&objects_ref);
197 return InterlockedDecrement(&objects_ref);