42#define formtypeWAVE mmioFOURCC('W','A','V','E')
43#define ckidWAVEFORMAT mmioFOURCC('f','m','t',' ')
44#define ckidWAVEFACT mmioFOURCC('f','a','c','t')
45#define ckidWAVEDATA mmioFOURCC('d','a','t','a')
49#define ENDIAN_SWAPWORD(x) ((((x) >> 8) & 0xFF) | (((x) & 0xFF) << 8))
50#define ENDIAN_SWAPDWORD(x) (ENDIAN_SWAPWORD((x >> 16) & 0xFFFF) | \
51 ENDIAN_SWAPWORD(x & 0xFFFF) << 16)
54#define BE2H_WORD(x) (x)
55#define BE2H_DWORD(x) (x)
56#define LE2H_WORD(x) ENDIAN_SWAPWORD(x)
57#define LE2H_DWORD(x) ENDIAN_SWAPDWORD(x)
59#define BE2H_WORD(x) ENDIAN_SWAPWORD(x)
60#define BE2H_DWORD(x) ENDIAN_SWAPDWORD(x)
61#define LE2H_WORD(x) (x)
62#define LE2H_DWORD(x) (x)
74#define AU_ENCODING_ULAW_8 1
75#define AU_ENCODING_PCM_8 2
76#define AU_ENCODING_PCM_16 3
77#define AU_ENCODING_PCM_24 4
78#define AU_ENCODING_PCM_32 5
79#define AU_ENCODING_FLOAT 6
80#define AU_ENCODING_DOUBLE 7
81#define AU_ENCODING_ADPCM_G721_32 23
82#define AU_ENCODING_ADPCM_G722 24
83#define AU_ENCODING_ADPCM_G723_24 25
84#define AU_ENCODING_ADPCM_G723_5 26
85#define AU_ENCODING_ALAW_8 27
132 *ret_iface = &
This->IUnknown_inner;
134 *ret_iface = &
This->IAVIFile_iface;
136 *ret_iface = &
This->IAVIStream_iface;
138 *ret_iface = &
This->IPersistFile_iface;
146 IUnknown_AddRef(&
This->IUnknown_inner);
206 return IUnknown_QueryInterface(
This->outer_unk,
riid, ret_iface);
213 return IUnknown_AddRef(
This->outer_unk);
220 return IUnknown_Release(
This->outer_unk);
235 This->fInfo.dwFlags = 0;
240 This->fInfo.dwStreams = 1;
241 This->fInfo.dwScale =
This->sInfo.dwScale;
242 This->fInfo.dwRate =
This->sInfo.dwRate;
243 This->fInfo.dwLength =
This->sInfo.dwLength;
244 This->fInfo.dwSuggestedBufferSize =
This->ckData.cksize;
245 This->fInfo.dwMaxBytesPerSec =
261 TRACE(
"(%p,%p,0x%08X,%d)\n", iface, avis, fccType,
lParam);
270 if (
lParam != 0 ||
This->fInfo.dwStreams == 0)
275 *avis = &
This->IAVIStream_iface;
286 TRACE(
"(%p,%p,%p)\n", iface, avis, asi);
295 if (
This->fInfo.dwStreams != 0 ||
This->lpFormat !=
NULL)
310 This->sInfo.fccHandler = 0;
311 This->sInfo.dwFlags = 0;
313 This->sInfo.dwStart = 0;
314 This->sInfo.dwInitialFrames = 0;
315 This->sInfo.dwFormatChangeCount = 0;
318 This->fInfo.dwStreams = 1;
319 This->fInfo.dwScale =
This->sInfo.dwScale;
320 This->fInfo.dwRate =
This->sInfo.dwRate;
321 This->fInfo.dwLength =
This->sInfo.dwLength;
323 This->ckData.dwDataOffset = 0;
324 This->ckData.cksize = 0;
326 *avis = &
This->IAVIStream_iface;
336 TRACE(
"(%p,0x%08X,%p,%d)\n", iface, ckid, lpData,
size);
357 TRACE(
"(%p,0x%08X,%p,%p)\n", iface, ckid, lpData,
size);
364 TRACE(
"(%p)\n",iface);
383 if (
lParam != 0 ||
This->fInfo.dwStreams == 0 ||
396 This->ckData.dwDataOffset = 0;
397 This->ckData.cksize = 0;
399 This->sInfo.dwScale = 0;
400 This->sInfo.dwRate = 0;
401 This->sInfo.dwLength = 0;
402 This->sInfo.dwSuggestedBufferSize = 0;
404 This->fInfo.dwStreams = 0;
405 This->fInfo.dwEditCount++;
412static const struct IAVIFileVtbl
iwavft = {
437 return IUnknown_QueryInterface(
This->outer_unk,
riid, ret_iface);
444 return IUnknown_AddRef(
This->outer_unk);
451 return IUnknown_Release(
This->outer_unk);
457 TRACE(
"(%p,%p)\n", iface, pClassID);
459 if (pClassID ==
NULL)
462 *pClassID = CLSID_WAVFile;
471 TRACE(
"(%p)\n", iface);
479 WCHAR wszStreamFmt[50];
492 This->uMode = dwMode;
508 if (szFileName ==
NULL)
526 wszStreamFmt,
ARRAY_SIZE(wszStreamFmt)) > 0) {
563 TRACE(
"(%p,%p)\n", iface, ppszFileName);
565 if (ppszFileName ==
NULL)
568 *ppszFileName =
NULL;
570 if (
This->szFileName) {
574 if (*ppszFileName ==
NULL)
583static const struct IPersistFileVtbl
iwavpft = {
606 return IUnknown_QueryInterface(
This->outer_unk,
riid, ret_iface);
613 return IUnknown_AddRef(
This->outer_unk);
620 return IUnknown_Release(
This->outer_unk);
626 TRACE(
"(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2);
679 return This->sInfo.dwSampleSize;
681 return This->ckData.dwDataOffset +
pos *
This->sInfo.dwSampleSize;
693 if (formatsize ==
NULL)
698 *formatsize =
This->cbFormat;
705 if (*formatsize < This->cbFormat) {
706 *formatsize =
This->cbFormat;
710 *formatsize =
This->cbFormat;
728 if (formatsize !=
This->cbFormat ||
748 This->cbFormat = formatsize;
752 This->ckData.dwDataOffset = formatsize + 7 *
sizeof(
DWORD);
753 This->ckData.cksize = 0;
757 This->ckData.dwDataOffset += 3 *
sizeof(
DWORD);
760 This->sInfo.dwSampleSize =
This->lpFormat->nBlockAlign;
761 This->sInfo.dwScale =
This->lpFormat->nBlockAlign;
762 This->sInfo.dwRate =
This->lpFormat->nAvgBytesPerSec;
763 This->sInfo.dwLength = 0;
764 This->sInfo.dwSuggestedBufferSize = 0;
774 TRACE(
"(%p,%d,%d,%p,%d,%p,%p)\n", iface,
start,
samples,
buffer,
775 buffersize, bytesread, samplesread);
778 if (bytesread !=
NULL)
780 if (samplesread !=
NULL)
790 if (buffersize > 0) {
804 if (bytesread ==
NULL && samplesread ==
NULL)
807 if (bytesread !=
NULL)
809 if (samplesread !=
NULL)
820 if ((
DWORD)buffersize < This->sInfo.dwSampleSize)
832 if (bytesread !=
NULL)
833 *bytesread = buffersize;
834 if (samplesread !=
NULL)
845 TRACE(
"(%p,%d,%d,%p,%d,0x%08X,%p,%p)\n", iface,
start,
samples,
846 buffer, buffersize,
flags, sampwritten, byteswritten);
849 if (sampwritten !=
NULL)
851 if (byteswritten !=
NULL)
867 if (buffersize & ~(
This->sInfo.dwSampleSize - 1))
882 start *
This->sInfo.dwSampleSize + buffersize);
885 if (sampwritten !=
NULL)
887 if (byteswritten !=
NULL)
888 *byteswritten = buffersize;
921 }
else if ((
DWORD)start <= This->sInfo.dwStart) {
929 FIXME(
": deletion inside of stream not supported!\n");
956 FIXME(
"(%p,%p,%d): stub\n", iface,
info, infolen);
961static const struct IAVIStreamVtbl
iwavst = {
1012 This->sInfo.dwLength = 0;
1053 This->sInfo.dwRate =
This->lpFormat->nAvgBytesPerSec;
1054 This->sInfo.dwSampleSize =
1055 This->sInfo.dwScale =
This->lpFormat->nBlockAlign;
1056 This->sInfo.dwLength =
This->ckData.cksize /
This->lpFormat->nBlockAlign;
1057 This->sInfo.dwSuggestedBufferSize =
This->ckData.cksize;
1059 This->fInfo.dwStreams = 1;
1063 WARN(
": file seems to be truncated!\n");
1065 This->ckData.dwDataOffset;
1066 This->sInfo.dwLength =
This->ckData.cksize /
This->lpFormat->nBlockAlign;
1067 This->sInfo.dwSuggestedBufferSize =
This->ckData.cksize;
1084 if (auhdr.
fccType == 0x0064732E) {
1114 WARN(
"unsupported Sun audio format %d\n", auhdr.
encoding);
1129 This->lpFormat->wBitsPerSample = 8;
1133 This->lpFormat->wBitsPerSample = 8;
1137 This->lpFormat->wBitsPerSample = 16;
1141 This->lpFormat->wBitsPerSample = 24;
1145 This->lpFormat->wBitsPerSample = 32;
1149 This->lpFormat->wBitsPerSample = 8;
1153 This->lpFormat->wBitsPerSample = (3*5*8);
1154 This->lpFormat->nBlockAlign = 15*15*8;
1155 This->lpFormat->cbSize =
sizeof(
WORD);
1160 This->lpFormat->wBitsPerSample = (3*5*8);
1161 This->lpFormat->nBlockAlign = 15*15*8;
1162 This->lpFormat->cbSize = 2*
sizeof(
WORD);
1167 WARN(
"unsupported Sun audio format %d\n", auhdr.
encoding);
1171 This->lpFormat->nBlockAlign =
1172 (
This->lpFormat->nChannels *
This->lpFormat->wBitsPerSample) / 8;
1173 if (
This->lpFormat->nBlockAlign == 0 &&
This->lpFormat->wBitsPerSample < 8)
1174 This->lpFormat->nBlockAlign++;
1175 This->lpFormat->nAvgBytesPerSec =
1176 This->lpFormat->nBlockAlign *
This->lpFormat->nSamplesPerSec;
1181 This->sInfo.fccHandler = 0;
1182 This->sInfo.dwFlags = 0;
1183 This->sInfo.wPriority = 0;
1184 This->sInfo.wLanguage = 0;
1185 This->sInfo.dwInitialFrames = 0;
1186 This->sInfo.dwScale =
This->lpFormat->nBlockAlign;
1187 This->sInfo.dwRate =
This->lpFormat->nAvgBytesPerSec;
1188 This->sInfo.dwStart = 0;
1189 This->sInfo.dwLength =
1190 This->ckData.cksize /
This->lpFormat->nBlockAlign;
1191 This->sInfo.dwSuggestedBufferSize =
This->sInfo.dwLength;
1192 This->sInfo.dwSampleSize =
This->lpFormat->nBlockAlign;
1194 This->fInfo.dwStreams = 1;
1195 This->fInfo.dwScale = 1;
1196 This->fInfo.dwRate =
This->lpFormat->nSamplesPerSec;
1197 This->fInfo.dwLength =
1199 This->lpFormat->nAvgBytesPerSec);
1250 ck.
cksize =
sizeof(dwFactLength);
1263 ERR(
": fact chunk is needed for non-pcm files -- currently no codec found, so skipped!\n");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define InterlockedIncrement
#define InterlockedDecrement
LPCWSTR AVIFILE_BasenameW(LPCWSTR szFileName) DECLSPEC_HIDDEN
#define IDS_WAVESTREAMFORMAT
static const WCHAR avifile[]
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define WAVE_FORMAT_MULAW
#define HeapFree(x, y, z)
#define WideCharToMultiByte
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize)
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
MMRESULT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags)
LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
HMMIO WINAPI mmioOpenA(LPSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, const MMCKINFO *lpckParent, UINT uFlags)
LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO *lpck, UINT uFlags)
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
#define memcpy(s1, s2, n)
struct g721_adpcmwaveformat_tag G721_ADPCMWAVEFORMAT
#define WAVE_FORMAT_G721_ADPCM
G721_ADPCMWAVEFORMAT * LPG721_ADPCMWAVEFORMAT
struct g723_adpcmwaveformat_tag G723_ADPCMWAVEFORMAT
G723_ADPCMWAVEFORMAT * LPG723_ADPCMWAVEFORMAT
#define WAVE_FORMAT_G723_ADPCM
#define mmioFOURCC(c0, c1, c2, c3)
#define ACM_STREAMOPENF_NONREALTIME
#define ACM_FORMATSUGGESTF_WFORMATTAG
#define ACM_STREAMSIZEF_SOURCE
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
const GUID IID_IPersistFile
#define IsEqualGUID(rguid1, rguid2)
IPersistFile IPersistFile_iface
IAVIStream IAVIStream_iface
#define CONTAINING_RECORD(address, type, field)
WORD WORD PSZ PSZ pszFileName
#define IAVIStream_AddRef(p)
#define AVIERR_UNSUPPORTED
#define AVIFILECAPS_CANWRITE
#define IAVIFile_ReadData(p, a, b, c)
#define IAVIFile_WriteData(p, a, b, c)
#define AVIERR_BUFFERTOOSMALL
#define AVIFILECAPS_CANREAD
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface)
static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface)
#define AU_ENCODING_PCM_24
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface)
static const struct IAVIFileVtbl iwavft
static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface)
static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile *iface)
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *format, LONG formatsize)
static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface)
#define AU_ENCODING_PCM_16
static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface)
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, LPARAM lParam2)
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG size)
static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface)
#define AU_ENCODING_ALAW_8
static const struct IAVIStreamVtbl iwavst
static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void *lpData, LONG *size)
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, LONG samples)
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, LONG samples, void *buffer, LONG buffersize, LONG *bytesread, LONG *samplesread)
static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, LPCLSID pClassID)
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, LONG lParam)
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *ppszFileName)
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream *iface)
static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
static IAVIFileImpl * impl_from_IUnknown(IUnknown *iface)
#define AU_ENCODING_ADPCM_G721_32
static const struct IPersistFileVtbl iwavpft
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface, AVISTREAMINFOW *psi, LONG size)
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface)
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void *lpData, LONG size)
static IAVIFileImpl * impl_from_IAVIFile(IAVIFile *iface)
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags)
#define AU_ENCODING_ADPCM_G723_24
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, void *lp, LONG size)
static const IUnknownVtbl unk_vtbl
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, void *format, LONG *formatsize)
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, LPAVISTREAMINFOW info, LONG infolen)
static IAVIFileImpl * impl_from_IAVIStream(IAVIStream *iface)
static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, void *buffer, LONG buffersize, DWORD flags, LONG *sampwritten, LONG *byteswritten)
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, void *lp, LONG *lpread)
#define AU_ENCODING_ULAW_8
static IAVIFileImpl * impl_from_IPersistFile(IPersistFile *iface)
struct _IAVIFileImpl IAVIFileImpl
#define AU_ENCODING_PCM_32
#define AU_ENCODING_ADPCM_G723_5
static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, AVISTREAMINFOW *asi)
static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
#define AU_ENCODING_ADPCM_G722
#define AU_ENCODING_PCM_8
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LONG lParam)
static HRESULT AVIFILE_SaveFile(const IAVIFileImpl *This)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)