2003-08-24 00:56:43 +02:00
|
|
|
/*
|
|
|
|
* self-registerable dll functions for quartz.dll
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 John K. Hohm
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-08-24 00:56:43 +02:00
|
|
|
*/
|
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
#define COBJMACROS
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-08-24 00:56:43 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2008-07-10 19:38:47 +02:00
|
|
|
#include "wingdi.h"
|
2003-08-24 00:56:43 +02:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "uuids.h"
|
2005-01-09 18:28:07 +01:00
|
|
|
#include "strmif.h"
|
2003-08-24 00:56:43 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2008-12-16 16:41:01 +01:00
|
|
|
#include "wine/unicode.h"
|
2003-08-24 00:56:43 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Near the bottom of this file are the exported DllRegisterServer and
|
|
|
|
* DllUnregisterServer, which make all this worthwhile.
|
|
|
|
*/
|
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
struct mediatype
|
|
|
|
{
|
|
|
|
CLSID const *majortype; /* NULL for end of list */
|
|
|
|
CLSID const *subtype;
|
|
|
|
DWORD fourcc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pin
|
|
|
|
{
|
|
|
|
DWORD flags; /* 0xFFFFFFFF for end of list */
|
|
|
|
struct mediatype mediatypes[11];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct regsvr_filter
|
|
|
|
{
|
|
|
|
CLSID const *clsid; /* NULL for end of list */
|
|
|
|
CLSID const *category;
|
|
|
|
WCHAR name[50];
|
|
|
|
DWORD merit;
|
|
|
|
struct pin pins[11];
|
|
|
|
};
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* register_filters
|
|
|
|
*/
|
|
|
|
static HRESULT register_filters(struct regsvr_filter const *list)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IFilterMapper2* pFM2 = NULL;
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
for (; SUCCEEDED(hr) && list->clsid; ++list) {
|
|
|
|
REGFILTER2 rf2;
|
|
|
|
REGFILTERPINS2* prfp2;
|
|
|
|
int i;
|
2005-01-21 11:14:45 +01:00
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) ;
|
|
|
|
rf2.dwVersion = 2;
|
|
|
|
rf2.dwMerit = list->merit;
|
2012-05-12 16:14:07 +02:00
|
|
|
rf2.u.s2.cPins2 = i;
|
|
|
|
rf2.u.s2.rgPins2 = prfp2 = CoTaskMemAlloc(i*sizeof(REGFILTERPINS2));
|
2005-01-09 18:28:07 +01:00
|
|
|
if (!prfp2) {
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) {
|
|
|
|
REGPINTYPES* lpMediatype;
|
|
|
|
CLSID* lpClsid;
|
|
|
|
int j, nbmt;
|
2005-01-21 11:14:45 +01:00
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
for (nbmt = 0; list->pins[i].mediatypes[nbmt].majortype; nbmt++) ;
|
|
|
|
/* Allocate a single buffer for regpintypes struct and clsids */
|
2007-06-27 00:12:07 +02:00
|
|
|
lpMediatype = CoTaskMemAlloc(nbmt*(sizeof(REGPINTYPES) + 2*sizeof(CLSID)));
|
2005-01-09 18:28:07 +01:00
|
|
|
if (!lpMediatype) {
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lpClsid = (CLSID*) (lpMediatype + nbmt);
|
|
|
|
for (j = 0; j < nbmt; j++) {
|
|
|
|
(lpMediatype + j)->clsMajorType = lpClsid + j*2;
|
|
|
|
memcpy(lpClsid + j*2, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
|
|
|
|
(lpMediatype + j)->clsMinorType = lpClsid + j*2 + 1;
|
|
|
|
if (list->pins[i].mediatypes[j].subtype)
|
|
|
|
memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].subtype, sizeof(CLSID));
|
|
|
|
else {
|
2014-04-30 15:42:10 +02:00
|
|
|
/* Subtypes are often a combination of major type + fourcc/tag */
|
2005-01-09 18:28:07 +01:00
|
|
|
memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
|
|
|
|
*(DWORD*)(lpClsid + j*2 + 1) = list->pins[i].mediatypes[j].fourcc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prfp2[i].dwFlags = list->pins[i].flags;
|
|
|
|
prfp2[i].cInstances = 0;
|
|
|
|
prfp2[i].nMediaTypes = j;
|
|
|
|
prfp2[i].lpMediaType = lpMediatype;
|
|
|
|
prfp2[i].nMediums = 0;
|
|
|
|
prfp2[i].lpMedium = NULL;
|
|
|
|
prfp2[i].clsPinCategory = NULL;
|
|
|
|
}
|
|
|
|
|
2005-01-21 11:14:45 +01:00
|
|
|
if (FAILED(hr)) {
|
2006-10-12 20:57:23 +02:00
|
|
|
ERR("failed to register with hresult 0x%x\n", hr);
|
2005-01-31 17:24:00 +01:00
|
|
|
CoTaskMemFree(prfp2);
|
2005-01-21 11:14:45 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
hr = IFilterMapper2_RegisterFilter(pFM2, list->clsid, list->name, NULL, list->category, NULL, &rf2);
|
|
|
|
|
2005-01-21 11:14:45 +01:00
|
|
|
while (i) {
|
2005-01-09 18:28:07 +01:00
|
|
|
CoTaskMemFree((REGPINTYPES*)prfp2[i-1].lpMediaType);
|
2005-01-21 11:14:45 +01:00
|
|
|
i--;
|
|
|
|
}
|
2005-01-09 18:28:07 +01:00
|
|
|
CoTaskMemFree(prfp2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pFM2)
|
|
|
|
IFilterMapper2_Release(pFM2);
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* unregister_filters
|
|
|
|
*/
|
|
|
|
static HRESULT unregister_filters(struct regsvr_filter const *list)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IFilterMapper2* pFM2;
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
for (; SUCCEEDED(hr) && list->clsid; ++list)
|
|
|
|
hr = IFilterMapper2_UnregisterFilter(pFM2, list->category, NULL, list->clsid);
|
|
|
|
IFilterMapper2_Release(pFM2);
|
|
|
|
}
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* filter list
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct regsvr_filter const filter_list[] = {
|
|
|
|
{ &CLSID_AviSplitter,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'A','V','I',' ','S','p','l','i','t','t','e','r',0},
|
2012-01-17 16:02:25 +01:00
|
|
|
0x5ffff0,
|
2005-01-09 18:28:07 +01:00
|
|
|
{ { 0,
|
|
|
|
{ { &MEDIATYPE_Stream, &MEDIASUBTYPE_Avi },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2007-04-24 14:28:14 +02:00
|
|
|
{ &CLSID_MPEG1Splitter,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'M','P','E','G','-','I',' ','S','t','r','e','a','m',' ','S','p','l','i','t','t','e','r',0},
|
2012-01-17 16:02:25 +01:00
|
|
|
0x5ffff0,
|
2007-04-24 14:28:14 +02:00
|
|
|
{ { 0,
|
|
|
|
{ { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio },
|
|
|
|
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Video },
|
|
|
|
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System },
|
|
|
|
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet },
|
|
|
|
{ &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet },
|
|
|
|
{ &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2008-03-12 18:12:18 +01:00
|
|
|
{ &CLSID_NullRenderer,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'N','u','l','l',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x200000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_NULL, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2005-01-09 18:28:07 +01:00
|
|
|
{ &CLSID_VideoRenderer,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x800000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2008-02-02 10:47:34 +01:00
|
|
|
{ &CLSID_VideoRendererDefault,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x800000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2013-11-05 23:59:54 +01:00
|
|
|
{ &CLSID_VideoMixingRenderer,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x200000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2012-04-03 21:37:55 +02:00
|
|
|
{ &CLSID_VideoMixingRenderer9,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',' ','9',0},
|
|
|
|
0x200000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2008-03-14 04:29:40 +01:00
|
|
|
{ &CLSID_DSoundRender,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'A','u','d','i','o',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x800000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Audio, &MEDIASUBTYPE_PCM },
|
2008-07-03 01:48:13 +02:00
|
|
|
/* { &MEDIATYPE_Audio, &MEDIASUBTYPE_IEEE_FLOAT }, */
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &CLSID_AudioRender,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'A','u','d','i','o',' ','R','e','n','d','e','r','e','r',0},
|
|
|
|
0x800000,
|
|
|
|
{ { REG_PINFLAG_B_RENDERER,
|
|
|
|
{ { &MEDIATYPE_Audio, &MEDIASUBTYPE_PCM },
|
2008-03-14 04:29:40 +01:00
|
|
|
/* { &MEDIATYPE_Audio, &MEDIASUBTYPE_IEEE_FLOAT }, */
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2005-01-09 18:28:07 +01:00
|
|
|
{ &CLSID_AVIDec,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'A','V','I',' ','D','e','c','o','m','p','r','e','s','s','o','r',0},
|
2012-01-17 16:02:25 +01:00
|
|
|
0x5ffff0,
|
2005-01-09 18:28:07 +01:00
|
|
|
{ { 0,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &CLSID_AsyncReader,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'F','i','l','e',' ','S','o','u','r','c','e',' ','(','A','s','y','n','c','.',')',0},
|
|
|
|
0x400000,
|
|
|
|
{ { REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Stream, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2005-02-01 15:22:00 +01:00
|
|
|
{ &CLSID_ACMWrapper,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'A','C','M',' ','W','r','a','p','p','e','r',0},
|
2012-01-17 16:02:25 +01:00
|
|
|
0x5ffff0,
|
2005-02-01 15:22:00 +01:00
|
|
|
{ { 0,
|
|
|
|
{ { &MEDIATYPE_Audio, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Audio, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2005-02-10 18:13:18 +01:00
|
|
|
{ &CLSID_WAVEParser,
|
|
|
|
&CLSID_LegacyAmFilterCategory,
|
|
|
|
{'W','a','v','e',' ','P','a','r','s','e','r',0},
|
|
|
|
0x400000,
|
|
|
|
{ { 0,
|
|
|
|
{ { &MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE },
|
|
|
|
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_AU },
|
|
|
|
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_AIFF },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ REG_PINFLAG_B_OUTPUT,
|
|
|
|
{ { &MEDIATYPE_Audio, &GUID_NULL },
|
|
|
|
{ NULL }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ 0xFFFFFFFF },
|
|
|
|
}
|
|
|
|
},
|
2005-01-09 18:28:07 +01:00
|
|
|
{ NULL } /* list terminator */
|
|
|
|
};
|
|
|
|
|
2009-09-11 13:40:17 +02:00
|
|
|
extern HRESULT WINAPI QUARTZ_DllRegisterServer(void) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI QUARTZ_DllUnregisterServer(void) DECLSPEC_HIDDEN;
|
|
|
|
|
2003-08-24 00:56:43 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DllRegisterServer (QUARTZ.@)
|
|
|
|
*/
|
2005-05-17 16:41:37 +02:00
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
2003-08-24 00:56:43 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2009-09-11 13:40:17 +02:00
|
|
|
hr = QUARTZ_DllRegisterServer();
|
2005-01-09 18:28:07 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = register_filters(filter_list);
|
2003-08-24 00:56:43 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllUnregisterServer (QUARTZ.@)
|
|
|
|
*/
|
2005-05-17 16:41:37 +02:00
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
2003-08-24 00:56:43 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2005-01-09 18:28:07 +01:00
|
|
|
hr = unregister_filters(filter_list);
|
2009-09-11 13:40:17 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = QUARTZ_DllUnregisterServer();
|
2003-08-24 00:56:43 +02:00
|
|
|
return hr;
|
|
|
|
}
|