netstat: Initial implementation.
[wine] / dlls / wineqtdecoder / main.c
1 /*
2  * DirectShow filter for QuickTime Toolkit on Mac OS X
3  *
4  * Copyright (C) 2010 Aric Stewart, CodeWeavers
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 #include "config.h"
21
22 #include <assert.h>
23 #include <stdio.h>
24 #include <stdarg.h>
25
26 #define COBJMACROS
27 #define NONAMELESSSTRUCT
28 #define NONAMELESSUNION
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winerror.h"
34 #include "objbase.h"
35 #include "uuids.h"
36 #include "strmif.h"
37 #include "rpcproxy.h"
38
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
41 #include "wine/strmbase.h"
42
43 #include "initguid.h"
44 DEFINE_GUID(CLSID_QTVDecoder, 0x683DDACB, 0x4354, 0x490C, 0xA0,0x58, 0xE0,0x5A,0xD0,0xF2,0x05,0x37);
45 DEFINE_GUID(CLSID_QTSplitter,    0xD0E70E49, 0x5927, 0x4894, 0xA3,0x86, 0x35,0x94,0x60,0xEE,0x87,0xC9);
46 DEFINE_GUID(WINESUBTYPE_QTSplitter,    0xFFFFFFFF, 0x5927, 0x4894, 0xA3,0x86, 0x35,0x94,0x60,0xEE,0x87,0xC9);
47
48 WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
49
50 extern IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr);
51 extern IUnknown * CALLBACK QTSplitter_create(IUnknown * pUnkOuter, HRESULT* phr);
52
53 static const WCHAR wQTVName[] =
54 {'Q','T',' ','V','i','d','e','o',' ','D','e','c','o','d','e','r',0};
55 static const WCHAR wQTDName[] =
56 {'Q','T',' ','V','i','d','e','o',' ','D','e','m','u','x',0};
57 static WCHAR wNull[] = {'\0'};
58
59 static const AMOVIESETUP_MEDIATYPE amfMTvideo[] =
60 {   { &MEDIATYPE_Video, &MEDIASUBTYPE_NULL } };
61 static const AMOVIESETUP_MEDIATYPE amfMTaudio[] =
62 {   { &MEDIATYPE_Audio, &MEDIASUBTYPE_NULL } };
63 static const AMOVIESETUP_MEDIATYPE amfMTstream[] =
64 {   { &MEDIATYPE_Stream, &WINESUBTYPE_QTSplitter},
65     { &MEDIATYPE_Stream, &MEDIASUBTYPE_NULL } };
66
67 static const AMOVIESETUP_PIN amfQTVPin[] =
68 {   {   wNull,
69         FALSE, FALSE, FALSE, FALSE,
70         &GUID_NULL,
71         NULL,
72         1,
73         amfMTvideo
74     },
75     {
76         wNull,
77         FALSE, TRUE, FALSE, FALSE,
78         &GUID_NULL,
79         NULL,
80         1,
81         amfMTvideo
82     },
83 };
84
85 static const AMOVIESETUP_PIN amfQTDPin[] =
86 {   {   wNull,
87         FALSE, FALSE, FALSE, FALSE,
88         &GUID_NULL,
89         NULL,
90         2,
91         amfMTstream
92     },
93     {
94         wNull,
95         FALSE, TRUE, TRUE, FALSE,
96         &GUID_NULL,
97         NULL,
98         1,
99         amfMTvideo
100     },
101     {
102         wNull,
103         FALSE, TRUE, TRUE, FALSE,
104         &GUID_NULL,
105         NULL,
106         1,
107         amfMTaudio
108     },
109 };
110
111 static const AMOVIESETUP_FILTER amfQTV =
112 {   &CLSID_QTVDecoder,
113     wQTVName,
114     MERIT_NORMAL-1,
115     2,
116     amfQTVPin
117 };
118
119 static const AMOVIESETUP_FILTER amfQTD =
120 {   &CLSID_QTSplitter,
121     wQTDName,
122     MERIT_NORMAL-1,
123     3,
124     amfQTDPin
125 };
126
127 FactoryTemplate const g_Templates[] = {
128     {
129         wQTVName,
130         &CLSID_QTVDecoder,
131         QTVDecoder_create,
132         NULL,
133         &amfQTV,
134     },
135     {
136         wQTDName,
137         &CLSID_QTSplitter,
138         QTSplitter_create,
139         NULL,
140         &amfQTD,
141     }
142 };
143
144 int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
145 static HINSTANCE hInst = NULL;
146
147 /***********************************************************************
148  *    Dll EntryPoint (wineqtdecoder.@)
149  */
150 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
151 {
152     hInst = hInstDLL;
153     return STRMBASE_DllMain(hInstDLL,fdwReason,lpv);
154 }
155
156 /***********************************************************************
157  *    DllGetClassObject
158  */
159 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
160 {
161     return STRMBASE_DllGetClassObject( rclsid, riid, ppv );
162 }
163
164 /***********************************************************************
165  *    DllRegisterServer (wineqtdecoder.@)
166  */
167 HRESULT WINAPI DllRegisterServer(void)
168 {
169     HRESULT hr;
170     TRACE("()\n");
171     hr = AMovieDllRegisterServer2(TRUE);
172     if (SUCCEEDED(hr))
173         hr = __wine_register_resources(hInst);
174     return hr;
175 }
176
177 /***********************************************************************
178  *    DllUnregisterServer (wineqtdecoder.@)
179  */
180 HRESULT WINAPI DllUnregisterServer(void)
181 {
182     HRESULT hr;
183     TRACE("\n");
184     hr = AMovieDllRegisterServer2(FALSE);
185     if (SUCCEEDED(hr))
186         hr = __wine_unregister_resources(hInst);
187     return hr;
188 }
189
190 /***********************************************************************
191  *    DllCanUnloadNow (wineqtdecoder.@)
192  */
193 HRESULT WINAPI DllCanUnloadNow(void)
194 {
195     TRACE("\n");
196     return STRMBASE_DllCanUnloadNow();
197 }