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) 53 #ifdef WORDS_BIGENDIAN 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++;
412 static 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)
583 static 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;
929 FIXME(
": deletion inside of stream not supported!\n");
956 FIXME(
"(%p,%p,%d): stub\n", iface,
info, infolen);
961 static 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) {
1090 auhdr.sampleRate =
LE2H_DWORD(auhdr.sampleRate);
1092 }
else if (auhdr.fccType ==
mmioFOURCC(
'.',
's',
'n',
'd')) {
1098 auhdr.sampleRate =
BE2H_DWORD(auhdr.sampleRate);
1103 if (auhdr.channels < 1)
1107 switch(auhdr.encoding) {
1114 WARN(
"unsupported Sun audio format %d\n", auhdr.encoding);
1124 This->lpFormat->nChannels = auhdr.channels;
1125 This->lpFormat->nSamplesPerSec = auhdr.sampleRate;
1126 switch(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");
#define AU_ENCODING_ADPCM_G722
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
static const struct IAVIFileVtbl iwavft
static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface)
MMRESULT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags)
#define AU_ENCODING_ALAW_8
static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, AVISTREAMINFOW *asi)
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void *lpData, LONG *size)
#define IDS_WAVESTREAMFORMAT
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define WideCharToMultiByte
#define AVIFILECAPS_CANREAD
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
#define AU_ENCODING_ADPCM_G723_5
#define AU_ENCODING_PCM_8
#define ACM_FORMATSUGGESTF_WFORMATTAG
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile *iface)
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *ppszFileName)
static const struct IAVIStreamVtbl iwavst
struct tWAVEFORMATEX WAVEFORMATEX
IAVIStream IAVIStream_iface
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
HMMIO WINAPI mmioOpenA(LPSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void *lpData, LONG size)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, LPARAM lParam2)
static const WCHAR avifile[]
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define AU_ENCODING_PCM_16
#define IAVIFile_WriteData(p, a, b, c)
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface, AVISTREAMINFOW *psi, LONG size)
#define AU_ENCODING_ULAW_8
G723_ADPCMWAVEFORMAT * LPG723_ADPCMWAVEFORMAT
#define WAVE_FORMAT_MULAW
WORD WORD PSZ PSZ pszFileName
#define IAVIStream_AddRef(p)
LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
#define WAVE_FORMAT_G723_ADPCM
static IAVIFileImpl * impl_from_IAVIStream(IAVIStream *iface)
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream *iface)
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *format, LONG formatsize)
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
#define AVIFILECAPS_CANWRITE
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
#define AVIERR_BUFFERTOOSMALL
#define AVIERR_UNSUPPORTED
HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface)
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, LONG lParam)
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, void *format, LONG *formatsize)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ACM_STREAMSIZEF_SOURCE
static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
struct g721_adpcmwaveformat_tag G721_ADPCMWAVEFORMAT
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, void *lp, LONG *lpread)
struct g723_adpcmwaveformat_tag G723_ADPCMWAVEFORMAT
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface)
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags)
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LONG lParam)
struct _IAVIFileImpl IAVIFileImpl
static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID riid, void **ret_iface)
#define AU_ENCODING_PCM_24
static IAVIFileImpl * impl_from_IUnknown(IUnknown *iface)
IPersistFile IPersistFile_iface
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, LPAVISTREAMINFOW info, LONG infolen)
#define InterlockedDecrement
MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO *lpck, UINT uFlags)
#define mmioFOURCC(c0, c1, c2, c3)
#define memcpy(s1, s2, n)
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface)
static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define AU_ENCODING_PCM_32
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG size)
static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, LPCLSID pClassID)
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface)
#define AU_ENCODING_ADPCM_G721_32
static IAVIFileImpl * impl_from_IAVIFile(IAVIFile *iface)
#define InterlockedIncrement
static IAVIFileImpl * impl_from_IPersistFile(IPersistFile *iface)
#define AU_ENCODING_ADPCM_G723_24
MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, const MMCKINFO *lpckParent, UINT uFlags)
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, void *lp, LONG size)
WINE_DEFAULT_DEBUG_CHANNEL(avifile)
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, LONG samples)
G721_ADPCMWAVEFORMAT * LPG721_ADPCMWAVEFORMAT
static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
const GUID IID_IPersistFile
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize)
#define ACM_STREAMOPENF_NONREALTIME
static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, void **ret_iface)
LPCWSTR AVIFILE_BasenameW(LPCWSTR szFileName) DECLSPEC_HIDDEN
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID riid, void **ret_iface)
static HRESULT AVIFILE_SaveFile(const IAVIFileImpl *This)
static const struct IPersistFileVtbl iwavpft
#define IAVIFile_ReadData(p, a, b, c)
static const IUnknownVtbl unk_vtbl
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
#define HeapFree(x, y, z)
static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface)
#define WAVE_FORMAT_G721_ADPCM
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, LONG samples, void *buffer, LONG buffersize, LONG *bytesread, LONG *samplesread)
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, void *buffer, LONG buffersize, DWORD flags, LONG *sampwritten, LONG *byteswritten)
LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)