From 2914d65579d4868bf7843559ecc2cd8ec466e128 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 20 Oct 2010 13:55:16 -0500 Subject: [PATCH] winegstreamer: Add wine GStreamer parser filter framework. --- configure | 85 ++++++++++++++ configure.ac | 27 +++++ dlls/winegstreamer/Makefile.in | 16 +++ dlls/winegstreamer/gst_guids.h | 25 +++++ dlls/winegstreamer/gst_private.h | 40 +++++++ dlls/winegstreamer/main.c | 154 ++++++++++++++++++++++++++ dlls/winegstreamer/rsrc.rc | 28 +++++ dlls/winegstreamer/winegstreamer.inf | 12 ++ dlls/winegstreamer/winegstreamer.spec | 5 + tools/wine.inf.in | 1 + 10 files changed, 393 insertions(+) create mode 100644 dlls/winegstreamer/Makefile.in create mode 100644 dlls/winegstreamer/gst_guids.h create mode 100644 dlls/winegstreamer/gst_private.h create mode 100644 dlls/winegstreamer/main.c create mode 100644 dlls/winegstreamer/rsrc.rc create mode 100644 dlls/winegstreamer/winegstreamer.inf create mode 100644 dlls/winegstreamer/winegstreamer.spec diff --git a/configure b/configure index 74f9849f86d..122e443e5fd 100755 --- a/configure +++ b/configure @@ -618,6 +618,8 @@ FONTCONFIGINCL CUPSINCL AUDIOIOLIBS ALSALIBS +GSTREAMER_INCL +GSTREAMER_LIBS ESDLIBS ESDINCL ESDCONFIG @@ -779,6 +781,7 @@ with_gphoto with_glu with_gnutls with_gsm +with_gstreamer with_hal with_icns with_jack @@ -1468,6 +1471,7 @@ Optional Packages: --without-glu do not use the GLU library --without-gnutls do not use GnuTLS (schannel support) --without-gsm do not use libgsm (GSM 06.10 codec support) + --without-gstreamer do not use GStreamer (codecs support) --without-hal do not use HAL (dynamic device support) --without-icns do not use ICNS icon support --without-jack do not use the Jack sound support @@ -2586,6 +2590,12 @@ if test "${with_gsm+set}" = set; then : fi +# Check whether --with-gstreamer was given. +if test "${with_gstreamer+set}" = set; then : + withval=$with_gstreamer; +fi + + # Check whether --with-hal was given. if test "${with_hal+set}" = set; then : withval=$with_hal; @@ -10478,6 +10488,80 @@ fi CFLAGS="$save_CFLAGS" fi +if test "x$with_gstreamer" != "xno" +then + ac_save_CPPFLAGS="$CPPFLAGS" + if test "$PKG_CONFIG" != "false"; then + ac_gst_incl="" + for i in `$PKG_CONFIG --cflags gstreamer-app-0.10 2>/dev/null` + do + case "$i" in + -I*) ac_gst_incl="$ac_gst_incl $i";; + esac + done + ac_gst_libs="`$PKG_CONFIG --libs gstreamer-app-0.10 2>/dev/null`" + CPPFLAGS="$CPPFLAGS $ac_gst_incl" + ac_fn_c_check_header_mongrel "$LINENO" "gst/app/gstappsink.h" "ac_cv_header_gst_app_gstappsink_h" "$ac_includes_default" +if test "x$ac_cv_header_gst_app_gstappsink_h" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_app_buffer_new in -lgstapp-0.10" >&5 +$as_echo_n "checking for gst_app_buffer_new in -lgstapp-0.10... " >&6; } +if test "${ac_cv_lib_gstapp_0_10_gst_app_buffer_new+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgstapp-0.10 $ac_gst_libs $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gst_app_buffer_new (); +int +main () +{ +return gst_app_buffer_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gstapp_0_10_gst_app_buffer_new=yes +else + ac_cv_lib_gstapp_0_10_gst_app_buffer_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gstapp_0_10_gst_app_buffer_new" >&5 +$as_echo "$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" >&6; } +if test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = x""yes; then : + GSTREAMER_LIBS="$ac_gst_libs" + + GSTREAMER_INCL="$ac_gst_incl" + +fi + +fi + + + fi + CPPFLAGS="$ac_save_CPPFLAGS" +fi +if test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" != xyes; then : + case "x$with_gstreamer" in + x) as_fn_append wine_notices "|gstreamer-0.10 ${notice_platform}development files not found, gstreamer support disabled" ;; + xno) ;; + *) as_fn_error $? "gstreamer-0.10 ${notice_platform}development files not found, gstreamer support disabled +This is an error since --with-gstreamer was requested." "$LINENO" 5 ;; +esac +fi +test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no} + ALSALIBS="" if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes" @@ -14941,6 +15025,7 @@ wine_fn_config_dll winecoreaudio.drv enable_winecoreaudio_drv wine_fn_config_lib winecrt0 wine_fn_config_dll wined3d enable_wined3d wined3d wine_fn_config_dll wineesd.drv enable_wineesd_drv +wine_fn_config_dll winegstreamer enable_winegstreamer wine_fn_config_dll winejack.drv enable_winejack_drv wine_fn_config_dll winejoystick.drv enable_winejoystick_drv wine_fn_config_dll winemapi enable_winemapi diff --git a/configure.ac b/configure.ac index 12603702f8b..a13fc9243a2 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,7 @@ AC_ARG_WITH(glu, AS_HELP_STRING([--without-glu],[do not use the GLU librar AC_ARG_WITH(gnutls, AS_HELP_STRING([--without-gnutls],[do not use GnuTLS (schannel support)])) AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06.10 codec support)]), [if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi]) +AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)])) AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) AC_ARG_WITH(icns, AS_HELP_STRING([--without-icns],[do not use ICNS icon support]), [if test "x$withval" = "xno"; then ac_cv_header_icns_h=no; fi]) @@ -1403,6 +1404,31 @@ then CFLAGS="$save_CFLAGS" fi +dnl **** Check for gstreamer **** +if test "x$with_gstreamer" != "xno" +then + ac_save_CPPFLAGS="$CPPFLAGS" + if test "$PKG_CONFIG" != "false"; then + ac_gst_incl="" + for i in `$PKG_CONFIG --cflags gstreamer-app-0.10 2>/dev/null` + do + case "$i" in + -I*) ac_gst_incl="$ac_gst_incl $i";; + esac + done + ac_gst_libs="`$PKG_CONFIG --libs gstreamer-app-0.10 2>/dev/null`" + CPPFLAGS="$CPPFLAGS $ac_gst_incl" + AC_CHECK_HEADER([gst/app/gstappsink.h], + [AC_CHECK_LIB(gstapp-0.10,gst_app_buffer_new, + [AC_SUBST(GSTREAMER_LIBS,"$ac_gst_libs") + AC_SUBST(GSTREAMER_INCL,"$ac_gst_incl")],,[$ac_gst_libs])]) + fi + CPPFLAGS="$ac_save_CPPFLAGS" +fi +WINE_NOTICE_WITH(gstreamer,[test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" != xyes], + [gstreamer-0.10 ${notice_platform}development files not found, gstreamer support disabled]) +test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no} + dnl **** Check for ALSA 1.x **** AC_SUBST(ALSALIBS,"") if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes" @@ -2719,6 +2745,7 @@ WINE_CONFIG_DLL(winecoreaudio.drv) WINE_CONFIG_LIB(winecrt0) WINE_CONFIG_DLL(wined3d,,[wined3d]) WINE_CONFIG_DLL(wineesd.drv) +WINE_CONFIG_DLL(winegstreamer) WINE_CONFIG_DLL(winejack.drv) WINE_CONFIG_DLL(winejoystick.drv) WINE_CONFIG_DLL(winemapi) diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in new file mode 100644 index 00000000000..b5b16f19f4b --- /dev/null +++ b/dlls/winegstreamer/Makefile.in @@ -0,0 +1,16 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = winegstreamer +IMPORTS = strmbase strmiids uuid winmm msacm32 msvfw32 ole32 oleaut32 user32 gdi32 advapi32 +EXTRAINCL = @GSTREAMER_INCL@ +EXTRALIBS = @GSTREAMER_LIBS@ @LIBPTHREAD@ + +C_SRCS = \ + main.c + +RC_SRCS = \ + rsrc.rc + +@MAKE_DLL_RULES@ diff --git a/dlls/winegstreamer/gst_guids.h b/dlls/winegstreamer/gst_guids.h new file mode 100644 index 00000000000..156c82105eb --- /dev/null +++ b/dlls/winegstreamer/gst_guids.h @@ -0,0 +1,25 @@ +/* + * GStreamer Guids + * + * Copyright 2010 Maarten Lankhorst for CodeWeavers + * Copyright 2010 Aric Stewart for CodeWeavers + * + * This file contains the (internal) driver registration functions, + * driver enumeration APIs and DirectDraw creation functions. + * + * 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 + */ + +DEFINE_GUID(WINESUBTYPE_Gstreamer, 0xffffffff, 0x128f, 0x4dd1, 0xad, 0x22, 0xbe, 0xcf, 0xa6, 0x6c, 0xe7, 0xaa); diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h new file mode 100644 index 00000000000..3cff181799b --- /dev/null +++ b/dlls/winegstreamer/gst_private.h @@ -0,0 +1,40 @@ +/* + * GStreamer splitter + decoder, adapted from parser.c + * + * Copyright 2010 Maarten Lankhorst for CodeWeavers + * + * This file contains the (internal) driver registration functions, + * driver enumeration APIs and DirectDraw creation functions. + * + * 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 + */ + +#ifndef __GST_PRIVATE_INCLUDED__ +#define __GST_PRIVATE_INCLUDED__ + +#include + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "wtypes.h" +#include "winuser.h" +#include "dshow.h" +#include "strmif.h" +#include "wine/strmbase.h" + +/* enum media */ +void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt); +#endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c new file mode 100644 index 00000000000..3898fc915b8 --- /dev/null +++ b/dlls/winegstreamer/main.c @@ -0,0 +1,154 @@ +/* Gstreamer Base Functions + * + * Copyright 2002 Lionel Ulmer + * 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 "config.h" +#include +#include + +#include +#include +#include + +#include "initguid.h" +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "winerror.h" +#include "advpub.h" +#include "wine/debug.h" + +#include "wine/unicode.h" +#include "gst_private.h" +#include "gst_guids.h" + +static HINSTANCE hInst = NULL; + +WINE_DEFAULT_DEBUG_CHANNEL(gstreamer); + +FactoryTemplate const g_Templates[] = { +}; + +const int g_cTemplates = 0; + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + hInst = hInstDLL; + return STRMBASE_DllMain(hInstDLL, fdwReason, lpv); +} + +/* GStreamer common functions */ + +void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt) +{ + if (!pmt) + return; + TRACE("\t%s\n\t%s\n\t...\n\t%s\n", debugstr_guid(&pmt->majortype), debugstr_guid(&pmt->subtype), debugstr_guid(&pmt->formattype)); +} + +#define INF_SET_ID(id) \ + do \ + { \ + static CHAR name[] = #id; \ + \ + pse[i].pszName = name; \ + clsids[i++] = &id; \ + } while (0) + +#define INF_SET_CLSID(clsid) INF_SET_ID(CLSID_ ## clsid) + +static HRESULT register_server(BOOL do_register) +{ + HRESULT hres; + HMODULE hAdvpack; + HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable); + STRTABLEA strtable; + STRENTRYA pse[3]; + static CLSID const *clsids[3]; + unsigned int i = 0; + + static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + + TRACE("(%x)\n", do_register); + + INF_SET_CLSID(AsyncReader); + INF_SET_ID(MEDIATYPE_Stream); + INF_SET_ID(WINESUBTYPE_Gstreamer); + + for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) { + pse[i].pszValue = HeapAlloc(GetProcessHeap(),0,39); + sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0], + clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4], + clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]); + } + + strtable.cEntries = sizeof(pse)/sizeof(pse[0]); + strtable.pse = pse; + + hAdvpack = LoadLibraryW(wszAdvpack); + pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall"); + + hres = pRegInstall(hInst, do_register ? "RegisterDll" : "UnregisterDll", &strtable); + + for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) + HeapFree(GetProcessHeap(),0,pse[i].pszValue); + + if(FAILED(hres)) { + ERR("RegInstall failed: %08x\n", hres); + return hres; + } + + return hres; +} + +#undef INF_SET_CLSID +#undef INF_SET_ID + +/*********************************************************************** + * DllRegisterServer + */ +HRESULT WINAPI DllRegisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = AMovieDllRegisterServer2(TRUE); + if (SUCCEEDED(hr)) + hr = register_server(TRUE); + return hr; +} + +/*********************************************************************** + * DllUnregisterServer + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = AMovieDllRegisterServer2(FALSE); + if (SUCCEEDED(hr)) + hr = register_server(FALSE); + return hr; +} diff --git a/dlls/winegstreamer/rsrc.rc b/dlls/winegstreamer/rsrc.rc new file mode 100644 index 00000000000..09c8c774b99 --- /dev/null +++ b/dlls/winegstreamer/rsrc.rc @@ -0,0 +1,28 @@ +/* + * 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 + */ + +#define WINE_OLESELFREGISTER +#define WINE_FILEDESCRIPTION_STR "Wine GStreamer" +#define WINE_FILENAME_STR "winegstreamer.dll" +#define WINE_FILEVERSION 0,0,1,0 +#define WINE_FILEVERSION_STR "0.0.1.0" +#define WINE_PRODUCTVERSION 0,0,1,0 +#define WINE_PRODUCTVERSION_STR "1.0.1.0" + +#include "wine/wine_common_ver.rc" + +/* @makedep: winegstreamer.inf */ +REGINST REGINST winegstreamer.inf diff --git a/dlls/winegstreamer/winegstreamer.inf b/dlls/winegstreamer/winegstreamer.inf new file mode 100644 index 00000000000..64777553b76 --- /dev/null +++ b/dlls/winegstreamer/winegstreamer.inf @@ -0,0 +1,12 @@ +[version] +Signature="$CHICAGO$" + +[RegisterDll] +AddReg=MediaParsing.Reg + +[UnregisterDll] +DelReg=MediaParsing.Reg + +[MediaParsing.Reg] +HKCR,"Media Type\%MEDIATYPE_Stream%\%WINESUBTYPE_Gstreamer%","0",,"0,1,00,0" +HKCR,"Media Type\%MEDIATYPE_Stream%\%WINESUBTYPE_Gstreamer%","Source Filter",,"%CLSID_AsyncReader%" diff --git a/dlls/winegstreamer/winegstreamer.spec b/dlls/winegstreamer/winegstreamer.spec new file mode 100644 index 00000000000..f011ea8636f --- /dev/null +++ b/dlls/winegstreamer/winegstreamer.spec @@ -0,0 +1,5 @@ +@ stdcall -private DllMain(long long ptr) +@ stdcall -private DllCanUnloadNow() STRMBASE_DllCanUnloadNow +@ stdcall -private DllGetClassObject(ptr ptr ptr) STRMBASE_DllGetClassObject +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/tools/wine.inf.in b/tools/wine.inf.in index 94a6476d2da..a4434b41528 100644 --- a/tools/wine.inf.in +++ b/tools/wine.inf.in @@ -2551,6 +2551,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,wbemprox.dll,1 11,,wiaservc.dll,1 11,,windowscodecs.dll,1 +11,,winegstreamer.dll,1 11,,wintrust.dll,1 11,,wmiutils.dll,1 11,,wuapi.dll,1