2 * Copyright 1999 Marcus Meissner
3 * Copyright 2002 Michael Günnewig
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "avifile_private.h"
35 #include "wine/debug.h"
36 #include "wine/unicode.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(avifile);
40 /***********************************************************************
41 * copied from dlls/shell32/undocshell.h
43 HRESULT WINAPI SHCoCreateInstance(LPCSTR lpszClsid,REFCLSID rClsid,
44 LPUNKNOWN pUnkOuter,REFIID riid,LPVOID *ppv);
46 /***********************************************************************
47 * copied from dlls/ole32/compobj.c
49 static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
51 BYTE *s = (BYTE*)idstr;
57 memset(s, 0, sizeof(CLSID));
59 } else { /* validate the CLSID string */
60 if (lstrlenA(s) != 38)
61 return CO_E_CLASSSTRING;
63 if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
64 (s[24]!='-') || (s[37]!='}'))
65 return CO_E_CLASSSTRING;
67 for (i = 1; i < 37; i++) {
68 if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
70 if (!(((s[i] >= '0') && (s[i] <= '9')) ||
71 ((s[i] >= 'a') && (s[i] <= 'f')) ||
72 ((s[i] >= 'A') && (s[i] <= 'F')))
74 return CO_E_CLASSSTRING;
78 TRACE("%s -> %p\n", s, id);
80 /* quick lookup table */
81 memset(table, 0, 256);
83 for (i = 0; i < 10; i++)
86 for (i = 0; i < 6; i++) {
87 table['A' + i] = i+10;
88 table['a' + i] = i+10;
91 /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
94 s++; /* skip leading brace */
95 for (i = 0; i < 4; i++) {
96 p[3 - i] = table[*s]<<4 | table[*(s+1)];
102 for (i = 0; i < 2; i++) {
103 p[1-i] = table[*s]<<4 | table[*(s+1)];
109 for (i = 0; i < 2; i++) {
110 p[1-i] = table[*s]<<4 | table[*(s+1)];
116 /* these are just sequential bytes */
117 for (i = 0; i < 2; i++) {
118 *p++ = table[*s]<<4 | table[*(s+1)];
123 for (i = 0; i < 6; i++) {
124 *p++ = table[*s]<<4 | table[*(s+1)];
131 static BOOL AVIFILE_GetFileHandlerByExtension(LPCWSTR szFile, LPCLSID lpclsid)
135 LPWSTR szExt = strrchrW(szFile, '.');
136 LONG len = sizeof(szValue) / sizeof(szValue[0]);
143 wsprintfA(szRegKey, "AVIFile\\Extensions\\%.3ls", szExt);
144 if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &len) != ERROR_SUCCESS)
147 return (AVIFILE_CLSIDFromString(szValue, lpclsid) == S_OK);
150 /***********************************************************************
151 * AVIFileInit (AVIFIL32.@)
152 * AVIFileInit (AVIFILE.100)
154 void WINAPI AVIFileInit(void) {
155 /* need to load ole32.dll if not already done and get some functions */
156 FIXME("(): stub!\n");
159 /***********************************************************************
160 * AVIFileExit (AVIFIL32.@)
161 * AVIFileExit (AVIFILE.101)
163 void WINAPI AVIFileExit(void) {
164 /* need to free ole32.dll if we are the last exit call */
165 FIXME("(): stub!\n");
168 /***********************************************************************
169 * AVIFileOpenA (AVIFIL32.@)
170 * AVIFileOpenA (AVIFILE.102)
172 HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
175 LPWSTR wszFile = NULL;
179 TRACE("(%p,%s,0x%08X,%s)\n", ppfile, debugstr_a(szFile), uMode,
180 debugstr_guid(lpHandler));
182 /* check parameters */
183 if (ppfile == NULL || szFile == NULL)
184 return AVIERR_BADPARAM;
186 /* convert ASCII string to Unicode and call unicode function */
187 len = lstrlenA(szFile);
189 return AVIERR_BADPARAM;
191 wszFile = (LPWSTR)LocalAlloc(LPTR, (len + 1) * sizeof(WCHAR));
193 return AVIERR_MEMORY;
195 MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len + 1);
196 wszFile[len + 1] = 0;
198 hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
200 LocalFree((HLOCAL)wszFile);
205 /***********************************************************************
206 * AVIFileOpenW (AVIFIL32.@)
208 HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode,
211 IPersistFile *ppersist = NULL;
215 TRACE("(%p,%s,0x%X,%s)\n", ppfile, debugstr_w(szFile), uMode,
216 debugstr_guid(lpHandler));
218 /* check parameters */
219 if (ppfile == NULL || szFile == NULL)
220 return AVIERR_BADPARAM;
224 /* if no handler then try guessing it by extension */
225 if (lpHandler == NULL) {
226 if (! AVIFILE_GetFileHandlerByExtension(szFile, &clsidHandler))
227 return AVIERR_UNSUPPORTED;
229 memcpy(&clsidHandler, lpHandler, sizeof(clsidHandler));
231 /* crete instance of handler */
232 hr = SHCoCreateInstance(NULL, &clsidHandler, NULL,
233 &IID_IAVIFile, (LPVOID*)ppfile);
234 if (FAILED(hr) || *ppfile == NULL)
237 /* ask for IPersistFile interface for loading/creating the file */
238 hr = IAVIFile_QueryInterface(*ppfile, &IID_IPersistFile, (LPVOID*)&ppersist);
239 if (FAILED(hr) || ppersist == NULL) {
240 IAVIFile_Release(*ppfile);
245 hr = IPersistFile_Load(ppersist, szFile, uMode);
246 IPersistFile_Release(ppersist);
248 IAVIFile_Release(*ppfile);
255 /***********************************************************************
256 * AVIFileAddRef (AVIFIL32.@)
257 * AVIFileAddRef (AVIFILE.140)
259 ULONG WINAPI AVIFileAddRef(PAVIFILE pfile)
261 TRACE("(%p)\n", pfile);
264 ERR(": bad handle passed!\n");
268 return IAVIFile_AddRef(pfile);
271 /***********************************************************************
272 * AVIFileRelease (AVIFIL32.@)
273 * AVIFileRelease (AVIFILE.141)
275 ULONG WINAPI AVIFileRelease(PAVIFILE pfile)
277 TRACE("(%p)\n", pfile);
280 ERR(": bad handle passed!\n");
284 return IAVIFile_Release(pfile);
287 /***********************************************************************
288 * AVIFileInfoA (AVIFIL32.@)
290 HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile, LPAVIFILEINFOA afi, LONG size)
295 TRACE("(%p,%p,%ld)\n", pfile, afi, size);
298 return AVIERR_BADHANDLE;
299 if (size < sizeof(AVIFILEINFOA))
300 return AVIERR_BADSIZE;
302 hres = IAVIFile_Info(pfile, &afiw, sizeof(afiw));
304 memcpy(afi, &afiw, sizeof(*afi) - sizeof(afi->szFileType));
305 WideCharToMultiByte(CP_ACP, 0, afiw.szFileType, -1, afi->szFileType,
306 sizeof(afi->szFileType), NULL, NULL);
307 afi->szFileType[sizeof(afi->szFileType) - 1] = 0;
312 /***********************************************************************
313 * AVIFileInfoW (AVIFIL32.@)
315 HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile, LPAVIFILEINFOW afiw, LONG size)
317 TRACE("(%p,%p,%ld)\n", pfile, afiw, size);
320 return AVIERR_BADHANDLE;
322 return IAVIFile_Info(pfile, afiw, size);
325 /***********************************************************************
326 * AVIFileGetStream (AVIFIL32.@)
327 * AVIFileGetStream (AVIFILE.143)
329 HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile, PAVISTREAM *avis,
330 DWORD fccType, LONG lParam)
332 TRACE("(%p,%p,'%4.4s',%ld)\n", pfile, avis, (char*)&fccType, lParam);
335 return AVIERR_BADHANDLE;
337 return IAVIFile_GetStream(pfile, avis, fccType, lParam);
340 /***********************************************************************
341 * AVIFileCreateStreamA (AVIFIL32.@)
343 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile, PAVISTREAM *ppavi,
344 LPAVISTREAMINFOA psi)
348 TRACE("(%p,%p,%p)\n", pfile, ppavi, psi);
351 return AVIERR_BADHANDLE;
353 /* Only the szName at the end is different */
354 memcpy(&psiw, psi, sizeof(*psi) - sizeof(psi->szName));
355 MultiByteToWideChar(CP_ACP, 0, psi->szName, -1, psiw.szName,
356 sizeof(psiw.szName) / sizeof(psiw.szName[0]));
358 return IAVIFile_CreateStream(pfile, ppavi, &psiw);
361 /***********************************************************************
362 * AVIFileCreateStreamW (AVIFIL32.@)
364 HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile, PAVISTREAM *avis,
365 LPAVISTREAMINFOW asi)
367 TRACE("(%p,%p,%p)\n", pfile, avis, asi);
369 return IAVIFile_CreateStream(pfile, avis, asi);
372 /***********************************************************************
373 * AVIFileWriteData (AVIFIL32.@)
375 HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size)
377 TRACE("(%p,'%4.4s',%p,%ld)\n", pfile, (char*)&fcc, lp, size);
380 return AVIERR_BADHANDLE;
382 return IAVIFile_WriteData(pfile, fcc, lp, size);
385 /***********************************************************************
386 * AVIFileReadData (AVIFIL32.@)
388 HRESULT WINAPI AVIFileReadData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LPLONG size)
390 TRACE("(%p,'%4.4s',%p,%p)\n", pfile, (char*)&fcc, lp, size);
393 return AVIERR_BADHANDLE;
395 return IAVIFile_ReadData(pfile, fcc, lp, size);
398 /***********************************************************************
399 * AVIFileEndRecord (AVIFIL32.@)
401 HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile)
403 TRACE("(%p)\n", pfile);
406 return AVIERR_BADHANDLE;
408 return IAVIFile_EndRecord(pfile);
411 /***********************************************************************
412 * AVIStreamAddRef (AVIFIL32.@)
414 ULONG WINAPI AVIStreamAddRef(PAVISTREAM pstream)
416 TRACE("(%p)\n", pstream);
418 if (pstream == NULL) {
419 ERR(": bad handle passed!\n");
423 return IAVIStream_AddRef(pstream);
426 /***********************************************************************
427 * AVIStreamRelease (AVIFIL32.@)
429 ULONG WINAPI AVIStreamRelease(PAVISTREAM pstream)
431 TRACE("(%p)\n", pstream);
433 if (pstream == NULL) {
434 ERR(": bad handle passed!\n");
438 return IAVIStream_Release(pstream);
441 HRESULT WINAPI AVIStreamCreate(PAVISTREAM *ppavi, LONG lParam1, LONG lParam2,
442 LPCLSID pclsidHandler)
446 TRACE("(%p,0x%08lX,0x%08lX,%s)\n", ppavi, lParam1, lParam2,
447 debugstr_guid(pclsidHandler));
450 return AVIERR_BADPARAM;
453 if (pclsidHandler == NULL)
454 return AVIERR_UNSUPPORTED;
456 hr = SHCoCreateInstance(NULL, pclsidHandler, NULL,
457 &IID_IAVIStream, (LPVOID*)ppavi);
458 if (FAILED(hr) || *ppavi == NULL)
461 hr = IAVIStream_Create(*ppavi, lParam1, lParam2);
463 IAVIStream_Release(*ppavi);
470 /***********************************************************************
471 * AVIStreamInfoA (AVIFIL32.@)
473 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
479 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
482 return AVIERR_BADHANDLE;
483 if (size < sizeof(AVISTREAMINFOA))
484 return AVIERR_BADSIZE;
486 hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
488 memcpy(asi, &asiw, sizeof(asiw) - sizeof(asiw.szName));
489 WideCharToMultiByte(CP_ACP, 0, asiw.szName, -1, asi->szName,
490 sizeof(asi->szName), NULL, NULL);
491 asi->szName[sizeof(asi->szName) - 1] = 0;
496 /***********************************************************************
497 * AVIStreamInfoW (AVIFIL32.@)
499 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
502 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
505 return AVIERR_BADHANDLE;
507 return IAVIStream_Info(pstream, asi, size);
510 /***********************************************************************
511 * AVIStreamFindSample (AVIFIL32.@)
513 HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags)
515 TRACE("(%p,%ld,0x%lX)\n", pstream, pos, flags);
520 return IAVIStream_FindSample(pstream, pos, flags);
523 /***********************************************************************
524 * AVIStreamReadFormat (AVIFIL32.@)
526 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos,
527 LPVOID format, LPLONG formatsize)
529 TRACE("(%p,%ld,%p,%p)\n", pstream, pos, format, formatsize);
532 return AVIERR_BADHANDLE;
534 return IAVIStream_ReadFormat(pstream, pos, format, formatsize);
537 /***********************************************************************
538 * AVIStreamSetFormat (AVIFIL32.@)
540 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos,
541 LPVOID format, LONG formatsize)
543 TRACE("(%p,%ld,%p,%ld)\n", pstream, pos, format, formatsize);
546 return AVIERR_BADHANDLE;
548 return IAVIStream_SetFormat(pstream, pos, format, formatsize);
551 /***********************************************************************
552 * AVIStreamRead (AVIFIL32.@)
554 HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples,
555 LPVOID buffer, LONG buffersize,
556 LPLONG bytesread, LPLONG samplesread)
558 TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", pstream, start, samples, buffer,
559 buffersize, bytesread, samplesread);
562 return AVIERR_BADHANDLE;
564 return IAVIStream_Read(pstream, start, samples, buffer, buffersize,
565 bytesread, samplesread);
568 /***********************************************************************
569 * AVIStreamWrite (AVIFIL32.@)
571 HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples,
572 LPVOID buffer, LONG buffersize, DWORD flags,
573 LPLONG sampwritten, LPLONG byteswritten)
575 TRACE("(%p,%ld,%ld,%p,%ld,0x%lX,%p,%p)\n", pstream, start, samples, buffer,
576 buffersize, flags, sampwritten, byteswritten);
579 return AVIERR_BADHANDLE;
581 return IAVIStream_Write(pstream, start, samples, buffer, buffersize,
582 flags, sampwritten, byteswritten);
585 /***********************************************************************
586 * AVIStreamReadData (AVIFIL32.@)
588 HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
591 TRACE("(%p,'%4.4s',%p,%p)\n", pstream, (char*)&fcc, lp, lpread);
594 return AVIERR_BADHANDLE;
596 return IAVIStream_ReadData(pstream, fcc, lp, lpread);
599 /***********************************************************************
600 * AVIStreamWriteData (AVIFIL32.@)
602 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
605 TRACE("(%p,'%4.4s',%p,%ld)\n", pstream, (char*)&fcc, lp, size);
608 return AVIERR_BADHANDLE;
610 return IAVIStream_WriteData(pstream, fcc, lp, size);
613 /***********************************************************************
614 * AVIStreamGetFrameOpen (AVIFIL32.@)
616 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream,
617 LPBITMAPINFOHEADER lpbiWanted)
621 TRACE("(%p,%p)\n", pstream, lpbiWanted);
623 if (FAILED(IAVIStream_QueryInterface(pstream, &IID_IGetFrame, (LPVOID*)&pg)) ||
625 pg = AVIFILE_CreateGetFrame(pstream);
630 if (FAILED(IGetFrame_SetFormat(pg, lpbiWanted, NULL, 0, 0, -1, -1))) {
631 IGetFrame_Release(pg);
638 /***********************************************************************
639 * AVIStreamGetFrame (AVIFIL32.@)
641 LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
643 TRACE("(%p,%ld)\n", pg, pos);
648 return IGetFrame_GetFrame(pg, pos);
651 /***********************************************************************
652 * AVIStreamGetFrameClose (AVIFIL32.@)
654 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg)
659 return IGetFrame_Release(pg);
663 /***********************************************************************
664 * AVIMakeCompressedStream (AVIFIL32.@)
666 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,
668 LPAVICOMPRESSOPTIONS aco,
669 LPCLSID pclsidHandler)
676 LONG size = sizeof(szValue);
678 TRACE("(%p,%p,%p,%s)\n", ppsCompressed, psSource, aco,
679 debugstr_guid(pclsidHandler));
681 if (ppsCompressed == NULL)
682 return AVIERR_BADPARAM;
683 if (psSource == NULL)
684 return AVIERR_BADHANDLE;
686 *ppsCompressed = NULL;
688 /* if no handler given get default ones based on streamtype */
689 if (pclsidHandler == NULL) {
690 hr = IAVIStream_Info(psSource, &asiw, sizeof(asiw));
694 wsprintfA(szRegKey, "AVIFile\\Compressors\\%4.4s", (char*)&asiw.fccHandler);
695 if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &size) != ERROR_SUCCESS)
696 return AVIERR_UNSUPPORTED;
697 if (AVIFILE_CLSIDFromString(szValue, &clsidHandler) != S_OK)
698 return AVIERR_UNSUPPORTED;
700 memcpy(&clsidHandler, pclsidHandler, sizeof(clsidHandler));
702 hr = SHCoCreateInstance(NULL, &clsidHandler, NULL,
703 &IID_IAVIStream, (LPVOID*)ppsCompressed);
704 if (FAILED(hr) || *ppsCompressed == NULL)
707 hr = IAVIStream_Create(*ppsCompressed, (LPARAM)psSource, (LPARAM)aco);
709 IAVIStream_Release(*ppsCompressed);
710 *ppsCompressed = NULL;
716 /***********************************************************************
717 * AVIStreamOpenFromFileA (AVIFIL32.@)
719 HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
720 DWORD fccType, LONG lParam,
721 UINT mode, LPCLSID pclsidHandler)
723 PAVIFILE pfile = NULL;
726 TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_a(szFile),
727 (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
729 if (ppavi == NULL || szFile == NULL)
730 return AVIERR_BADPARAM;
734 hr = AVIFileOpenA(&pfile, szFile, mode, pclsidHandler);
735 if (FAILED(hr) || pfile == NULL)
738 hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
739 IAVIFile_Release(pfile);
744 /***********************************************************************
745 * AVIStreamOpenFromFileW (AVIFIL32.@)
747 HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile,
748 DWORD fccType, LONG lParam,
749 UINT mode, LPCLSID pclsidHandler)
751 PAVIFILE pfile = NULL;
754 TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_w(szFile),
755 (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
757 if (ppavi == NULL || szFile == NULL)
758 return AVIERR_BADPARAM;
762 hr = AVIFileOpenW(&pfile, szFile, mode, pclsidHandler);
763 if (FAILED(hr) || pfile == NULL)
766 hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
767 IAVIFile_Release(pfile);
772 /***********************************************************************
773 * AVIStreamStart (AVIFIL32.@)
775 LONG WINAPI AVIStreamStart(PAVISTREAM pstream)
779 TRACE("(%p)\n", pstream);
784 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
790 /***********************************************************************
791 * AVIStreamLength (AVIFIL32.@)
793 LONG WINAPI AVIStreamLength(PAVISTREAM pstream)
797 TRACE("(%p)\n", pstream);
802 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
805 return asiw.dwLength;
808 /***********************************************************************
809 * AVIStreamSampleToTime (AVIFIL32.@)
811 LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample)
815 TRACE("(%p,%ld)\n", pstream, lSample);
820 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
822 if (asiw.dwRate == 0)
825 return (LONG)(((float)lSample * asiw.dwScale * 1000.0) / asiw.dwRate);
828 /***********************************************************************
829 * AVIStreamTimeToSample (AVIFIL32.@)
831 LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime)
835 TRACE("(%p,%ld)\n", pstream, lTime);
840 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
842 if (asiw.dwScale == 0)
845 return (LONG)(((float)lTime * asiw.dwRate) / asiw.dwScale / 1000.0);
848 /***********************************************************************
849 * AVIBuildFilterA (AVIFIL32.@)
851 HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
853 FIXME("(%p,%ld,%d): stub\n", szFilter, cbFilter, fSaving);
855 /* check parameters */
856 if (szFilter == NULL)
857 return AVIERR_BADPARAM;
859 return AVIERR_BADSIZE;
864 return AVIERR_UNSUPPORTED;
867 /***********************************************************************
868 * AVIBuildFilterW (AVIFIL32.@)
870 HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
872 FIXME("(%p,%ld,%d): stub\n", szFilter, cbFilter, fSaving);
874 /* check parameters */
875 if (szFilter == NULL)
876 return AVIERR_BADPARAM;
878 return AVIERR_BADSIZE;
883 return AVIERR_UNSUPPORTED;
886 /***********************************************************************
887 * AVISaveOptions (AVIFIL32.@)
889 BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStream,
890 PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *ppOptions)
892 FIXME("(%p,0x%X,%d,%p,%p): stub\n", hWnd, uFlags, nStream,
898 /***********************************************************************
899 * AVISaveOptionsFree (AVIFIL32.@)
901 HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions)
903 TRACE("(%d,%p)\n", nStreams, ppOptions);
905 if (nStreams < 0 || ppOptions == NULL)
906 return AVIERR_BADPARAM;
908 for (; nStreams > 0; nStreams--) {
909 if (ppOptions[nStreams] != NULL) {
910 ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
912 if (ppOptions[nStreams]->lpParms != NULL) {
913 GlobalFreePtr(ppOptions[nStreams]->lpParms);
914 ppOptions[nStreams]->lpParms = NULL;
915 ppOptions[nStreams]->cbParms = 0;
917 if (ppOptions[nStreams]->lpFormat != NULL) {
918 GlobalFreePtr(ppOptions[nStreams]->lpFormat);
919 ppOptions[nStreams]->lpFormat = NULL;
920 ppOptions[nStreams]->cbFormat = 0;