wineqtdecoder: Remove the QuickTime decoder.

QuickTime is deprecated on macOS, so remove the module instead of
doing the work to convert it to msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-11-29 17:41:41 +01:00
parent f98d956e52
commit 34289e749f
14 changed files with 5 additions and 3328 deletions

75
configure vendored
View File

@ -749,7 +749,6 @@ LIBWINE_LDFLAGS
LIBWINE_SHAREDLIB
METAL_LIBS
CARBON_LIBS
QUICKTIME_LIBS
OPENCL_LIBS
OPENAL_LIBS
COREAUDIO_LIBS
@ -909,7 +908,6 @@ with_oss
with_pcap
with_pthread
with_pulse
with_quicktime
with_sane
with_sdl
with_udev
@ -1725,7 +1723,6 @@ enable_winemapi
enable_wineoss_drv
enable_wineps_drv
enable_winepulse_drv
enable_wineqtdecoder
enable_wineusb_sys
enable_winevulkan
enable_winex11_drv
@ -2695,7 +2692,6 @@ Optional Packages:
--without-pcap do not use the Packet Capture library
--without-pthread do not use the pthread library
--without-pulse do not use PulseAudio sound support
--without-quicktime do not use QuickTime support
--without-sane do not use SANE (scanner support)
--without-sdl do not use SDL
--without-udev do not use udev (plug and play support)
@ -4615,13 +4611,6 @@ then :
fi
# Check whether --with-quicktime was given.
if test ${with_quicktime+y}
then :
withval=$with_quicktime;
fi
# Check whether --with-sane was given.
if test ${with_sane+y}
then :
@ -8215,12 +8204,6 @@ if test "x$ac_cv_header_OpenCL_opencl_h" = xyes
then :
printf "%s\n" "#define HAVE_OPENCL_OPENCL_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "QuickTime/ImageCompression.h" "ac_cv_header_QuickTime_ImageCompression_h" "$ac_includes_default"
if test "x$ac_cv_header_QuickTime_ImageCompression_h" = xyes
then :
printf "%s\n" "#define HAVE_QUICKTIME_IMAGECOMPRESSION_H 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "Security/Security.h" "ac_cv_header_Security_Security_h" "$ac_includes_default"
if test "x$ac_cv_header_Security_Security_h" = xyes
@ -10547,53 +10530,6 @@ fi
LIBS="$ac_save_LIBS"
fi
if test "x$with_quicktime" != "xno"
then
if test "$ac_cv_header_QuickTime_ImageCompression_h" = "yes"
then
ac_save_LIBS="$LIBS"
LIBS="-framework QuickTime -framework ApplicationServices -framework CoreVideo $LIBS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the QuickTime framework" >&5
printf %s "checking for the QuickTime framework... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <QuickTime/ImageCompression.h>
int
main (void)
{
CodecManagerVersion(NULL);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
QUICKTIME_LIBS="-framework QuickTime -framework ApplicationServices -framework CoreVideo"
enable_wineqtdecoder=${enable_wineqtdecoder:-yes}
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
ac_cv_header_QuickTime_ImageCompression_h=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS="$ac_save_LIBS"
fi
fi
if test "$ac_cv_header_QuickTime_ImageCompression_h" != "yes"
then :
case "x$with_quicktime" in
x) as_fn_append wine_notices "|QuickTime ${notice_platform}development files not found, video decoding won't be supported." ;;
xno) ;;
*) as_fn_error $? "QuickTime ${notice_platform}development files not found, video decoding won't be supported.
This is an error since --with-quicktime was requested." "$LINENO" 5 ;;
esac
fi
if test "$ac_cv_header_Carbon_Carbon_h" = "yes"
then
CARBON_LIBS="-framework Carbon"
@ -11141,7 +11077,6 @@ fi
esac
enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no}
enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_wineandroid_drv=${enable_wineandroid_drv:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
test "$ac_cv_header_linux_joystick_h" = "yes" -o "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no}
@ -16176,9 +16111,7 @@ fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
if test "x$with_gstreamer" = xyes -o "x$with_quicktime" = xno -o "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes
then
if test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes
if test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes
then :
case "x$with_gstreamer" in
x) as_fn_append wine_notices "|gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported." ;;
@ -16186,10 +16119,8 @@ then :
*) as_fn_error $? "gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported.
This is an error since --with-gstreamer was requested." "$LINENO" 5 ;;
esac
enable_winegstreamer=${enable_winegstreamer:-no}
fi
fi
test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no}
ALSA_LIBS=""
@ -21798,7 +21729,6 @@ wine_fn_config_makefile dlls/wineoss.drv enable_wineoss_drv
wine_fn_config_makefile dlls/wineps.drv enable_wineps_drv
wine_fn_config_makefile dlls/wineps16.drv16 enable_win16
wine_fn_config_makefile dlls/winepulse.drv enable_winepulse_drv
wine_fn_config_makefile dlls/wineqtdecoder enable_wineqtdecoder
wine_fn_config_makefile dlls/wineusb.sys enable_wineusb_sys
wine_fn_config_makefile dlls/winevulkan enable_winevulkan
wine_fn_config_makefile dlls/winex11.drv enable_winex11_drv
@ -23015,7 +22945,6 @@ SECURITY_LIBS = $SECURITY_LIBS
COREAUDIO_LIBS = $COREAUDIO_LIBS
OPENAL_LIBS = $OPENAL_LIBS
OPENCL_LIBS = $OPENCL_LIBS
QUICKTIME_LIBS = $QUICKTIME_LIBS
CARBON_LIBS = $CARBON_LIBS
METAL_LIBS = $METAL_LIBS
LIBWINE_SHAREDLIB = $LIBWINE_SHAREDLIB

View File

