ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
875 discussions
Start a n
N
ew thread
[cwittich] 19402: WINE 0.9.1 vendor drop
by cwittich@svn.reactos.com
WINE 0.9.1 vendor drop Added: vendor/wine/dlls/avifil32/Wine-0_9_1/ Added: vendor/wine/dlls/avifil32/Wine-0_9_1/.cvsignore Added: vendor/wine/dlls/avifil32/Wine-0_9_1/Makefile.in Added: vendor/wine/dlls/avifil32/Wine-0_9_1/acmstream.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/api.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifil32.spec Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile.spec Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Cs.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_De.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_En.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Es.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Fr.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_It.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Ja.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Nl.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_No.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Pl.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Pt.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Ru.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_Si.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/avifile_private.h Added: vendor/wine/dlls/avifil32/Wine-0_9_1/editstream.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/extrachunk.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/extrachunk.h Added: vendor/wine/dlls/avifil32/Wine-0_9_1/factory.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/getframe.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/icmstream.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/regsvr.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/rsrc.rc Added: vendor/wine/dlls/avifil32/Wine-0_9_1/tmpfile.c Added: vendor/wine/dlls/avifil32/Wine-0_9_1/wavfile.c _____ Added: vendor/wine/dlls/avifil32/Wine-0_9_1/.cvsignore --- vendor/wine/dlls/avifil32/Wine-0_9_1/.cvsignore 2005-11-21 09:35:23 UTC (rev 19401) +++ vendor/wine/dlls/avifil32/Wine-0_9_1/.cvsignore 2005-11-21 09:38:25 UTC (rev 19402) @@ -0,0 +1,3 @@ +Makefile +libavifil32.def +rsrc.res _____ Added: vendor/wine/dlls/avifil32/Wine-0_9_1/Makefile.in --- vendor/wine/dlls/avifil32/Wine-0_9_1/Makefile.in 2005-11-21 09:35:23 UTC (rev 19401) +++ vendor/wine/dlls/avifil32/Wine-0_9_1/Makefile.in 2005-11-21 09:38:25 UTC (rev 19402) @@ -0,0 +1,30 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = avifil32.dll +IMPORTLIB = libavifil32.$(IMPLIBEXT) +IMPORTS = msacm32 msvfw32 winmm ole32 user32 advapi32 kernel32 ntdll +EXTRALIBS = -luuid + +C_SRCS = \ + acmstream.c \ + api.c \ + avifile.c \ + editstream.c \ + extrachunk.c \ + factory.c \ + getframe.c \ + icmstream.c \ + regsvr.c \ + tmpfile.c \ + wavfile.c + +SPEC_SRCS16 = avifile.spec + +RC_SRCS = \ + rsrc.rc + +@MAKE_DLL_RULES@ + +### Dependencies: _____ Added: vendor/wine/dlls/avifil32/Wine-0_9_1/acmstream.c --- vendor/wine/dlls/avifil32/Wine-0_9_1/acmstream.c 2005-11-21 09:35:23 UTC (rev 19401) +++ vendor/wine/dlls/avifil32/Wine-0_9_1/acmstream.c 2005-11-21 09:38:25 UTC (rev 19402) @@ -0,0 +1,747 @@ +/* + * Copyright 2002 Michael G³nnewig + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define COM_NO_WINDOWS_H +#include <assert.h> +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winerror.h" +#include "windowsx.h" +#include "mmsystem.h" +#include "vfw.h" +#include "msacm.h" + +#include "avifile_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(avifile); + +/********************************************************************** */ + +static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj); +static ULONG WINAPI ACMStream_fnAddRef(IAVIStream*iface); +static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface); +static HRESULT WINAPI ACMStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2); +static HRESULT WINAPI ACMStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size); +static LONG WINAPI ACMStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags); +static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize); +static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize); +static HRESULT WINAPI ACMStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread); +static HRESULT WINAPI ACMStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten); +static HRESULT WINAPI ACMStream_fnDelete(IAVIStream*iface,LONG start,LONG samples); +static HRESULT WINAPI ACMStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread); +static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size); +static HRESULT WINAPI ACMStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen); + +static const struct IAVIStreamVtbl iacmst = { + ACMStream_fnQueryInterface, + ACMStream_fnAddRef, + ACMStream_fnRelease, + ACMStream_fnCreate, + ACMStream_fnInfo, + ACMStream_fnFindSample, + ACMStream_fnReadFormat, + ACMStream_fnSetFormat, + ACMStream_fnRead, + ACMStream_fnWrite, + ACMStream_fnDelete, + ACMStream_fnReadData, + ACMStream_fnWriteData, + ACMStream_fnSetInfo +}; + +typedef struct _IAVIStreamImpl { + /* IUnknown stuff */ + const IAVIStreamVtbl *lpVtbl; + LONG ref; + + /* IAVIStream stuff */ + PAVISTREAM pStream; + AVISTREAMINFOW sInfo; + + HACMSTREAM has; + + LPWAVEFORMATEX lpInFormat; + LONG cbInFormat; + + LPWAVEFORMATEX lpOutFormat; + LONG cbOutFormat; + + ACMSTREAMHEADER acmStreamHdr; +} IAVIStreamImpl; + +/********************************************************************** */ + +#define CONVERT_STREAM_to_THIS(a) do { \ + DWORD __bytes; \ + acmStreamSize(This->has,*(a) * This->lpInFormat->nBlockAlign,\ + &__bytes, ACM_STREAMSIZEF_SOURCE); \ + *(a) = __bytes / This->lpOutFormat->nBlockAlign; } while(0) + +#define CONVERT_THIS_to_STREAM(a) do { \ + DWORD __bytes; \ + acmStreamSize(This->has,*(a) * This->lpOutFormat->nBlockAlign,\ + &__bytes, ACM_STREAMSIZEF_DESTINATION); \ + *(a) = __bytes / This->lpInFormat->nBlockAlign; } while(0) + +static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This); + +HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv) +{ + IAVIStreamImpl *pstream; + HRESULT hr; + + assert(riid != NULL && ppv != NULL); + + *ppv = NULL; + + pstream = (IAVIStreamImpl*)LocalAlloc(LPTR, sizeof(IAVIStreamImpl)); + if (pstream == NULL) + return AVIERR_MEMORY; + + pstream->lpVtbl = &iacmst; + + hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv); + if (FAILED(hr)) + LocalFree((HLOCAL)pstream); + + return hr; +} + +static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream *iface, + REFIID refiid, LPVOID *obj) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj); + + if (IsEqualGUID(&IID_IUnknown, refiid) || + IsEqualGUID(&IID_IAVIStream, refiid)) { + *obj = This; + IAVIStream_AddRef(iface); + + return S_OK; + } + + return OLE_E_ENUM_NOMORE; +} + +static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) -> %ld\n", iface, ref); + + /* also add reference to the nested stream */ + if (This->pStream != NULL) + IAVIStream_AddRef(This->pStream); + + return ref; +} + +static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) -> %ld\n", iface, ref); + + if (ref == 0) { + /* destruct */ + if (This->has != NULL) { + if (This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) + acmStreamUnprepareHeader(This->has, &This->acmStreamHdr, 0); + acmStreamClose(This->has, 0); + This->has = NULL; + } + if (This->acmStreamHdr.pbSrc != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbSrc); + This->acmStreamHdr.pbSrc = NULL; + } + if (This->acmStreamHdr.pbDst != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbDst); + This->acmStreamHdr.pbDst = NULL; + } + if (This->lpInFormat != NULL) { + GlobalFreePtr(This->lpInFormat); + This->lpInFormat = NULL; + This->cbInFormat = 0; + } + if (This->lpOutFormat != NULL) { + GlobalFreePtr(This->lpOutFormat); + This->lpOutFormat = NULL; + This->cbOutFormat = 0; + } + if (This->pStream != NULL) { + IAVIStream_Release(This->pStream); + This->pStream = NULL; + } + LocalFree((HLOCAL)This); + + return 0; + } + + /* also release reference to the nested stream */ + if (This->pStream != NULL) + IAVIStream_Release(This->pStream); + + return ref; +} + +/* lParam1: PAVISTREAM + * lParam2: LPAVICOMPRESSOPTIONS -- even if doc's say LPWAVEFORMAT + */ +static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1, + LPARAM lParam2) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2); + + /* check for swapped parameters */ + if ((LPVOID)lParam1 != NULL && + ((LPAVICOMPRESSOPTIONS)lParam1)->fccType == streamtypeAUDIO) { + register LPARAM tmp = lParam1; + + lParam1 = lParam2; + lParam2 = tmp; + } + + if ((LPVOID)lParam1 == NULL) + return AVIERR_BADPARAM; + + IAVIStream_Info((PAVISTREAM)lParam1, &This->sInfo, sizeof(This->sInfo)); + if (This->sInfo.fccType != streamtypeAUDIO) + return AVIERR_ERROR; /* error in registry or AVIMakeCompressedStream */ + + This->sInfo.fccHandler = 0; /* be paranoid */ + + /* FIXME: check ACM version? Which version does we need? */ + + if ((LPVOID)lParam2 != NULL) { + /* We only need the format from the compress-options */ + if (((LPAVICOMPRESSOPTIONS)lParam2)->fccType == streamtypeAUDIO) + lParam2 = (LPARAM)((LPAVICOMPRESSOPTIONS)lParam2)->lpFormat; + + if (((LPWAVEFORMATEX)lParam2)->wFormatTag != WAVE_FORMAT_PCM) + This->cbOutFormat = sizeof(WAVEFORMATEX) + ((LPWAVEFORMATEX)lParam2)->cbSize; + else + This->cbOutFormat = sizeof(PCMWAVEFORMAT); + + This->lpOutFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GHND, This->cbOutFormat); + if (This->lpOutFormat == NULL) + return AVIERR_MEMORY; + + memcpy(This->lpOutFormat, (LPVOID)lParam2, This->cbOutFormat); + } else { + This->lpOutFormat = NULL; + This->cbOutFormat = 0; + } + + This->pStream = (PAVISTREAM)lParam1; + IAVIStream_AddRef(This->pStream); + + return AVIERR_OK; +} + +static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, + LONG size) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%p,%ld)\n", iface, psi, size); + + if (psi == NULL) + return AVIERR_BADPARAM; + if (size < 0) + return AVIERR_BADSIZE; + + /* Need codec to correct some values in structure */ + if (This->has == NULL) { + HRESULT hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + memcpy(psi, &This->sInfo, min(size, (LONG)sizeof(This->sInfo))); + + if (size < (LONG)sizeof(This->sInfo)) + return AVIERR_BUFFERTOOSMALL; + return AVIERR_OK; +} + +static LONG WINAPI ACMStream_fnFindSample(IAVIStream *iface, LONG pos, + LONG flags) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,0x%08lX)\n",iface,pos,flags); + + if (flags & FIND_FROM_START) { + pos = This->sInfo.dwStart; + flags &= ~(FIND_FROM_START|FIND_PREV); + flags |= FIND_NEXT; + } + + /* convert pos from our 'space' to This->pStream's one */ + CONVERT_THIS_to_STREAM(&pos); + + /* ask stream */ + pos = IAVIStream_FindSample(This->pStream, pos, flags); + + if (pos != -1) { + /* convert pos back to our 'space' if it's no size or physical pos */ + if ((flags & FIND_RET) == 0) + CONVERT_STREAM_to_THIS(&pos); + } + + return pos; +} + +static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream *iface, LONG pos, + LPVOID format, LONG *formatsize) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,%p,%p)\n", iface, pos, format, formatsize); + + if (formatsize == NULL) + return AVIERR_BADPARAM; + + if (This->has == NULL) { + HRESULT hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + /* only interested in needed buffersize? */ + if (format == NULL || *formatsize <= 0) { + *formatsize = This->cbOutFormat; + + return AVIERR_OK; + } + + /* copy initial format (only as much as will fit) */ + memcpy(format, This->lpOutFormat, min(*formatsize, This->cbOutFormat)); + if (*formatsize < This->cbOutFormat) { + *formatsize = This->cbOutFormat; + return AVIERR_BUFFERTOOSMALL; + } + + *formatsize = This->cbOutFormat; + return AVIERR_OK; +} + +static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos, + LPVOID format, LONG formatsize) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + + TRACE("(%p,%ld,%p,%ld)\n", iface, pos, format, formatsize); + + /* check parameters */ + if (format == NULL || formatsize <= 0) + return AVIERR_BADPARAM; + + /* Input format already known? + * Changing is unsupported, but be quiet if it's the same */ + if (This->lpInFormat != NULL) { + if (This->cbInFormat != formatsize || + memcmp(format, This->lpInFormat, formatsize) != 0) + return AVIERR_UNSUPPORTED; + + return AVIERR_OK; + } + + /* Does the nested stream support writing? */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + This->lpInFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, formatsize); + if (This->lpInFormat == NULL) + return AVIERR_MEMORY; + This->cbInFormat = formatsize; + memcpy(This->lpInFormat, format, formatsize); + + /* initialize formats and get compressor */ + hr = AVIFILE_OpenCompressor(This); + if (FAILED(hr)) + return hr; + + CONVERT_THIS_to_STREAM(&pos); + + /* tell the nested stream the new format */ + return IAVIStream_SetFormat(This->pStream, pos, This->lpOutFormat, + This->cbOutFormat); +} + +static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start, + LONG samples, LPVOID buffer, + LONG buffersize, LPLONG bytesread, + LPLONG samplesread) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + DWORD size; + + TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", iface, start, samples, buffer, + buffersize, bytesread, samplesread); + + /* clear return parameters if given */ + if (bytesread != NULL) + *bytesread = 0; + if (samplesread != NULL) + *samplesread = 0; + + /* Do we have our compressor? */ + if (This->has == NULL) { + hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + /* only need to pass through? */ + if (This->cbInFormat == This->cbOutFormat && + memcmp(This->lpInFormat, This->lpOutFormat, This->cbInFormat) == 0) { + return IAVIStream_Read(This->pStream, start, samples, buffer, buffersize, + bytesread, samplesread); + } + + /* read as much as fit? */ + if (samples == -1) + samples = buffersize / This->lpOutFormat->nBlockAlign; + /* limit to buffersize */ + if (samples * This->lpOutFormat->nBlockAlign > buffersize) + samples = buffersize / This->lpOutFormat->nBlockAlign; + + /* only return needed size? */ + if (buffer == NULL || buffersize <= 0 || samples == 0) { + if (bytesread == NULL && samplesread == NULL) + return AVIERR_BADPARAM; + + if (bytesread != NULL) + *bytesread = samples * This->lpOutFormat->nBlockAlign; + if (samplesread != NULL) + *samplesread = samples; + + return AVIERR_OK; + } + + /* map our positions to pStream positions */ + CONVERT_THIS_to_STREAM(&start); + + /* our needed internal buffersize */ + size = samples * This->lpInFormat->nBlockAlign; + + /* Need to free destination buffer used for writing? */ + if (This->acmStreamHdr.pbDst != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbDst); + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.dwDstUser = 0; + } + + /* need bigger source buffer? */ + if (This->acmStreamHdr.pbSrc == NULL || + This->acmStreamHdr.dwSrcUser < size) { + if (This->acmStreamHdr.pbSrc == NULL) + This->acmStreamHdr.pbSrc = GlobalAllocPtr(GMEM_MOVEABLE, size); + else + This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc, + size, GMEM_MOVEABLE); + if (This->acmStreamHdr.pbSrc == NULL) + return AVIERR_MEMORY; + This->acmStreamHdr.dwSrcUser = size; + } + + This->acmStreamHdr.cbStruct = sizeof(This->acmStreamHdr); + This->acmStreamHdr.cbSrcLengthUsed = 0; + This->acmStreamHdr.cbDstLengthUsed = 0; + This->acmStreamHdr.cbSrcLength = size; + + /* read source data */ + hr = IAVIStream_Read(This->pStream, start, -1, This->acmStreamHdr.pbSrc, + This->acmStreamHdr.cbSrcLength, + (LONG *)&This->acmStreamHdr.cbSrcLength, NULL); + if (FAILED(hr) || This->acmStreamHdr.cbSrcLength == 0) + return hr; + + /* need to prepare stream? */ + This->acmStreamHdr.pbDst = buffer; + This->acmStreamHdr.cbDstLength = buffersize; + if ((This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) == 0) { + if (acmStreamPrepareHeader(This->has, &This->acmStreamHdr, 0) != S_OK) { + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.cbDstLength = 0; + return AVIERR_COMPRESSOR; + } + } + + /* now do the conversion */ + /* FIXME: use ACM_CONVERTF_* flags */ + if (acmStreamConvert(This->has, &This->acmStreamHdr, 0) != S_OK) + hr = AVIERR_COMPRESSOR; + + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.cbDstLength = 0; + + /* fill out return parameters if given */ + if (bytesread != NULL) + *bytesread = This->acmStreamHdr.cbDstLengthUsed; + if (samplesread != NULL) + *samplesread = + This->acmStreamHdr.cbDstLengthUsed / This->lpOutFormat->nBlockAlign; + + return hr; +} + +static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start, + LONG samples, LPVOID buffer, + LONG buffersize, DWORD flags, + LPLONG sampwritten, + LPLONG byteswritten) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + ULONG size; + + TRACE("(%p,%ld,%ld,%p,%ld,0x%08lX,%p,%p)\n", iface, start, samples, + buffer, buffersize, flags, sampwritten, byteswritten); + + /* clear return parameters if given */ + if (sampwritten != NULL) + *sampwritten = 0; + if (byteswritten != NULL) + *byteswritten = 0; + + /* check parameters */ + if (buffer == NULL && (buffersize > 0 || samples > 0)) + return AVIERR_BADPARAM; + + /* Have we write capability? */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + /* also need a compressor */ + if (This->has == NULL) + return AVIERR_NOCOMPRESSOR; + + /* map our sizes to pStream sizes */ + size = buffersize; + CONVERT_THIS_to_STREAM(&size); + CONVERT_THIS_to_STREAM(&start); + + /* no bytes to write? -- short circuit */ + if (size == 0) { + return IAVIStream_Write(This->pStream, -1, samples, buffer, size, + flags, sampwritten, byteswritten); + } + + /* Need to free source buffer used for reading? */ + if (This->acmStreamHdr.pbSrc != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbSrc); + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.dwSrcUser = 0; + } + + /* Need bigger destination buffer? */ + if (This->acmStreamHdr.pbDst == NULL || + This->acmStreamHdr.dwDstUser < size) { + if (This->acmStreamHdr.pbDst == NULL) + This->acmStreamHdr.pbDst = GlobalAllocPtr(GMEM_MOVEABLE, size); + else + This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst, + size, GMEM_MOVEABLE); + if (This->acmStreamHdr.pbDst == NULL) + return AVIERR_MEMORY; + This->acmStreamHdr.dwDstUser = size; + } + This->acmStreamHdr.cbStruct = sizeof(This->acmStreamHdr); + This->acmStreamHdr.cbSrcLengthUsed = 0; + This->acmStreamHdr.cbDstLengthUsed = 0; + This->acmStreamHdr.cbDstLength = This->acmStreamHdr.dwDstUser; + + /* need to prepare stream? */ + This->acmStreamHdr.pbSrc = buffer; + This->acmStreamHdr.cbSrcLength = buffersize; + if ((This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) == 0) { + if (acmStreamPrepareHeader(This->has, &This->acmStreamHdr, 0) != S_OK) { + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.cbSrcLength = 0; + return AVIERR_COMPRESSOR; + } + } + + /* now do the conversion */ + /* FIXME: use ACM_CONVERTF_* flags */ + if (acmStreamConvert(This->has, &This->acmStreamHdr, 0) != S_OK) + hr = AVIERR_COMPRESSOR; + else + hr = AVIERR_OK; + + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.cbSrcLength = 0; + + if (FAILED(hr)) + return hr; + + return IAVIStream_Write(This->pStream,-1,This->acmStreamHdr.cbDstLengthUsed / + This->lpOutFormat->nBlockAlign,This->acmStreamHdr.pbDst, + This->acmStreamHdr.cbDstLengthUsed,flags,sampwritten, + byteswritten); +} + +static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start, + LONG samples) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,%ld)\n", iface, start, samples); + + /* check parameters */ + if (start < 0 || samples < 0) + return AVIERR_BADPARAM; + + /* Delete before start of stream? */ + if ((DWORD)(start + samples) < This->sInfo.dwStart) + return AVIERR_OK; + + /* Delete after end of stream? */ + if ((DWORD)start > This->sInfo.dwLength) + return AVIERR_OK; + + /* For the rest we need write capability */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + /* A compressor is also necessary */ + if (This->has == NULL) + return AVIERR_NOCOMPRESSOR; + + /* map our positions to pStream positions */ + CONVERT_THIS_to_STREAM(&start); + CONVERT_THIS_to_STREAM(&samples); + + return IAVIStream_Delete(This->pStream, start, samples); +} + +static HRESULT WINAPI ACMStream_fnReadData(IAVIStream *iface, DWORD fcc, + LPVOID lp, LPLONG lpread) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lX,%p,%p)\n", iface, fcc, lp, lpread); + + assert(This->pStream != NULL); + + return IAVIStream_ReadData(This->pStream, fcc, lp, lpread); +} + +static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream *iface, DWORD fcc, + LPVOID lp, LONG size) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lx,%p,%ld)\n", iface, fcc, lp, size); + + assert(This->pStream != NULL); + + return IAVIStream_WriteData(This->pStream, fcc, lp, size); +} + +static HRESULT WINAPI ACMStream_fnSetInfo(IAVIStream *iface, + LPAVISTREAMINFOW info, LONG infolen) +{ + FIXME("(%p,%p,%ld): stub\n", iface, info, infolen); + + return E_FAIL; +} + +/********************************************************************** */ + +static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This) +{ + HRESULT hr; + + /* pre-conditions */ + assert(This != NULL); + assert(This->pStream != NULL); + + if (This->has != NULL) + return AVIERR_OK; + + if (This->lpInFormat == NULL) { + /* decode or encode the data from pStream */ + hr = AVIStreamFormatSize(This->pStream, This->sInfo.dwStart, &This->cbInFormat); + if (FAILED(hr)) + return hr; + This->lpInFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, This->cbInFormat); + if (This->lpInFormat == NULL) + return AVIERR_MEMORY; + + hr = IAVIStream_ReadFormat(This->pStream, This->sInfo.dwStart, + This->lpInFormat, &This->cbInFormat); + if (FAILED(hr)) + return hr; + + if (This->lpOutFormat == NULL) { + /* we must decode to default format */ + This->cbOutFormat = sizeof(PCMWAVEFORMAT); + This->lpOutFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GHND, This->cbOutFormat); + if (This->lpOutFormat == NULL) + return AVIERR_MEMORY; + + This->lpOutFormat->wFormatTag = WAVE_FORMAT_PCM; + if (acmFormatSuggest(NULL, This->lpInFormat, This->lpOutFormat, + This->cbOutFormat, ACM_FORMATSUGGESTF_WFORMATTAG) != S_OK) + return AVIERR_NOCOMPRESSOR; + } + } else if (This->lpOutFormat == NULL) + return AVIERR_ERROR; /* To what should I encode? */ + + if (acmStreamOpen(&This->has, NULL, This->lpInFormat, This->lpOutFormat, + NULL, 0, 0, ACM_STREAMOPENF_NONREALTIME) != S_OK) + return AVIERR_NOCOMPRESSOR; + + /* update AVISTREAMINFO structure */ + This->sInfo.dwSampleSize = This->lpOutFormat->nBlockAlign; + This->sInfo.dwScale = This->lpOutFormat->nBlockAlign; + This->sInfo.dwRate = This->lpOutFormat->nAvgBytesPerSec; + This->sInfo.dwQuality = (DWORD)ICQUALITY_DEFAULT; + SetRectEmpty(&This->sInfo.rcFrame); + + /* convert positions ansd sizes to output format */ + CONVERT_STREAM_to_THIS(&This->sInfo.dwStart); + CONVERT_STREAM_to_THIS(&This->sInfo.dwLength); + CONVERT_STREAM_to_THIS(&This->sInfo.dwSuggestedBufferSize); + + return AVIERR_OK; +} _____ Added: vendor/wine/dlls/avifil32/Wine-0_9_1/api.c --- vendor/wine/dlls/avifil32/Wine-0_9_1/api.c 2005-11-21 09:35:23 UTC (rev 19401) +++ vendor/wine/dlls/avifil32/Wine-0_9_1/api.c 2005-11-21 09:38:25 UTC (rev 19402) @@ -0,0 +1,2338 @@ +/* + * Copyright 1999 Marcus Meissner + * Copyright 2002-2003 Michael G³nnewig + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <assert.h> +#include <stdarg.h> + +#define COBJMACROS +#define COM_NO_WINDOWS_H + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winerror.h" +#include "windowsx.h" + +#include "ole2.h" +#include "shellapi.h" +#include "shlobj.h" +#include "vfw.h" +#include "msacm.h" + +#include "avifile_private.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(avifile); + + +/********************************************************************** * + * for AVIBuildFilterW -- uses fixed size table + */ +#define MAX_FILTERS 30 /* 30 => 7kB */ + +typedef struct _AVIFilter { + WCHAR szClsid[40]; + WCHAR szExtensions[MAX_FILTERS * 7]; +} AVIFilter; + +/********************************************************************** * + * for AVISaveOptions + */ +static struct { + UINT uFlags; + INT nStreams; + PAVISTREAM *ppavis; + LPAVICOMPRESSOPTIONS *ppOptions; + INT nCurrent; +} SaveOpts; + +/********************************************************************** * + * copied from dlls/ole32/compobj.c + */ +static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id) +{ + BYTE const *s; + BYTE *p; + INT i; + BYTE table[256]; + + if (!idstr) { + memset(id, 0, sizeof(CLSID)); + return S_OK; + } + + /* validate the CLSID string */ + if (lstrlenA(idstr) != 38) + return CO_E_CLASSSTRING; + + s = (BYTE const*)idstr; + if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || + (s[24]!='-') || (s[37]!='}')) + return CO_E_CLASSSTRING; + + for (i = 1; i < 37; i++) { + if ((i == 9) || (i == 14) || (i == 19) || (i == 24)) + continue; + if (!(((s[i] >= '0') && (s[i] <= '9')) || + ((s[i] >= 'a') && (s[i] <= 'f')) || + ((s[i] >= 'A') && (s[i] <= 'F'))) + ) + return CO_E_CLASSSTRING; + } + + TRACE("%s -> %p\n", s, id); + + /* quick lookup table */ + memset(table, 0, 256); + + for (i = 0; i < 10; i++) + table['0' + i] = i; + + for (i = 0; i < 6; i++) { + table['A' + i] = i+10; + table['a' + i] = i+10; + } + + /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ + p = (BYTE *) id; + + s++; /* skip leading brace */ + for (i = 0; i < 4; i++) { + p[3 - i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 4; + s++; /* skip - */ + + for (i = 0; i < 2; i++) { + p[1-i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 2; + s++; /* skip - */ + + for (i = 0; i < 2; i++) { + p[1-i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 2; + s++; /* skip - */ + + /* these are just sequential bytes */ + for (i = 0; i < 2; i++) { + *p++ = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + s++; /* skip - */ + + for (i = 0; i < 6; i++) { + *p++ = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + + return S_OK; +} + +static BOOL AVIFILE_GetFileHandlerByExtension(LPCWSTR szFile, LPCLSID lpclsid) +{ + CHAR szRegKey[25]; + CHAR szValue[100]; + LPWSTR szExt = strrchrW(szFile, '.'); + LONG len = sizeof(szValue) / sizeof(szValue[0]); + + if (szExt == NULL) + return FALSE; + + szExt++; + + wsprintfA(szRegKey, "AVIFile\\Extensions\\%.3ls", szExt); + if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &len) != ERROR_SUCCESS) + return FALSE; + + return (AVIFILE_CLSIDFromString(szValue, lpclsid) == S_OK); +} + +/********************************************************************** * + * AVIFileInit (AVIFIL32.@) + * AVIFileInit (AVIFILE.100) + */ +void WINAPI AVIFileInit(void) { + OleInitialize(NULL); +} + +/********************************************************************** * + * AVIFileExit (AVIFIL32.@) + * AVIFileExit (AVIFILE.101) + */ +void WINAPI AVIFileExit(void) { + /* need to free ole32.dll if we are the last exit call */ + /* OleUnitialize() */ + FIXME("(): stub!\n"); +} + +/********************************************************************** * + * AVIFileOpen (AVIFIL32.@) + * AVIFileOpenA (AVIFIL32.@) + * AVIFileOpen (AVIFILE.102) + */ +HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, + LPCLSID lpHandler) [truncated at 1000 lines; 11168 more skipped]
19 years, 1 month
1
0
0
0
[cwittich] 19401: WINE 0.9.1 vendor drop
by cwittich@svn.reactos.com
WINE 0.9.1 vendor drop Added: vendor/wine/dlls/avifil32/ Added: vendor/wine/dlls/avifil32/current/ Added: vendor/wine/dlls/avifil32/current/.cvsignore Added: vendor/wine/dlls/avifil32/current/Makefile.in Added: vendor/wine/dlls/avifil32/current/acmstream.c Added: vendor/wine/dlls/avifil32/current/api.c Added: vendor/wine/dlls/avifil32/current/avifil32.spec Added: vendor/wine/dlls/avifil32/current/avifile.c Added: vendor/wine/dlls/avifil32/current/avifile.spec Added: vendor/wine/dlls/avifil32/current/avifile_Cs.rc Added: vendor/wine/dlls/avifil32/current/avifile_De.rc Added: vendor/wine/dlls/avifil32/current/avifile_En.rc Added: vendor/wine/dlls/avifil32/current/avifile_Es.rc Added: vendor/wine/dlls/avifil32/current/avifile_Fr.rc Added: vendor/wine/dlls/avifil32/current/avifile_It.rc Added: vendor/wine/dlls/avifil32/current/avifile_Ja.rc Added: vendor/wine/dlls/avifil32/current/avifile_Nl.rc Added: vendor/wine/dlls/avifil32/current/avifile_No.rc Added: vendor/wine/dlls/avifil32/current/avifile_Pl.rc Added: vendor/wine/dlls/avifil32/current/avifile_Pt.rc Added: vendor/wine/dlls/avifil32/current/avifile_Ru.rc Added: vendor/wine/dlls/avifil32/current/avifile_Si.rc Added: vendor/wine/dlls/avifil32/current/avifile_private.h Added: vendor/wine/dlls/avifil32/current/editstream.c Added: vendor/wine/dlls/avifil32/current/extrachunk.c Added: vendor/wine/dlls/avifil32/current/extrachunk.h Added: vendor/wine/dlls/avifil32/current/factory.c Added: vendor/wine/dlls/avifil32/current/getframe.c Added: vendor/wine/dlls/avifil32/current/icmstream.c Added: vendor/wine/dlls/avifil32/current/regsvr.c Added: vendor/wine/dlls/avifil32/current/rsrc.rc Added: vendor/wine/dlls/avifil32/current/tmpfile.c Added: vendor/wine/dlls/avifil32/current/wavfile.c _____ Added: vendor/wine/dlls/avifil32/current/.cvsignore --- vendor/wine/dlls/avifil32/current/.cvsignore 2005-11-21 01:16:29 UTC (rev 19400) +++ vendor/wine/dlls/avifil32/current/.cvsignore 2005-11-21 09:35:23 UTC (rev 19401) @@ -0,0 +1,3 @@ +Makefile +libavifil32.def +rsrc.res _____ Added: vendor/wine/dlls/avifil32/current/Makefile.in --- vendor/wine/dlls/avifil32/current/Makefile.in 2005-11-21 01:16:29 UTC (rev 19400) +++ vendor/wine/dlls/avifil32/current/Makefile.in 2005-11-21 09:35:23 UTC (rev 19401) @@ -0,0 +1,30 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = avifil32.dll +IMPORTLIB = libavifil32.$(IMPLIBEXT) +IMPORTS = msacm32 msvfw32 winmm ole32 user32 advapi32 kernel32 ntdll +EXTRALIBS = -luuid + +C_SRCS = \ + acmstream.c \ + api.c \ + avifile.c \ + editstream.c \ + extrachunk.c \ + factory.c \ + getframe.c \ + icmstream.c \ + regsvr.c \ + tmpfile.c \ + wavfile.c + +SPEC_SRCS16 = avifile.spec + +RC_SRCS = \ + rsrc.rc + +@MAKE_DLL_RULES@ + +### Dependencies: _____ Added: vendor/wine/dlls/avifil32/current/acmstream.c --- vendor/wine/dlls/avifil32/current/acmstream.c 2005-11-21 01:16:29 UTC (rev 19400) +++ vendor/wine/dlls/avifil32/current/acmstream.c 2005-11-21 09:35:23 UTC (rev 19401) @@ -0,0 +1,747 @@ +/* + * Copyright 2002 Michael G³nnewig + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define COM_NO_WINDOWS_H +#include <assert.h> +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winerror.h" +#include "windowsx.h" +#include "mmsystem.h" +#include "vfw.h" +#include "msacm.h" + +#include "avifile_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(avifile); + +/********************************************************************** */ + +static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj); +static ULONG WINAPI ACMStream_fnAddRef(IAVIStream*iface); +static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface); +static HRESULT WINAPI ACMStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2); +static HRESULT WINAPI ACMStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size); +static LONG WINAPI ACMStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags); +static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize); +static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize); +static HRESULT WINAPI ACMStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread); +static HRESULT WINAPI ACMStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten); +static HRESULT WINAPI ACMStream_fnDelete(IAVIStream*iface,LONG start,LONG samples); +static HRESULT WINAPI ACMStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread); +static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size); +static HRESULT WINAPI ACMStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen); + +static const struct IAVIStreamVtbl iacmst = { + ACMStream_fnQueryInterface, + ACMStream_fnAddRef, + ACMStream_fnRelease, + ACMStream_fnCreate, + ACMStream_fnInfo, + ACMStream_fnFindSample, + ACMStream_fnReadFormat, + ACMStream_fnSetFormat, + ACMStream_fnRead, + ACMStream_fnWrite, + ACMStream_fnDelete, + ACMStream_fnReadData, + ACMStream_fnWriteData, + ACMStream_fnSetInfo +}; + +typedef struct _IAVIStreamImpl { + /* IUnknown stuff */ + const IAVIStreamVtbl *lpVtbl; + LONG ref; + + /* IAVIStream stuff */ + PAVISTREAM pStream; + AVISTREAMINFOW sInfo; + + HACMSTREAM has; + + LPWAVEFORMATEX lpInFormat; + LONG cbInFormat; + + LPWAVEFORMATEX lpOutFormat; + LONG cbOutFormat; + + ACMSTREAMHEADER acmStreamHdr; +} IAVIStreamImpl; + +/********************************************************************** */ + +#define CONVERT_STREAM_to_THIS(a) do { \ + DWORD __bytes; \ + acmStreamSize(This->has,*(a) * This->lpInFormat->nBlockAlign,\ + &__bytes, ACM_STREAMSIZEF_SOURCE); \ + *(a) = __bytes / This->lpOutFormat->nBlockAlign; } while(0) + +#define CONVERT_THIS_to_STREAM(a) do { \ + DWORD __bytes; \ + acmStreamSize(This->has,*(a) * This->lpOutFormat->nBlockAlign,\ + &__bytes, ACM_STREAMSIZEF_DESTINATION); \ + *(a) = __bytes / This->lpInFormat->nBlockAlign; } while(0) + +static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This); + +HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv) +{ + IAVIStreamImpl *pstream; + HRESULT hr; + + assert(riid != NULL && ppv != NULL); + + *ppv = NULL; + + pstream = (IAVIStreamImpl*)LocalAlloc(LPTR, sizeof(IAVIStreamImpl)); + if (pstream == NULL) + return AVIERR_MEMORY; + + pstream->lpVtbl = &iacmst; + + hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv); + if (FAILED(hr)) + LocalFree((HLOCAL)pstream); + + return hr; +} + +static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream *iface, + REFIID refiid, LPVOID *obj) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj); + + if (IsEqualGUID(&IID_IUnknown, refiid) || + IsEqualGUID(&IID_IAVIStream, refiid)) { + *obj = This; + IAVIStream_AddRef(iface); + + return S_OK; + } + + return OLE_E_ENUM_NOMORE; +} + +static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) -> %ld\n", iface, ref); + + /* also add reference to the nested stream */ + if (This->pStream != NULL) + IAVIStream_AddRef(This->pStream); + + return ref; +} + +static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) -> %ld\n", iface, ref); + + if (ref == 0) { + /* destruct */ + if (This->has != NULL) { + if (This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) + acmStreamUnprepareHeader(This->has, &This->acmStreamHdr, 0); + acmStreamClose(This->has, 0); + This->has = NULL; + } + if (This->acmStreamHdr.pbSrc != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbSrc); + This->acmStreamHdr.pbSrc = NULL; + } + if (This->acmStreamHdr.pbDst != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbDst); + This->acmStreamHdr.pbDst = NULL; + } + if (This->lpInFormat != NULL) { + GlobalFreePtr(This->lpInFormat); + This->lpInFormat = NULL; + This->cbInFormat = 0; + } + if (This->lpOutFormat != NULL) { + GlobalFreePtr(This->lpOutFormat); + This->lpOutFormat = NULL; + This->cbOutFormat = 0; + } + if (This->pStream != NULL) { + IAVIStream_Release(This->pStream); + This->pStream = NULL; + } + LocalFree((HLOCAL)This); + + return 0; + } + + /* also release reference to the nested stream */ + if (This->pStream != NULL) + IAVIStream_Release(This->pStream); + + return ref; +} + +/* lParam1: PAVISTREAM + * lParam2: LPAVICOMPRESSOPTIONS -- even if doc's say LPWAVEFORMAT + */ +static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1, + LPARAM lParam2) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2); + + /* check for swapped parameters */ + if ((LPVOID)lParam1 != NULL && + ((LPAVICOMPRESSOPTIONS)lParam1)->fccType == streamtypeAUDIO) { + register LPARAM tmp = lParam1; + + lParam1 = lParam2; + lParam2 = tmp; + } + + if ((LPVOID)lParam1 == NULL) + return AVIERR_BADPARAM; + + IAVIStream_Info((PAVISTREAM)lParam1, &This->sInfo, sizeof(This->sInfo)); + if (This->sInfo.fccType != streamtypeAUDIO) + return AVIERR_ERROR; /* error in registry or AVIMakeCompressedStream */ + + This->sInfo.fccHandler = 0; /* be paranoid */ + + /* FIXME: check ACM version? Which version does we need? */ + + if ((LPVOID)lParam2 != NULL) { + /* We only need the format from the compress-options */ + if (((LPAVICOMPRESSOPTIONS)lParam2)->fccType == streamtypeAUDIO) + lParam2 = (LPARAM)((LPAVICOMPRESSOPTIONS)lParam2)->lpFormat; + + if (((LPWAVEFORMATEX)lParam2)->wFormatTag != WAVE_FORMAT_PCM) + This->cbOutFormat = sizeof(WAVEFORMATEX) + ((LPWAVEFORMATEX)lParam2)->cbSize; + else + This->cbOutFormat = sizeof(PCMWAVEFORMAT); + + This->lpOutFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GHND, This->cbOutFormat); + if (This->lpOutFormat == NULL) + return AVIERR_MEMORY; + + memcpy(This->lpOutFormat, (LPVOID)lParam2, This->cbOutFormat); + } else { + This->lpOutFormat = NULL; + This->cbOutFormat = 0; + } + + This->pStream = (PAVISTREAM)lParam1; + IAVIStream_AddRef(This->pStream); + + return AVIERR_OK; +} + +static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, + LONG size) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%p,%ld)\n", iface, psi, size); + + if (psi == NULL) + return AVIERR_BADPARAM; + if (size < 0) + return AVIERR_BADSIZE; + + /* Need codec to correct some values in structure */ + if (This->has == NULL) { + HRESULT hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + memcpy(psi, &This->sInfo, min(size, (LONG)sizeof(This->sInfo))); + + if (size < (LONG)sizeof(This->sInfo)) + return AVIERR_BUFFERTOOSMALL; + return AVIERR_OK; +} + +static LONG WINAPI ACMStream_fnFindSample(IAVIStream *iface, LONG pos, + LONG flags) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,0x%08lX)\n",iface,pos,flags); + + if (flags & FIND_FROM_START) { + pos = This->sInfo.dwStart; + flags &= ~(FIND_FROM_START|FIND_PREV); + flags |= FIND_NEXT; + } + + /* convert pos from our 'space' to This->pStream's one */ + CONVERT_THIS_to_STREAM(&pos); + + /* ask stream */ + pos = IAVIStream_FindSample(This->pStream, pos, flags); + + if (pos != -1) { + /* convert pos back to our 'space' if it's no size or physical pos */ + if ((flags & FIND_RET) == 0) + CONVERT_STREAM_to_THIS(&pos); + } + + return pos; +} + +static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream *iface, LONG pos, + LPVOID format, LONG *formatsize) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,%p,%p)\n", iface, pos, format, formatsize); + + if (formatsize == NULL) + return AVIERR_BADPARAM; + + if (This->has == NULL) { + HRESULT hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + /* only interested in needed buffersize? */ + if (format == NULL || *formatsize <= 0) { + *formatsize = This->cbOutFormat; + + return AVIERR_OK; + } + + /* copy initial format (only as much as will fit) */ + memcpy(format, This->lpOutFormat, min(*formatsize, This->cbOutFormat)); + if (*formatsize < This->cbOutFormat) { + *formatsize = This->cbOutFormat; + return AVIERR_BUFFERTOOSMALL; + } + + *formatsize = This->cbOutFormat; + return AVIERR_OK; +} + +static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos, + LPVOID format, LONG formatsize) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + + TRACE("(%p,%ld,%p,%ld)\n", iface, pos, format, formatsize); + + /* check parameters */ + if (format == NULL || formatsize <= 0) + return AVIERR_BADPARAM; + + /* Input format already known? + * Changing is unsupported, but be quiet if it's the same */ + if (This->lpInFormat != NULL) { + if (This->cbInFormat != formatsize || + memcmp(format, This->lpInFormat, formatsize) != 0) + return AVIERR_UNSUPPORTED; + + return AVIERR_OK; + } + + /* Does the nested stream support writing? */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + This->lpInFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, formatsize); + if (This->lpInFormat == NULL) + return AVIERR_MEMORY; + This->cbInFormat = formatsize; + memcpy(This->lpInFormat, format, formatsize); + + /* initialize formats and get compressor */ + hr = AVIFILE_OpenCompressor(This); + if (FAILED(hr)) + return hr; + + CONVERT_THIS_to_STREAM(&pos); + + /* tell the nested stream the new format */ + return IAVIStream_SetFormat(This->pStream, pos, This->lpOutFormat, + This->cbOutFormat); +} + +static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start, + LONG samples, LPVOID buffer, + LONG buffersize, LPLONG bytesread, + LPLONG samplesread) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + DWORD size; + + TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", iface, start, samples, buffer, + buffersize, bytesread, samplesread); + + /* clear return parameters if given */ + if (bytesread != NULL) + *bytesread = 0; + if (samplesread != NULL) + *samplesread = 0; + + /* Do we have our compressor? */ + if (This->has == NULL) { + hr = AVIFILE_OpenCompressor(This); + + if (FAILED(hr)) + return hr; + } + + /* only need to pass through? */ + if (This->cbInFormat == This->cbOutFormat && + memcmp(This->lpInFormat, This->lpOutFormat, This->cbInFormat) == 0) { + return IAVIStream_Read(This->pStream, start, samples, buffer, buffersize, + bytesread, samplesread); + } + + /* read as much as fit? */ + if (samples == -1) + samples = buffersize / This->lpOutFormat->nBlockAlign; + /* limit to buffersize */ + if (samples * This->lpOutFormat->nBlockAlign > buffersize) + samples = buffersize / This->lpOutFormat->nBlockAlign; + + /* only return needed size? */ + if (buffer == NULL || buffersize <= 0 || samples == 0) { + if (bytesread == NULL && samplesread == NULL) + return AVIERR_BADPARAM; + + if (bytesread != NULL) + *bytesread = samples * This->lpOutFormat->nBlockAlign; + if (samplesread != NULL) + *samplesread = samples; + + return AVIERR_OK; + } + + /* map our positions to pStream positions */ + CONVERT_THIS_to_STREAM(&start); + + /* our needed internal buffersize */ + size = samples * This->lpInFormat->nBlockAlign; + + /* Need to free destination buffer used for writing? */ + if (This->acmStreamHdr.pbDst != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbDst); + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.dwDstUser = 0; + } + + /* need bigger source buffer? */ + if (This->acmStreamHdr.pbSrc == NULL || + This->acmStreamHdr.dwSrcUser < size) { + if (This->acmStreamHdr.pbSrc == NULL) + This->acmStreamHdr.pbSrc = GlobalAllocPtr(GMEM_MOVEABLE, size); + else + This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc, + size, GMEM_MOVEABLE); + if (This->acmStreamHdr.pbSrc == NULL) + return AVIERR_MEMORY; + This->acmStreamHdr.dwSrcUser = size; + } + + This->acmStreamHdr.cbStruct = sizeof(This->acmStreamHdr); + This->acmStreamHdr.cbSrcLengthUsed = 0; + This->acmStreamHdr.cbDstLengthUsed = 0; + This->acmStreamHdr.cbSrcLength = size; + + /* read source data */ + hr = IAVIStream_Read(This->pStream, start, -1, This->acmStreamHdr.pbSrc, + This->acmStreamHdr.cbSrcLength, + (LONG *)&This->acmStreamHdr.cbSrcLength, NULL); + if (FAILED(hr) || This->acmStreamHdr.cbSrcLength == 0) + return hr; + + /* need to prepare stream? */ + This->acmStreamHdr.pbDst = buffer; + This->acmStreamHdr.cbDstLength = buffersize; + if ((This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) == 0) { + if (acmStreamPrepareHeader(This->has, &This->acmStreamHdr, 0) != S_OK) { + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.cbDstLength = 0; + return AVIERR_COMPRESSOR; + } + } + + /* now do the conversion */ + /* FIXME: use ACM_CONVERTF_* flags */ + if (acmStreamConvert(This->has, &This->acmStreamHdr, 0) != S_OK) + hr = AVIERR_COMPRESSOR; + + This->acmStreamHdr.pbDst = NULL; + This->acmStreamHdr.cbDstLength = 0; + + /* fill out return parameters if given */ + if (bytesread != NULL) + *bytesread = This->acmStreamHdr.cbDstLengthUsed; + if (samplesread != NULL) + *samplesread = + This->acmStreamHdr.cbDstLengthUsed / This->lpOutFormat->nBlockAlign; + + return hr; +} + +static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start, + LONG samples, LPVOID buffer, + LONG buffersize, DWORD flags, + LPLONG sampwritten, + LPLONG byteswritten) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + HRESULT hr; + ULONG size; + + TRACE("(%p,%ld,%ld,%p,%ld,0x%08lX,%p,%p)\n", iface, start, samples, + buffer, buffersize, flags, sampwritten, byteswritten); + + /* clear return parameters if given */ + if (sampwritten != NULL) + *sampwritten = 0; + if (byteswritten != NULL) + *byteswritten = 0; + + /* check parameters */ + if (buffer == NULL && (buffersize > 0 || samples > 0)) + return AVIERR_BADPARAM; + + /* Have we write capability? */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + /* also need a compressor */ + if (This->has == NULL) + return AVIERR_NOCOMPRESSOR; + + /* map our sizes to pStream sizes */ + size = buffersize; + CONVERT_THIS_to_STREAM(&size); + CONVERT_THIS_to_STREAM(&start); + + /* no bytes to write? -- short circuit */ + if (size == 0) { + return IAVIStream_Write(This->pStream, -1, samples, buffer, size, + flags, sampwritten, byteswritten); + } + + /* Need to free source buffer used for reading? */ + if (This->acmStreamHdr.pbSrc != NULL) { + GlobalFreePtr(This->acmStreamHdr.pbSrc); + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.dwSrcUser = 0; + } + + /* Need bigger destination buffer? */ + if (This->acmStreamHdr.pbDst == NULL || + This->acmStreamHdr.dwDstUser < size) { + if (This->acmStreamHdr.pbDst == NULL) + This->acmStreamHdr.pbDst = GlobalAllocPtr(GMEM_MOVEABLE, size); + else + This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst, + size, GMEM_MOVEABLE); + if (This->acmStreamHdr.pbDst == NULL) + return AVIERR_MEMORY; + This->acmStreamHdr.dwDstUser = size; + } + This->acmStreamHdr.cbStruct = sizeof(This->acmStreamHdr); + This->acmStreamHdr.cbSrcLengthUsed = 0; + This->acmStreamHdr.cbDstLengthUsed = 0; + This->acmStreamHdr.cbDstLength = This->acmStreamHdr.dwDstUser; + + /* need to prepare stream? */ + This->acmStreamHdr.pbSrc = buffer; + This->acmStreamHdr.cbSrcLength = buffersize; + if ((This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED) == 0) { + if (acmStreamPrepareHeader(This->has, &This->acmStreamHdr, 0) != S_OK) { + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.cbSrcLength = 0; + return AVIERR_COMPRESSOR; + } + } + + /* now do the conversion */ + /* FIXME: use ACM_CONVERTF_* flags */ + if (acmStreamConvert(This->has, &This->acmStreamHdr, 0) != S_OK) + hr = AVIERR_COMPRESSOR; + else + hr = AVIERR_OK; + + This->acmStreamHdr.pbSrc = NULL; + This->acmStreamHdr.cbSrcLength = 0; + + if (FAILED(hr)) + return hr; + + return IAVIStream_Write(This->pStream,-1,This->acmStreamHdr.cbDstLengthUsed / + This->lpOutFormat->nBlockAlign,This->acmStreamHdr.pbDst, + This->acmStreamHdr.cbDstLengthUsed,flags,sampwritten, + byteswritten); +} + +static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start, + LONG samples) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,%ld,%ld)\n", iface, start, samples); + + /* check parameters */ + if (start < 0 || samples < 0) + return AVIERR_BADPARAM; + + /* Delete before start of stream? */ + if ((DWORD)(start + samples) < This->sInfo.dwStart) + return AVIERR_OK; + + /* Delete after end of stream? */ + if ((DWORD)start > This->sInfo.dwLength) + return AVIERR_OK; + + /* For the rest we need write capability */ + if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) + return AVIERR_READONLY; + + /* A compressor is also necessary */ + if (This->has == NULL) + return AVIERR_NOCOMPRESSOR; + + /* map our positions to pStream positions */ + CONVERT_THIS_to_STREAM(&start); + CONVERT_THIS_to_STREAM(&samples); + + return IAVIStream_Delete(This->pStream, start, samples); +} + +static HRESULT WINAPI ACMStream_fnReadData(IAVIStream *iface, DWORD fcc, + LPVOID lp, LPLONG lpread) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lX,%p,%p)\n", iface, fcc, lp, lpread); + + assert(This->pStream != NULL); + + return IAVIStream_ReadData(This->pStream, fcc, lp, lpread); +} + +static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream *iface, DWORD fcc, + LPVOID lp, LONG size) +{ + IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + + TRACE("(%p,0x%08lx,%p,%ld)\n", iface, fcc, lp, size); + + assert(This->pStream != NULL); + + return IAVIStream_WriteData(This->pStream, fcc, lp, size); +} + +static HRESULT WINAPI ACMStream_fnSetInfo(IAVIStream *iface, + LPAVISTREAMINFOW info, LONG infolen) +{ + FIXME("(%p,%p,%ld): stub\n", iface, info, infolen); + + return E_FAIL; +} + +/********************************************************************** */ + +static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This) +{ + HRESULT hr; + + /* pre-conditions */ + assert(This != NULL); + assert(This->pStream != NULL); + + if (This->has != NULL) + return AVIERR_OK; + + if (This->lpInFormat == NULL) { + /* decode or encode the data from pStream */ + hr = AVIStreamFormatSize(This->pStream, This->sInfo.dwStart, &This->cbInFormat); + if (FAILED(hr)) + return hr; + This->lpInFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, This->cbInFormat); + if (This->lpInFormat == NULL) + return AVIERR_MEMORY; + + hr = IAVIStream_ReadFormat(This->pStream, This->sInfo.dwStart, + This->lpInFormat, &This->cbInFormat); + if (FAILED(hr)) + return hr; + + if (This->lpOutFormat == NULL) { + /* we must decode to default format */ + This->cbOutFormat = sizeof(PCMWAVEFORMAT); + This->lpOutFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GHND, This->cbOutFormat); + if (This->lpOutFormat == NULL) + return AVIERR_MEMORY; + + This->lpOutFormat->wFormatTag = WAVE_FORMAT_PCM; + if (acmFormatSuggest(NULL, This->lpInFormat, This->lpOutFormat, + This->cbOutFormat, ACM_FORMATSUGGESTF_WFORMATTAG) != S_OK) + return AVIERR_NOCOMPRESSOR; + } + } else if (This->lpOutFormat == NULL) + return AVIERR_ERROR; /* To what should I encode? */ + + if (acmStreamOpen(&This->has, NULL, This->lpInFormat, This->lpOutFormat, + NULL, 0, 0, ACM_STREAMOPENF_NONREALTIME) != S_OK) + return AVIERR_NOCOMPRESSOR; + + /* update AVISTREAMINFO structure */ + This->sInfo.dwSampleSize = This->lpOutFormat->nBlockAlign; + This->sInfo.dwScale = This->lpOutFormat->nBlockAlign; + This->sInfo.dwRate = This->lpOutFormat->nAvgBytesPerSec; + This->sInfo.dwQuality = (DWORD)ICQUALITY_DEFAULT; + SetRectEmpty(&This->sInfo.rcFrame); + + /* convert positions ansd sizes to output format */ + CONVERT_STREAM_to_THIS(&This->sInfo.dwStart); + CONVERT_STREAM_to_THIS(&This->sInfo.dwLength); + CONVERT_STREAM_to_THIS(&This->sInfo.dwSuggestedBufferSize); + + return AVIERR_OK; +} _____ Added: vendor/wine/dlls/avifil32/current/api.c --- vendor/wine/dlls/avifil32/current/api.c 2005-11-21 01:16:29 UTC (rev 19400) +++ vendor/wine/dlls/avifil32/current/api.c 2005-11-21 09:35:23 UTC (rev 19401) @@ -0,0 +1,2338 @@ +/* + * Copyright 1999 Marcus Meissner + * Copyright 2002-2003 Michael G³nnewig + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <assert.h> +#include <stdarg.h> + +#define COBJMACROS +#define COM_NO_WINDOWS_H + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winerror.h" +#include "windowsx.h" + +#include "ole2.h" +#include "shellapi.h" +#include "shlobj.h" +#include "vfw.h" +#include "msacm.h" + +#include "avifile_private.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(avifile); + + +/********************************************************************** * + * for AVIBuildFilterW -- uses fixed size table + */ +#define MAX_FILTERS 30 /* 30 => 7kB */ + +typedef struct _AVIFilter { + WCHAR szClsid[40]; + WCHAR szExtensions[MAX_FILTERS * 7]; +} AVIFilter; + +/********************************************************************** * + * for AVISaveOptions + */ +static struct { + UINT uFlags; + INT nStreams; + PAVISTREAM *ppavis; + LPAVICOMPRESSOPTIONS *ppOptions; + INT nCurrent; +} SaveOpts; + +/********************************************************************** * + * copied from dlls/ole32/compobj.c + */ +static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id) +{ + BYTE const *s; + BYTE *p; + INT i; + BYTE table[256]; + + if (!idstr) { + memset(id, 0, sizeof(CLSID)); + return S_OK; + } + + /* validate the CLSID string */ + if (lstrlenA(idstr) != 38) + return CO_E_CLASSSTRING; + + s = (BYTE const*)idstr; + if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || + (s[24]!='-') || (s[37]!='}')) + return CO_E_CLASSSTRING; + + for (i = 1; i < 37; i++) { + if ((i == 9) || (i == 14) || (i == 19) || (i == 24)) + continue; + if (!(((s[i] >= '0') && (s[i] <= '9')) || + ((s[i] >= 'a') && (s[i] <= 'f')) || + ((s[i] >= 'A') && (s[i] <= 'F'))) + ) + return CO_E_CLASSSTRING; + } + + TRACE("%s -> %p\n", s, id); + + /* quick lookup table */ + memset(table, 0, 256); + + for (i = 0; i < 10; i++) + table['0' + i] = i; + + for (i = 0; i < 6; i++) { + table['A' + i] = i+10; + table['a' + i] = i+10; + } + + /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ + p = (BYTE *) id; + + s++; /* skip leading brace */ + for (i = 0; i < 4; i++) { + p[3 - i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 4; + s++; /* skip - */ + + for (i = 0; i < 2; i++) { + p[1-i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 2; + s++; /* skip - */ + + for (i = 0; i < 2; i++) { + p[1-i] = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + p += 2; + s++; /* skip - */ + + /* these are just sequential bytes */ + for (i = 0; i < 2; i++) { + *p++ = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + s++; /* skip - */ + + for (i = 0; i < 6; i++) { + *p++ = table[*s]<<4 | table[*(s+1)]; + s += 2; + } + + return S_OK; +} + +static BOOL AVIFILE_GetFileHandlerByExtension(LPCWSTR szFile, LPCLSID lpclsid) +{ + CHAR szRegKey[25]; + CHAR szValue[100]; + LPWSTR szExt = strrchrW(szFile, '.'); + LONG len = sizeof(szValue) / sizeof(szValue[0]); + + if (szExt == NULL) + return FALSE; + + szExt++; + + wsprintfA(szRegKey, "AVIFile\\Extensions\\%.3ls", szExt); + if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &len) != ERROR_SUCCESS) + return FALSE; + + return (AVIFILE_CLSIDFromString(szValue, lpclsid) == S_OK); +} + +/********************************************************************** * + * AVIFileInit (AVIFIL32.@) + * AVIFileInit (AVIFILE.100) + */ +void WINAPI AVIFileInit(void) { + OleInitialize(NULL); +} + +/********************************************************************** * + * AVIFileExit (AVIFIL32.@) + * AVIFileExit (AVIFILE.101) + */ +void WINAPI AVIFileExit(void) { + /* need to free ole32.dll if we are the last exit call */ + /* OleUnitialize() */ + FIXME("(): stub!\n"); +} + +/********************************************************************** * + * AVIFileOpen (AVIFIL32.@) + * AVIFileOpenA (AVIFIL32.@) + * AVIFileOpen (AVIFILE.102) + */ +HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, + LPCLSID lpHandler) [truncated at 1000 lines; 11168 more skipped]
19 years, 1 month
1
0
0
0
[greatlrd] 19400: prepareing for waveopendevice code adding waveThread as stub
by greatlrd@svn.reactos.com
prepareing for waveopendevice code adding waveThread as stub Modified: trunk/reactos/lib/mmdrv/wave.c _____ Modified: trunk/reactos/lib/mmdrv/wave.c --- trunk/reactos/lib/mmdrv/wave.c 2005-11-21 00:56:13 UTC (rev 19399) +++ trunk/reactos/lib/mmdrv/wave.c 2005-11-21 01:16:29 UTC (rev 19400) @@ -22,6 +22,10 @@ * functions start here * ============================ */ +static DWORD waveThread(LPVOID lpParameter) +{ + return MMSYSERR_NOERROR; +} MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType, LPBYTE pCaps, DWORD Size) @@ -73,7 +77,7 @@ DWORD dwParam2) { // TODO: Implement - //PWAVEALLOC pClient; + PWAVEALLOC pClient; //MMRESULT mResult; //BOOL Result; //DWORD BytesReturned; @@ -82,6 +86,9 @@ pFormats = (LPWAVEFORMATEX)((LPWAVEOPENDESC)dwParam1)->lpFormat; + + mmTaskCreate((LPTASKCALLBACK)waveThread, &pClient->ThreadHandle, (DWORD)pClient); + return MMSYSERR_NOERROR; }
19 years, 1 month
1
0
0
0
[greatlrd] 19399: remove stub for CallbackWaveDevice, Left todo WODM_OPEN, WODM_WRITE, WODM_GETPOS, WODM_SETVOLUME, WODM_GETVOLUME some code exists but not checked if it is complete or it contain some stub
by greatlrd@svn.reactos.com
remove stub for CallbackWaveDevice, Left todo WODM_OPEN, WODM_WRITE, WODM_GETPOS, WODM_SETVOLUME, WODM_GETVOLUME some code exists but not checked if it is complete or it contain some stub Modified: trunk/reactos/lib/mmdrv/wave.c _____ Modified: trunk/reactos/lib/mmdrv/wave.c --- trunk/reactos/lib/mmdrv/wave.c 2005-11-21 00:16:30 UTC (rev 19398) +++ trunk/reactos/lib/mmdrv/wave.c 2005-11-21 00:56:13 UTC (rev 19399) @@ -86,11 +86,7 @@ } -//FIXME: Params are MS-specific -static void CallbackWaveDevice(PWAVEALLOC pWave, DWORD msg, DWORD dw1) -{ -} //FIXME: Params are MS-specific static MMRESULT WriteWaveDevice(LPWAVEHDR pHdr, PWAVEALLOC pClient) @@ -189,7 +185,15 @@ return Result; } else - CallbackWaveDevice(pTask, WOM_CLOSE, 0L); + + { + if (pTask->dwCallback) + { + DriverCallback(pTask->dwCallback, HIWORD(pTask->dwFlags), (HDRVR)pTask->hWave, + WOM_CLOSE, pTask->dwInstance, 0L, 0L); + } + } + // 2. Close the device if (pTask->hDev != INVALID_HANDLE_VALUE) { @@ -235,8 +239,6 @@ } case WODM_PAUSE: - - DPRINT("WODM_PAUSE"); pTask->AuxParam.State = WAVE_DD_STOP;
19 years, 1 month
1
0
0
0
[greatlrd] 19398: remove the stub of ThreadCallWaveDevice and implement it there it need it.
by greatlrd@svn.reactos.com
remove the stub of ThreadCallWaveDevice and implement it there it need it. Modified: trunk/reactos/lib/mmdrv/wave.c _____ Modified: trunk/reactos/lib/mmdrv/wave.c --- trunk/reactos/lib/mmdrv/wave.c 2005-11-20 23:25:16 UTC (rev 19397) +++ trunk/reactos/lib/mmdrv/wave.c 2005-11-21 00:16:30 UTC (rev 19398) @@ -85,15 +85,11 @@ return MMSYSERR_NOERROR; } -//FIXME: Params are MS-specific -static MMRESULT ThreadCallWaveDevice(WAVETHREADFUNCTION Function, PWAVEALLOC pClient) -{ - return MMSYSERR_NOERROR; -} //FIXME: Params are MS-specific static void CallbackWaveDevice(PWAVEALLOC pWave, DWORD msg, DWORD dw1) { + } //FIXME: Params are MS-specific @@ -162,6 +158,8 @@ */ APIENTRY DWORD wodMessage(DWORD dwId, DWORD dwMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2) { + PWAVEALLOC pTask = (PWAVEALLOC)dwUser; + switch (dwMessage) { case WODM_GETNUMDEVS: DPRINT("WODM_GETNUMDEVS"); @@ -178,13 +176,16 @@ case WODM_CLOSE: { - MMRESULT Result; - PWAVEALLOC pTask = (PWAVEALLOC)dwUser; + MMRESULT Result; DPRINT("WODM_CLOSE"); // 1. Check if the task is ready to complete - Result = ThreadCallWaveDevice(WaveThreadClose, pTask); - if (Result != MMSYSERR_NOERROR) { + pTask->AuxFunction = WaveThreadClose; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + + if ( pTask->AuxReturnCode != MMSYSERR_NOERROR) + { return Result; } else @@ -233,36 +234,57 @@ return WriteWaveDevice(pWaveHdr, (PWAVEALLOC)dwUser); } + case WODM_PAUSE: + - case WODM_PAUSE: DPRINT("WODM_PAUSE"); - ((PWAVEALLOC)dwUser)->AuxParam.State = WAVE_DD_STOP; - return ThreadCallWaveDevice(WaveThreadSetState, (PWAVEALLOC)dwUser); + pTask->AuxParam.State = WAVE_DD_STOP; + + pTask->AuxFunction = WaveThreadSetState; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; case WODM_RESTART: DPRINT("WODM_RESTART"); - ((PWAVEALLOC)dwUser)->AuxParam.State = WAVE_DD_PLAY; - return ThreadCallWaveDevice(WaveThreadSetState, (PWAVEALLOC)dwUser); + pTask->AuxParam.State = WAVE_DD_PLAY; + pTask->AuxFunction = WaveThreadSetState; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; + case WODM_RESET: DPRINT("WODM_RESET"); - ((PWAVEALLOC)dwUser)->AuxParam.State = WAVE_DD_RESET; - return ThreadCallWaveDevice(WaveThreadSetState, (PWAVEALLOC)dwUser); + pTask->AuxParam.State = WAVE_DD_RESET; + pTask->AuxFunction = WaveThreadSetState; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; + case WODM_BREAKLOOP: DPRINT("WODM_BREAKLOOP"); - return ThreadCallWaveDevice(WaveThreadBreakLoop, (PWAVEALLOC)dwUser); + pTask->AuxFunction = WaveThreadBreakLoop; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; + case WODM_GETPOS: DPRINT("WODM_GETPOS"); - return GetPositionWaveDevice(((PWAVEALLOC)dwUser), (LPMMTIME)dwParam1, dwParam2); + return GetPositionWaveDevice(pTask, (LPMMTIME)dwParam1, dwParam2); case WODM_SETPITCH: DPRINT("WODM_SETPITCH"); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.pData = (PBYTE)&dwParam1; - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.DataLen = sizeof(DWORD); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.Function = IOCTL_WAVE_SET_PITCH; - return ThreadCallWaveDevice(WaveThreadSetData, ((PWAVEALLOC)dwUser)); + pTask->AuxParam.GetSetData.pData = (PBYTE)&dwParam1; + pTask->AuxParam.GetSetData.DataLen = sizeof(DWORD); + pTask->AuxParam.GetSetData.Function = IOCTL_WAVE_SET_PITCH; + + pTask->AuxFunction = WaveThreadSetData; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; case WODM_SETVOLUME: DPRINT("WODM_SETVOLUME"); @@ -277,17 +299,26 @@ case WODM_SETPLAYBACKRATE: DPRINT("WODM_SETPLAYBACKRATE"); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.pData = (PBYTE)&dwParam1; - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.DataLen = sizeof(DWORD); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.Function = IOCTL_WAVE_SET_PLAYBACK_RATE; - return ThreadCallWaveDevice(WaveThreadSetData, (PWAVEALLOC)dwUser); + pTask->AuxParam.GetSetData.pData = (PBYTE)&dwParam1; + pTask->AuxParam.GetSetData.DataLen = sizeof(DWORD); + pTask->AuxParam.GetSetData.Function = IOCTL_WAVE_SET_PLAYBACK_RATE; + + pTask->AuxFunction = WaveThreadSetData; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; + case WODM_GETPITCH: DPRINT("WODM_GETPITCH"); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.pData = (PBYTE)dwParam1; - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.DataLen = sizeof(DWORD); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.Function = IOCTL_WAVE_GET_PITCH; - return ThreadCallWaveDevice(WaveThreadGetData, (PWAVEALLOC)dwUser); + pTask->AuxParam.GetSetData.pData = (PBYTE)dwParam1; + pTask->AuxParam.GetSetData.DataLen = sizeof(DWORD); + pTask->AuxParam.GetSetData.Function = IOCTL_WAVE_GET_PITCH; + + pTask->AuxFunction = WaveThreadGetData; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; case WODM_GETVOLUME: DPRINT("WODM_GETVOLUME"); @@ -306,10 +337,14 @@ case WODM_GETPLAYBACKRATE: DPRINT("WODM_GETPLAYBACKRATE"); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.pData = (PBYTE)dwParam1; - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.DataLen = sizeof(DWORD); - ((PWAVEALLOC)dwUser)->AuxParam.GetSetData.Function = IOCTL_WAVE_GET_PLAYBACK_RATE; - return ThreadCallWaveDevice(WaveThreadGetData, (PWAVEALLOC)dwUser); + pTask->AuxParam.GetSetData.pData = (PBYTE)dwParam1; + pTask->AuxParam.GetSetData.DataLen = sizeof(DWORD); + pTask->AuxParam.GetSetData.Function = IOCTL_WAVE_GET_PLAYBACK_RATE; + + pTask->AuxFunction = WaveThreadGetData; + SetEvent(pTask->AuxEvent1); + WaitForSingleObject(pTask->AuxEvent2, INFINITE); + return pTask->AuxReturnCode; default: return MMSYSERR_NOTSUPPORTED;
19 years, 1 month
1
0
0
0
[greatlrd] 19397: correct some bugs
by greatlrd@svn.reactos.com
correct some bugs Modified: trunk/reactos/lib/mmdrv/midi.c Modified: trunk/reactos/lib/mmdrv/mmddk.h Modified: trunk/reactos/lib/mmdrv/wave.c _____ Modified: trunk/reactos/lib/mmdrv/midi.c --- trunk/reactos/lib/mmdrv/midi.c 2005-11-20 22:30:01 UTC (rev 19396) +++ trunk/reactos/lib/mmdrv/midi.c 2005-11-20 23:25:16 UTC (rev 19397) @@ -157,6 +157,7 @@ if (DeviceType == MidiInDevice) { + pClient->AuxEvent1 = CreateEvent(NULL, FALSE, FALSE, NULL); if (pClient->AuxEvent1 == NULL) { @@ -174,6 +175,7 @@ // TaskCreate + WaitForSingleObject(pClient->AuxEvent2, INFINITE); } _____ Modified: trunk/reactos/lib/mmdrv/mmddk.h --- trunk/reactos/lib/mmdrv/mmddk.h 2005-11-20 22:30:01 UTC (rev 19396) +++ trunk/reactos/lib/mmdrv/mmddk.h 2005-11-20 23:25:16 UTC (rev 19397) @@ -29,8 +29,17 @@ #include <mmsystem.h> #include <winbase.h> +typedef VOID (TASKCALLBACK) (DWORD dwInst); +typedef TASKCALLBACK FAR *LPTASKCALLBACK; +UINT APIENTRY mmTaskCreate(LPTASKCALLBACK lpfn, HANDLE FAR * lph, DWORD dwInst); +VOID APIENTRY mmTaskBlock(DWORD h); +BOOL APIENTRY mmTaskSignal(DWORD h); +VOID APIENTRY mmTaskYield(VOID); +DWORD APIENTRY mmGetCurrentTask(VOID); + + #define MAX_MIDIINDRV (16) /* For now I'm making 16 the maximum number of midi devices one can * have. This should be more than enough for everybody. But as a purist, _____ Modified: trunk/reactos/lib/mmdrv/wave.c --- trunk/reactos/lib/mmdrv/wave.c 2005-11-20 22:30:01 UTC (rev 19396) +++ trunk/reactos/lib/mmdrv/wave.c 2005-11-20 23:25:16 UTC (rev 19397) @@ -36,15 +36,7 @@ if (Result != MMSYSERR_NOERROR) return Result; - // - // Set our data. - // - // Setting the overlapped parameter (last) to null means we - // wait until the operation completes. - // - - - if (DeviceType == WaveOutDevice) + if ((DeviceType == WaveOutDevice) || (DeviceType == WaveInDevice)) { Result = DeviceIoControl(DeviceHandle, IOCTL_WAVE_GET_CAPABILITIES, NULL, 0, (LPVOID)pCaps, Size, @@ -69,7 +61,7 @@ // Close the handle and return the result code -// CloseHandle(DeviceHandle); + CloseHandle(DeviceHandle); return Result; } @@ -81,6 +73,15 @@ DWORD dwParam2) { // TODO: Implement + //PWAVEALLOC pClient; + //MMRESULT mResult; + //BOOL Result; + //DWORD BytesReturned; + LPWAVEFORMATEX pFormats; + + pFormats = (LPWAVEFORMATEX)((LPWAVEOPENDESC)dwParam1)->lpFormat; + + return MMSYSERR_NOERROR; }
19 years, 1 month
1
0
0
0
[greatlrd] 19396: implement more case to widMessage
by greatlrd@svn.reactos.com
implement more case to widMessage Modified: trunk/reactos/lib/mmdrv/wave.c _____ Modified: trunk/reactos/lib/mmdrv/wave.c --- trunk/reactos/lib/mmdrv/wave.c 2005-11-20 21:59:21 UTC (rev 19395) +++ trunk/reactos/lib/mmdrv/wave.c 2005-11-20 22:30:01 UTC (rev 19396) @@ -320,17 +320,47 @@ /* - * @unimplemented + * @implemented */ APIENTRY DWORD widMessage(DWORD dwId, DWORD dwMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2) { DPRINT("widMessage\n"); - switch (dwMessage) { - case WIDM_GETNUMDEVS: + switch (dwMessage) + { + case WIDM_GETNUMDEVS: + DPRINT("WIDM_GETNUMDEVS"); return GetDeviceCount(WaveInDevice); + + case WIDM_GETDEVCAPS: + DPRINT("WODM_GETDEVCAPS"); + return GetDeviceCapabilities(dwId, WaveInDevice, (LPBYTE)dwParam1, (DWORD)dwParam2); + + case WIDM_OPEN: + DPRINT("WIDM_OPEN"); + return OpenWaveDevice(WaveInDevice, dwId, dwUser, dwParam1, dwParam2); + + case WIDM_CLOSE: + return MMSYSERR_NOERROR; + + case WIDM_ADDBUFFER: + return MMSYSERR_NOERROR; + + case WIDM_STOP: + return MMSYSERR_NOERROR; + + case WIDM_START: + return MMSYSERR_NOERROR; + + case WIDM_RESET: + return MMSYSERR_NOERROR; + + case WIDM_GETPOS: + return MMSYSERR_NOERROR; + + default : - return MMSYSERR_NOERROR; + return MMSYSERR_NOTSUPPORTED; } }
19 years, 1 month
1
0
0
0
[greatlrd] 19395: implement AUXDM_SETVOLUME now the auxMessage are complete
by greatlrd@svn.reactos.com
implement AUXDM_SETVOLUME now the auxMessage are complete Modified: trunk/reactos/lib/mmdrv/auxil.c Modified: trunk/reactos/lib/mmdrv/wave.h _____ Modified: trunk/reactos/lib/mmdrv/auxil.c --- trunk/reactos/lib/mmdrv/auxil.c 2005-11-20 21:42:23 UTC (rev 19394) +++ trunk/reactos/lib/mmdrv/auxil.c 2005-11-20 21:59:21 UTC (rev 19395) @@ -52,7 +52,13 @@ case AUXDM_SETVOLUME: - return 0; + DPRINT("AUXDM_SETVOLUME"); + + Volume.Right = HIWORD(dwParam1) << 16; + Volume.Left = LOWORD(dwParam1) << 16; + + return AuxSetAudio(dwId, (PBYTE)&Volume, sizeof(Volume)); + } return MMSYSERR_NOERROR; @@ -79,3 +85,22 @@ return Result; } +DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume) +{ + HANDLE DeviceHandle; + MMRESULT Result; + DWORD BytesReturned; + + Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ); + if (Result != MMSYSERR_NOERROR) + return Result; + + Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_SET_VOLUME, (LPVOID)pVolume, sizeVolume, NULL, 0, + &BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus(); + + + CloseHandle(DeviceHandle); + + return Result; + } + _____ Modified: trunk/reactos/lib/mmdrv/wave.h --- trunk/reactos/lib/mmdrv/wave.h 2005-11-20 21:42:23 UTC (rev 19394) +++ trunk/reactos/lib/mmdrv/wave.h 2005-11-20 21:59:21 UTC (rev 19395) @@ -84,6 +84,7 @@ LPBYTE pCaps, DWORD Size); DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume); +DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume); typedef struct _AUX_DD_VOLUME { ULONG Left;
19 years, 1 month
1
0
0
0
[greatlrd] 19394: Implement AUXDM_GETVOLUME
by greatlrd@svn.reactos.com
Implement AUXDM_GETVOLUME Modified: trunk/reactos/lib/mmdrv/auxil.c Modified: trunk/reactos/lib/mmdrv/utils.c Modified: trunk/reactos/lib/mmdrv/wave.h _____ Modified: trunk/reactos/lib/mmdrv/auxil.c --- trunk/reactos/lib/mmdrv/auxil.c 2005-11-20 21:29:42 UTC (rev 19393) +++ trunk/reactos/lib/mmdrv/auxil.c 2005-11-20 21:42:23 UTC (rev 19394) @@ -23,8 +23,12 @@ DWORD dwParam2) { + MMRESULT Result; + AUX_DD_VOLUME Volume; + DPRINT("auxMessage\n"); + // the following cases are documented by DDK switch (uMessage) { @@ -37,7 +41,15 @@ return GetDeviceCount(AuxDevice); case AUXDM_GETVOLUME: - return 0; + DPRINT("AUXDM_GETVOLUME"); + Result = AuxGetAudio(dwId, (PBYTE) &Volume, sizeof(Volume)); + + if (Result == MMSYSERR_NOERROR) + { + *(LPDWORD)dwParam1 = (DWORD)MAKELONG(HIWORD(Volume.Left), HIWORD(Volume.Right)); + } + return Result; + case AUXDM_SETVOLUME: return 0; @@ -47,3 +59,23 @@ } +DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume) +{ + HANDLE DeviceHandle; + MMRESULT Result; + DWORD BytesReturned; + + Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ); + if (Result != MMSYSERR_NOERROR) + return Result; + + + Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_GET_VOLUME, NULL, 0, (LPVOID)pVolume, sizeVolume, + &BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus(); + + + CloseHandle(DeviceHandle); + + return Result; + } + _____ Modified: trunk/reactos/lib/mmdrv/utils.c --- trunk/reactos/lib/mmdrv/utils.c 2005-11-20 21:29:42 UTC (rev 19393) +++ trunk/reactos/lib/mmdrv/utils.c 2005-11-20 21:42:23 UTC (rev 19394) @@ -85,7 +85,7 @@ case AuxDevice : wsprintf(DeviceName, L"\\\\.%ls%d", AUX_DEVICE_NAME_U + strlen("\\Device"), ID); break; - default : // Aux + default : DPRINT("No Auido Device Found"); return MMSYSERR_BADDEVICEID; /* Maybe we should change error code */ }; _____ Modified: trunk/reactos/lib/mmdrv/wave.h --- trunk/reactos/lib/mmdrv/wave.h 2005-11-20 21:29:42 UTC (rev 19393) +++ trunk/reactos/lib/mmdrv/wave.h 2005-11-20 21:42:23 UTC (rev 19394) @@ -79,5 +79,13 @@ MMRESULT AuxReturnCode; // Return code from Aux task }WAVEALLOC, *PWAVEALLOC; +/* Misc should move to own header */ MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType, LPBYTE pCaps, DWORD Size); + +DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume); + +typedef struct _AUX_DD_VOLUME { + ULONG Left; + ULONG Right; +} AUX_DD_VOLUME, *PAUX_DD_VOLUME;
19 years, 1 month
1
0
0
0
[weiden] 19393: added stub for SetupDiGetClassImageIndex
by weiden@svn.reactos.com
added stub for SetupDiGetClassImageIndex Modified: trunk/reactos/lib/setupapi/setupapi.spec Modified: trunk/reactos/lib/setupapi/stubs.c _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-11-20 21:21:01 UTC (rev 19392) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-11-20 21:29:42 UTC (rev 19393) @@ -312,7 +312,7 @@ @ stdcall SetupDiGetClassDevsExA(ptr str ptr long ptr str ptr) @ stdcall SetupDiGetClassDevsExW(ptr wstr ptr long ptr wstr ptr) @ stdcall SetupDiGetClassDevsW(ptr ptr long long) -@ stub SetupDiGetClassImageIndex +@ stdcall SetupDiGetClassImageIndex(ptr ptr ptr) @ stdcall SetupDiGetClassImageList(ptr) @ stdcall SetupDiGetClassImageListExA(ptr str ptr) @ stdcall SetupDiGetClassImageListExW(ptr wstr ptr) _____ Modified: trunk/reactos/lib/setupapi/stubs.c --- trunk/reactos/lib/setupapi/stubs.c 2005-11-20 21:21:01 UTC (rev 19392) +++ trunk/reactos/lib/setupapi/stubs.c 2005-11-20 21:29:42 UTC (rev 19393) @@ -213,6 +213,18 @@ /*********************************************************************** + * SetupDiGetClassImageIndex(SETUPAPI.@) + */ +BOOL WINAPI SetupDiGetClassImageIndex(PSP_CLASSIMAGELIST_DATA ClassImageListData, + CONST GUID *ClassGuid, PINT ImageIndex) +{ + FIXME ("Stub %p %p %p\n", ClassImageListData, ClassGuid, ImageIndex); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/********************************************************************** * * SetupDiDestroyClassImageList(SETUPAPI.@) */ BOOL WINAPI SetupDiDestroyClassImageList(PSP_CLASSIMAGELIST_DATA ClassImageListData)
19 years, 1 month
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
88
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Results per page:
10
25
50
100
200