ReactOS 0.4.17-dev-769-g1500a35
api.c
Go to the documentation of this file.
1/*
2 * Copyright 1999 Marcus Meissner
3 * Copyright 2002-2003 Michael Günnewig
4 *
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.
9 *
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.
14 *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#define COBJMACROS
23
24#include "windef.h"
25#include "winbase.h"
26#include "winnls.h"
27#include "wingdi.h"
28#include "winuser.h"
29#include "winreg.h"
30#include "winerror.h"
31
32#include "ole2.h"
33#include "shellapi.h"
34#include "shlobj.h"
35#include "vfw.h"
36#include "msacm.h"
37
38#include "avifile_private.h"
39
40#include "wine/debug.h"
41
43
44
45/***********************************************************************
46 * for AVIBuildFilterW -- uses fixed size table
47 */
48#define MAX_FILTERS 30 /* 30 => 7kB */
49
50typedef struct _AVIFilter {
54
55/***********************************************************************
56 * for AVISaveOptions
57 */
58static struct {
65
66/***********************************************************************
67 * copied from dlls/ole32/compobj.c
68 */
70{
71 BYTE const *s;
72 BYTE *p;
73 INT i;
74 BYTE table[256];
75
76 if (!idstr) {
77 memset(id, 0, sizeof(CLSID));
78 return S_OK;
79 }
80
81 /* validate the CLSID string */
82 if (lstrlenA(idstr) != 38)
83 return CO_E_CLASSSTRING;
84
85 s = (BYTE const*)idstr;
86 if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
87 (s[24]!='-') || (s[37]!='}'))
88 return CO_E_CLASSSTRING;
89
90 for (i = 1; i < 37; i++) {
91 if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
92 continue;
93 if (!(((s[i] >= '0') && (s[i] <= '9')) ||
94 ((s[i] >= 'a') && (s[i] <= 'f')) ||
95 ((s[i] >= 'A') && (s[i] <= 'F')))
96 )
97 return CO_E_CLASSSTRING;
98 }
99
100 TRACE("%s -> %p\n", s, id);
101
102 /* quick lookup table */
103 memset(table, 0, 256);
104
105 for (i = 0; i < 10; i++)
106 table['0' + i] = i;
107
108 for (i = 0; i < 6; i++) {
109 table['A' + i] = i+10;
110 table['a' + i] = i+10;
111 }
112
113 /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
114 p = (BYTE *) id;
115
116 s++; /* skip leading brace */
117 for (i = 0; i < 4; i++) {
118 p[3 - i] = table[*s]<<4 | table[*(s+1)];
119 s += 2;
120 }
121 p += 4;
122 s++; /* skip - */
123
124 for (i = 0; i < 2; i++) {
125 p[1-i] = table[*s]<<4 | table[*(s+1)];
126 s += 2;
127 }
128 p += 2;
129 s++; /* skip - */
130
131 for (i = 0; i < 2; i++) {
132 p[1-i] = table[*s]<<4 | table[*(s+1)];
133 s += 2;
134 }
135 p += 2;
136 s++; /* skip - */
137
138 /* these are just sequential bytes */
139 for (i = 0; i < 2; i++) {
140 *p++ = table[*s]<<4 | table[*(s+1)];
141 s += 2;
142 }
143 s++; /* skip - */
144
145 for (i = 0; i < 6; i++) {
146 *p++ = table[*s]<<4 | table[*(s+1)];
147 s += 2;
148 }
149
150 return S_OK;
151}
152
154{
155 CHAR szRegKey[25];
156 CHAR szValue[100];
157 LPWSTR szExt = wcsrchr(szFile, '.');
158 LONG len = ARRAY_SIZE(szValue);
159
160 if (szExt == NULL)
161 return FALSE;
162
163 szExt++;
164
165 wsprintfA(szRegKey, "AVIFile\\Extensions\\%.3ls", szExt);
166 if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &len) != ERROR_SUCCESS)
167 return FALSE;
168
169 return (AVIFILE_CLSIDFromString(szValue, lpclsid) == S_OK);
170}
171
172/***********************************************************************
173 * AVIFileInit (AVIFIL32.@)
174 */
175void WINAPI AVIFileInit(void) {
177}
178
179/***********************************************************************
180 * AVIFileExit (AVIFIL32.@)
181 */
182void WINAPI AVIFileExit(void) {
183 /* need to free ole32.dll if we are the last exit call */
184 /* OleUninitialize() */
185 FIXME("(): stub!\n");
186}
187
188/***********************************************************************
189 * AVIFileOpen (AVIFIL32.@)
190 * AVIFileOpenA (AVIFIL32.@)
191 */
193 LPCLSID lpHandler)
194{
196 HRESULT hr;
197 int len;
198
199 TRACE("(%p,%s,0x%08X,%s)\n", ppfile, debugstr_a(szFile), uMode,
200 debugstr_guid(lpHandler));
201
202 /* check parameters */
203 if (ppfile == NULL || szFile == NULL)
204 return AVIERR_BADPARAM;
205
206 /* convert the ANSI string to Unicode and call the Unicode function */
207 len = MultiByteToWideChar(CP_ACP, 0, szFile, -1, NULL, 0);
208 if (len <= 0)
209 return AVIERR_BADPARAM;
210
211 wszFile = malloc(len * sizeof(WCHAR));
212 if (wszFile == NULL)
213 return AVIERR_MEMORY;
214
215 MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len);
216
217 hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
218
219 free(wszFile);
220
221 return hr;
222}
223
224/***********************************************************************
225 * AVIFileOpenW (AVIFIL32.@)
226 */
228 LPCLSID lpHandler)
229{
230 IPersistFile *ppersist = NULL;
231 CLSID clsidHandler;
232 HRESULT hr;
233
234 TRACE("(%p,%s,0x%X,%s)\n", ppfile, debugstr_w(szFile), uMode,
235 debugstr_guid(lpHandler));
236
237 /* check parameters */
238 if (ppfile == NULL || szFile == NULL)
239 return AVIERR_BADPARAM;
240
241 *ppfile = NULL;
242
243 /* if no handler then try guessing it by extension */
244 if (lpHandler == NULL) {
245 if (! AVIFILE_GetFileHandlerByExtension(szFile, &clsidHandler))
246 clsidHandler = CLSID_AVIFile;
247 } else
248 clsidHandler = *lpHandler;
249
250 /* create instance of handler */
251 hr = CoCreateInstance(&clsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIFile, (LPVOID*)ppfile);
252 if (FAILED(hr) || *ppfile == NULL)
253 return hr;
254
255 /* ask for IPersistFile interface for loading/creating the file */
256 hr = IAVIFile_QueryInterface(*ppfile, &IID_IPersistFile, (LPVOID*)&ppersist);
257 if (FAILED(hr) || ppersist == NULL) {
258 IAVIFile_Release(*ppfile);
259 *ppfile = NULL;
260 return hr;
261 }
262
263 hr = IPersistFile_Load(ppersist, szFile, uMode);
264 IPersistFile_Release(ppersist);
265 if (FAILED(hr)) {
266 IAVIFile_Release(*ppfile);
267 *ppfile = NULL;
268 }
269
270 return hr;
271}
272
273/***********************************************************************
274 * AVIFileAddRef (AVIFIL32.@)
275 */
277{
278 TRACE("(%p)\n", pfile);
279
280 if (pfile == NULL) {
281 ERR(": bad handle passed!\n");
282 return 0;
283 }
284
285 return IAVIFile_AddRef(pfile);
286}
287
288/***********************************************************************
289 * AVIFileRelease (AVIFIL32.@)
290 */
292{
293 TRACE("(%p)\n", pfile);
294
295 if (pfile == NULL) {
296 ERR(": bad handle passed!\n");
297 return 0;
298 }
299
300 return IAVIFile_Release(pfile);
301}
302
303/***********************************************************************
304 * AVIFileInfo (AVIFIL32.@)
305 * AVIFileInfoA (AVIFIL32.@)
306 */
308{
309 AVIFILEINFOW afiw;
311
312 TRACE("(%p,%p,%ld)\n", pfile, afi, size);
313
314 if (pfile == NULL)
315 return AVIERR_BADHANDLE;
316 if ((DWORD)size < sizeof(AVIFILEINFOA))
317 return AVIERR_BADSIZE;
318
319 hres = IAVIFile_Info(pfile, &afiw, sizeof(afiw));
320
321 memcpy(afi, &afiw, sizeof(*afi) - sizeof(afi->szFileType));
323 sizeof(afi->szFileType), NULL, NULL);
324 afi->szFileType[sizeof(afi->szFileType) - 1] = 0;
325
326 return hres;
327}
328
329/***********************************************************************
330 * AVIFileInfoW (AVIFIL32.@)
331 */
333{
334 TRACE("(%p,%p,%ld)\n", pfile, afiw, size);
335
336 if (pfile == NULL)
337 return AVIERR_BADHANDLE;
338
339 return IAVIFile_Info(pfile, afiw, size);
340}
341
342/***********************************************************************
343 * AVIFileGetStream (AVIFIL32.@)
344 */
346 DWORD fccType, LONG lParam)
347{
348 TRACE("(%p,%p,'%4.4s',%ld)\n", pfile, avis, (char*)&fccType, lParam);
349
350 if (pfile == NULL)
351 return AVIERR_BADHANDLE;
352
353 return IAVIFile_GetStream(pfile, avis, fccType, lParam);
354}
355
356/***********************************************************************
357 * AVIFileCreateStream (AVIFIL32.@)
358 * AVIFileCreateStreamA (AVIFIL32.@)
359 */
362{
363 AVISTREAMINFOW psiw;
364
365 TRACE("(%p,%p,%p)\n", pfile, ppavi, psi);
366
367 if (pfile == NULL)
368 return AVIERR_BADHANDLE;
369
370 /* Only the szName at the end is different */
371 memcpy(&psiw, psi, sizeof(*psi) - sizeof(psi->szName));
372 MultiByteToWideChar(CP_ACP, 0, psi->szName, -1, psiw.szName,
373 ARRAY_SIZE(psiw.szName));
374
375 return IAVIFile_CreateStream(pfile, ppavi, &psiw);
376}
377
378/***********************************************************************
379 * AVIFileCreateStreamW (AVIFIL32.@)
380 */
383{
384 TRACE("(%p,%p,%p)\n", pfile, avis, asi);
385
386 if (pfile == NULL)
387 return AVIERR_BADHANDLE;
388
389 return IAVIFile_CreateStream(pfile, avis, asi);
390}
391
392/***********************************************************************
393 * AVIFileWriteData (AVIFIL32.@)
394 */
396{
397 TRACE("(%p,'%4.4s',%p,%ld)\n", pfile, (char*)&fcc, lp, size);
398
399 if (pfile == NULL)
400 return AVIERR_BADHANDLE;
401
402 return IAVIFile_WriteData(pfile, fcc, lp, size);
403}
404
405/***********************************************************************
406 * AVIFileReadData (AVIFIL32.@)
407 */
409{
410 TRACE("(%p,'%4.4s',%p,%p)\n", pfile, (char*)&fcc, lp, size);
411
412 if (pfile == NULL)
413 return AVIERR_BADHANDLE;
414
415 return IAVIFile_ReadData(pfile, fcc, lp, size);
416}
417
418/***********************************************************************
419 * AVIFileEndRecord (AVIFIL32.@)
420 */
422{
423 TRACE("(%p)\n", pfile);
424
425 if (pfile == NULL)
426 return AVIERR_BADHANDLE;
427
428 return IAVIFile_EndRecord(pfile);
429}
430
431/***********************************************************************
432 * AVIStreamAddRef (AVIFIL32.@)
433 */
435{
436 TRACE("(%p)\n", pstream);
437
438 if (pstream == NULL) {
439 ERR(": bad handle passed!\n");
440 return 0;
441 }
442
443 return IAVIStream_AddRef(pstream);
444}
445
446/***********************************************************************
447 * AVIStreamRelease (AVIFIL32.@)
448 */
450{
451 TRACE("(%p)\n", pstream);
452
453 if (pstream == NULL) {
454 ERR(": bad handle passed!\n");
455 return 0;
456 }
457
458 return IAVIStream_Release(pstream);
459}
460
461/***********************************************************************
462 * AVIStreamCreate (AVIFIL32.@)
463 */
465 LPCLSID pclsidHandler)
466{
467 HRESULT hr;
468
469 TRACE("(%p,0x%08lX,0x%08lX,%s)\n", ppavi, lParam1, lParam2,
470 debugstr_guid(pclsidHandler));
471
472 if (ppavi == NULL)
473 return AVIERR_BADPARAM;
474
475 *ppavi = NULL;
476 if (pclsidHandler == NULL)
477 return AVIERR_UNSUPPORTED;
478
479 hr = CoCreateInstance(pclsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIStream, (LPVOID*)ppavi);
480 if (FAILED(hr) || *ppavi == NULL)
481 return hr;
482
483 hr = IAVIStream_Create(*ppavi, lParam1, lParam2);
484 if (FAILED(hr)) {
485 IAVIStream_Release(*ppavi);
486 *ppavi = NULL;
487 }
488
489 return hr;
490}
491
492/***********************************************************************
493 * AVIStreamInfo (AVIFIL32.@)
494 * AVIStreamInfoA (AVIFIL32.@)
495 */
497 LONG size)
498{
499 AVISTREAMINFOW asiw;
501
502 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
503
504 if (pstream == NULL)
505 return AVIERR_BADHANDLE;
506 if ((DWORD)size < sizeof(AVISTREAMINFOA))
507 return AVIERR_BADSIZE;
508
509 hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
510
511 memcpy(asi, &asiw, sizeof(asiw) - sizeof(asiw.szName));
512 WideCharToMultiByte(CP_ACP, 0, asiw.szName, -1, asi->szName,
513 sizeof(asi->szName), NULL, NULL);
514 asi->szName[sizeof(asi->szName) - 1] = 0;
515
516 return hres;
517}
518
519/***********************************************************************
520 * AVIStreamInfoW (AVIFIL32.@)
521 */
523 LONG size)
524{
525 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
526
527 if (pstream == NULL)
528 return AVIERR_BADHANDLE;
529
530 return IAVIStream_Info(pstream, asi, size);
531}
532
533/***********************************************************************
534 * AVIStreamFindSample (AVIFIL32.@)
535 */
537{
538 TRACE("(%p,%ld,0x%lX)\n", pstream, pos, flags);
539
540 if (pstream == NULL)
541 return -1;
542
543 return IAVIStream_FindSample(pstream, pos, flags);
544}
545
546/***********************************************************************
547 * AVIStreamReadFormat (AVIFIL32.@)
548 */
550 LPVOID format, LPLONG formatsize)
551{
552 TRACE("(%p,%ld,%p,%p)\n", pstream, pos, format, formatsize);
553
554 if (pstream == NULL)
555 return AVIERR_BADHANDLE;
556
557 return IAVIStream_ReadFormat(pstream, pos, format, formatsize);
558}
559
560/***********************************************************************
561 * AVIStreamSetFormat (AVIFIL32.@)
562 */
564 LPVOID format, LONG formatsize)
565{
566 TRACE("(%p,%ld,%p,%ld)\n", pstream, pos, format, formatsize);
567
568 if (pstream == NULL)
569 return AVIERR_BADHANDLE;
570
571 return IAVIStream_SetFormat(pstream, pos, format, formatsize);
572}
573
574/***********************************************************************
575 * AVIStreamRead (AVIFIL32.@)
576 */
578 LPVOID buffer, LONG buffersize,
579 LPLONG bytesread, LPLONG samplesread)
580{
581 TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", pstream, start, samples, buffer,
582 buffersize, bytesread, samplesread);
583
584 if (pstream == NULL)
585 return AVIERR_BADHANDLE;
586
587 return IAVIStream_Read(pstream, start, samples, buffer, buffersize,
588 bytesread, samplesread);
589}
590
591/***********************************************************************
592 * AVIStreamWrite (AVIFIL32.@)
593 */
595 LPVOID buffer, LONG buffersize, DWORD flags,
596 LPLONG sampwritten, LPLONG byteswritten)
597{
598 TRACE("(%p,%ld,%ld,%p,%ld,0x%lX,%p,%p)\n", pstream, start, samples, buffer,
599 buffersize, flags, sampwritten, byteswritten);
600
601 if (pstream == NULL)
602 return AVIERR_BADHANDLE;
603
604 return IAVIStream_Write(pstream, start, samples, buffer, buffersize,
605 flags, sampwritten, byteswritten);
606}
607
608/***********************************************************************
609 * AVIStreamReadData (AVIFIL32.@)
610 */
612 LPLONG lpread)
613{
614 TRACE("(%p,'%4.4s',%p,%p)\n", pstream, (char*)&fcc, lp, lpread);
615
616 if (pstream == NULL)
617 return AVIERR_BADHANDLE;
618
619 return IAVIStream_ReadData(pstream, fcc, lp, lpread);
620}
621
622/***********************************************************************
623 * AVIStreamWriteData (AVIFIL32.@)
624 */
626 LONG size)
627{
628 TRACE("(%p,'%4.4s',%p,%ld)\n", pstream, (char*)&fcc, lp, size);
629
630 if (pstream == NULL)
631 return AVIERR_BADHANDLE;
632
633 return IAVIStream_WriteData(pstream, fcc, lp, size);
634}
635
636/***********************************************************************
637 * AVIStreamGetFrameOpen (AVIFIL32.@)
638 */
640 LPBITMAPINFOHEADER lpbiWanted)
641{
642 PGETFRAME pg = NULL;
643
644 TRACE("(%p,%p)\n", pstream, lpbiWanted);
645
646 if (FAILED(IAVIStream_QueryInterface(pstream, &IID_IGetFrame, (LPVOID*)&pg)) ||
647 pg == NULL) {
648 pg = AVIFILE_CreateGetFrame(pstream);
649 if (pg == NULL)
650 return NULL;
651 }
652
653 if (FAILED(IGetFrame_SetFormat(pg, lpbiWanted, NULL, 0, 0, -1, -1))) {
655 return NULL;
656 }
657
658 return pg;
659}
660
661/***********************************************************************
662 * AVIStreamGetFrame (AVIFIL32.@)
663 */
665{
666 TRACE("(%p,%ld)\n", pg, pos);
667
668 if (pg == NULL)
669 return NULL;
670
671 return IGetFrame_GetFrame(pg, pos);
672}
673
674/***********************************************************************
675 * AVIStreamGetFrameClose (AVIFIL32.@)
676 */
678{
679 TRACE("(%p)\n", pg);
680
681 if (pg != NULL)
682 return IGetFrame_Release(pg);
683 return 0;
684}
685
686/***********************************************************************
687 * AVIMakeCompressedStream (AVIFIL32.@)
688 */
690 PAVISTREAM psSource,
692 LPCLSID pclsidHandler)
693{
694 AVISTREAMINFOW asiw;
695 CHAR szRegKey[25];
696 CHAR szValue[100];
697 CLSID clsidHandler;
698 HRESULT hr;
699 LONG size = sizeof(szValue);
700
701 TRACE("(%p,%p,%p,%s)\n", ppsCompressed, psSource, aco,
702 debugstr_guid(pclsidHandler));
703
704 if (ppsCompressed == NULL)
705 return AVIERR_BADPARAM;
706 if (psSource == NULL)
707 return AVIERR_BADHANDLE;
708
709 *ppsCompressed = NULL;
710
711 /* if no handler given get default ones based on streamtype */
712 if (pclsidHandler == NULL) {
713 hr = IAVIStream_Info(psSource, &asiw, sizeof(asiw));
714 if (FAILED(hr))
715 return hr;
716
717 wsprintfA(szRegKey, "AVIFile\\Compressors\\%4.4s", (char*)&asiw.fccType);
718 if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &size) != ERROR_SUCCESS)
719 return AVIERR_UNSUPPORTED;
720 if (AVIFILE_CLSIDFromString(szValue, &clsidHandler) != S_OK)
721 return AVIERR_UNSUPPORTED;
722 } else
723 clsidHandler = *pclsidHandler;
724
725 hr = CoCreateInstance(&clsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIStream, (LPVOID*)ppsCompressed);
726 if (FAILED(hr) || *ppsCompressed == NULL)
727 return hr;
728
729 hr = IAVIStream_Create(*ppsCompressed, (LPARAM)psSource, (LPARAM)aco);
730 if (FAILED(hr)) {
731 IAVIStream_Release(*ppsCompressed);
732 *ppsCompressed = NULL;
733 }
734
735 return hr;
736}
737
738/***********************************************************************
739 * AVIMakeFileFromStreams (AVIFIL32.@)
740 */
742 PAVISTREAM *ppStreams)
743{
744 TRACE("(%p,%d,%p)\n", ppfile, nStreams, ppStreams);
745
746 if (nStreams < 0 || ppfile == NULL || ppStreams == NULL)
747 return AVIERR_BADPARAM;
748
749 *ppfile = AVIFILE_CreateAVITempFile(nStreams, ppStreams);
750 if (*ppfile == NULL)
751 return AVIERR_MEMORY;
752
753 return AVIERR_OK;
754}
755
756/***********************************************************************
757 * AVIStreamOpenFromFile (AVIFIL32.@)
758 * AVIStreamOpenFromFileA (AVIFIL32.@)
759 */
761 DWORD fccType, LONG lParam,
762 UINT mode, LPCLSID pclsidHandler)
763{
764 PAVIFILE pfile = NULL;
765 HRESULT hr;
766
767 TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_a(szFile),
768 (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
769
770 if (ppavi == NULL || szFile == NULL)
771 return AVIERR_BADPARAM;
772
773 *ppavi = NULL;
774
775 hr = AVIFileOpenA(&pfile, szFile, mode, pclsidHandler);
776 if (FAILED(hr) || pfile == NULL)
777 return hr;
778
779 hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
780 IAVIFile_Release(pfile);
781
782 return hr;
783}
784
785/***********************************************************************
786 * AVIStreamOpenFromFileW (AVIFIL32.@)
787 */
789 DWORD fccType, LONG lParam,
790 UINT mode, LPCLSID pclsidHandler)
791{
792 PAVIFILE pfile = NULL;
793 HRESULT hr;
794
795 TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_w(szFile),
796 (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
797
798 if (ppavi == NULL || szFile == NULL)
799 return AVIERR_BADPARAM;
800
801 *ppavi = NULL;
802
803 hr = AVIFileOpenW(&pfile, szFile, mode, pclsidHandler);
804 if (FAILED(hr) || pfile == NULL)
805 return hr;
806
807 hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
808 IAVIFile_Release(pfile);
809
810 return hr;
811}
812
813/***********************************************************************
814 * AVIStreamBeginStreaming (AVIFIL32.@)
815 */
817{
818 IAVIStreaming* pstream = NULL;
819 HRESULT hr;
820
821 TRACE("(%p,%ld,%ld,%ld)\n", pavi, lStart, lEnd, lRate);
822
823 if (pavi == NULL)
824 return AVIERR_BADHANDLE;
825
826 hr = IAVIStream_QueryInterface(pavi, &IID_IAVIStreaming, (LPVOID*)&pstream);
827 if (SUCCEEDED(hr) && pstream != NULL) {
828 hr = IAVIStreaming_Begin(pstream, lStart, lEnd, lRate);
829 IAVIStreaming_Release(pstream);
830 } else
831 hr = AVIERR_OK;
832
833 return hr;
834}
835
836/***********************************************************************
837 * AVIStreamEndStreaming (AVIFIL32.@)
838 */
840{
841 IAVIStreaming* pstream = NULL;
842 HRESULT hr;
843
844 TRACE("(%p)\n", pavi);
845
846 hr = IAVIStream_QueryInterface(pavi, &IID_IAVIStreaming, (LPVOID*)&pstream);
847 if (SUCCEEDED(hr) && pstream != NULL) {
848 IAVIStreaming_End(pstream);
849 IAVIStreaming_Release(pstream);
850 }
851
852 return AVIERR_OK;
853}
854
855/***********************************************************************
856 * AVIStreamStart (AVIFIL32.@)
857 */
859{
860 AVISTREAMINFOW asiw;
861
862 TRACE("(%p)\n", pstream);
863
864 if (pstream == NULL)
865 return 0;
866
867 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
868 return 0;
869
870 return asiw.dwStart;
871}
872
873/***********************************************************************
874 * AVIStreamLength (AVIFIL32.@)
875 */
877{
878 AVISTREAMINFOW asiw;
879
880 TRACE("(%p)\n", pstream);
881
882 if (pstream == NULL)
883 return 0;
884
885 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
886 return 0;
887
888 return asiw.dwLength;
889}
890
891/***********************************************************************
892 * AVIStreamSampleToTime (AVIFIL32.@)
893 */
895{
896 AVISTREAMINFOW asiw;
897 LONG time;
898
899 TRACE("(%p,%ld)\n", pstream, lSample);
900
901 if (pstream == NULL)
902 return -1;
903
904 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
905 return -1;
906 if (asiw.dwRate == 0)
907 return -1;
908
909 /* limit to stream bounds */
910 if (lSample < asiw.dwStart)
911 lSample = asiw.dwStart;
912 if (lSample > asiw.dwStart + asiw.dwLength)
913 lSample = asiw.dwStart + asiw.dwLength;
914
915 if (asiw.dwRate / asiw.dwScale < 1000)
916 time = (LONG)(((float)lSample * asiw.dwScale * 1000) / asiw.dwRate);
917 else
918 time = (LONG)(((float)lSample * asiw.dwScale * 1000 + (asiw.dwRate - 1)) / asiw.dwRate);
919
920 TRACE(" -> %ld\n",time);
921 return time;
922}
923
924/***********************************************************************
925 * AVIStreamTimeToSample (AVIFIL32.@)
926 */
928{
929 AVISTREAMINFOW asiw;
930 ULONG sample;
931
932 TRACE("(%p,%ld)\n", pstream, lTime);
933
934 if (pstream == NULL || lTime < 0)
935 return -1;
936
937 if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
938 return -1;
939 if (asiw.dwScale == 0)
940 return -1;
941
942 if (asiw.dwRate / asiw.dwScale < 1000)
943 sample = (LONG)((((float)asiw.dwRate * lTime) / (asiw.dwScale * 1000)));
944 else
945 sample = (LONG)(((float)asiw.dwRate * lTime + (asiw.dwScale * 1000 - 1)) / (asiw.dwScale * 1000));
946
947 /* limit to stream bounds */
948 if (sample < asiw.dwStart)
949 sample = asiw.dwStart;
950 if (sample > asiw.dwStart + asiw.dwLength)
951 sample = asiw.dwStart + asiw.dwLength;
952
953 TRACE(" -> %ld\n", sample);
954 return sample;
955}
956
957/***********************************************************************
958 * AVIBuildFilter (AVIFIL32.@)
959 * AVIBuildFilterA (AVIFIL32.@)
960 */
962{
964 HRESULT hr;
965
966 TRACE("(%p,%ld,%d)\n", szFilter, cbFilter, fSaving);
967
968 /* check parameters */
969 if (szFilter == NULL)
970 return AVIERR_BADPARAM;
971 if (cbFilter < 2)
972 return AVIERR_BADSIZE;
973
974 szFilter[0] = 0;
975 szFilter[1] = 0;
976
977 wszFilter = malloc(cbFilter * sizeof(WCHAR));
978 if (wszFilter == NULL)
979 return AVIERR_MEMORY;
980
981 hr = AVIBuildFilterW(wszFilter, cbFilter, fSaving);
982 if (SUCCEEDED(hr)) {
984 szFilter, cbFilter, NULL, NULL);
985 }
986
988
989 return hr;
990}
991
992/***********************************************************************
993 * AVIBuildFilterW (AVIFIL32.@)
994 */
996{
997 static const WCHAR all_files[] = L"*.*\0";
998
999 AVIFilter *lp;
1000 WCHAR szAllFiles[40];
1001 WCHAR szFileExt[10];
1002 WCHAR szValue[128];
1003 HKEY hKey;
1004 DWORD n, i;
1005 LONG size;
1006 DWORD count = 0;
1007
1008 TRACE("(%p,%ld,%d)\n", szFilter, cbFilter, fSaving);
1009
1010 /* check parameters */
1011 if (szFilter == NULL)
1012 return AVIERR_BADPARAM;
1013 if (cbFilter < 2)
1014 return AVIERR_BADSIZE;
1015
1016 lp = calloc(MAX_FILTERS, sizeof(AVIFilter));
1017 if (lp == NULL)
1018 return AVIERR_MEMORY;
1019
1020 /*
1021 * 1. iterate over HKEY_CLASSES_ROOT\\AVIFile\\Extensions and collect
1022 * extensions and CLSIDs
1023 * 2. iterate over collected CLSIDs and copy its description and its
1024 * extensions to szFilter if it fits
1025 *
1026 * First filter is named "All multimedia files" and its filter is a
1027 * collection of all possible extensions except "*.*".
1028 */
1029 if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"AVIFile\\Extensions", &hKey) != ERROR_SUCCESS) {
1030 free(lp);
1031 return AVIERR_ERROR;
1032 }
1033 for (n = 0;RegEnumKeyW(hKey, n, szFileExt, ARRAY_SIZE(szFileExt)) == ERROR_SUCCESS;n++) {
1034 WCHAR clsidW[40];
1035
1036 /* get CLSID to extension */
1037 size = sizeof(clsidW);
1038 if (RegQueryValueW(hKey, szFileExt, clsidW, &size) != ERROR_SUCCESS)
1039 break;
1040
1041 /* search if the CLSID is already known */
1042 for (i = 1; i <= count; i++) {
1043 if (lstrcmpW(lp[i].szClsid, clsidW) == 0)
1044 break; /* a new one */
1045 }
1046
1047 if (i == count + 1) {
1048 /* it's a new CLSID */
1049
1050 /* FIXME: How do we get info's about read/write capabilities? */
1051
1052 if (count >= MAX_FILTERS) {
1053 /* try to inform user of our full fixed size table */
1054 ERR(": More than %d filters found! Adjust MAX_FILTERS in dlls/avifil32/api.c\n", MAX_FILTERS);
1055 break;
1056 }
1057
1058 lstrcpyW(lp[i].szClsid, clsidW);
1059
1060 count++;
1061 }
1062
1063 /* append extension to the filter */
1064 wsprintfW(szValue, L";*.%s", szFileExt);
1065 if (lp[i].szExtensions[0] == 0)
1066 lstrcatW(lp[i].szExtensions, szValue + 1);
1067 else
1068 lstrcatW(lp[i].szExtensions, szValue);
1069
1070 /* also append to the "all multimedia"-filter */
1071 if (lp[0].szExtensions[0] == 0)
1072 lstrcatW(lp[0].szExtensions, szValue + 1);
1073 else
1074 lstrcatW(lp[0].szExtensions, szValue);
1075 }
1077
1078 /* 2. get descriptions for the CLSIDs and fill out szFilter */
1079 if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"CLSID", &hKey) != ERROR_SUCCESS) {
1080 free(lp);
1081 return AVIERR_ERROR;
1082 }
1083 for (n = 0; n <= count; n++) {
1084 /* first the description */
1085 if (n != 0) {
1086 size = sizeof(szValue);
1087 if (RegQueryValueW(hKey, lp[n].szClsid, szValue, &size) == ERROR_SUCCESS) {
1088 size = lstrlenW(szValue);
1089 lstrcpynW(szFilter, szValue, cbFilter);
1090 }
1091 } else
1093
1094 /* check for enough space */
1095 size++;
1096 if (cbFilter < size + lstrlenW(lp[n].szExtensions) + 2) {
1097 szFilter[0] = 0;
1098 szFilter[1] = 0;
1099 free(lp);
1101 return AVIERR_BUFFERTOOSMALL;
1102 }
1103 cbFilter -= size;
1104 szFilter += size;
1105
1106 /* and then the filter */
1107 lstrcpynW(szFilter, lp[n].szExtensions, cbFilter);
1108 size = lstrlenW(lp[n].szExtensions) + 1;
1109 cbFilter -= size;
1110 szFilter += size;
1111 }
1112
1114 free(lp);
1115
1116 /* add "All files" "*.*" filter if enough space left */
1118 ARRAY_SIZE(szAllFiles) - ARRAY_SIZE(all_files)) + 1;
1119 memcpy( szAllFiles + size, all_files, sizeof(all_files) );
1121
1122 if (cbFilter > size) {
1123 memcpy(szFilter, szAllFiles, size * sizeof(szAllFiles[0]));
1124 return AVIERR_OK;
1125 } else {
1126 szFilter[0] = 0;
1127 return AVIERR_BUFFERTOOSMALL;
1128 }
1129}
1130
1132{
1133 LPAVICOMPRESSOPTIONS pOptions = SaveOpts.ppOptions[SaveOpts.nCurrent];
1134 AVISTREAMINFOW sInfo;
1135
1136 TRACE("(%p)\n", hWnd);
1137
1138 if (pOptions == NULL || SaveOpts.ppavis[SaveOpts.nCurrent] == NULL) {
1139 ERR(": bad state!\n");
1140 return FALSE;
1141 }
1142
1143 if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent],
1144 &sInfo, sizeof(sInfo)))) {
1145 ERR(": AVIStreamInfoW failed!\n");
1146 return FALSE;
1147 }
1148
1149 if (sInfo.fccType == streamtypeVIDEO) {
1150 COMPVARS cv;
1151 BOOL ret;
1152
1153 memset(&cv, 0, sizeof(cv));
1154
1155 if ((pOptions->dwFlags & AVICOMPRESSF_VALID) == 0) {
1156 memset(pOptions, 0, sizeof(AVICOMPRESSOPTIONS));
1157 pOptions->fccType = streamtypeVIDEO;
1158 pOptions->fccHandler = comptypeDIB;
1159 pOptions->dwQuality = (DWORD)ICQUALITY_DEFAULT;
1160 }
1161
1162 cv.cbSize = sizeof(cv);
1163 cv.dwFlags = ICMF_COMPVARS_VALID;
1164 /*cv.fccType = pOptions->fccType; */
1165 cv.fccHandler = pOptions->fccHandler;
1166 cv.lQ = pOptions->dwQuality;
1167 cv.lpState = pOptions->lpParms;
1168 cv.cbState = pOptions->cbParms;
1169 if (pOptions->dwFlags & AVICOMPRESSF_KEYFRAMES)
1170 cv.lKey = pOptions->dwKeyFrameEvery;
1171 else
1172 cv.lKey = 0;
1173 if (pOptions->dwFlags & AVICOMPRESSF_DATARATE)
1174 cv.lDataRate = pOptions->dwBytesPerSecond / 1024; /* need kBytes */
1175 else
1176 cv.lDataRate = 0;
1177
1179 SaveOpts.ppavis[SaveOpts.nCurrent], &cv, NULL);
1180
1181 if (ret) {
1182 pOptions->fccHandler = cv.fccHandler;
1183 pOptions->lpParms = cv.lpState;
1184 pOptions->cbParms = cv.cbState;
1185 pOptions->dwQuality = cv.lQ;
1186 if (cv.lKey != 0) {
1187 pOptions->dwKeyFrameEvery = cv.lKey;
1188 pOptions->dwFlags |= AVICOMPRESSF_KEYFRAMES;
1189 } else
1190 pOptions->dwFlags &= ~AVICOMPRESSF_KEYFRAMES;
1191 if (cv.lDataRate != 0) {
1192 pOptions->dwBytesPerSecond = cv.lDataRate * 1024; /* need bytes */
1193 pOptions->dwFlags |= AVICOMPRESSF_DATARATE;
1194 } else
1195 pOptions->dwFlags &= ~AVICOMPRESSF_DATARATE;
1196 pOptions->dwFlags |= AVICOMPRESSF_VALID;
1197 }
1199
1200 return ret;
1201 } else if (sInfo.fccType == streamtypeAUDIO) {
1202 ACMFORMATCHOOSEW afmtc;
1203 MMRESULT ret;
1204 LONG size;
1205
1206 /* FIXME: check ACM version -- Which version is needed? */
1207
1208 memset(&afmtc, 0, sizeof(afmtc));
1209 afmtc.cbStruct = sizeof(afmtc);
1210 afmtc.fdwStyle = 0;
1211 afmtc.hwndOwner = hWnd;
1212
1214 if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
1215 pOptions->lpFormat = malloc(size);
1216 if (!pOptions->lpFormat) return FALSE;
1217 pOptions->cbFormat = size;
1218 } else if (pOptions->cbFormat < (DWORD)size) {
1219 void *new_buffer = realloc(pOptions->lpFormat, size);
1220 if (!new_buffer) return FALSE;
1221 pOptions->lpFormat = new_buffer;
1222 pOptions->cbFormat = size;
1223 }
1224 afmtc.pwfx = pOptions->lpFormat;
1225 afmtc.cbwfx = pOptions->cbFormat;
1226
1227 size = 0;
1228 AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],
1229 sInfo.dwStart, &size);
1230 if (size < (LONG)sizeof(PCMWAVEFORMAT))
1231 size = sizeof(PCMWAVEFORMAT);
1232 afmtc.pwfxEnum = malloc(size);
1233 if (afmtc.pwfxEnum != NULL) {
1234 AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
1235 sInfo.dwStart, afmtc.pwfxEnum, &size);
1237 }
1238
1239 ret = acmFormatChooseW(&afmtc);
1240 if (ret == S_OK)
1241 pOptions->dwFlags |= AVICOMPRESSF_VALID;
1242
1243 free(afmtc.pwfxEnum);
1244 return ret == S_OK;
1245 } else {
1246 ERR(": unknown streamtype 0x%08lX\n", sInfo.fccType);
1247 return FALSE;
1248 }
1249}
1250
1252{
1253 WCHAR szFormat[128];
1254 AVISTREAMINFOW sInfo;
1256 LONG size;
1257
1258 TRACE("(%p)\n", hWnd);
1259
1261 if (SaveOpts.nCurrent < 0)
1262 return;
1263
1264 if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent], &sInfo, sizeof(sInfo))))
1265 return;
1266
1267 AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,&size);
1268 if (size > 0) {
1269 szFormat[0] = 0;
1270
1271 /* read format to build format description string */
1272 lpFormat = malloc(size);
1273 if (lpFormat != NULL) {
1274 if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
1275 if (sInfo.fccType == streamtypeVIDEO) {
1277 ICINFO icinfo;
1278
1279 wsprintfW(szFormat, L"%ldx%ldx%d", lpbi->biWidth,
1280 lpbi->biHeight, lpbi->biBitCount);
1281
1282 if (lpbi->biCompression != BI_RGB) {
1283 HIC hic;
1284
1287 if (hic != NULL) {
1288 if (ICGetInfo(hic, &icinfo, sizeof(icinfo)) == S_OK)
1289 lstrcatW(szFormat, icinfo.szDescription);
1290 ICClose(hic);
1291 }
1292 } else {
1294 icinfo.szDescription,
1295 ARRAY_SIZE(icinfo.szDescription));
1296 lstrcatW(szFormat, icinfo.szDescription);
1297 }
1298 } else if (sInfo.fccType == streamtypeAUDIO) {
1301
1302 memset(&aftd, 0, sizeof(aftd));
1303 memset(&afd, 0, sizeof(afd));
1304
1305 aftd.cbStruct = sizeof(aftd);
1306 aftd.dwFormatTag = afd.dwFormatTag =
1307 ((PWAVEFORMATEX)lpFormat)->wFormatTag;
1308 aftd.cbFormatSize = afd.cbwfx = size;
1309
1310 afd.cbStruct = sizeof(afd);
1311 afd.pwfx = lpFormat;
1312
1313 if (acmFormatTagDetailsW(NULL, &aftd,
1316 wsprintfW(szFormat, L"%s %s", afd.szFormat, aftd.szFormatTag);
1317 }
1318 }
1319 }
1320 free(lpFormat);
1321 }
1322
1323 /* set text for format description */
1325
1326 /* Disable option button for unsupported streamtypes */
1327 if (sInfo.fccType == streamtypeVIDEO ||
1328 sInfo.fccType == streamtypeAUDIO)
1330 else
1332 }
1333
1334}
1335
1338{
1339 DWORD dwInterleave;
1340 BOOL bIsInterleaved;
1341 INT n;
1342
1343 /*TRACE("(%p,%u,0x%04X,0x%08lX)\n", hWnd, uMsg, wParam, lParam);*/
1344
1345 switch (uMsg) {
1346 case WM_INITDIALOG:
1347 SaveOpts.nCurrent = 0;
1348 if (SaveOpts.nStreams == 1) {
1350 return TRUE;
1351 }
1352
1353 /* add streams */
1354 for (n = 0; n < SaveOpts.nStreams; n++) {
1355 AVISTREAMINFOW sInfo;
1356
1357 AVIStreamInfoW(SaveOpts.ppavis[n], &sInfo, sizeof(sInfo));
1359 0L, (LPARAM)sInfo.szName);
1360 }
1361
1362 /* select first stream */
1365
1366 /* initialize interleave */
1367 if (SaveOpts.ppOptions[0] != NULL &&
1368 (SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_VALID)) {
1369 bIsInterleaved = (SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_INTERLEAVE);
1370 dwInterleave = SaveOpts.ppOptions[0]->dwInterleaveEvery;
1371 } else {
1372 bIsInterleaved = TRUE;
1373 dwInterleave = 0;
1374 }
1375 CheckDlgButton(hWnd, IDC_INTERLEAVE, bIsInterleaved);
1378 break;
1379 case WM_COMMAND:
1380 switch (LOWORD(wParam)) {
1381 case IDOK:
1382 /* get data from controls and save them */
1383 dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
1384 bIsInterleaved = IsDlgButtonChecked(hWnd, IDC_INTERLEAVE);
1385 for (n = 0; n < SaveOpts.nStreams; n++) {
1386 if (SaveOpts.ppOptions[n] != NULL) {
1387 if (bIsInterleaved) {
1388 SaveOpts.ppOptions[n]->dwFlags |= AVICOMPRESSF_INTERLEAVE;
1389 SaveOpts.ppOptions[n]->dwInterleaveEvery = dwInterleave;
1390 } else
1391 SaveOpts.ppOptions[n]->dwFlags &= ~AVICOMPRESSF_INTERLEAVE;
1392 }
1393 }
1394 /* fall through */
1395 case IDCANCEL:
1397 break;
1398 case IDC_INTERLEAVE:
1401 break;
1402 case IDC_STREAM:
1403 if (HIWORD(wParam) == CBN_SELCHANGE) {
1404 /* update control elements */
1406 }
1407 break;
1408 case IDC_OPTIONS:
1410 break;
1411 };
1412 return TRUE;
1413 };
1414
1415 return FALSE;
1416}
1417
1418/***********************************************************************
1419 * AVISaveOptions (AVIFIL32.@)
1420 */
1423{
1424 LPAVICOMPRESSOPTIONS pSavedOptions = NULL;
1425 INT ret, n;
1426
1427 TRACE("(%p,0x%X,%d,%p,%p)\n", hWnd, uFlags, nStreams,
1428 ppavi, ppOptions);
1429
1430 /* check parameters */
1431 if (nStreams <= 0 || ppavi == NULL || ppOptions == NULL)
1432 return AVIERR_BADPARAM;
1433
1434 /* save options in case the user presses cancel */
1435 if (nStreams > 1) {
1436 pSavedOptions = malloc(nStreams * sizeof(AVICOMPRESSOPTIONS));
1437 if (pSavedOptions == NULL)
1438 return FALSE;
1439
1440 for (n = 0; n < nStreams; n++) {
1441 if (ppOptions[n] != NULL)
1442 memcpy(pSavedOptions + n, ppOptions[n], sizeof(AVICOMPRESSOPTIONS));
1443 }
1444 }
1445
1446 SaveOpts.uFlags = uFlags;
1447 SaveOpts.nStreams = nStreams;
1448 SaveOpts.ppavis = ppavi;
1449 SaveOpts.ppOptions = ppOptions;
1450
1453
1454 if (ret == -1)
1455 ret = FALSE;
1456
1457 /* restore options when user pressed cancel */
1458 if (pSavedOptions != NULL) {
1459 if (ret == FALSE) {
1460 for (n = 0; n < nStreams; n++) {
1461 if (ppOptions[n] != NULL)
1462 memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
1463 }
1464 }
1465 free(pSavedOptions);
1466 }
1467
1468 return ret;
1469}
1470
1471/***********************************************************************
1472 * AVISaveOptionsFree (AVIFIL32.@)
1473 */
1475{
1476 TRACE("(%d,%p)\n", nStreams, ppOptions);
1477
1478 if (nStreams < 0 || ppOptions == NULL)
1479 return AVIERR_BADPARAM;
1480
1481 for (nStreams--; nStreams >= 0; nStreams--) {
1482 if (ppOptions[nStreams] != NULL) {
1483 ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
1484
1485 if (ppOptions[nStreams]->lpParms != NULL) {
1486 free(ppOptions[nStreams]->lpParms);
1489 }
1490 if (ppOptions[nStreams]->lpFormat != NULL) {
1494 }
1495 }
1496 }
1497
1498 return AVIERR_OK;
1499}
1500
1501/***********************************************************************
1502 * AVISaveVA (AVIFIL32.@)
1503 */
1504HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
1505 AVISAVECALLBACK lpfnCallback, int nStream,
1506 PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
1507{
1509 HRESULT hr;
1510 int len;
1511
1512 TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler,
1513 lpfnCallback, nStream, ppavi, plpOptions);
1514
1515 if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
1516 return AVIERR_BADPARAM;
1517
1518 /* convert the ANSI string to Unicode and call the Unicode function */
1519 len = MultiByteToWideChar(CP_ACP, 0, szFile, -1, NULL, 0);
1520 if (len <= 0)
1521 return AVIERR_BADPARAM;
1522
1523 wszFile = malloc(len * sizeof(WCHAR));
1524 if (wszFile == NULL)
1525 return AVIERR_MEMORY;
1526
1527 MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len);
1528
1529 hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
1530 nStream, ppavi, plpOptions);
1531
1532 free(wszFile);
1533
1534 return hr;
1535}
1536
1537/***********************************************************************
1538 * AVIFILE_AVISaveDefaultCallback (internal)
1539 */
1541{
1542 TRACE("(%d)\n", progress);
1543
1544 return FALSE;
1545}
1546
1547/***********************************************************************
1548 * AVISaveVW (AVIFIL32.@)
1549 */
1550HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
1551 AVISAVECALLBACK lpfnCallback, int nStreams,
1552 PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
1553{
1554 LONG lStart[MAX_AVISTREAMS];
1555 PAVISTREAM pOutStreams[MAX_AVISTREAMS];
1556 PAVISTREAM pInStreams[MAX_AVISTREAMS];
1557 AVIFILEINFOW fInfo;
1558 AVISTREAMINFOW sInfo;
1559
1560 PAVIFILE pfile = NULL; /* the output AVI file */
1561 LONG lFirstVideo = -1;
1562 int curStream;
1563
1564 /* for interleaving ... */
1565 DWORD dwInterleave = 0; /* interleave rate */
1566 DWORD dwFileInitialFrames;
1567 LONG lFileLength;
1568 LONG lSampleInc;
1569
1570 /* for reading/writing the data ... */
1572 LONG cbBuffer; /* real size of lpBuffer */
1573 LONG lBufferSize; /* needed bytes for format(s), etc. */
1574 LONG lReadBytes;
1575 LONG lReadSamples;
1576 HRESULT hres;
1577
1578 TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_w(szFile), pclsidHandler,
1579 lpfnCallback, nStreams, ppavi, plpOptions);
1580
1581 if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
1582 return AVIERR_BADPARAM;
1583 if (nStreams >= MAX_AVISTREAMS) {
1584 WARN("Can't write AVI with %d streams only supports %d -- change MAX_AVISTREAMS!\n", nStreams, MAX_AVISTREAMS);
1585 return AVIERR_INTERNAL;
1586 }
1587
1588 if (lpfnCallback == NULL)
1589 lpfnCallback = AVIFILE_AVISaveDefaultCallback;
1590
1591 /* clear local variable(s) */
1592 for (curStream = 0; curStream < nStreams; curStream++) {
1593 pInStreams[curStream] = NULL;
1594 pOutStreams[curStream] = NULL;
1595 }
1596
1597 /* open output AVI file (create it if it doesn't exist) */
1599 pclsidHandler);
1600 if (FAILED(hres))
1601 return hres;
1602 AVIFileInfoW(pfile, &fInfo, sizeof(fInfo)); /* for dwCaps */
1603
1604 /* initialize our data structures part 1 */
1605 for (curStream = 0; curStream < nStreams; curStream++) {
1606 PAVISTREAM pCurStream = ppavi[curStream];
1607
1608 hres = AVIStreamInfoW(pCurStream, &sInfo, sizeof(sInfo));
1609 if (FAILED(hres))
1610 goto error;
1611
1612 /* search first video stream and check for interleaving */
1613 if (sInfo.fccType == streamtypeVIDEO) {
1614 /* remember first video stream -- needed for interleaving */
1615 if (lFirstVideo < 0)
1616 lFirstVideo = curStream;
1617 } else if (!dwInterleave) {
1618 /* check if any non-video stream wants to be interleaved */
1619 WARN("options.flags=0x%lX options.dwInterleave=%lu\n",plpOptions[curStream]->dwFlags,plpOptions[curStream]->dwInterleaveEvery);
1620 if (plpOptions[curStream] != NULL &&
1621 plpOptions[curStream]->dwFlags & AVICOMPRESSF_INTERLEAVE)
1622 dwInterleave = plpOptions[curStream]->dwInterleaveEvery;
1623 }
1624
1625 /* create de-/compressed stream interface if needed */
1626 pInStreams[curStream] = NULL;
1627 if (plpOptions[curStream] != NULL) {
1628 if (plpOptions[curStream]->fccHandler ||
1629 plpOptions[curStream]->lpFormat != NULL) {
1630 DWORD dwKeySave = plpOptions[curStream]->dwKeyFrameEvery;
1631
1632 if (fInfo.dwCaps & AVIFILECAPS_ALLKEYFRAMES)
1633 plpOptions[curStream]->dwKeyFrameEvery = 1;
1634
1635 hres = AVIMakeCompressedStream(&pInStreams[curStream], pCurStream,
1636 plpOptions[curStream], NULL);
1637 plpOptions[curStream]->dwKeyFrameEvery = dwKeySave;
1638 if (FAILED(hres) || pInStreams[curStream] == NULL) {
1639 pInStreams[curStream] = NULL;
1640 goto error;
1641 }
1642
1643 /* test stream interface and update stream-info */
1644 hres = AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1645 if (FAILED(hres))
1646 goto error;
1647 }
1648 }
1649
1650 /* now handle streams which will only be copied */
1651 if (pInStreams[curStream] == NULL) {
1652 pCurStream = pInStreams[curStream] = ppavi[curStream];
1653 AVIStreamAddRef(pCurStream);
1654 } else
1655 pCurStream = pInStreams[curStream];
1656
1657 lStart[curStream] = sInfo.dwStart;
1658 } /* for all streams */
1659
1660 /* check that first video stream is the first stream */
1661 if (lFirstVideo > 0) {
1662 PAVISTREAM pTmp = pInStreams[lFirstVideo];
1663 LONG lTmp = lStart[lFirstVideo];
1664
1665 pInStreams[lFirstVideo] = pInStreams[0];
1666 pInStreams[0] = pTmp;
1667 lStart[lFirstVideo] = lStart[0];
1668 lStart[0] = lTmp;
1669 lFirstVideo = 0;
1670 }
1671
1672 /* allocate buffer for formats, data, etc. of an initial size of 64 kBytes*/
1673 cbBuffer = 0x00010000;
1674 lpBuffer = malloc(cbBuffer);
1675 if (lpBuffer == NULL) {
1677 goto error;
1678 }
1679
1680 AVIStreamInfoW(pInStreams[0], &sInfo, sizeof(sInfo));
1681 lFileLength = sInfo.dwLength;
1682 dwFileInitialFrames = 0;
1683 if (lFirstVideo >= 0) {
1684 /* check for correct version of the format
1685 * -- need at least BITMAPINFOHEADER or newer
1686 */
1687 lSampleInc = 1;
1688 lBufferSize = cbBuffer;
1689 hres = AVIStreamReadFormat(pInStreams[lFirstVideo], AVIStreamStart(pInStreams[lFirstVideo]), lpBuffer, &lBufferSize);
1690 if (lBufferSize < (LONG)sizeof(BITMAPINFOHEADER))
1692 if (FAILED(hres))
1693 goto error;
1694 } else /* use one second blocks for interleaving if no video present */
1695 lSampleInc = AVIStreamTimeToSample(pInStreams[0], 1000000);
1696
1697 /* create output streams */
1698 for (curStream = 0; curStream < nStreams; curStream++) {
1699 AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1700
1701 sInfo.dwInitialFrames = 0;
1702 if (dwInterleave != 0 && curStream > 0 && sInfo.fccType != streamtypeVIDEO) {
1703 /* 750 ms initial frames for non-video streams */
1704 sInfo.dwInitialFrames = AVIStreamTimeToSample(pInStreams[0], 750);
1705 }
1706
1707 hres = AVIFileCreateStreamW(pfile, &pOutStreams[curStream], &sInfo);
1708 if (pOutStreams[curStream] != NULL && SUCCEEDED(hres)) {
1709 /* copy initial format for this stream */
1710 lBufferSize = cbBuffer;
1711 hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1712 lpBuffer, &lBufferSize);
1713 if (FAILED(hres))
1714 goto error;
1715 hres = AVIStreamSetFormat(pOutStreams[curStream], 0, lpBuffer, lBufferSize);
1716 if (FAILED(hres))
1717 goto error;
1718
1719 /* try to copy stream handler data */
1720 lBufferSize = cbBuffer;
1721 hres = AVIStreamReadData(pInStreams[curStream], ckidSTREAMHANDLERDATA,
1722 lpBuffer, &lBufferSize);
1723 if (SUCCEEDED(hres) && lBufferSize > 0) {
1724 hres = AVIStreamWriteData(pOutStreams[curStream],ckidSTREAMHANDLERDATA,
1725 lpBuffer, lBufferSize);
1726 if (FAILED(hres))
1727 goto error;
1728 }
1729
1730 if (dwFileInitialFrames < sInfo.dwInitialFrames)
1731 dwFileInitialFrames = sInfo.dwInitialFrames;
1732 lReadBytes =
1733 AVIStreamSampleToSample(pOutStreams[0], pInStreams[curStream],
1734 sInfo.dwLength);
1735 if (lFileLength < lReadBytes)
1736 lFileLength = lReadBytes;
1737 } else {
1738 /* creation of de-/compression stream interface failed */
1739 WARN("creation of (de-)compression stream failed for stream %d\n",curStream);
1740 AVIStreamRelease(pInStreams[curStream]);
1741 if (curStream + 1 >= nStreams) {
1742 /* move the others one up */
1743 PAVISTREAM *ppas = &pInStreams[curStream];
1744 int n = nStreams - (curStream + 1);
1745
1746 do {
1747 *ppas = pInStreams[curStream + 1];
1748 } while (--n);
1749 }
1750 nStreams--;
1751 curStream--;
1752 }
1753 } /* create output streams for all input streams */
1754
1755 /* have we still something to write, or lost everything? */
1756 if (nStreams <= 0)
1757 goto error;
1758
1759 if (dwInterleave) {
1760 LONG lCurFrame = -dwFileInitialFrames;
1761
1762 /* interleaved file */
1763 if (dwInterleave == 1)
1764 AVIFileEndRecord(pfile);
1765
1766 for (; lCurFrame < lFileLength; lCurFrame += lSampleInc) {
1767 for (curStream = 0; curStream < nStreams; curStream++) {
1768 LONG lLastSample;
1769
1770 hres = AVIStreamInfoW(pOutStreams[curStream], &sInfo, sizeof(sInfo));
1771 if (FAILED(hres))
1772 goto error;
1773
1774 /* initial frames phase at the end for this stream? */
1775 if (-(LONG)sInfo.dwInitialFrames > lCurFrame)
1776 continue;
1777
1778 if ((lFileLength - lSampleInc) <= lCurFrame) {
1779 lLastSample = AVIStreamLength(pInStreams[curStream]);
1780 lFirstVideo = lLastSample + AVIStreamStart(pInStreams[curStream]);
1781 } else {
1782 if (curStream != 0) {
1783 lFirstVideo =
1784 AVIStreamSampleToSample(pInStreams[curStream], pInStreams[0],
1785 (sInfo.fccType == streamtypeVIDEO ?
1786 (LONG)dwInterleave : lSampleInc) +
1787 sInfo.dwInitialFrames + lCurFrame);
1788 } else
1789 lFirstVideo = lSampleInc + (sInfo.dwInitialFrames + lCurFrame);
1790
1791 lLastSample = AVIStreamEnd(pInStreams[curStream]);
1792 if (lLastSample <= lFirstVideo)
1793 lFirstVideo = lLastSample;
1794 }
1795
1796 /* copy needed samples now */
1797 WARN("copy from stream %d samples %ld to %ld...\n",curStream,
1798 lStart[curStream],lFirstVideo);
1799 while (lFirstVideo > lStart[curStream]) {
1800 DWORD flags = 0;
1801
1802 /* copy format in case it can change */
1803 lBufferSize = cbBuffer;
1804 hres = AVIStreamReadFormat(pInStreams[curStream], lStart[curStream],
1805 lpBuffer, &lBufferSize);
1806 if (FAILED(hres))
1807 goto error;
1808 AVIStreamSetFormat(pOutStreams[curStream], lStart[curStream],
1809 lpBuffer, lBufferSize);
1810
1811 /* try to read data until we got it, or error */
1812 do {
1813 hres = AVIStreamRead(pInStreams[curStream], lStart[curStream],
1814 lFirstVideo - lStart[curStream], lpBuffer,
1815 cbBuffer, &lReadBytes, &lReadSamples);
1816 } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1817 (lpBuffer = realloc(lpBuffer, cbBuffer *= 2)) != NULL);
1818 if (lpBuffer == NULL)
1820 if (FAILED(hres))
1821 goto error;
1822
1823 if (AVIStreamIsKeyFrame(pInStreams[curStream], (LONG)sInfo.dwStart))
1825 hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1826 lpBuffer, lReadBytes, flags, NULL, NULL);
1827 if (FAILED(hres))
1828 goto error;
1829
1830 lStart[curStream] += lReadSamples;
1831 }
1832 lStart[curStream] = lFirstVideo;
1833 } /* stream by stream */
1834
1835 /* need to close this block? */
1836 if (dwInterleave == 1) {
1837 hres = AVIFileEndRecord(pfile);
1838 if (FAILED(hres))
1839 break;
1840 }
1841
1842 /* show progress */
1843 if (lpfnCallback(MulDiv(dwFileInitialFrames + lCurFrame, 100,
1844 dwFileInitialFrames + lFileLength))) {
1846 break;
1847 }
1848 } /* copy frame by frame */
1849 } else {
1850 /* non-interleaved file */
1851
1852 for (curStream = 0; curStream < nStreams; curStream++) {
1853 /* show progress */
1854 if (lpfnCallback(MulDiv(curStream, 100, nStreams))) {
1856 goto error;
1857 }
1858
1859 AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1860
1861 if (sInfo.dwSampleSize != 0) {
1862 /* sample-based data like audio */
1863 while (sInfo.dwStart < sInfo.dwLength) {
1864 LONG lSamples = cbBuffer / sInfo.dwSampleSize;
1865
1866 /* copy format in case it can change */
1867 lBufferSize = cbBuffer;
1868 hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1869 lpBuffer, &lBufferSize);
1870 if (FAILED(hres))
1871 goto error;
1872 AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
1873 lpBuffer, lBufferSize);
1874
1875 /* limit to stream boundaries */
1876 if (lSamples != (LONG)(sInfo.dwLength - sInfo.dwStart))
1877 lSamples = sInfo.dwLength - sInfo.dwStart;
1878
1879 /* now try to read until we get it, or an error occurs */
1880 do {
1881 lReadBytes = cbBuffer;
1882 lReadSamples = 0;
1883 hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
1884 lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
1885 } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1886 (lpBuffer = realloc(lpBuffer, cbBuffer *= 2)) != NULL);
1887 if (lpBuffer == NULL)
1889 if (FAILED(hres))
1890 goto error;
1891 if (lReadSamples != 0) {
1892 sInfo.dwStart += lReadSamples;
1893 hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1894 lpBuffer, lReadBytes, 0, NULL , NULL);
1895 if (FAILED(hres))
1896 goto error;
1897
1898 /* show progress */
1899 if (lpfnCallback(MulDiv(sInfo.dwStart,100,nStreams*sInfo.dwLength)+
1900 MulDiv(curStream, 100, nStreams))) {
1902 goto error;
1903 }
1904 } else {
1905 if ((sInfo.dwLength - sInfo.dwStart) != 1) {
1907 goto error;
1908 }
1909 }
1910 }
1911 } else {
1912 /* block-based data like video */
1913 for (; sInfo.dwStart < sInfo.dwLength; sInfo.dwStart++) {
1914 DWORD flags = 0;
1915
1916 /* copy format in case it can change */
1917 lBufferSize = cbBuffer;
1918 hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1919 lpBuffer, &lBufferSize);
1920 if (FAILED(hres))
1921 goto error;
1922 AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
1923 lpBuffer, lBufferSize);
1924
1925 /* try to read block and resize buffer if necessary */
1926 do {
1927 lReadSamples = 0;
1928 lReadBytes = cbBuffer;
1929 hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
1930 lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
1931 } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1932 (lpBuffer = realloc(lpBuffer, cbBuffer *= 2)) != NULL);
1933 if (lpBuffer == NULL)
1935 if (FAILED(hres))
1936 goto error;
1937 if (lReadSamples != 1) {
1939 goto error;
1940 }
1941
1942 if (AVIStreamIsKeyFrame(pInStreams[curStream], (LONG)sInfo.dwStart))
1944 hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1945 lpBuffer, lReadBytes, flags, NULL, NULL);
1946 if (FAILED(hres))
1947 goto error;
1948
1949 /* show progress */
1950 if (lpfnCallback(MulDiv(sInfo.dwStart,100,nStreams*sInfo.dwLength)+
1951 MulDiv(curStream, 100, nStreams))) {
1953 goto error;
1954 }
1955 } /* copy all blocks */
1956 }
1957 } /* copy data stream by stream */
1958 }
1959
1960 error:
1961 free(lpBuffer);
1962 if (pfile != NULL) {
1963 for (curStream = 0; curStream < nStreams; curStream++) {
1964 if (pOutStreams[curStream] != NULL)
1965 AVIStreamRelease(pOutStreams[curStream]);
1966 if (pInStreams[curStream] != NULL)
1967 AVIStreamRelease(pInStreams[curStream]);
1968 }
1969
1970 AVIFileRelease(pfile);
1971 }
1972
1973 return hres;
1974}
1975
1976/***********************************************************************
1977 * EditStreamClone (AVIFIL32.@)
1978 */
1980{
1981 PAVIEDITSTREAM pEdit = NULL;
1982 HRESULT hr;
1983
1984 TRACE("(%p,%p)\n", pStream, ppResult);
1985
1986 if (pStream == NULL)
1987 return AVIERR_BADHANDLE;
1988 if (ppResult == NULL)
1989 return AVIERR_BADPARAM;
1990
1991 *ppResult = NULL;
1992
1993 hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
1994 if (SUCCEEDED(hr) && pEdit != NULL) {
1996
1998 } else
2000
2001 return hr;
2002}
2003
2004/***********************************************************************
2005 * EditStreamCopy (AVIFIL32.@)
2006 */
2008 LONG *plLength, PAVISTREAM *ppResult)
2009{
2010 PAVIEDITSTREAM pEdit = NULL;
2011 HRESULT hr;
2012
2013 TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
2014
2015 if (pStream == NULL)
2016 return AVIERR_BADHANDLE;
2017 if (plStart == NULL || plLength == NULL || ppResult == NULL)
2018 return AVIERR_BADPARAM;
2019
2020 *ppResult = NULL;
2021
2022 hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2023 if (SUCCEEDED(hr) && pEdit != NULL) {
2024 hr = IAVIEditStream_Copy(pEdit, plStart, plLength, ppResult);
2025
2027 } else
2029
2030 return hr;
2031}
2032
2033/***********************************************************************
2034 * EditStreamCut (AVIFIL32.@)
2035 */
2037 LONG *plLength, PAVISTREAM *ppResult)
2038{
2039 PAVIEDITSTREAM pEdit = NULL;
2040 HRESULT hr;
2041
2042 TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
2043
2044 if (ppResult != NULL)
2045 *ppResult = NULL;
2046 if (pStream == NULL)
2047 return AVIERR_BADHANDLE;
2048 if (plStart == NULL || plLength == NULL)
2049 return AVIERR_BADPARAM;
2050
2051 hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2052 if (SUCCEEDED(hr) && pEdit != NULL) {
2053 hr = IAVIEditStream_Cut(pEdit, plStart, plLength, ppResult);
2054
2056 } else
2058
2059 return hr;
2060}
2061
2062/***********************************************************************
2063 * EditStreamPaste (AVIFIL32.@)
2064 */
2066 PAVISTREAM pSource, LONG lStart, LONG lEnd)
2067{
2068 PAVIEDITSTREAM pEdit = NULL;
2069 HRESULT hr;
2070
2071 TRACE("(%p,%p,%p,%p,%ld,%ld)\n", pDest, plStart, plLength,
2072 pSource, lStart, lEnd);
2073
2074 if (pDest == NULL || pSource == NULL)
2075 return AVIERR_BADHANDLE;
2076 if (plStart == NULL || plLength == NULL || lStart < 0)
2077 return AVIERR_BADPARAM;
2078
2079 hr = IAVIStream_QueryInterface(pDest, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2080 if (SUCCEEDED(hr) && pEdit != NULL) {
2081 hr = IAVIEditStream_Paste(pEdit, plStart, plLength, pSource, lStart, lEnd);
2082
2084 } else
2086
2087 return hr;
2088}
2089
2090/***********************************************************************
2091 * EditStreamSetInfoA (AVIFIL32.@)
2092 */
2094 LONG size)
2095{
2096 AVISTREAMINFOW asiw;
2097
2098 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
2099
2100 if (size >= 0 && size < sizeof(AVISTREAMINFOA))
2101 return AVIERR_BADSIZE;
2102
2103 memcpy(&asiw, asi, sizeof(asiw) - sizeof(asiw.szName));
2104 MultiByteToWideChar(CP_ACP, 0, asi->szName, -1, asiw.szName, ARRAY_SIZE(asiw.szName));
2105
2106 return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
2107}
2108
2109/***********************************************************************
2110 * EditStreamSetInfoW (AVIFIL32.@)
2111 */
2113 LONG size)
2114{
2115 PAVIEDITSTREAM pEdit = NULL;
2116 HRESULT hr;
2117
2118 TRACE("(%p,%p,%ld)\n", pstream, asi, size);
2119
2120 if (size >= 0 && size < sizeof(AVISTREAMINFOA))
2121 return AVIERR_BADSIZE;
2122
2123 hr = IAVIStream_QueryInterface(pstream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2124 if (SUCCEEDED(hr) && pEdit != NULL) {
2125 hr = IAVIEditStream_SetInfo(pEdit, asi, size);
2126
2128 } else
2130
2131 return hr;
2132}
2133
2134/***********************************************************************
2135 * EditStreamSetNameA (AVIFIL32.@)
2136 */
2138{
2139 AVISTREAMINFOA asia;
2140 HRESULT hres;
2141
2142 TRACE("(%p,%s)\n", pstream, debugstr_a(szName));
2143
2144 if (pstream == NULL)
2145 return AVIERR_BADHANDLE;
2146 if (szName == NULL)
2147 return AVIERR_BADPARAM;
2148
2149 hres = AVIStreamInfoA(pstream, &asia, sizeof(asia));
2150 if (FAILED(hres))
2151 return hres;
2152
2153 memset(asia.szName, 0, sizeof(asia.szName));
2154 lstrcpynA(asia.szName, szName, ARRAY_SIZE(asia.szName));
2155
2156 return EditStreamSetInfoA(pstream, &asia, sizeof(asia));
2157}
2158
2159/***********************************************************************
2160 * EditStreamSetNameW (AVIFIL32.@)
2161 */
2163{
2164 AVISTREAMINFOW asiw;
2165 HRESULT hres;
2166
2167 TRACE("(%p,%s)\n", pstream, debugstr_w(szName));
2168
2169 if (pstream == NULL)
2170 return AVIERR_BADHANDLE;
2171 if (szName == NULL)
2172 return AVIERR_BADPARAM;
2173
2174 hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
2175 if (FAILED(hres))
2176 return hres;
2177
2178 memset(asiw.szName, 0, sizeof(asiw.szName));
2179 lstrcpynW(asiw.szName, szName, ARRAY_SIZE(asiw.szName));
2180
2181 return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
2182}
2183
2184/***********************************************************************
2185 * AVIClearClipboard (AVIFIL32.@)
2186 */
2188{
2189 TRACE("()\n");
2190
2191 return AVIERR_UNSUPPORTED; /* OleSetClipboard(NULL); */
2192}
2193
2194/***********************************************************************
2195 * AVIGetFromClipboard (AVIFIL32.@)
2196 */
2198{
2199 FIXME("(%p), stub!\n", ppfile);
2200
2201 *ppfile = NULL;
2202
2203 return AVIERR_UNSUPPORTED;
2204}
2205
2206/***********************************************************************
2207 * AVIMakeStreamFromClipboard (AVIFIL32.@)
2208 */
2210 PAVISTREAM * ppstream)
2211{
2212 FIXME("(0x%08x,%p,%p), stub!\n", cfFormat, hGlobal, ppstream);
2213
2214 if (ppstream == NULL)
2215 return AVIERR_BADHANDLE;
2216
2217 return AVIERR_UNSUPPORTED;
2218}
2219
2220/***********************************************************************
2221 * AVIPutFileOnClipboard (AVIFIL32.@)
2222 */
2224{
2225 FIXME("(%p), stub!\n", pfile);
2226
2227 if (pfile == NULL)
2228 return AVIERR_BADHANDLE;
2229
2230 return AVIERR_UNSUPPORTED;
2231}
2232
2233HRESULT WINAPIV AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback,
2234 int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...)
2235{
2236 va_list vl;
2237 int i;
2238 HRESULT ret;
2239 PAVISTREAM *streams;
2241
2242 TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler, lpfnCallback,
2243 nStreams, pavi, lpOptions);
2244
2245 if (nStreams <= 0) return AVIERR_BADPARAM;
2246
2247 streams = malloc(nStreams * sizeof(*streams));
2248 options = malloc(nStreams * sizeof(*options));
2249 if (!streams || !options)
2250 {
2252 goto error;
2253 }
2254
2255 streams[0] = pavi;
2256 options[0] = lpOptions;
2257
2258 va_start(vl, lpOptions);
2259 for (i = 1; i < nStreams; i++)
2260 {
2261 streams[i] = va_arg(vl, PAVISTREAM);
2263 }
2264 va_end(vl);
2265
2266 for (i = 0; i < nStreams; i++)
2267 TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]);
2268
2269 ret = AVISaveVA(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options);
2270error:
2271 free(streams);
2272 free(options);
2273 return ret;
2274}
2275
2276HRESULT WINAPIV AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback,
2277 int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...)
2278{
2279 va_list vl;
2280 int i;
2281 HRESULT ret;
2282 PAVISTREAM *streams;
2284
2285 TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_w(szFile), pclsidHandler, lpfnCallback,
2286 nStreams, pavi, lpOptions);
2287
2288 if (nStreams <= 0) return AVIERR_BADPARAM;
2289
2290 streams = malloc(nStreams * sizeof(*streams));
2291 options = malloc(nStreams * sizeof(*options));
2292 if (!streams || !options)
2293 {
2295 goto error;
2296 }
2297
2298 streams[0] = pavi;
2299 options[0] = lpOptions;
2300
2301 va_start(vl, lpOptions);
2302 for (i = 1; i < nStreams; i++)
2303 {
2304 streams[i] = va_arg(vl, PAVISTREAM);
2306 }
2307 va_end(vl);
2308
2309 for (i = 0; i < nStreams; i++)
2310 TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]);
2311
2312 ret = AVISaveVW(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options);
2313error:
2314 free(streams);
2315 free(options);
2316 return ret;
2317}
#define IDC_OPTIONS
#define IDC_FORMATTEXT
#define IDS_UNCOMPRESSED
PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pstream)
Definition: getframe.c:488
#define IDC_INTERLEAVEEVERY
#define MAX_AVISTREAMS
#define IDC_STREAM
#define IDC_INTERLEAVE
HMODULE AVIFILE_hModule
Definition: factory.c:39
PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
Definition: tmpfile.c:220
#define IDS_ALLMULTIMEDIA
#define IDD_SAVEOPTIONS
#define AVIIF_KEYFRAME
Definition: aviriff.h:131
#define streamtypeAUDIO
Definition: aviriff.h:93
#define streamtypeVIDEO
Definition: aviriff.h:92
static const WCHAR avifile[]
Definition: avisplitter.c:273
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define IDS_ALLFILES
Definition: resource.h:214
#define ARRAY_SIZE(A)
Definition: main.h:20
static WCHAR wszFilter[MAX_STRING_LEN *4+6 *3+5]
Definition: wordpad.c:72
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
cd_progress_ptr progress
Definition: cdjpeg.h:152
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR clsidW[]
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4212
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
PAVISTREAM * ppavis
Definition: api.c:61
HRESULT WINAPI AVIStreamCreate(PAVISTREAM *ppavi, LONG lParam1, LONG lParam2, LPCLSID pclsidHandler)
Definition: api.c:464
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp, LONG size)
Definition: api.c:625
HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
Definition: api.c:2093
struct _AVIFilter AVIFilter
static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
Definition: api.c:1131
INT nCurrent
Definition: api.c:63
HRESULT WINAPI EditStreamCut(PAVISTREAM pStream, LONG *plStart, LONG *plLength, PAVISTREAM *ppResult)
Definition: api.c:2036
static void AVISaveOptionsUpdate(HWND hWnd)
Definition: api.c:1251
BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *ppOptions)
Definition: api.c:1421
HRESULT WINAPI EditStreamSetNameA(PAVISTREAM pstream, LPCSTR szName)
Definition: api.c:2137
HRESULT WINAPI EditStreamClone(PAVISTREAM pStream, PAVISTREAM *ppResult)
Definition: api.c:1979
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LONG formatsize)
Definition: api.c:563
HRESULT WINAPI AVISaveOptionsFree(INT nStreams, LPAVICOMPRESSOPTIONS *ppOptions)
Definition: api.c:1474
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream, LPBITMAPINFOHEADER lpbiWanted)
Definition: api.c:639
HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile, PAVISTREAM *avis, DWORD fccType, LONG lParam)
Definition: api.c:345
HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:227
UINT uFlags
Definition: api.c:59
LONG WINAPI AVIStreamLength(PAVISTREAM pstream)
Definition: api.c:876
LONG WINAPI AVIStreamEndStreaming(PAVISTREAM pavi)
Definition: api.c:839
LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime)
Definition: api.c:927
HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
Definition: api.c:1550
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed, PAVISTREAM psSource, LPAVICOMPRESSOPTIONS aco, LPCLSID pclsidHandler)
Definition: api.c:689
HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile)
Definition: api.c:421
HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
Definition: api.c:961
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile, PAVISTREAM *avis, LPAVISTREAMINFOW asi)
Definition: api.c:381
HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile, DWORD fcc, LPVOID lp, LONG size)
Definition: api.c:395
HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStream, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
Definition: api.c:1504
LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample)
Definition: api.c:894
HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile, DWORD fccType, LONG lParam, UINT mode, LPCLSID pclsidHandler)
Definition: api.c:788
LONG WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, LONG flags)
Definition: api.c:536
void WINAPI AVIFileExit(void)
Definition: api.c:182
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg)
Definition: api.c:677
ULONG WINAPI AVIStreamAddRef(PAVISTREAM pstream)
Definition: api.c:434
HRESULT WINAPI AVIGetFromClipboard(PAVIFILE *ppfile)
Definition: api.c:2197
static BOOL AVIFILE_GetFileHandlerByExtension(LPCWSTR szFile, LPCLSID lpclsid)
Definition: api.c:153
HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, LPLONG bytesread, LPLONG samplesread)
Definition: api.c:577
HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:192
HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:2112
HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
Definition: api.c:995
static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: api.c:1336
HRESULT WINAPI AVIMakeFileFromStreams(PAVIFILE *ppfile, int nStreams, PAVISTREAM *ppStreams)
Definition: api.c:741
void WINAPI AVIFileInit(void)
Definition: api.c:175
#define MAX_FILTERS
Definition: api.c:48
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
Definition: api.c:496
LONG WINAPI AVIStreamStart(PAVISTREAM pstream)
Definition: api.c:858
INT nStreams
Definition: api.c:60
HRESULT WINAPI EditStreamCopy(PAVISTREAM pStream, LONG *plStart, LONG *plLength, PAVISTREAM *ppResult)
Definition: api.c:2007
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
Definition: api.c:664
HRESULT WINAPI EditStreamPaste(PAVISTREAM pDest, LONG *plStart, LONG *plLength, PAVISTREAM pSource, LONG lStart, LONG lEnd)
Definition: api.c:2065
HRESULT WINAPI AVIFileReadData(PAVIFILE pfile, DWORD fcc, LPVOID lp, LPLONG size)
Definition: api.c:408
ULONG WINAPI AVIFileRelease(PAVIFILE pfile)
Definition: api.c:291
HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp, LPLONG lpread)
Definition: api.c:611
HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile, DWORD fccType, LONG lParam, UINT mode, LPCLSID pclsidHandler)
Definition: api.c:760
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile, PAVISTREAM *ppavi, LPAVISTREAMINFOA psi)
Definition: api.c:360
LPAVICOMPRESSOPTIONS * ppOptions
Definition: api.c:62
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile, LPAVIFILEINFOW afiw, LONG size)
Definition: api.c:332
HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile)
Definition: api.c:2223
static struct @316 SaveOpts
HRESULT WINAPI EditStreamSetNameW(PAVISTREAM pstream, LPCWSTR szName)
Definition: api.c:2162
static BOOL WINAPI AVIFILE_AVISaveDefaultCallback(INT progress)
Definition: api.c:1540
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:522
ULONG WINAPI AVIFileAddRef(PAVIFILE pfile)
Definition: api.c:276
HRESULT WINAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM *ppstream)
Definition: api.c:2209
HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, DWORD flags, LPLONG sampwritten, LPLONG byteswritten)
Definition: api.c:594
HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile, LPAVIFILEINFOA afi, LONG size)
Definition: api.c:307
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LPLONG formatsize)
Definition: api.c:549
HRESULT WINAPI AVIClearClipboard(void)
Definition: api.c:2187
LONG WINAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate)
Definition: api.c:816
HRESULT WINAPIV AVISaveA(LPCSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions,...)
Definition: api.c:2233
ULONG WINAPI AVIStreamRelease(PAVISTREAM pstream)
Definition: api.c:449
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
Definition: api.c:69
HRESULT WINAPIV AVISaveW(LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions,...)
Definition: api.c:2276
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
Definition: format.c:431
MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails)
Definition: format.c:852
MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc)
Definition: format.c:378
#define va_end(v)
Definition: stdarg.h:28
#define va_arg(v, l)
Definition: stdarg.h:27
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
GLsizei samples
Definition: glext.h:7006
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum mode
Definition: glext.h:6217
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
int all_files
Definition: mkisofs.c:132
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _WAVEFORMATEX * PWAVEFORMATEX
#define ICTYPE_VIDEO
Definition: mmreg.h:531
UINT MMRESULT
Definition: mmsystem.h:964
struct pcmwaveformat_tag PCMWAVEFORMAT
HRESULT hres
Definition: protocol.c:465
CONDITION_VARIABLE cv
Definition: sync.c:1887
static const WCHAR wszFile[]
Definition: misc.c:301
LPTSTR szFilter
Definition: mplay32.c:30
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
Definition: msacm32_main.c:106
#define ACM_FORMATENUMF_CONVERT
Definition: msacm.h:168
#define ACM_METRIC_MAX_SIZE_FORMAT
Definition: msacm.h:200
#define ACM_FORMATTAGDETAILSF_FORMATTAG
Definition: msacm.h:183
#define ACM_FORMATDETAILSF_FORMAT
Definition: msacm.h:161
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:594
HIC VFWAPI ICLocate(DWORD type, DWORD handler, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, WORD mode)
Definition: msvideo_main.c:633
void VFWAPI ICCompressorFree(PCOMPVARS pc)
BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData, PCOMPVARS pc, LPSTR lpszTitle)
LRESULT WINAPI ICClose(HIC hic)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
enum _tagppResult ppResult
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define DWORD
Definition: nt_native.h:44
const GUID IID_IPersistFile
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
static const WCHAR szName[]
Definition: powrprof.c:45
#define calloc
Definition: rosglue.h:14
#define WINAPIV
Definition: sdbpapi.h:64
#define LoadStringW
Definition: utils.h:64
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwQuality
Definition: vfw.h:1107
DWORD dwBytesPerSecond
Definition: vfw.h:1108
DWORD dwInterleaveEvery
Definition: vfw.h:1114
DWORD dwFlags
Definition: vfw.h:1109
DWORD cbFormat
Definition: vfw.h:1111
DWORD dwKeyFrameEvery
Definition: vfw.h:1106
DWORD cbParms
Definition: vfw.h:1113
DWORD fccType
Definition: vfw.h:1104
DWORD fccHandler
Definition: vfw.h:1105
LPVOID lpParms
Definition: vfw.h:1112
LPVOID lpFormat
Definition: vfw.h:1110
DWORD biCompression
Definition: amvideo.idl:35
Definition: vfw.h:817
Definition: vfw.h:280
WCHAR szDescription[128]
Definition: vfw.h:291
HWND hwndOwner
Definition: msacm.h:465
DWORD fdwEnum
Definition: msacm.h:477
DWORD cbStruct
Definition: msacm.h:462
LPWAVEFORMATEX pwfxEnum
Definition: msacm.h:478
DWORD fdwStyle
Definition: msacm.h:463
PWAVEFORMATEX pwfx
Definition: msacm.h:467
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:509
DWORD dwFormatTag
Definition: msacm.h:505
PWAVEFORMATEX pwfx
Definition: msacm.h:507
DWORD cbStruct
Definition: msacm.h:503
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:535
CHAR szFileType[64]
Definition: vfw.h:1091
WCHAR szFileType[64]
Definition: avifil32.idl:81
DWORD dwCaps
Definition: avifil32.idl:72
Definition: api.c:50
WCHAR szExtensions[MAX_FILTERS *7]
Definition: api.c:52
WCHAR szClsid[40]
Definition: api.c:51
CHAR szName[64]
Definition: vfw.h:1021
DWORD dwInitialFrames
Definition: avifil32.idl:39
DWORD fccHandler
Definition: avifil32.idl:30
WCHAR szName[64]
Definition: avifil32.idl:46
DWORD dwSampleSize
Definition: avifil32.idl:42
Definition: format.c:58
LPCWSTR lpFormat
Definition: trayclock.cpp:32
const char * LPCSTR
Definition: typedefs.h:52
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t * LPLONG
Definition: typedefs.h:58
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define BI_RGB
Definition: uefivid.c:46
#define IAVIStream_SetFormat(p, a, b, c)
Definition: vfw.h:1183
#define comptypeDIB
Definition: vfw.h:147
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define AVICOMPRESSF_VALID
Definition: vfw.h:1101
#define IAVIStream_AddRef(p)
Definition: vfw.h:1176
#define IAVIStream_WriteData(p, a, b, c)
Definition: vfw.h:1188
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
#define AVIStreamSampleToSample(pavi1, pavi2, samp2)
Definition: vfw.h:1442
#define AVIERR_ERROR
Definition: vfw.h:1761
#define ICQUALITY_DEFAULT
Definition: vfw.h:278
#define IGetFrame_SetFormat(p, a, b, c, d, e, f)
Definition: vfw.h:1724
#define AVIERR_INTERNAL
Definition: vfw.h:1746
#define AVIERR_FILEREAD
Definition: vfw.h:1751
#define AVICOMPRESSF_KEYFRAMES
Definition: vfw.h:1100
#define AVICOMPRESSF_DATARATE
Definition: vfw.h:1099
#define IAVIEditStream_Copy(p, a, b, c)
Definition: vfw.h:1514
#define IAVIEditStream_Clone(p, a)
Definition: vfw.h:1516
#define AVIERR_BADSIZE
Definition: vfw.h:1749
#define IAVIStream_Read(p, a, b, c, d, e, f)
Definition: vfw.h:1184
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStreaming_Release(p)
Definition: vfw.h:1482
#define AVIERR_USERABORT
Definition: vfw.h:1760
#define IAVIEditStream_SetInfo(p, a, b)
Definition: vfw.h:1517
#define IGetFrame_GetFrame(p, a)
Definition: vfw.h:1721
#define IAVIStream_ReadFormat(p, a, b, c)
Definition: vfw.h:1182
#define IAVIFile_ReadData(p, a, b, c)
Definition: vfw.h:1610
#define AVIERR_OK
Definition: vfw.h:1740
#define IAVIFile_QueryInterface(p, a, b)
Definition: vfw.h:1602
#define IGetFrame_Release(p)
Definition: vfw.h:1719
#define ckidSTREAMHANDLERDATA
Definition: vfw.h:895
#define IAVIFile_Info(p, a, b)
Definition: vfw.h:1606
#define IAVIFile_GetStream(p, a, b, c)
Definition: vfw.h:1607
BOOL(CALLBACK * AVISAVECALLBACK)(INT)
Definition: vfw.h:937
#define IAVIFile_WriteData(p, a, b, c)
Definition: vfw.h:1609
#define IAVIStream_ReadData(p, a, b, c)
Definition: vfw.h:1187
#define IAVIFile_Release(p)
Definition: vfw.h:1604
#define ICMF_COMPVARS_VALID
Definition: vfw.h:836
#define AVIStreamFormatSize(pavi, lPos, plSize)
Definition: vfw.h:1436
#define AVIStreamEnd(pavi)
Definition: vfw.h:1432
#define AVICOMPRESSF_INTERLEAVE
Definition: vfw.h:1098
#define AVIStreamIsKeyFrame(pavi, pos)
Definition: vfw.h:1459
#define IAVIStream_Create(p, a, b)
Definition: vfw.h:1179
#define IAVIEditStream_Paste(p, a, b, c, d, e)
Definition: vfw.h:1515
#define IAVIEditStream_Cut(p, a, b, c)
Definition: vfw.h:1513
#define IAVIFile_AddRef(p)
Definition: vfw.h:1603
#define AVIERR_MEMORY
Definition: vfw.h:1745
#define AVIERR_BUFFERTOOSMALL
Definition: vfw.h:1758
#define IAVIStream_Write(p, a, b, c, d, e, f, g)
Definition: vfw.h:1185
#define IAVIFile_EndRecord(p)
Definition: vfw.h:1611
#define AVIFILECAPS_ALLKEYFRAMES
Definition: vfw.h:1062
#define IAVIStream_Release(p)
Definition: vfw.h:1177
#define IAVIStreaming_End(p)
Definition: vfw.h:1485
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define IAVIStreaming_Begin(p, a, b, c)
Definition: vfw.h:1484
struct IGetFrame * PGETFRAME
Definition: vfw.h:40
#define IAVIFile_CreateStream(p, a, b)
Definition: vfw.h:1608
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define IAVIStream_FindSample(p, a, b)
Definition: vfw.h:1181
#define OF_SHARE_EXCLUSIVE
Definition: winbase.h:126
#define OF_CREATE
Definition: winbase.h:128
#define OF_WRITE
Definition: winbase.h:121
#define WINAPI
Definition: msvc.h:6
#define CO_E_CLASSSTRING
Definition: winerror.h:3919
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:842
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4553
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_SETCURSEL
Definition: winuser.h:1990
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1767
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define CB_ADDSTRING
Definition: winuser.h:1965
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_GETCURSEL
Definition: winuser.h:1972
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
unsigned char BYTE
Definition: xxhash.c:193