@ -57,7 +57,6 @@ AC_ARG_WITH(pcap, AS_HELP_STRING([--without-pcap],[do not use the Packet Ca
AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
AC_ARG_WITH(pulse, AS_HELP_STRING([--without-pulse],[do not use PulseAudio sound support]))
AC_ARG_WITH(quicktime, AS_HELP_STRING([--without-quicktime],[do not use QuickTime support]))
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl],[do not use SDL]))
AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)]))
@ -427,7 +426,6 @@ AC_CHECK_HEADERS(\
IOKit/hid/IOHIDLib.h \
OpenAL/al.h \
OpenCL/opencl.h \
QuickTime/ImageCompression.h \
Security/Security.h \
SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h \
SystemConfiguration/SCNetworkConfiguration.h \
@ -787,27 +785,6 @@ case $host_os in
LIBS="$ac_save_LIBS"
fi
dnl *** Check for QuickTime ***
if test "x$with_quicktime" != "xno"
then
if test "$ac_cv_header_QuickTime_ImageCompression_h" = "yes"
then
dnl Make sure we can actually use the QuickTime framework
ac_save_LIBS="$LIBS"
LIBS="-framework QuickTime -framework ApplicationServices -framework CoreVideo $LIBS"
AC_MSG_CHECKING([for the QuickTime framework])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QuickTime/ImageCompression.h>]],[[CodecManagerVersion(NULL);]])],
[AC_MSG_RESULT([yes])
AC_SUBST(QUICKTIME_LIBS,"-framework QuickTime -framework ApplicationServices -framework CoreVideo")
enable_wineqtdecoder=${enable_wineqtdecoder:-yes}],
[AC_MSG_RESULT([no])
ac_cv_header_QuickTime_ImageCompression_h=no])
LIBS="$ac_save_LIBS"
fi
fi
WINE_NOTICE_WITH(quicktime,[test "$ac_cv_header_QuickTime_ImageCompression_h" != "yes"],
[QuickTime ${notice_platform}development files not found, video decoding won't be supported.])
if test "$ac_cv_header_Carbon_Carbon_h" = "yes"
then
AC_SUBST(CARBON_LIBS,"-framework Carbon")
@ -920,7 +897,6 @@ case $host_os in
esac
enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no}
enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_wineandroid_drv=${enable_wineandroid_drv:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
test "$ac_cv_header_linux_joystick_h" = "yes" -o "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no}
@ -1503,12 +1479,9 @@ then
ac_glib2_broken=yes
WINE_NOTICE([glib-2.0 pkgconfig configuration is for the wrong architecture, winegstreamer won't be built.])])])])
fi
if test "x$with_gstreamer" = xyes -o "x$with_quicktime" = xno -o "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes
then
WINE_NOTICE_WITH(gstreamer,[test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes],
[gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported.])
fi
test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no}
WINE_NOTICE_WITH(gstreamer,[test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes],
[gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported.],
[enable_winegstreamer])
dnl **** Check for ALSA 1.x ****
AC_SUBST(ALSA_LIBS,"")
@ -3473,7 +3446,6 @@ WINE_CONFIG_MAKEFILE(dlls/wineoss.drv)
WINE_CONFIG_MAKEFILE(dlls/wineps.drv)
WINE_CONFIG_MAKEFILE(dlls/wineps16.drv16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/winepulse.drv)
WINE_CONFIG_MAKEFILE(dlls/wineqtdecoder)
WINE_CONFIG_MAKEFILE(dlls/wineusb.sys)
WINE_CONFIG_MAKEFILE(dlls/winevulkan)
WINE_CONFIG_MAKEFILE(dlls/winex11.drv)

View File

@ -1,24 +0,0 @@
MODULE = wineqtdecoder.dll
IMPORTS = strmiids uuid ole32 advapi32
EXTRALIBS = $(QUICKTIME_LIBS)
PARENTSRC = ../strmbase
EXTRADLLFLAGS = -mcygwin
C_SRCS = \
filter.c \
main.c \
mediatype.c \
outputqueue.c \
pin.c \
qtdatahandler.c \
qtsplitter.c \
qtutils.c \
qtvdecoder.c \
seeking.c
RC_SRCS = \
rsrc.rc
IDL_SRCS = \
wineqtdecoder_classes.idl

View File

@ -1,245 +0,0 @@
/*
* DirectShow filter for QuickTime Toolkit on Mac OS X
*
* Copyright (C) 2010 Aric Stewart, CodeWeavers
* Copyright (C) 2019 Zebediah Figura
*
* 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 <assert.h>
#include <stdio.h>
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#define WINE_NO_NAMELESS_EXTENSION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "objbase.h"
#include "uuids.h"
#include "strmif.h"
#include "rpcproxy.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/strmbase.h"
#include "wineqtdecoder_classes.h"
#include "initguid.h"
DEFINE_GUID(WINESUBTYPE_QTSplitter, 0xFFFFFFFF, 0x5927, 0x4894, 0xA3,0x86, 0x35,0x94,0x60,0xEE,0x87,0xC9);
WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
extern HRESULT video_decoder_create(IUnknown *outer, IUnknown **out);
extern HRESULT qt_splitter_create(IUnknown *outer, IUnknown **out);
static const WCHAR wQTVName[] =
{'Q','T',' ','V','i','d','e','o',' ','D','e','c','o','d','e','r',0};
static const WCHAR wQTDName[] =
{'Q','T',' ','V','i','d','e','o',' ','D','e','m','u','x',0};
struct class_factory
{
IClassFactory IClassFactory_iface;
HRESULT (*create_instance)(IUnknown *outer, IUnknown **out);
};
static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
}
static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
{
*out = iface;
IClassFactory_AddRef(iface);
return S_OK;
}
*out = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
return E_NOINTERFACE;
}
static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
{
return 2;
}
static ULONG WINAPI class_factory_Release(IClassFactory *iface)
{
return 1;
}
static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
{
struct class_factory *factory = impl_from_IClassFactory(iface);
IUnknown *unk;
HRESULT hr;
TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
if (outer && !IsEqualGUID(iid, &IID_IUnknown))
return E_NOINTERFACE;
*out = NULL;
if (SUCCEEDED(hr = factory->create_instance(outer, &unk)))
{
hr = IUnknown_QueryInterface(unk, iid, out);
IUnknown_Release(unk);
}
return hr;
}
static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock)
{
TRACE("iface %p, lock %d.\n", iface, lock);
return S_OK;
}
static const IClassFactoryVtbl class_factory_vtbl =
{
class_factory_QueryInterface,
class_factory_AddRef,
class_factory_Release,
class_factory_CreateInstance,
class_factory_LockServer,
};
static struct class_factory qt_splitter_cf = {{&class_factory_vtbl}, qt_splitter_create};
static struct class_factory video_decoder_cf = {{&class_factory_vtbl}, video_decoder_create};
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
{
struct class_factory *factory;
TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
if (IsEqualGUID(clsid, &CLSID_QTSplitter))
factory = &qt_splitter_cf;
else if (IsEqualGUID(clsid, &CLSID_QTVDecoder))
factory = &video_decoder_cf;
else
{
FIXME("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
return IClassFactory_QueryInterface(&factory->IClassFactory_iface, iid, out);
}
static const REGPINTYPES reg_audio_mt = {&MEDIATYPE_Audio, &GUID_NULL};
static const REGPINTYPES reg_stream_mt = {&MEDIATYPE_Stream, &GUID_NULL};
static const REGPINTYPES reg_video_mt = {&MEDIATYPE_Video, &GUID_NULL};
static const REGFILTERPINS2 reg_qt_splitter_pins[3] =
{
{
.nMediaTypes = 1,
.lpMediaType = &reg_stream_mt,
},
{
.dwFlags = REG_PINFLAG_B_OUTPUT | REG_PINFLAG_B_ZERO,
.nMediaTypes = 1,
.lpMediaType = &reg_audio_mt,
},
{
.dwFlags = REG_PINFLAG_B_OUTPUT | REG_PINFLAG_B_ZERO,
.nMediaTypes = 1,
.lpMediaType = &reg_video_mt,
},
};
static const REGFILTER2 reg_qt_splitter =
{
.dwVersion = 2,
.dwMerit = MERIT_NORMAL - 1,
.u.s2.cPins2 = 3,
.u.s2.rgPins2 = reg_qt_splitter_pins,
};
static const REGFILTERPINS2 reg_video_decoder_pins[2] =
{
{
.nMediaTypes = 1,
.lpMediaType = &reg_video_mt,
},
{
.dwFlags = REG_PINFLAG_B_OUTPUT,
.nMediaTypes = 1,
.lpMediaType = &reg_video_mt,
},
};
static const REGFILTER2 reg_video_decoder =
{
.dwVersion = 2,
.dwMerit = MERIT_NORMAL - 1,
.u.s2.cPins2 = 2,
.u.s2.rgPins2 = reg_video_decoder_pins,
};
HRESULT WINAPI DllRegisterServer(void)
{
IFilterMapper2 *mapper;
HRESULT hr;
TRACE(".\n");
if (FAILED(hr = __wine_register_resources()))
return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
&IID_IFilterMapper2, (void **)&mapper)))
return hr;
IFilterMapper2_RegisterFilter(mapper, &CLSID_QTSplitter, wQTDName, NULL, NULL, NULL, &reg_qt_splitter);
IFilterMapper2_RegisterFilter(mapper, &CLSID_QTVDecoder, wQTVName, NULL, NULL, NULL, &reg_video_decoder);
IFilterMapper2_Release(mapper);
return S_OK;
}
HRESULT WINAPI DllUnregisterServer(void)
{
IFilterMapper2 *mapper;
HRESULT hr;
TRACE(".\n");
if (FAILED(hr = __wine_unregister_resources()))
return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
&IID_IFilterMapper2, (void **)&mapper)))
return hr;
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_QTSplitter);
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_QTVDecoder);
IFilterMapper2_Release(mapper);
return S_OK;
}

View File

@ -1,792 +0,0 @@
/*
* QuickTime Data Handler
*
* Copyright 2011 Aric Stewart for 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"
#define ULONG CoreFoundation_ULONG
#define HRESULT CoreFoundation_HRESULT
#define LoadResource __carbon_LoadResource
#define CompareString __carbon_CompareString
#define GetCurrentThread __carbon_GetCurrentThread
#define GetCurrentProcess __carbon_GetCurrentProcess
#define AnimatePalette __carbon_AnimatePalette
#define EqualRgn __carbon_EqualRgn
#define FillRgn __carbon_FillRgn
#define FrameRgn __carbon_FrameRgn
#define GetPixel __carbon_GetPixel
#define InvertRgn __carbon_InvertRgn
#define LineTo __carbon_LineTo
#define OffsetRgn __carbon_OffsetRgn
#define PaintRgn __carbon_PaintRgn
#define Polygon __carbon_Polygon
#define ResizePalette __carbon_ResizePalette
#define SetRectRgn __carbon_SetRectRgn
#define CheckMenuItem __carbon_CheckMenuItem
#define DeleteMenu __carbon_DeleteMenu
#define DrawMenuBar __carbon_DrawMenuBar
#define EnableMenuItem __carbon_EnableMenuItem
#define EqualRect __carbon_EqualRect
#define FillRect __carbon_FillRect
#define FrameRect __carbon_FrameRect
#define GetCursor __carbon_GetCursor
#define GetMenu __carbon_GetMenu
#define InvertRect __carbon_InvertRect
#define IsWindowVisible __carbon_IsWindowVisible
#define MoveWindow __carbon_MoveWindow
#define OffsetRect __carbon_OffsetRect
#define PtInRect __carbon_PtInRect
#define SetCursor __carbon_SetCursor
#define SetRect __carbon_SetRect
#define ShowCursor __carbon_ShowCursor
#define ShowWindow __carbon_ShowWindow
#define UnionRect __carbon_UnionRect
#include <QuickTime/QuickTimeComponents.h>
#undef LoadResource
#undef CompareString
#undef GetCurrentThread
#undef _CDECL
#undef GetCurrentProcess
#undef AnimatePalette
#undef EqualRgn
#undef FillRgn
#undef FrameRgn
#undef GetPixel
#undef InvertRgn
#undef LineTo
#undef OffsetRgn
#undef PaintRgn
#undef Polygon
#undef ResizePalette
#undef SetRectRgn
#undef CheckMenuItem
#undef DeleteMenu
#undef DrawMenuBar
#undef EnableMenuItem
#undef EqualRect
#undef FillRect
#undef FrameRect
#undef GetCursor
#undef GetMenu
#undef InvertRect
#undef IsWindowVisible
#undef MoveWindow
#undef OffsetRect
#undef PtInRect
#undef SetCursor
#undef SetRect
#undef ShowCursor
#undef ShowWindow
#undef UnionRect
#undef ULONG
#undef HRESULT
#undef STDMETHODCALLTYPE
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "winuser.h"
#include "dshow.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "qtprivate.h"
WINE_DEFAULT_DEBUG_CHANNEL(qtdatahandler);
static ComponentDescription myType =
{
'dhlr',
'WINE',
'WINE',
0,
0
};
typedef struct DHData
{
WineDataRefRecord dataRef;
Ptr AsyncPtr;
long AsyncRefCon;
DataHCompletionUPP AsyncCompletionRtn;
} DHData;
static pascal ComponentResult myComponentRoutineProc ( ComponentParameters *
cp, Handle componentStorage);
void RegisterWineDataHandler( void )
{
ComponentRoutineUPP MyComponentRoutineUPP;
MyComponentRoutineUPP = NewComponentRoutineUPP(&myComponentRoutineProc);
RegisterComponent( &myType , MyComponentRoutineUPP, 0, NULL, NULL, NULL);
}
static pascal ComponentResult myDataHCanUseDataRef ( DataHandler dh,
Handle dataRef,
long *useFlags
)
{
WineDataRefRecord *record = (WineDataRefRecord*)(*dataRef);
TRACE("%p %p %p\n",dh,dataRef,useFlags);
if (record->pReader == NULL)
return badComponentSelector;
*useFlags = kDataHCanRead;
return noErr;
}
static pascal ComponentResult myDataHSetDataRef ( DataHandler dh, Handle dataRef)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
WineDataRefRecord* newRef = (WineDataRefRecord*)(*dataRef);
TRACE("\n");
if (newRef->pReader != data->dataRef.pReader)
IAsyncReader_AddRef(newRef->pReader);
data->dataRef = *newRef;
return noErr;
}
static pascal ComponentResult myDataHGetAvailableFileSize ( DataHandler dh,
long *fileSize)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
LONGLONG total;
LONGLONG available;
TRACE("%p\n",dh);
IAsyncReader_Length(data->dataRef.pReader,&total,&available);
*fileSize = available;
return noErr;
}
static pascal ComponentResult myDataHGetFileSize ( DataHandler dh, long *fileSize)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
LONGLONG total;
LONGLONG available;
TRACE("%p\n",dh);
IAsyncReader_Length(data->dataRef.pReader,&total,&available);
*fileSize = total;
return noErr;
}
static pascal ComponentResult myDataHScheduleData ( DataHandler dh,
Ptr PlaceToPutDataPtr,
long FileOffset,
long DataSize,
long RefCon,
DataHSchedulePtr scheduleRec,
DataHCompletionUPP CompletionRtn)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
HRESULT hr;
LONGLONG offset = FileOffset;
BYTE* buffer = (BYTE*)PlaceToPutDataPtr;
TRACE("%p %p %li %li %li %p %p\n",dh, PlaceToPutDataPtr, FileOffset, DataSize, RefCon, scheduleRec, CompletionRtn);
hr = IAsyncReader_SyncRead(data->dataRef.pReader, offset, DataSize, buffer);
TRACE("result %x\n",hr);
if (CompletionRtn)
{
if (data->AsyncCompletionRtn)
InvokeDataHCompletionUPP(data->AsyncPtr, data->AsyncRefCon, noErr, data->AsyncCompletionRtn);
data->AsyncPtr = PlaceToPutDataPtr;
data->AsyncRefCon = RefCon;
data->AsyncCompletionRtn = CompletionRtn;
}
return noErr;
}
static pascal ComponentResult myDataHFinishData (DataHandler dh, Ptr PlaceToPutDataPtr, Boolean Cancel)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
if (!data->AsyncCompletionRtn)
return noErr;
if (!PlaceToPutDataPtr || PlaceToPutDataPtr == data->AsyncPtr)
{
if (!Cancel)
InvokeDataHCompletionUPP(data->AsyncPtr, data->AsyncRefCon, noErr, data->AsyncCompletionRtn);
data->AsyncPtr = NULL;
data->AsyncRefCon = 0;
data->AsyncCompletionRtn = NULL;
}
return noErr;
}
static pascal ComponentResult myDataHGetData ( DataHandler dh,
Handle h,
long hOffset,
long offset,
long size)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
BYTE *target = (BYTE*)*h;
LONGLONG off = offset;
HRESULT hr;
TRACE("%p %p %li %li %li\n",dh, h, hOffset, offset, size);
hr = IAsyncReader_SyncRead(data->dataRef.pReader, off, size, target+hOffset);
TRACE("result %x\n",hr);
return noErr;
}
static pascal ComponentResult myDataHCompareDataRef ( DataHandler dh,
Handle dataRef, Boolean *equal)
{
WineDataRefRecord *ptr1;
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
TRACE("\n");
ptr1 = (WineDataRefRecord*)dataRef;
*equal = (ptr1->pReader == data->dataRef.pReader);
return noErr;
}
static pascal ComponentResult myDataHGetDataRef ( DataHandler dh, Handle *dataRef)
{
Handle storage = GetComponentInstanceStorage(dh);
TRACE("\n");
*dataRef = storage;
HandToHand(dataRef);
return noErr;
}
static pascal ComponentResult myDataHGetScheduleAheadTime ( DataHandler dh,
long *millisecs)
{
TRACE("\n");
*millisecs = 1000;
return noErr;
}
static pascal ComponentResult myDataHGetInfoFlags ( DataHandler dh, UInt32 *flags)
{
TRACE("\n");
*flags = 0;
return noErr;
}
static pascal ComponentResult myDataHGetFileTypeOrdering ( DataHandler dh,
DataHFileTypeOrderingHandle *orderingListHandle)
{
OSType orderlist[1] = {kDataHFileTypeExtension};
TRACE("\n");
PtrToHand( &orderlist, (Handle*)orderingListHandle, sizeof(OSType));
return noErr;
}
typedef struct {
const char *const fname;
const int sig_length;
const BYTE sig[10];
} signature;
static const signature stream_sigs[] = {
{"video.asf",4,{0x30,0x26,0xb2,0x75}},
{"video.mov",8,{0x00,0x00,0x00,0x14,0x66,0x74,0x79,0x70}},
{"video.mp4",8,{0x00,0x00,0x00,0x18,0x66,0x74,0x79,0x70}},
{"video.m4v",8,{0x00,0x00,0x00,0x1c,0x66,0x74,0x79,0x70}},
{"video.flv",4,{0x46,0x4C,0x56,0x01}},
{"video.mpg",3,{0x00,0x00,0x01}},
{"avideo.rm",4,{0x2E,0x52,0x4D,0x46}}
};
static pascal ComponentResult myDataHGetFileName ( DataHandler dh, Str255 str)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
TRACE("%p %s\n",str,debugstr_guid(&data->dataRef.streamSubtype));
/* Todo Expand this list */
if (IsEqualIID(&data->dataRef.streamSubtype, &MEDIASUBTYPE_MPEG1Video) ||
IsEqualIID(&data->dataRef.streamSubtype, &MEDIASUBTYPE_MPEG1System))
CFStringGetPascalString(CFSTR("video.mpg"),str,256,kCFStringEncodingMacRoman);
else if(IsEqualIID(&data->dataRef.streamSubtype, &MEDIASUBTYPE_Asf))
CFStringGetPascalString(CFSTR("video.asf"),str,256,kCFStringEncodingMacRoman);
else if(IsEqualIID(&data->dataRef.streamSubtype, &MEDIASUBTYPE_Avi))
CFStringGetPascalString(CFSTR("video.avi"),str,256,kCFStringEncodingMacRoman);
else if(IsEqualIID(&data->dataRef.streamSubtype, &MEDIASUBTYPE_QTMovie))
CFStringGetPascalString(CFSTR("video.mov"),str,256,kCFStringEncodingMacRoman);
else
{
BYTE header[10] = {0,0,0,0,0,0,0,0,0,0};
int i;
IAsyncReader_SyncRead(data->dataRef.pReader, 0, 8, header);
for (i = 0; i < ARRAY_SIZE(stream_sigs); i++)
if (memcmp(header, stream_sigs[i].sig, stream_sigs[i].sig_length)==0)
{
str[0] = strlen(stream_sigs[i].fname);
memcpy(str + 1, stream_sigs[i].fname, str[0]);
return noErr;
}
return badComponentSelector;
}
return noErr;
}
static pascal ComponentResult myDataHOpenForRead(DataHandler dh)
{
TRACE("\n");
return noErr;
}
static pascal ComponentResult myDataHTask(DataHandler dh)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
if (data->AsyncCompletionRtn)
{
TRACE("Sending Completion\n");
InvokeDataHCompletionUPP(data->AsyncPtr, data->AsyncRefCon, noErr, data->AsyncCompletionRtn);
data->AsyncPtr = NULL;
data->AsyncRefCon = 0;
data->AsyncCompletionRtn = NULL;
}
return noErr;
}
static pascal ComponentResult myDataHPlaybackHints(DataHandler dh, long flags,
unsigned long minFileOffset, unsigned long maxFileOffset,
long bytesPerSecond)
{
TRACE("%lu %lu %li\n",minFileOffset, maxFileOffset, bytesPerSecond);
return noErr;
}
static pascal ComponentResult myDataHPlaybackHints64(DataHandler dh, long flags,
wide *minFileOffset, wide *maxFileOffset,
long bytesPerSecond)
{
if (TRACE_ON(qtdatahandler))
{
SInt64 minFileOffset64 = WideToSInt64(*minFileOffset);
LONGLONG minFileOffsetLL = minFileOffset64;
SInt64 maxFileOffset64 = WideToSInt64(*maxFileOffset);
LONGLONG maxFileOffsetLL = maxFileOffset64;
TRACE("%s %s %li\n",wine_dbgstr_longlong(minFileOffsetLL), wine_dbgstr_longlong(maxFileOffsetLL), bytesPerSecond);
}
return noErr;
}
static pascal ComponentResult myDataHGetFileSize64(DataHandler dh, wide * fileSize)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
LONGLONG total;
LONGLONG available;
SInt64 total64;
TRACE("%p\n",dh);
IAsyncReader_Length(data->dataRef.pReader,&total,&available);
total64 = total;
*fileSize = SInt64ToWide(total64);
return noErr;
}
static pascal ComponentResult myDataHGetFileSizeAsync ( DataHandler dh, wide *fileSize, DataHCompletionUPP CompletionRtn, long RefCon )
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
LONGLONG total;
LONGLONG available;
SInt64 total64;
TRACE("%p\n",dh);
IAsyncReader_Length(data->dataRef.pReader,&total,&available);
total64 = total;
*fileSize = SInt64ToWide(total64);
if (CompletionRtn)
{
if (data->AsyncCompletionRtn)
InvokeDataHCompletionUPP(data->AsyncPtr, data->AsyncRefCon, noErr, data->AsyncCompletionRtn);
data->AsyncPtr = (Ptr)fileSize;
data->AsyncRefCon = RefCon;
data->AsyncCompletionRtn = CompletionRtn;
}
return noErr;
}
static pascal ComponentResult myDataHGetAvailableFileSize64(DataHandler dh, wide * fileSize)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
LONGLONG total;
LONGLONG available;
SInt64 total64;
TRACE("%p\n",dh);
IAsyncReader_Length(data->dataRef.pReader,&total,&available);
total64 = available;
*fileSize = SInt64ToWide(total64);
return noErr;
}
static pascal ComponentResult myDataHScheduleData64( DataHandler dh,
Ptr PlaceToPutDataPtr,
const wide * FileOffset,
long DataSize,
long RefCon,
DataHSchedulePtr scheduleRec,
DataHCompletionUPP CompletionRtn)
{
Handle storage = GetComponentInstanceStorage(dh);
DHData *data = (DHData*)*storage;
HRESULT hr;
SInt64 fileOffset64 = WideToSInt64(*FileOffset);
LONGLONG offset = fileOffset64;
BYTE* buffer = (BYTE*)PlaceToPutDataPtr;
TRACE("%p %p %s %li %li %p %p\n",dh, PlaceToPutDataPtr, wine_dbgstr_longlong(offset), DataSize, RefCon, scheduleRec, CompletionRtn);
hr = IAsyncReader_SyncRead(data->dataRef.pReader, offset, DataSize, buffer);
TRACE("result %x\n",hr);
if (CompletionRtn)
{
if (data->AsyncCompletionRtn)
InvokeDataHCompletionUPP(data->AsyncPtr, data->AsyncRefCon, noErr, data->AsyncCompletionRtn);
data->AsyncPtr = PlaceToPutDataPtr;
data->AsyncRefCon = RefCon;
data->AsyncCompletionRtn = CompletionRtn;
}
return noErr;
}
static const struct { LPVOID proc; ProcInfoType type;} componentFunctions[] =
{
{NULL, 0}, /* 0 */
{NULL, 0}, /* 1 */
{myDataHGetData, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
}, /* kDataHGetDataSelect */
{NULL, 0}, /* kDataHPutDataSelect */
{NULL, 0}, /* kDataHFlushDataSelect */
{NULL, 0}, /* kDataHOpenForWriteSelect */
{NULL, 0}, /* kDataHCloseForWriteSelect */
{NULL, 0}, /* 7 */
{myDataHOpenForRead, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
}, /* kDataHOpenForReadSelect
*/
{NULL, 0}, /* kDataHCloseForReadSelect */
{myDataHSetDataRef, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
}, /* kDataHSetDataRefSelect */
{myDataHGetDataRef, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
}, /* kDataHGetDataRefSelect */
{myDataHCompareDataRef, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean*)))
}, /* kDataHCompareDataRefSelect */
{myDataHTask, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
}, /* kDataHTaskSelect */
{myDataHScheduleData, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(DataHSchedulePtr)))
| STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DataHCompletionUPP)))
}, /* kDataHScheduleDataSelect */
{myDataHFinishData, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean)))
}, /* kDataHFinishDataSelect */
{NULL, 0}, /* kDataHFlushCacheSelect 0x10 */
{NULL, 0}, /* kDataHResolveDataRefSelect */
{myDataHGetFileSize, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
}, /* kDataHGetFileSizeSelect */
{myDataHCanUseDataRef, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long*)))
}, /* kDataHCanUseDataRefSelect */
{NULL, 0}, /* kDataHGetVolumeListSelect */
{NULL, 0}, /* kDataHWriteSelect */
{NULL, 0}, /* kDataHPreextendSelect */
{NULL, 0}, /* kDataHSetFileSizeSelect */
{NULL, 0}, /* kDataHGetFreeSpaceSelect */
{NULL, 0}, /* kDataHCreateFileSelect */
{NULL, 0}, /* kDataHGetPreferredBlockSizeSelect */
{NULL, 0}, /* kDataHGetDeviceIndexSelect */
{NULL, 0}, /* kDataHIsStreamingDataHandlerSelect */
{NULL, 0}, /* kDataHGetDataInBufferSelect */
{myDataHGetScheduleAheadTime, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
}, /* kDataHGetScheduleAheadTimeSelect */
/* End of Required List */
{NULL, 0}, /* kDataHSetCacheSizeLimitSelect */
{NULL, 0}, /* kDataHGetCacheSizeLimitSelect 0x20 */
{NULL, 0}, /* kDataHGetMovieSelect */
{NULL, 0}, /* kDataHAddMovieSelect */
{NULL, 0}, /* kDataHUpdateMovieSelect */
{NULL, 0}, /* kDataHDoesBufferSelect */
{myDataHGetFileName, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Str255*)))
}, /* kDataHGetFileNameSelect */
{myDataHGetAvailableFileSize, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
}, /* kDataHGetAvailableFileSizeSelect */
{NULL, 0}, /* kDataHGetMacOSFileTypeSelect */
{NULL, 0}, /* kDataHGetMIMETypeSelect */
{NULL, 0}, /* kDataHSetDataRefWithAnchorSelect */
{NULL, 0}, /* kDataHGetDataRefWithAnchorSelect */
{NULL, 0}, /* kDataHSetMacOSFileTypeSelect */
{NULL, 0}, /* kDataHSetTimeBaseSelect */
{myDataHGetInfoFlags, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(UInt32*)))
}, /* kDataHGetInfoFlagsSelect */
{myDataHScheduleData64, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(wide*)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(DataHSchedulePtr)))
| STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DataHCompletionUPP)))
}, /* kDataHScheduleData64Select */
{NULL, 0}, /* kDataHWrite64Select */
{myDataHGetFileSize64, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(wide*)))
}, /* kDataHGetFileSize64Select 0x30 */
{NULL, 0}, /* kDataHPreextend64Select */
{NULL, 0}, /* kDataHSetFileSize64Select */
{NULL, 0}, /* kDataHGetFreeSpace64Select */
{NULL, 0}, /* kDataHAppend64Select */
{NULL, 0}, /* kDataHReadAsyncSelect */
{NULL, 0}, /* kDataHPollReadSelect */
{NULL, 0}, /* kDataHGetDataAvailabilitySelect */
{NULL, 0}, /* 0x0038 */
{NULL, 0}, /* 0x0039 */
{myDataHGetFileSizeAsync, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(wide*)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DataHCompletionUPP)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
}, /* kDataHGetFileSizeAsyncSelect */
{NULL, 0}, /* kDataHGetDataRefAsTypeSelect */
{NULL, 0}, /* kDataHSetDataRefExtensionSelect */
{NULL, 0}, /* kDataHGetDataRefExtensionSelect */
{NULL, 0}, /* kDataHGetMovieWithFlagsSelect */
{NULL, 0}, /* 0x3F */
{myDataHGetFileTypeOrdering, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DataHFileTypeOrderingHandle*)))
}, /* kDataHGetFileTypeOrderingSelect 0x40 */
{NULL, 0}, /* kDataHCreateFileWithFlagsSelect */
{NULL, 0}, /* kDataHGetMIMETypeAsyncSelect */
{NULL, 0}, /* kDataHGetInfoSelect */
{NULL, 0}, /* kDataHSetIdleManagerSelect */
{NULL, 0}, /* kDataHDeleteFileSelect */
{NULL, 0}, /* kDataHSetMovieUsageFlagsSelect */
{NULL, 0}, /* kDataHUseTemporaryDataRefSelect */
{NULL, 0}, /* kDataHGetTemporaryDataRefCapabilitiesSelect */
{NULL, 0}, /* kDataHRenameFileSelect */
{NULL, 0}, /* 0x4A */
{NULL, 0}, /* 0x4B */
{NULL, 0}, /* 0x4C */
{NULL, 0}, /* 0x4D */
{myDataHGetAvailableFileSize64, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(wide*)))
}, /* kDataHGetAvailableFileSize64Select */
{NULL, 0}, /* kDataHGetDataAvailability64Select */
};
static const struct { LPVOID proc; ProcInfoType type;} componentFunctions_2[] =
{
{myDataHPlaybackHints, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(unsigned long)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(unsigned long)))
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
}, /* kDataHPlaybackHintsSelect 0x103 */
{myDataHPlaybackHints64, kPascalStackBased
| RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DataHandler)))
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(wide*)))
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(wide*)))
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
}, /* kDataHPlaybackHints64Select 0x10E */
{NULL, 0}, /* kDataHGetDataRateSelect 0x110 */
{NULL, 0}, /* kDataHSetTimeHintsSelect 0x111 */
};
/* Component Functions */
static pascal ComponentResult myComponentOpen(ComponentInstance ci, ComponentInstance self)
{
DHData myData;
Handle storage;
ZeroMemory(&myData,sizeof(DHData));
PtrToHand( &myData, &storage, sizeof(DHData));
SetComponentInstanceStorage(self,storage);
return noErr;
}
static pascal ComponentResult myComponentClose(ComponentInstance ci, ComponentInstance self)
{
Handle storage = GetComponentInstanceStorage(self);
DHData *data;
if (storage)
{
data = (DHData*)*storage;
if (data && data->dataRef.pReader != NULL)
IAsyncReader_Release(data->dataRef.pReader);
DisposeHandle(storage);
SetComponentInstanceStorage(self,NULL);
}
return noErr;
}
static pascal ComponentResult myComponentCanDo(ComponentInstance ci, SInt16 ftnNumber)
{
TRACE("test 0x%x\n",ftnNumber);
if (ftnNumber <= kComponentOpenSelect && ftnNumber >= kComponentCanDoSelect)
return TRUE;
if (ftnNumber == kDataHPlaybackHintsSelect)
return TRUE;
if (ftnNumber == kDataHPlaybackHints64Select)
return TRUE;
if (ftnNumber > kDataHGetDataAvailability64Select)
return FALSE;
TRACE("impl? %i\n",(componentFunctions[ftnNumber].proc != NULL));
return (componentFunctions[ftnNumber].proc != NULL);
}
/* Main Proc */
static ComponentResult callOurFunction(LPVOID proc, ProcInfoType type, ComponentParameters * cp)
{
ComponentRoutineUPP myUUP;
ComponentResult result;
myUUP = NewComponentFunctionUPP(proc, type);
result = CallComponentFunction(cp, myUUP);
DisposeComponentFunctionUPP(myUUP);
return result;
}
static pascal ComponentResult myComponentRoutineProc ( ComponentParameters * cp,
Handle componentStorage)
{
switch (cp->what)
{
case kComponentOpenSelect:
return callOurFunction(myComponentOpen, uppCallComponentOpenProcInfo, cp);
case kComponentCloseSelect:
return callOurFunction(myComponentClose, uppCallComponentOpenProcInfo, cp);
case kComponentCanDoSelect:
return callOurFunction(myComponentCanDo, uppCallComponentCanDoProcInfo, cp);
case kDataHPlaybackHintsSelect:
return callOurFunction(componentFunctions_2[0].proc, componentFunctions_2[0].type, cp);
case kDataHPlaybackHints64Select:
return callOurFunction(componentFunctions_2[1].proc, componentFunctions_2[1].type, cp);
}
if (cp->what > 0 && cp->what <=kDataHGetDataAvailability64Select && componentFunctions[cp->what].proc)
return callOurFunction(componentFunctions[cp->what].proc, componentFunctions[cp->what].type, cp);
FIXME("unhandled select 0x%x\n",cp->what);
return badComponentSelector;
}

