Module: wine Branch: master Commit: 961921060c9b63beaf80043d7ee0f4f3f74df413 URL: http://source.winehq.org/git/wine.git/?a=commit;h=961921060c9b63beaf80043d7e...
Author: Aric Stewart aric@codeweavers.com Date: Mon Oct 4 09:48:25 2010 -0500
strmbase: Initial creation of static strmbase library for Quartz and Quartz filters.
Move the Media Type Functions.
---
configure | 1 + configure.ac | 1 + dlls/qcap/Makefile.in | 2 +- dlls/qcap/enummedia.c | 29 +--------------- dlls/qcap/qcap_main.h | 4 +- dlls/quartz/Makefile.in | 2 +- dlls/quartz/enummedia.c | 49 -------------------------- dlls/quartz/quartz_private.h | 4 +-- dlls/strmbase/Makefile.in | 6 +++ dlls/strmbase/mediatype.c | 78 ++++++++++++++++++++++++++++++++++++++++++ include/wine/strmbase.h | 25 +++++++++++++ 11 files changed, 117 insertions(+), 84 deletions(-)
diff --git a/configure b/configure index 025eda3..a735091 100755 --- a/configure +++ b/configure @@ -14884,6 +14884,7 @@ wine_fn_config_dll sti enable_sti sti wine_fn_config_test dlls/sti/tests sti_test wine_fn_config_dll storage.dll16 enable_win16 wine_fn_config_dll stress.dll16 enable_win16 +wine_fn_config_lib strmbase wine_fn_config_lib strmiids wine_fn_config_dll svrapi enable_svrapi wine_fn_config_dll sxs enable_sxs diff --git a/configure.ac b/configure.ac index 52fee51..1a502db 100644 --- a/configure.ac +++ b/configure.ac @@ -2662,6 +2662,7 @@ WINE_CONFIG_DLL(sti,,[sti]) WINE_CONFIG_TEST(dlls/sti/tests) WINE_CONFIG_DLL(storage.dll16,enable_win16) WINE_CONFIG_DLL(stress.dll16,enable_win16) +WINE_CONFIG_LIB(strmbase) WINE_CONFIG_LIB(strmiids) WINE_CONFIG_DLL(svrapi) WINE_CONFIG_DLL(sxs) diff --git a/dlls/qcap/Makefile.in b/dlls/qcap/Makefile.in index f3b61ab..a8675e2 100644 --- a/dlls/qcap/Makefile.in +++ b/dlls/qcap/Makefile.in @@ -1,5 +1,5 @@ MODULE = qcap.dll -IMPORTS = strmiids uuid ole32 gdi32 advapi32 +IMPORTS = strmiids strmbase uuid ole32 gdi32 advapi32
C_SRCS = \ capturegraph.c \ diff --git a/dlls/qcap/enummedia.c b/dlls/qcap/enummedia.c index a4d84b0..94b2907 100644 --- a/dlls/qcap/enummedia.c +++ b/dlls/qcap/enummedia.c @@ -32,37 +32,10 @@ #include "qcap_main.h"
#include "wine/debug.h" +#include "wine/strmbase.h"
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
-HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc) -{ - *pDest = *pSrc; - if (!pSrc->pbFormat) return S_OK; - if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat))) - return E_OUTOFMEMORY; - memcpy(pDest->pbFormat, pSrc->pbFormat, pSrc->cbFormat); - return S_OK; -} - -static void FreeMediaType(AM_MEDIA_TYPE * pMediaType) -{ - CoTaskMemFree(pMediaType->pbFormat); - pMediaType->pbFormat = NULL; - - if (pMediaType->pUnk) - { - IUnknown_Release(pMediaType->pUnk); - pMediaType->pUnk = NULL; - } -} - -void DeleteMediaType(AM_MEDIA_TYPE * pMediaType) -{ - FreeMediaType(pMediaType); - CoTaskMemFree(pMediaType); -} - BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards) { diff --git a/dlls/qcap/qcap_main.h b/dlls/qcap/qcap_main.h index 2b75830..59a172f 100644 --- a/dlls/qcap/qcap_main.h +++ b/dlls/qcap/qcap_main.h @@ -20,6 +20,8 @@ #ifndef _QCAP_MAIN_H_DEFINED #define _QCAP_MAIN_H_DEFINED
+#include "wine/strmbase.h" + extern DWORD ObjectRefCount(BOOL increment);
extern IUnknown * WINAPI QCAP_createAudioCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr); @@ -50,8 +52,6 @@ typedef struct tagENUMEDIADETAILS HRESULT IEnumPinsImpl_Construct(const ENUMPINDETAILS * pDetails, IEnumPins ** ppEnum); HRESULT IEnumMediaTypesImpl_Construct(const ENUMMEDIADETAILS * pDetails, IEnumMediaTypes ** ppEnum);
-HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc); -void DeleteMediaType(AM_MEDIA_TYPE * pmt); BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards); void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);
diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index 4ccc08c..fe61eae 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -1,6 +1,6 @@ MODULE = quartz.dll IMPORTLIB = quartz -IMPORTS = strmiids uuid dsound msacm32 msvfw32 ole32 oleaut32 shlwapi rpcrt4 user32 gdi32 advapi32 +IMPORTS = strmiids strmbase uuid dsound msacm32 msvfw32 ole32 oleaut32 shlwapi rpcrt4 user32 gdi32 advapi32 EXTRADEFS = -DENTRY_PREFIX=QUARTZ_ -DPROXY_DELEGATION -DREGISTER_PROXY_DLL
C_SRCS = \ diff --git a/dlls/quartz/enummedia.c b/dlls/quartz/enummedia.c index 60ff13a..db78965 100644 --- a/dlls/quartz/enummedia.c +++ b/dlls/quartz/enummedia.c @@ -24,55 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
-HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc) -{ - *pDest = *pSrc; - if (!pSrc->pbFormat) return S_OK; - if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat))) - return E_OUTOFMEMORY; - memcpy(pDest->pbFormat, pSrc->pbFormat, pSrc->cbFormat); - if (pDest->pUnk) - IUnknown_AddRef(pDest->pUnk); - return S_OK; -} - -void FreeMediaType(AM_MEDIA_TYPE * pMediaType) -{ - if (pMediaType->pbFormat) - { - CoTaskMemFree(pMediaType->pbFormat); - pMediaType->pbFormat = NULL; - } - if (pMediaType->pUnk) - { - IUnknown_Release(pMediaType->pUnk); - pMediaType->pUnk = NULL; - } -} - -static AM_MEDIA_TYPE * CreateMediaType(AM_MEDIA_TYPE const * pSrc) -{ - AM_MEDIA_TYPE * pDest; - - pDest = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); - if (!pDest) - return NULL; - - if (FAILED(CopyMediaType(pDest, pSrc))) - { - CoTaskMemFree(pDest); - return NULL; - } - - return pDest; -} - -void DeleteMediaType(AM_MEDIA_TYPE * pMediaType) -{ - FreeMediaType(pMediaType); - CoTaskMemFree(pMediaType); -} - BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards) { TRACE("pmt1: "); diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 3e0dfe1..b6dfcfa 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -33,6 +33,7 @@ #include "wingdi.h" #include "winuser.h" #include "dshow.h" +#include "wine/strmbase.h" #include "wine/list.h"
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000) @@ -77,9 +78,6 @@ HRESULT IEnumFiltersImpl_Construct(IBaseFilter ** ppFilters, ULONG nFilters, IEn
extern const char * qzdebugstr_guid(const GUID * id);
-HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc); -void FreeMediaType(AM_MEDIA_TYPE * pmt); -void DeleteMediaType(AM_MEDIA_TYPE * pmt); BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards); void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt); HRESULT updatehres( HRESULT original, HRESULT new ); diff --git a/dlls/strmbase/Makefile.in b/dlls/strmbase/Makefile.in new file mode 100644 index 0000000..105b5b6 --- /dev/null +++ b/dlls/strmbase/Makefile.in @@ -0,0 +1,6 @@ +MODULE = strmbase + +C_SRCS = \ + mediatype.c + +@MAKE_IMPLIB_RULES@ diff --git a/dlls/strmbase/mediatype.c b/dlls/strmbase/mediatype.c new file mode 100644 index 0000000..6de3e7a --- /dev/null +++ b/dlls/strmbase/mediatype.c @@ -0,0 +1,78 @@ +/* + * Implementation of MedaType utility functions + * + * Copyright 2003 Robert Shearman + * Copyright 2010 Aric Stewart, CodeWeavers + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#include <stdarg.h> + +#define COBJMACROS +#include "dshow.h" + +#include "wine/strmbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(strmbase); + +HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc) +{ + *pDest = *pSrc; + if (!pSrc->pbFormat) return S_OK; + if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat))) + return E_OUTOFMEMORY; + memcpy(pDest->pbFormat, pSrc->pbFormat, pSrc->cbFormat); + if (pDest->pUnk) + IUnknown_AddRef(pDest->pUnk); + return S_OK; +} + +void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType) +{ + if (pMediaType->pbFormat) + { + CoTaskMemFree(pMediaType->pbFormat); + pMediaType->pbFormat = NULL; + } + if (pMediaType->pUnk) + { + IUnknown_Release(pMediaType->pUnk); + pMediaType->pUnk = NULL; + } +} + +AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc) +{ + AM_MEDIA_TYPE * pDest; + + pDest = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + if (!pDest) + return NULL; + + if (FAILED(CopyMediaType(pDest, pSrc))) + { + CoTaskMemFree(pDest); + return NULL; + } + + return pDest; +} + +void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType) +{ + FreeMediaType(pMediaType); + CoTaskMemFree(pMediaType); +} diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h new file mode 100644 index 0000000..885a976 --- /dev/null +++ b/include/wine/strmbase.h @@ -0,0 +1,25 @@ +/* + * Header file for Wine's strmbase implementation + * + * Copyright 2003 Robert Shearman + * Copyright 2010 Aric Stewart, CodeWeavers + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc); +void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType); +AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc); +void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);