View File

@ -1,28 +0,0 @@
/*
* QuickTime Toolkit decoder header
*
* Copyright 2011 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
*/
typedef struct WineDataRefRecordTag
{
IAsyncReader* pReader;
GUID streamSubtype;
} WineDataRefRecord;
HRESULT AccessPixelBufferPixels( CVPixelBufferRef pixelBuffer, LPBYTE pbDstStream);
void RegisterWineDataHandler( void );

File diff suppressed because it is too large Load Diff

View File

@ -1,159 +0,0 @@
/*
* QuickTime Toolkit decoder utils
*
* Copyright 2011 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"
#define ULONG CoreFoundation_ULONG
#define HRESULT CoreFoundation_HRESULT
#define LoadResource __carbon_LoadResource
#define CompareString __carbon_CompareString
#define GetCurrentThread __carbon_GetCurrentThread
#define GetCurrentProcess __carbon_GetCurrentProcess
#define AnimatePalette __carbon_AnimatePalette
#define EqualRgn __carbon_EqualRgn
#define FillRgn __carbon_FillRgn
#define FrameRgn __carbon_FrameRgn
#define GetPixel __carbon_GetPixel
#define InvertRgn __carbon_InvertRgn
#define LineTo __carbon_LineTo
#define OffsetRgn __carbon_OffsetRgn
#define PaintRgn __carbon_PaintRgn
#define Polygon __carbon_Polygon
#define ResizePalette __carbon_ResizePalette
#define SetRectRgn __carbon_SetRectRgn
#define CheckMenuItem __carbon_CheckMenuItem
#define DeleteMenu __carbon_DeleteMenu
#define DrawMenuBar __carbon_DrawMenuBar
#define EnableMenuItem __carbon_EnableMenuItem
#define EqualRect __carbon_EqualRect
#define FillRect __carbon_FillRect
#define FrameRect __carbon_FrameRect
#define GetCursor __carbon_GetCursor
#define GetMenu __carbon_GetMenu
#define InvertRect __carbon_InvertRect
#define IsWindowVisible __carbon_IsWindowVisible
#define MoveWindow __carbon_MoveWindow
#define OffsetRect __carbon_OffsetRect
#define PtInRect __carbon_PtInRect
#define SetCursor __carbon_SetCursor
#define SetRect __carbon_SetRect
#define ShowCursor __carbon_ShowCursor
#define ShowWindow __carbon_ShowWindow
#define UnionRect __carbon_UnionRect
#include <CoreVideo/CVPixelBuffer.h>
#undef LoadResource
#undef CompareString
#undef GetCurrentThread
#undef _CDECL
#undef GetCurrentProcess
#undef AnimatePalette
#undef EqualRgn
#undef FillRgn
#undef FrameRgn
#undef GetPixel
#undef InvertRgn
#undef LineTo
#undef OffsetRgn
#undef PaintRgn
#undef Polygon
#undef ResizePalette
#undef SetRectRgn
#undef CheckMenuItem
#undef DeleteMenu
#undef DrawMenuBar
#undef EnableMenuItem
#undef EqualRect
#undef FillRect
#undef FrameRect
#undef GetCursor
#undef GetMenu
#undef InvertRect
#undef IsWindowVisible
#undef MoveWindow
#undef OffsetRect
#undef PtInRect
#undef SetCursor
#undef SetRect
#undef ShowCursor
#undef ShowWindow
#undef UnionRect
#undef ULONG
#undef HRESULT
#undef STDMETHODCALLTYPE
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "winuser.h"
#include "dshow.h"
#include "wine/debug.h"
#include "qtprivate.h"
WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
typedef struct {
UInt8 a; /* Alpha Channel */
UInt8 r; /* red component */
UInt8 g; /* green component */
UInt8 b; /* blue component */
} ARGBPixelRecord, *ARGBPixelPtr, **ARGBPixelHdl;
HRESULT AccessPixelBufferPixels( CVPixelBufferRef pixelBuffer, LPBYTE pbDstStream)
{
LPBYTE pPixels = NULL;
size_t bytesPerRow = 0, height = 0, width = 0;
OSType actualType;
int i;
actualType = CVPixelBufferGetPixelFormatType(pixelBuffer);
if (k32ARGBPixelFormat != actualType)
{
ERR("Pixel Buffer is not desired Type\n");
return E_FAIL;
}
CVPixelBufferLockBaseAddress(pixelBuffer,0);
pPixels = (LPBYTE)CVPixelBufferGetBaseAddress(pixelBuffer);
bytesPerRow = CVPixelBufferGetBytesPerRow(pixelBuffer);
height = CVPixelBufferGetHeight(pixelBuffer);
width = CVPixelBufferGetWidth(pixelBuffer);
for (i = 1; i <= height; i++)
{
int j;
LPBYTE out = pbDstStream + ((height - i) * width * 3);
for (j = 0; j < width; j++)
{
*((DWORD*)out) = (((ARGBPixelPtr)pPixels)[j].r) << 16
| (((ARGBPixelPtr)pPixels)[j].g) << 8
| (((ARGBPixelPtr)pPixels)[j].b);
out+=3;
}
pPixels += bytesPerRow;
}
CVPixelBufferUnlockBaseAddress(pixelBuffer,0);
return S_OK;
}

View File

@ -1,649 +0,0 @@
/*
* QuickTime Toolkit decoder filter for video
*
* 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"
#define ULONG CoreFoundation_ULONG
#define HRESULT CoreFoundation_HRESULT
#define LoadResource __carbon_LoadResource
#define CompareString __carbon_CompareString
#define GetCurrentThread __carbon_GetCurrentThread
#define GetCurrentProcess __carbon_GetCurrentProcess
#define AnimatePalette __carbon_AnimatePalette
#define EqualRgn __carbon_EqualRgn
#define FillRgn __carbon_FillRgn
#define FrameRgn __carbon_FrameRgn
#define GetPixel __carbon_GetPixel
#define InvertRgn __carbon_InvertRgn
#define LineTo __carbon_LineTo
#define OffsetRgn __carbon_OffsetRgn
#define PaintRgn __carbon_PaintRgn
#define Polygon __carbon_Polygon
#define ResizePalette __carbon_ResizePalette
#define SetRectRgn __carbon_SetRectRgn
#define CheckMenuItem __carbon_CheckMenuItem
#define DeleteMenu __carbon_DeleteMenu
#define DrawMenuBar __carbon_DrawMenuBar
#define EnableMenuItem __carbon_EnableMenuItem
#define EqualRect __carbon_EqualRect
#define FillRect __carbon_FillRect
#define FrameRect __carbon_FrameRect
#define GetCursor __carbon_GetCursor
#define GetMenu __carbon_GetMenu
#define InvertRect __carbon_InvertRect
#define IsWindowVisible __carbon_IsWindowVisible
#define MoveWindow __carbon_MoveWindow
#define OffsetRect __carbon_OffsetRect
#define PtInRect __carbon_PtInRect
#define SetCursor __carbon_SetCursor
#define SetRect __carbon_SetRect
#define ShowCursor __carbon_ShowCursor
#define ShowWindow __carbon_ShowWindow
#define UnionRect __carbon_UnionRect
#include <QuickTime/ImageCompression.h>
#include <CoreVideo/CVPixelBuffer.h>
#undef LoadResource
#undef CompareString
#undef GetCurrentThread
#undef _CDECL
#undef GetCurrentProcess
#undef AnimatePalette
#undef EqualRgn
#undef FillRgn
#undef FrameRgn
#undef GetPixel
#undef InvertRgn
#undef LineTo
#undef OffsetRgn
#undef PaintRgn
#undef Polygon
#undef ResizePalette
#undef SetRectRgn
#undef CheckMenuItem
#undef DeleteMenu
#undef DrawMenuBar
#undef EnableMenuItem
#undef EqualRect
#undef FillRect
#undef FrameRect
#undef GetCursor
#undef GetMenu
#undef InvertRect
#undef IsWindowVisible
#undef MoveWindow
#undef OffsetRect
#undef PtInRect
#undef SetCursor
#undef SetRect
#undef ShowCursor
#undef ShowWindow
#undef UnionRect
#undef ULONG
#undef HRESULT
#undef STDMETHODCALLTYPE
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "winuser.h"
#include "dshow.h"
#include "uuids.h"
#include "amvideo.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "vfw.h"
#include "dvdmedia.h"
#include <assert.h>
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/strmbase.h"
#include "qtprivate.h"
#include "wineqtdecoder_classes.h"
WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
typedef struct QTVDecoderImpl
{
struct strmbase_filter filter;
CRITICAL_SECTION stream_cs;
AM_MEDIA_TYPE mt;
struct strmbase_source source;
IUnknown *seeking;
struct strmbase_sink sink;
ImageDescriptionHandle hImageDescription;
CFMutableDictionaryRef outputBufferAttributes;
ICMDecompressionSessionRef decompressionSession;
HRESULT decodeHR;
DWORD outputSize;
} QTVDecoderImpl;
static inline QTVDecoderImpl *impl_from_strmbase_filter(struct strmbase_filter *iface)
{
return CONTAINING_RECORD(iface, QTVDecoderImpl, filter);
}
static HRESULT video_decoder_sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface->filter);
if (IsEqualGUID(iid, &IID_IMemInputPin))
*out = &filter->sink.IMemInputPin_iface;
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static void trackingCallback(
void *decompressionTrackingRefCon,
OSStatus result,
ICMDecompressionTrackingFlags decompressionTrackingFlags,
CVPixelBufferRef pixelBuffer,
TimeValue64 displayTime,
TimeValue64 displayDuration,
ICMValidTimeFlags validTimeFlags,
void *reserved,
void *sourceFrameRefCon )
{
QTVDecoderImpl *This = (QTVDecoderImpl*)decompressionTrackingRefCon;
IMediaSample *pSample = (IMediaSample*)sourceFrameRefCon;
HRESULT hr = S_OK;
IMediaSample* pOutSample = NULL;
LPBYTE pbDstStream;
DWORD cbDstStream;
if (result != noErr)
{
ERR("Error from Codec, no frame decompressed\n");
return;
}
if (!pixelBuffer)
{
ERR("No pixel buffer, no frame decompressed\n");
return;
}
EnterCriticalSection(&This->stream_cs);
hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr);
goto error;
}
hr = IMediaSample_SetActualDataLength(pOutSample, 0);
assert(hr == S_OK);
hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
if (FAILED(hr)) {
ERR("Unable to get pointer to buffer (%x)\n", hr);
goto error;
}
cbDstStream = IMediaSample_GetSize(pOutSample);
if (cbDstStream < This->outputSize) {
ERR("Sample size is too small %d < %d\n", cbDstStream, This->outputSize);
hr = E_FAIL;
goto error;
}
hr = AccessPixelBufferPixels(pixelBuffer, pbDstStream);
if (FAILED(hr))
goto error;
IMediaSample_SetActualDataLength(pOutSample, This->outputSize);
IMediaSample_SetPreroll(pOutSample, (IMediaSample_IsPreroll(pSample) == S_OK));
IMediaSample_SetDiscontinuity(pOutSample, (IMediaSample_IsDiscontinuity(pSample) == S_OK));
IMediaSample_SetSyncPoint(pOutSample, (IMediaSample_IsSyncPoint(pSample) == S_OK));
if (!validTimeFlags)
IMediaSample_SetTime(pOutSample, NULL, NULL);
else
{
LONGLONG tStart, tStop;
if (validTimeFlags & kICMValidTime_DisplayTimeStampIsValid)
tStart = displayTime;
else
tStart = 0;
if (validTimeFlags & kICMValidTime_DisplayDurationIsValid)
tStop = tStart + displayDuration;
else
tStop = tStart;
IMediaSample_SetTime(pOutSample, &tStart, &tStop);
}
hr = IMemInputPin_Receive(This->source.pMemInputPin, pOutSample);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr);
error:
LeaveCriticalSection(&This->stream_cs);
if (pOutSample)
IMediaSample_Release(pOutSample);
This->decodeHR = hr;
}
static HRESULT WINAPI video_decoder_sink_Receive(struct strmbase_sink *iface, IMediaSample *pSample)
{
QTVDecoderImpl *This = impl_from_strmbase_filter(iface->pin.filter);
HRESULT hr;
DWORD cbSrcStream;
LPBYTE pbSrcStream;
ICMFrameTimeRecord frameTime = {{0}};
TimeValue time = 1;
TimeScale timeScale = 1;
OSStatus err = noErr;
LONGLONG tStart, tStop;
EnterCriticalSection(&This->stream_cs);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
{
ERR("Cannot get pointer to sample data (%x)\n", hr);
goto error;
}
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
if (IMediaSample_GetTime(pSample, &tStart, &tStop) != S_OK)
tStart = tStop = 0;
time = tStart;
frameTime.recordSize = sizeof(ICMFrameTimeRecord);
*(TimeValue64 *)&frameTime.value = tStart;
frameTime.scale = 1;
frameTime.rate = fixed1;
frameTime.duration = tStop - tStart;
frameTime.frameNumber = 0;
frameTime.flags = icmFrameTimeIsNonScheduledDisplayTime;
err = ICMDecompressionSessionDecodeFrame(This->decompressionSession,
(UInt8 *)pbSrcStream, cbSrcStream, NULL, &frameTime, pSample);
if (err != noErr)
{
ERR("Error with ICMDecompressionSessionDecodeFrame\n");
hr = E_FAIL;
goto error;
}
ICMDecompressionSessionSetNonScheduledDisplayTime(This->decompressionSession, time, timeScale, 0);
ICMDecompressionSessionFlush(This->decompressionSession);
hr = This->decodeHR;
error:
LeaveCriticalSection(&This->stream_cs);
return hr;
}
static HRESULT video_decoder_sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *pmt)
{
QTVDecoderImpl *This = impl_from_strmbase_filter(iface->pin.filter);
HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
OSErr err = noErr;
AM_MEDIA_TYPE *outpmt = &This->mt;
CFNumberRef n = NULL;
FreeMediaType(outpmt);
CopyMediaType(outpmt, pmt);
if (This->hImageDescription)
DisposeHandle((Handle)This->hImageDescription);
This->hImageDescription = (ImageDescriptionHandle)
NewHandleClear(sizeof(ImageDescription));
if (This->hImageDescription != NULL)
{
(**This->hImageDescription).idSize = sizeof(ImageDescription);
(**This->hImageDescription).spatialQuality = codecNormalQuality;
(**This->hImageDescription).frameCount = 1;
(**This->hImageDescription).clutID = -1;
}
else
{
ERR("Failed to create ImageDescription\n");
goto failed;
}
/* Check root (GUID w/o FOURCC) */
if ((IsEqualIID(&pmt->majortype, &MEDIATYPE_Video)) &&
(!memcmp(((const char *)&pmt->subtype)+4, ((const char *)&MEDIATYPE_Video)+4, sizeof(GUID)-4)))
{
VIDEOINFOHEADER *format1 = (VIDEOINFOHEADER *)outpmt->pbFormat;
VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)outpmt->pbFormat;
BITMAPINFOHEADER *bmi;
OSType fourCC;
DecompressorComponent dc;
OSType format;
DWORD outputWidth, outputHeight, outputDepth;
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
bmi = &format1->bmiHeader;
else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
bmi = &format2->bmiHeader;
else
goto failed;
TRACE("Fourcc: %s\n", debugstr_an((const char *)&pmt->subtype.Data1, 4));
fourCC = ((const char *)&pmt->subtype.Data1)[3] |
(((const char *)&pmt->subtype.Data1)[2]<<8) |
(((const char *)&pmt->subtype.Data1)[1]<<16) |
(((const char *)&pmt->subtype.Data1)[0]<<24);
err = FindCodec(fourCC,NULL,NULL,&dc);
if (err != noErr || dc == 0x0)
{
TRACE("Codec not found\n");
goto failed;
}
outputWidth = bmi->biWidth;
outputHeight = bmi->biHeight;
(**This->hImageDescription).cType = fourCC;
(**This->hImageDescription).width = outputWidth;
(**This->hImageDescription).height = outputHeight;
(**This->hImageDescription).depth = bmi->biBitCount;
(**This->hImageDescription).hRes = 72<<16;
(**This->hImageDescription).vRes = 72<<16;
if (This->outputBufferAttributes)
CFRelease(This->outputBufferAttributes);
This->outputBufferAttributes = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (!This->outputBufferAttributes)
{
ERR("Failed to create outputBufferAttributes\n");
goto failed;
}
n = CFNumberCreate(NULL, kCFNumberIntType, &outputWidth);
CFDictionaryAddValue(This->outputBufferAttributes, kCVPixelBufferWidthKey, n);
CFRelease(n);
n = CFNumberCreate(NULL, kCFNumberIntType, &outputHeight);
CFDictionaryAddValue(This->outputBufferAttributes, kCVPixelBufferHeightKey, n);
CFRelease(n);
/* yes this looks wrong. but 32ARGB is 24 RGB with an alpha channel */
format = k32ARGBPixelFormat;
n = CFNumberCreate(NULL, kCFNumberIntType, &format);
CFDictionaryAddValue(This->outputBufferAttributes, kCVPixelBufferPixelFormatTypeKey, n);
CFRelease(n);
CFDictionaryAddValue(This->outputBufferAttributes, kCVPixelBufferCGBitmapContextCompatibilityKey, kCFBooleanTrue);
CFDictionaryAddValue(This->outputBufferAttributes, kCVPixelBufferCGImageCompatibilityKey, kCFBooleanTrue);
outputDepth = 3;
This->outputSize = outputWidth * outputHeight * outputDepth;
bmi->biCompression = BI_RGB;
bmi->biBitCount = 24;
outpmt->subtype = MEDIASUBTYPE_RGB24;
return S_OK;
}
failed:
if (This->hImageDescription)
{
DisposeHandle((Handle)This->hImageDescription);
This->hImageDescription = NULL;
}
if (This->outputBufferAttributes)
{
CFRelease(This->outputBufferAttributes);
This->outputBufferAttributes = NULL;
}
TRACE("Connection refused\n");
return hr;
}
static void video_decoder_sink_disconnect(struct strmbase_sink *iface)
{
QTVDecoderImpl *This = impl_from_strmbase_filter(iface->pin.filter);
if (This->hImageDescription)
DisposeHandle((Handle)This->hImageDescription);
if (This->outputBufferAttributes)
CFRelease(This->outputBufferAttributes);
This->hImageDescription = NULL;
This->outputBufferAttributes = NULL;
}
static const struct strmbase_sink_ops sink_ops =
{
.base.pin_query_interface = video_decoder_sink_query_interface,
.pfnReceive = video_decoder_sink_Receive,
.sink_connect = video_decoder_sink_connect,
.sink_disconnect = video_decoder_sink_disconnect,
};
static HRESULT video_decoder_source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface->filter);
if (IsEqualGUID(iid, &IID_IMediaSeeking))
return IUnknown_QueryInterface(filter->seeking, iid, out);
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static HRESULT video_decoder_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface->filter);
if (IsEqualGUID(&mt->majortype, &filter->mt.majortype)
&& (IsEqualGUID(&mt->subtype, &filter->mt.subtype)
|| IsEqualGUID(&filter->mt.subtype, &GUID_NULL)))
return S_OK;
return S_FALSE;
}
static HRESULT video_decoder_source_get_media_type(struct strmbase_pin *iface,
unsigned int index, AM_MEDIA_TYPE *mt)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface->filter);
if (index)
return VFW_S_NO_MORE_ITEMS;
CopyMediaType(mt, &filter->mt);
return S_OK;
}
static HRESULT WINAPI video_decoder_source_DecideBufferSize(struct strmbase_source *iface,
IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{
QTVDecoderImpl *This = impl_from_strmbase_filter(iface->pin.filter);
ALLOCATOR_PROPERTIES actual;
if (!ppropInputRequest->cbAlign)
ppropInputRequest->cbAlign = 1;
if (ppropInputRequest->cbBuffer < This->outputSize)
ppropInputRequest->cbBuffer = This->outputSize + ppropInputRequest->cbAlign;
if (!ppropInputRequest->cBuffers)
ppropInputRequest->cBuffers = 1;
return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
}
static const struct strmbase_source_ops source_ops =
{
.base.pin_query_interface = video_decoder_source_query_interface,
.base.pin_query_accept = video_decoder_source_query_accept,
.base.pin_get_media_type = video_decoder_source_get_media_type,
.pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
.pfnDecideBufferSize = video_decoder_source_DecideBufferSize,
};
static struct strmbase_pin *video_decoder_get_pin(struct strmbase_filter *iface, unsigned int index)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin;
else if (index == 1)
return &filter->source.pin;
return NULL;
}
static void video_decoder_destroy(struct strmbase_filter *iface)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
if (filter->sink.pin.peer)
IPin_Disconnect(filter->sink.pin.peer);
IPin_Disconnect(&filter->sink.pin.IPin_iface);
if (filter->source.pin.peer)
IPin_Disconnect(filter->source.pin.peer);
IPin_Disconnect(&filter->source.pin.IPin_iface);
strmbase_sink_cleanup(&filter->sink);
strmbase_source_cleanup(&filter->source);
filter->stream_cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->stream_cs);
FreeMediaType(&filter->mt);
IUnknown_Release(filter->seeking);
strmbase_filter_cleanup(&filter->filter);
free(filter);
}
static HRESULT video_decoder_init_stream(struct strmbase_filter *iface)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
HRESULT hr;
OSErr err = noErr;
ICMDecompressionSessionOptionsRef sessionOptions = NULL;
ICMDecompressionTrackingCallbackRecord trackingCallbackRecord;
trackingCallbackRecord.decompressionTrackingCallback = trackingCallback;
trackingCallbackRecord.decompressionTrackingRefCon = filter;
err = ICMDecompressionSessionCreate(NULL, filter->hImageDescription, sessionOptions,
filter->outputBufferAttributes, &trackingCallbackRecord, &filter->decompressionSession);
if (err != noErr)
{
ERR("Error with ICMDecompressionSessionCreate %i\n",err);
return E_FAIL;
}
if (filter->source.pin.peer && FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
ERR("Failed to commit allocator, hr %#x.\n", hr);
return S_OK;
}
static HRESULT video_decoder_cleanup_stream(struct strmbase_filter *iface)
{
QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
if (filter->decompressionSession)
ICMDecompressionSessionRelease(filter->decompressionSession);
filter->decompressionSession = NULL;
if (filter->source.pin.peer)
IMemAllocator_Decommit(filter->source.pAllocator);
return S_OK;
}
static const struct strmbase_filter_ops filter_ops =
{
.filter_get_pin = video_decoder_get_pin,
.filter_destroy = video_decoder_destroy,
.filter_init_stream = video_decoder_init_stream,
.filter_cleanup_stream = video_decoder_cleanup_stream,
};
HRESULT video_decoder_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR inW[] = { 'I','n',0 };
static const WCHAR outW[] = { 'O','u','t',0 };
QTVDecoderImpl *object;
HRESULT hr;
ISeekingPassThru *passthrough;
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, outer, &CLSID_QTVDecoder, &filter_ops);
InitializeCriticalSection(&object->stream_cs);
object->stream_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": QTVDecoderImpl.stream_cs");
strmbase_sink_init(&object->sink, &object->filter, inW, &sink_ops, NULL);
strmbase_source_init(&object->source, &object->filter, outW, &source_ops);
if (FAILED(hr = CoCreateInstance(&CLSID_SeekingPassThru,
(IUnknown *)&object->source.pin.IPin_iface, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&object->seeking)))
{
strmbase_sink_cleanup(&object->sink);
strmbase_source_cleanup(&object->source);
strmbase_filter_cleanup(&object->filter);
free(object);
return hr;
}
IUnknown_QueryInterface(object->seeking, &IID_ISeekingPassThru, (void **)&passthrough);
ISeekingPassThru_Init(passthrough, FALSE, &object->sink.pin.IPin_iface);
ISeekingPassThru_Release(passthrough);
TRACE("Created video decoder %p.\n", object);
*out = &object->filter.IUnknown_inner;
return S_OK;
}

View File

@ -1,28 +0,0 @@
/*
* 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_FILEDESCRIPTION_STR "Wine QT Decoder"
#define WINE_FILENAME_STR "wineqtdecoder.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"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc"
/* @makedep: wineqtdecoder.rgs */
2 WINE_REGISTRY wineqtdecoder.rgs

View File

@ -1,14 +0,0 @@
HKCR
{
NoRemove 'Media Type'
{
NoRemove '{E436EB83-524F-11CE-9F53-0020AF0BA770}'
{
ForceRemove '{FFFFFFFF-5927-4894-A386-359460EE87C9}'
{
val '0' = s '0,1,00,0'
val 'Source Filter' = s '{E436EBB5-524F-11CE-9F53-0020AF0BA770}'
}
}
}
}

View File

@ -1,4 +0,0 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View File

@ -1,37 +0,0 @@
/*
* COM classes for wineqtdecoder
*
* Copyright 2019 Zebediah Figura
*
* 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
*/
#pragma makedep header
#pragma makedep ident
#pragma makedep register
[
helpstring("Wine QuickTime splitter"),
threading(both),
uuid(d0e70e49-5927-4894-a386-359460ee87c9)
]
coclass QTSplitter {}
[
helpstring("Wine QuickTime video decoder"),
threading(both),
uuid(683ddacb-4354-490c-a058-e05ad0f20537)
]
coclass QTVDecoder {}

View File

@ -419,9 +419,6 @@
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the <QuickTime/ImageCompression.h> header file. */
#undef HAVE_QUICKTIME_IMAGECOMPRESSION_H
/* Define to 1 if the system has the type `request_sense'. */
#undef HAVE_REQUEST_SENSE