ReactOS  0.4.13-dev-66-gc714b7f
api.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "ole2.h"
#include "shellapi.h"
#include "shlobj.h"
#include "vfw.h"
#include "msacm.h"
#include "avifile_private.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for api.c:

Go to the source code of this file.

Classes

struct  _AVIFilter
 

Macros

#define COBJMACROS
 
#define MAX_FILTERS   30 /* 30 => 7kB */
 

Typedefs

typedef struct _AVIFilter AVIFilter
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (avifile)
 
static HRESULT AVIFILE_CLSIDFromString (LPCSTR idstr, LPCLSID id)
 
static BOOL AVIFILE_GetFileHandlerByExtension (LPCWSTR szFile, LPCLSID lpclsid)
 
void WINAPI AVIFileInit (void)
 
void WINAPI AVIFileExit (void)
 
HRESULT WINAPI AVIFileOpenA (PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler)
 
HRESULT WINAPI AVIFileOpenW (PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler)
 
ULONG WINAPI AVIFileAddRef (PAVIFILE pfile)
 
ULONG WINAPI AVIFileRelease (PAVIFILE pfile)
 
HRESULT WINAPI AVIFileInfoA (PAVIFILE pfile, LPAVIFILEINFOA afi, LONG size)
 
HRESULT WINAPI AVIFileInfoW (PAVIFILE pfile, LPAVIFILEINFOW afiw, LONG size)
 
HRESULT WINAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM *avis, DWORD fccType, LONG lParam)
 
HRESULT WINAPI AVIFileCreateStreamA (PAVIFILE pfile, PAVISTREAM *ppavi, LPAVISTREAMINFOA psi)
 
HRESULT WINAPI AVIFileCreateStreamW (PAVIFILE pfile, PAVISTREAM *avis, LPAVISTREAMINFOW asi)
 
HRESULT WINAPI AVIFileWriteData (PAVIFILE pfile, DWORD fcc, LPVOID lp, LONG size)
 
HRESULT WINAPI AVIFileReadData (PAVIFILE pfile, DWORD fcc, LPVOID lp, LPLONG size)
 
HRESULT WINAPI AVIFileEndRecord (PAVIFILE pfile)
 
ULONG WINAPI AVIStreamAddRef (PAVISTREAM pstream)
 
ULONG WINAPI AVIStreamRelease (PAVISTREAM pstream)
 
HRESULT WINAPI AVIStreamCreate (PAVISTREAM *ppavi, LONG lParam1, LONG lParam2, LPCLSID pclsidHandler)
 
HRESULT WINAPI AVIStreamInfoA (PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
 
HRESULT WINAPI AVIStreamInfoW (PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
 
LONG WINAPI AVIStreamFindSample (PAVISTREAM pstream, LONG pos, LONG flags)
 
HRESULT WINAPI AVIStreamReadFormat (PAVISTREAM pstream, LONG pos, LPVOID format, LPLONG formatsize)
 
HRESULT WINAPI AVIStreamSetFormat (PAVISTREAM pstream, LONG pos, LPVOID format, LONG formatsize)
 
HRESULT WINAPI AVIStreamRead (PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, LPLONG bytesread, LPLONG samplesread)
 
HRESULT WINAPI AVIStreamWrite (PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, DWORD flags, LPLONG sampwritten, LPLONG byteswritten)
 
HRESULT WINAPI AVIStreamReadData (PAVISTREAM pstream, DWORD fcc, LPVOID lp, LPLONG lpread)
 
HRESULT WINAPI AVIStreamWriteData (PAVISTREAM pstream, DWORD fcc, LPVOID lp, LONG size)
 
PGETFRAME WINAPI AVIStreamGetFrameOpen (PAVISTREAM pstream, LPBITMAPINFOHEADER lpbiWanted)
 
LPVOID WINAPI AVIStreamGetFrame (PGETFRAME pg, LONG pos)
 
HRESULT WINAPI AVIStreamGetFrameClose (PGETFRAME pg)
 
HRESULT WINAPI AVIMakeCompressedStream (PAVISTREAM *ppsCompressed, PAVISTREAM psSource, LPAVICOMPRESSOPTIONS aco, LPCLSID pclsidHandler)
 
HRESULT WINAPI AVIMakeFileFromStreams (PAVIFILE *ppfile, int nStreams, PAVISTREAM *ppStreams)
 
HRESULT WINAPI AVIStreamOpenFromFileA (PAVISTREAM *ppavi, LPCSTR szFile, DWORD fccType, LONG lParam, UINT mode, LPCLSID pclsidHandler)
 
HRESULT WINAPI AVIStreamOpenFromFileW (PAVISTREAM *ppavi, LPCWSTR szFile, DWORD fccType, LONG lParam, UINT mode, LPCLSID pclsidHandler)
 
LONG WINAPI AVIStreamBeginStreaming (PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate)
 
LONG WINAPI AVIStreamEndStreaming (PAVISTREAM pavi)
 
LONG WINAPI AVIStreamStart (PAVISTREAM pstream)
 
LONG WINAPI AVIStreamLength (PAVISTREAM pstream)
 
LONG WINAPI AVIStreamSampleToTime (PAVISTREAM pstream, LONG lSample)
 
LONG WINAPI AVIStreamTimeToSample (PAVISTREAM pstream, LONG lTime)
 
HRESULT WINAPI AVIBuildFilterA (LPSTR szFilter, LONG cbFilter, BOOL fSaving)
 
HRESULT WINAPI AVIBuildFilterW (LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
 
static BOOL AVISaveOptionsFmtChoose (HWND hWnd)
 
static void AVISaveOptionsUpdate (HWND hWnd)
 
static INT_PTR CALLBACK AVISaveOptionsDlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI AVISaveOptions (HWND hWnd, UINT uFlags, INT nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *ppOptions)
 
HRESULT WINAPI AVISaveOptionsFree (INT nStreams, LPAVICOMPRESSOPTIONS *ppOptions)
 
HRESULT WINAPI AVISaveVA (LPCSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStream, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
 
static BOOL WINAPI AVIFILE_AVISaveDefaultCallback (INT progress)
 
HRESULT WINAPI AVISaveVW (LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
 
HRESULT WINAPI EditStreamClone (PAVISTREAM pStream, PAVISTREAM *ppResult)
 
HRESULT WINAPI EditStreamCopy (PAVISTREAM pStream, LONG *plStart, LONG *plLength, PAVISTREAM *ppResult)
 
HRESULT WINAPI EditStreamCut (PAVISTREAM pStream, LONG *plStart, LONG *plLength, PAVISTREAM *ppResult)
 
HRESULT WINAPI EditStreamPaste (PAVISTREAM pDest, LONG *plStart, LONG *plLength, PAVISTREAM pSource, LONG lStart, LONG lEnd)
 
HRESULT WINAPI EditStreamSetInfoA (PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
 
HRESULT WINAPI EditStreamSetInfoW (PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
 
HRESULT WINAPI EditStreamSetNameA (PAVISTREAM pstream, LPCSTR szName)
 
HRESULT WINAPI EditStreamSetNameW (PAVISTREAM pstream, LPCWSTR szName)
 
HRESULT WINAPI AVIClearClipboard (void)
 
HRESULT WINAPI AVIGetFromClipboard (PAVIFILE *ppfile)
 
HRESULT WINAPI AVIMakeStreamFromClipboard (UINT cfFormat, HANDLE hGlobal, PAVISTREAM *ppstream)
 
HRESULT WINAPI AVIPutFileOnClipboard (PAVIFILE pfile)
 
HRESULT WINAPIV AVISaveA (LPCSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions,...)
 
HRESULT WINAPIV AVISaveW (LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions,...)
 

Variables

struct {
   UINT   uFlags
 
   INT   nStreams
 
   PAVISTREAM *   ppavis
 
   LPAVICOMPRESSOPTIONS *   ppOptions
 
   INT   nCurrent
 
SaveOpts
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file api.c.

◆ MAX_FILTERS

#define MAX_FILTERS   30 /* 30 => 7kB */

Definition at line 49 of file api.c.

Typedef Documentation

◆ AVIFilter

Function Documentation

◆ AVIBuildFilterA()

HRESULT WINAPI AVIBuildFilterA ( LPSTR  szFilter,
LONG  cbFilter,
BOOL  fSaving 
)

Definition at line 962 of file api.c.

963 {
965  HRESULT hr;
966 
967  TRACE("(%p,%d,%d)\n", szFilter, cbFilter, fSaving);
968 
969  /* check parameters */
970  if (szFilter == NULL)
971  return AVIERR_BADPARAM;
972  if (cbFilter < 2)
973  return AVIERR_BADSIZE;
974 
975  szFilter[0] = 0;
976  szFilter[1] = 0;
977 
978  wszFilter = HeapAlloc(GetProcessHeap(), 0, cbFilter * sizeof(WCHAR));
979  if (wszFilter == NULL)
980  return AVIERR_MEMORY;
981 
982  hr = AVIBuildFilterW(wszFilter, cbFilter, fSaving);
983  if (SUCCEEDED(hr)) {
984  WideCharToMultiByte(CP_ACP, 0, wszFilter, cbFilter,
985  szFilter, cbFilter, NULL, NULL);
986  }
987 
989 
990  return hr;
991 }
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
static WCHAR wszFilter[MAX_STRING_LEN *4+6 *3+5]
Definition: wordpad.c:71
#define CP_ACP
Definition: compat.h:99
#define AVIERR_MEMORY
Definition: vfw.h:1745
smooth NULL
Definition: ftsmooth.c:416
LPTSTR szFilter
Definition: mplay32.c:30
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define AVIERR_BADSIZE
Definition: vfw.h:1749
HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
Definition: api.c:996
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AVIBuildFilterW()

HRESULT WINAPI AVIBuildFilterW ( LPWSTR  szFilter,
LONG  cbFilter,
BOOL  fSaving 
)

Definition at line 996 of file api.c.

997 {
998  static const WCHAR all_files[] = { '*','.','*',0,0 };
999  static const WCHAR szClsid[] = {'C','L','S','I','D',0};
1000  static const WCHAR szExtensionFmt[] = {';','*','.','%','s',0};
1001  static const WCHAR szAVIFileExtensions[] =
1002  {'A','V','I','F','i','l','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1003 
1004  AVIFilter *lp;
1005  WCHAR szAllFiles[40];
1006  WCHAR szFileExt[10];
1007  WCHAR szValue[128];
1008  HKEY hKey;
1009  DWORD n, i;
1010  LONG size;
1011  DWORD count = 0;
1012 
1013  TRACE("(%p,%d,%d)\n", szFilter, cbFilter, fSaving);
1014 
1015  /* check parameters */
1016  if (szFilter == NULL)
1017  return AVIERR_BADPARAM;
1018  if (cbFilter < 2)
1019  return AVIERR_BADSIZE;
1020 
1022  if (lp == NULL)
1023  return AVIERR_MEMORY;
1024 
1025  /*
1026  * 1. iterate over HKEY_CLASSES_ROOT\\AVIFile\\Extensions and collect
1027  * extensions and CLSIDs
1028  * 2. iterate over collected CLSIDs and copy its description and its
1029  * extensions to szFilter if it fits
1030  *
1031  * First filter is named "All multimedia files" and its filter is a
1032  * collection of all possible extensions except "*.*".
1033  */
1034  if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != ERROR_SUCCESS) {
1035  HeapFree(GetProcessHeap(), 0, lp);
1036  return AVIERR_ERROR;
1037  }
1038  for (n = 0;RegEnumKeyW(hKey, n, szFileExt, ARRAY_SIZE(szFileExt)) == ERROR_SUCCESS;n++) {
1039  WCHAR clsidW[40];
1040 
1041  /* get CLSID to extension */
1042  size = sizeof(clsidW);
1043  if (RegQueryValueW(hKey, szFileExt, clsidW, &size) != ERROR_SUCCESS)
1044  break;
1045 
1046  /* search if the CLSID is already known */
1047  for (i = 1; i <= count; i++) {
1048  if (lstrcmpW(lp[i].szClsid, clsidW) == 0)
1049  break; /* a new one */
1050  }
1051 
1052  if (i == count + 1) {
1053  /* it's a new CLSID */
1054 
1055  /* FIXME: How do we get info's about read/write capabilities? */
1056 
1057  if (count >= MAX_FILTERS) {
1058  /* try to inform user of our full fixed size table */
1059  ERR(": More than %d filters found! Adjust MAX_FILTERS in dlls/avifil32/api.c\n", MAX_FILTERS);
1060  break;
1061  }
1062 
1063  lstrcpyW(lp[i].szClsid, clsidW);
1064 
1065  count++;
1066  }
1067 
1068  /* append extension to the filter */
1069  wsprintfW(szValue, szExtensionFmt, szFileExt);
1070  if (lp[i].szExtensions[0] == 0)
1071  lstrcatW(lp[i].szExtensions, szValue + 1);
1072  else
1073  lstrcatW(lp[i].szExtensions, szValue);
1074 
1075  /* also append to the "all multimedia"-filter */
1076  if (lp[0].szExtensions[0] == 0)
1077  lstrcatW(lp[0].szExtensions, szValue + 1);
1078  else
1079  lstrcatW(lp[0].szExtensions, szValue);
1080  }
1081  RegCloseKey(hKey);
1082 
1083  /* 2. get descriptions for the CLSIDs and fill out szFilter */
1084  if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != ERROR_SUCCESS) {
1085  HeapFree(GetProcessHeap(), 0, lp);
1086  return AVIERR_ERROR;
1087  }
1088  for (n = 0; n <= count; n++) {
1089  /* first the description */
1090  if (n != 0) {
1091  size = sizeof(szValue);
1092  if (RegQueryValueW(hKey, lp[n].szClsid, szValue, &size) == ERROR_SUCCESS) {
1093  size = lstrlenW(szValue);
1094  lstrcpynW(szFilter, szValue, cbFilter);
1095  }
1096  } else
1098 
1099  /* check for enough space */
1100  size++;
1101  if (cbFilter < size + lstrlenW(lp[n].szExtensions) + 2) {
1102  szFilter[0] = 0;
1103  szFilter[1] = 0;
1104  HeapFree(GetProcessHeap(), 0, lp);
1105  RegCloseKey(hKey);
1106  return AVIERR_BUFFERTOOSMALL;
1107  }
1108  cbFilter -= size;
1109  szFilter += size;
1110 
1111  /* and then the filter */
1112  lstrcpynW(szFilter, lp[n].szExtensions, cbFilter);
1113  size = lstrlenW(lp[n].szExtensions) + 1;
1114  cbFilter -= size;
1115  szFilter += size;
1116  }
1117 
1118  RegCloseKey(hKey);
1119  HeapFree(GetProcessHeap(), 0, lp);
1120 
1121  /* add "All files" "*.*" filter if enough space left */
1123  ARRAY_SIZE(szAllFiles) - ARRAY_SIZE(all_files)) + 1;
1124  memcpy( szAllFiles + size, all_files, sizeof(all_files) );
1126 
1127  if (cbFilter > size) {
1128  memcpy(szFilter, szAllFiles, size * sizeof(szAllFiles[0]));
1129  return AVIERR_OK;
1130  } else {
1131  szFilter[0] = 0;
1132  return AVIERR_BUFFERTOOSMALL;
1133  }
1134 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define ERROR_SUCCESS
Definition: deptool.c:10
HMODULE AVIFILE_hModule
Definition: factory.c:39
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
#define lstrlenW
Definition: compat.h:407
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define lstrcpynW
Definition: compat.h:397
#define AVIERR_MEMORY
Definition: vfw.h:1745
#define IDS_ALLMULTIMEDIA
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
smooth NULL
Definition: ftsmooth.c:416
LPTSTR szFilter
Definition: mplay32.c:30
#define AVIERR_BUFFERTOOSMALL
Definition: vfw.h:1758
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
static const WCHAR clsidW[]
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define AVIERR_BADSIZE
Definition: vfw.h:1749
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define AVIERR_OK
Definition: vfw.h:1740
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2430
#define ERR(fmt,...)
Definition: debug.h:109
int all_files
Definition: mkisofs.c:132
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define IDS_ALLFILES
Definition: definitions.h:229
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define MAX_FILTERS
Definition: api.c:49
#define HeapFree(x, y, z)
Definition: compat.h:394
#define AVIERR_ERROR
Definition: vfw.h:1761
Definition: api.c:51

Referenced by AVIBuildFilterA().

◆ AVIClearClipboard()

HRESULT WINAPI AVIClearClipboard ( void  )

Definition at line 2195 of file api.c.

2196 {
2197  TRACE("()\n");
2198 
2199  return AVIERR_UNSUPPORTED; /* OleSetClipboard(NULL); */
2200 }
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4

◆ AVIFILE_AVISaveDefaultCallback()

static BOOL WINAPI AVIFILE_AVISaveDefaultCallback ( INT  progress)
static

Definition at line 1548 of file api.c.

1549 {
1550  TRACE("(%d)\n", progress);
1551 
1552  return FALSE;
1553 }
#define TRACE(s)
Definition: solgame.cpp:4
cd_progress_ptr progress
Definition: cdjpeg.h:150

Referenced by AVISaveVW().

◆ AVIFILE_CLSIDFromString()

static HRESULT AVIFILE_CLSIDFromString ( LPCSTR  idstr,
LPCLSID  id 
)
static

Definition at line 70 of file api.c.

71 {
72  BYTE const *s;
73  BYTE *p;
74  INT i;
75  BYTE table[256];
76 
77  if (!idstr) {
78  memset(id, 0, sizeof(CLSID));
79  return S_OK;
80  }
81 
82  /* validate the CLSID string */
83  if (lstrlenA(idstr) != 38)
84  return CO_E_CLASSSTRING;
85 
86  s = (BYTE const*)idstr;
87  if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
88  (s[24]!='-') || (s[37]!='}'))
89  return CO_E_CLASSSTRING;
90 
91  for (i = 1; i < 37; i++) {
92  if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
93  continue;
94  if (!(((s[i] >= '0') && (s[i] <= '9')) ||
95  ((s[i] >= 'a') && (s[i] <= 'f')) ||
96  ((s[i] >= 'A') && (s[i] <= 'F')))
97  )
98  return CO_E_CLASSSTRING;
99  }
100 
101  TRACE("%s -> %p\n", s, id);
102 
103  /* quick lookup table */
104  memset(table, 0, 256);
105 
106  for (i = 0; i < 10; i++)
107  table['0' + i] = i;
108 
109  for (i = 0; i < 6; i++) {
110  table['A' + i] = i+10;
111  table['a' + i] = i+10;
112  }
113 
114  /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
115  p = (BYTE *) id;
116 
117  s++; /* skip leading brace */
118  for (i = 0; i < 4; i++) {
119  p[3 - i] = table[*s]<<4 | table[*(s+1)];
120  s += 2;
121  }
122  p += 4;
123  s++; /* skip - */
124 
125  for (i = 0; i < 2; i++) {
126  p[1-i] = table[*s]<<4 | table[*(s+1)];
127  s += 2;
128  }
129  p += 2;
130  s++; /* skip - */
131 
132  for (i = 0; i < 2; i++) {
133  p[1-i] = table[*s]<<4 | table[*(s+1)];
134  s += 2;
135  }
136  p += 2;
137  s++; /* skip - */
138 
139  /* these are just sequential bytes */
140  for (i = 0; i < 2; i++) {
141  *p++ = table[*s]<<4 | table[*(s+1)];
142  s += 2;
143  }
144  s++; /* skip - */
145 
146  for (i = 0; i < 6; i++) {
147  *p++ = table[*s]<<4 | table[*(s+1)];
148  s += 2;
149  }
150 
151  return S_OK;
152 }
int32_t INT
Definition: typedefs.h:56
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
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
#define S_OK
Definition: intsafe.h:59
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39

Referenced by AVIFILE_GetFileHandlerByExtension(), and AVIMakeCompressedStream().

◆ AVIFILE_GetFileHandlerByExtension()

static BOOL AVIFILE_GetFileHandlerByExtension ( LPCWSTR  szFile,
LPCLSID  lpclsid 
)
static

Definition at line 154 of file api.c.

155 {
156  CHAR szRegKey[25];
157  CHAR szValue[100];
158  LPWSTR szExt = strrchrW(szFile, '.');
159  LONG len = ARRAY_SIZE(szValue);
160 
161  if (szExt == NULL)
162  return FALSE;
163 
164  szExt++;
165 
166  wsprintfA(szRegKey, "AVIFile\\Extensions\\%.3ls", szExt);
167  if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &len) != ERROR_SUCCESS)
168  return FALSE;
169 
170  return (AVIFILE_CLSIDFromString(szValue, lpclsid) == S_OK);
171 }
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4243
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
Definition: api.c:70
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define S_OK
Definition: intsafe.h:59
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by AVIFileOpenW().

◆ AVIFileAddRef()

ULONG WINAPI AVIFileAddRef ( PAVIFILE  pfile)

Definition at line 277 of file api.c.

278 {
279  TRACE("(%p)\n", pfile);
280 
281  if (pfile == NULL) {
282  ERR(": bad handle passed!\n");
283  return 0;
284  }
285 
286  return IAVIFile_AddRef(pfile);
287 }
#define IAVIFile_AddRef(p)
Definition: vfw.h:1603
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109

◆ AVIFileCreateStreamA()

HRESULT WINAPI AVIFileCreateStreamA ( PAVIFILE  pfile,
PAVISTREAM ppavi,
LPAVISTREAMINFOA  psi 
)

Definition at line 361 of file api.c.

363 {
364  AVISTREAMINFOW psiw;
365 
366  TRACE("(%p,%p,%p)\n", pfile, ppavi, psi);
367 
368  if (pfile == NULL)
369  return AVIERR_BADHANDLE;
370 
371  /* Only the szName at the end is different */
372  memcpy(&psiw, psi, sizeof(*psi) - sizeof(psi->szName));
373  MultiByteToWideChar(CP_ACP, 0, psi->szName, -1, psiw.szName,
374  ARRAY_SIZE(psiw.szName));
375 
376  return IAVIFile_CreateStream(pfile, ppavi, &psiw);
377 }
#define CP_ACP
Definition: compat.h:99
CHAR szName[64]
Definition: vfw.h:1021
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
#define IAVIFile_CreateStream(p, a, b)
Definition: vfw.h:1608
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR szName[64]
Definition: avifil32.idl:46
#define MultiByteToWideChar
Definition: compat.h:100

◆ AVIFileCreateStreamW()

HRESULT WINAPI AVIFileCreateStreamW ( PAVIFILE  pfile,
PAVISTREAM avis,
LPAVISTREAMINFOW  asi 
)

Definition at line 382 of file api.c.

384 {
385  TRACE("(%p,%p,%p)\n", pfile, avis, asi);
386 
387  if (pfile == NULL)
388  return AVIERR_BADHANDLE;
389 
390  return IAVIFile_CreateStream(pfile, avis, asi);
391 }
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
#define IAVIFile_CreateStream(p, a, b)
Definition: vfw.h:1608
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVISaveVW().

◆ AVIFileEndRecord()

HRESULT WINAPI AVIFileEndRecord ( PAVIFILE  pfile)

Definition at line 422 of file api.c.

423 {
424  TRACE("(%p)\n", pfile);
425 
426  if (pfile == NULL)
427  return AVIERR_BADHANDLE;
428 
429  return IAVIFile_EndRecord(pfile);
430 }
#define IAVIFile_EndRecord(p)
Definition: vfw.h:1611
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVISaveVW().

◆ AVIFileExit()

void WINAPI AVIFileExit ( void  )

Definition at line 183 of file api.c.

183  {
184  /* need to free ole32.dll if we are the last exit call */
185  /* OleUninitialize() */
186  FIXME("(): stub!\n");
187 }
#define FIXME(fmt,...)
Definition: debug.h:110

Referenced by START_TEST().

◆ AVIFileGetStream()

HRESULT WINAPI AVIFileGetStream ( PAVIFILE  pfile,
PAVISTREAM avis,
DWORD  fccType,
LONG  lParam 
)

Definition at line 346 of file api.c.

348 {
349  TRACE("(%p,%p,'%4.4s',%d)\n", pfile, avis, (char*)&fccType, lParam);
350 
351  if (pfile == NULL)
352  return AVIERR_BADHANDLE;
353 
354  return IAVIFile_GetStream(pfile, avis, fccType, lParam);
355 }
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define IAVIFile_GetStream(p, a, b, c)
Definition: vfw.h:1607
LPARAM lParam
Definition: combotst.c:139

Referenced by test_ash1_corruption(), test_ash1_corruption2(), and test_default_data().

◆ AVIFileInfoA()

HRESULT WINAPI AVIFileInfoA ( PAVIFILE  pfile,
LPAVIFILEINFOA  afi,
LONG  size 
)

Definition at line 308 of file api.c.

309 {
310  AVIFILEINFOW afiw;
311  HRESULT hres;
312 
313  TRACE("(%p,%p,%d)\n", pfile, afi, size);
314 
315  if (pfile == NULL)
316  return AVIERR_BADHANDLE;
317  if ((DWORD)size < sizeof(AVIFILEINFOA))
318  return AVIERR_BADSIZE;
319 
320  hres = IAVIFile_Info(pfile, &afiw, sizeof(afiw));
321 
322  memcpy(afi, &afiw, sizeof(*afi) - sizeof(afi->szFileType));
323  WideCharToMultiByte(CP_ACP, 0, afiw.szFileType, -1, afi->szFileType,
324  sizeof(afi->szFileType), NULL, NULL);
325  afi->szFileType[sizeof(afi->szFileType) - 1] = 0;
326 
327  return hres;
328 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define IAVIFile_Info(p, a, b)
Definition: vfw.h:1606
CHAR szFileType[64]
Definition: vfw.h:1091
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define AVIERR_BADSIZE
Definition: vfw.h:1749
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR szFileType[64]
Definition: avifil32.idl:81
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ AVIFileInfoW()

HRESULT WINAPI AVIFileInfoW ( PAVIFILE  pfile,
LPAVIFILEINFOW  afiw,
LONG  size 
)

Definition at line 333 of file api.c.

334 {
335  TRACE("(%p,%p,%d)\n", pfile, afiw, size);
336 
337  if (pfile == NULL)
338  return AVIERR_BADHANDLE;
339 
340  return IAVIFile_Info(pfile, afiw, size);
341 }
#define IAVIFile_Info(p, a, b)
Definition: vfw.h:1606
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919

Referenced by AVISaveVW().

◆ AVIFileInit()

void WINAPI AVIFileInit ( void  )

Definition at line 176 of file api.c.

176  {
178 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172

Referenced by START_TEST().

◆ AVIFileOpenA()

HRESULT WINAPI AVIFileOpenA ( PAVIFILE ppfile,
LPCSTR  szFile,
UINT  uMode,
LPCLSID  lpHandler 
)

Definition at line 193 of file api.c.

195 {
196  LPWSTR wszFile = NULL;
197  HRESULT hr;
198  int len;
199 
200  TRACE("(%p,%s,0x%08X,%s)\n", ppfile, debugstr_a(szFile), uMode,
201  debugstr_guid(lpHandler));
202 
203  /* check parameters */
204  if (ppfile == NULL || szFile == NULL)
205  return AVIERR_BADPARAM;
206 
207  /* convert ASCII string to Unicode and call unicode function */
208  len = MultiByteToWideChar(CP_ACP, 0, szFile, -1, NULL, 0);
209  if (len <= 0)
210  return AVIERR_BADPARAM;
211 
212  wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
213  if (wszFile == NULL)
214  return AVIERR_MEMORY;
215 
216  MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len);
217 
218  hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
219 
221 
222  return hr;
223 }
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
#define AVIERR_MEMORY
Definition: vfw.h:1745
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:228
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by AVIStreamOpenFromFileA(), test_amh_corruption(), test_ash1_corruption(), test_ash1_corruption2(), and test_default_data().

◆ AVIFileOpenW()

HRESULT WINAPI AVIFileOpenW ( PAVIFILE ppfile,
LPCWSTR  szFile,
UINT  uMode,
LPCLSID  lpHandler 
)

Definition at line 228 of file api.c.

230 {
231  IPersistFile *ppersist = NULL;
232  CLSID clsidHandler;
233  HRESULT hr;
234 
235  TRACE("(%p,%s,0x%X,%s)\n", ppfile, debugstr_w(szFile), uMode,
236  debugstr_guid(lpHandler));
237 
238  /* check parameters */
239  if (ppfile == NULL || szFile == NULL)
240  return AVIERR_BADPARAM;
241 
242  *ppfile = NULL;
243 
244  /* if no handler then try guessing it by extension */
245  if (lpHandler == NULL) {
246  if (! AVIFILE_GetFileHandlerByExtension(szFile, &clsidHandler))
247  clsidHandler = CLSID_AVIFile;
248  } else
249  clsidHandler = *lpHandler;
250 
251  /* create instance of handler */
252  hr = CoCreateInstance(&clsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIFile, (LPVOID*)ppfile);
253  if (FAILED(hr) || *ppfile == NULL)
254  return hr;
255 
256  /* ask for IPersistFile interface for loading/creating the file */
257  hr = IAVIFile_QueryInterface(*ppfile, &IID_IPersistFile, (LPVOID*)&ppersist);
258  if (FAILED(hr) || ppersist == NULL) {
259  IAVIFile_Release(*ppfile);
260  *ppfile = NULL;
261  return hr;
262  }
263 
264  hr = IPersistFile_Load(ppersist, szFile, uMode);
265  IPersistFile_Release(ppersist);
266  if (FAILED(hr)) {
267  IAVIFile_Release(*ppfile);
268  *ppfile = NULL;
269  }
270 
271  return hr;
272 }
#define IAVIFile_QueryInterface(p, a, b)
Definition: vfw.h:1602
HRESULT hr
Definition: shlfolder.c:183
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
const GUID IID_IPersistFile
#define IAVIFile_Release(p)
Definition: vfw.h:1604
static BOOL AVIFILE_GetFileHandlerByExtension(LPCWSTR szFile, LPCLSID lpclsid)
Definition: api.c:154

Referenced by AVIFileOpenA(), AVISaveVW(), and AVIStreamOpenFromFileW().

◆ AVIFileReadData()

HRESULT WINAPI AVIFileReadData ( PAVIFILE  pfile,
DWORD  fcc,
LPVOID  lp,
LPLONG  size 
)

Definition at line 409 of file api.c.

410 {
411  TRACE("(%p,'%4.4s',%p,%p)\n", pfile, (char*)&fcc, lp, size);
412 
413  if (pfile == NULL)
414  return AVIERR_BADHANDLE;
415 
416  return IAVIFile_ReadData(pfile, fcc, lp, size);
417 }
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define IAVIFile_ReadData(p, a, b, c)
Definition: vfw.h:1610

◆ AVIFileRelease()

ULONG WINAPI AVIFileRelease ( PAVIFILE  pfile)

Definition at line 292 of file api.c.

293 {
294  TRACE("(%p)\n", pfile);
295 
296  if (pfile == NULL) {
297  ERR(": bad handle passed!\n");
298  return 0;
299  }
300 
301  return IAVIFile_Release(pfile);
302 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
#define IAVIFile_Release(p)
Definition: vfw.h:1604

Referenced by AVISaveVW(), test_ash1_corruption(), test_ash1_corruption2(), and test_default_data().

◆ AVIFileWriteData()

HRESULT WINAPI AVIFileWriteData ( PAVIFILE  pfile,
DWORD  fcc,
LPVOID  lp,
LONG  size 
)

Definition at line 396 of file api.c.

397 {
398  TRACE("(%p,'%4.4s',%p,%d)\n", pfile, (char*)&fcc, lp, size);
399 
400  if (pfile == NULL)
401  return AVIERR_BADHANDLE;
402 
403  return IAVIFile_WriteData(pfile, fcc, lp, size);
404 }
#define IAVIFile_WriteData(p, a, b, c)
Definition: vfw.h:1609
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919

◆ AVIGetFromClipboard()

HRESULT WINAPI AVIGetFromClipboard ( PAVIFILE ppfile)

Definition at line 2205 of file api.c.

2206 {
2207  FIXME("(%p), stub!\n", ppfile);
2208 
2209  *ppfile = NULL;
2210 
2211  return AVIERR_UNSUPPORTED;
2212 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743

◆ AVIMakeCompressedStream()

HRESULT WINAPI AVIMakeCompressedStream ( PAVISTREAM ppsCompressed,
PAVISTREAM  psSource,
LPAVICOMPRESSOPTIONS  aco,
LPCLSID  pclsidHandler 
)

Definition at line 690 of file api.c.

694 {
695  AVISTREAMINFOW asiw;
696  CHAR szRegKey[25];
697  CHAR szValue[100];
698  CLSID clsidHandler;
699  HRESULT hr;
700  LONG size = sizeof(szValue);
701 
702  TRACE("(%p,%p,%p,%s)\n", ppsCompressed, psSource, aco,
703  debugstr_guid(pclsidHandler));
704 
705  if (ppsCompressed == NULL)
706  return AVIERR_BADPARAM;
707  if (psSource == NULL)
708  return AVIERR_BADHANDLE;
709 
710  *ppsCompressed = NULL;
711 
712  /* if no handler given get default ones based on streamtype */
713  if (pclsidHandler == NULL) {
714  hr = IAVIStream_Info(psSource, &asiw, sizeof(asiw));
715  if (FAILED(hr))
716  return hr;
717 
718  wsprintfA(szRegKey, "AVIFile\\Compressors\\%4.4s", (char*)&asiw.fccType);
719  if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &size) != ERROR_SUCCESS)
720  return AVIERR_UNSUPPORTED;
721  if (AVIFILE_CLSIDFromString(szValue, &clsidHandler) != S_OK)
722  return AVIERR_UNSUPPORTED;
723  } else
724  clsidHandler = *pclsidHandler;
725 
726  hr = CoCreateInstance(&clsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIStream, (LPVOID*)ppsCompressed);
727  if (FAILED(hr) || *ppsCompressed == NULL)
728  return hr;
729 
730  hr = IAVIStream_Create(*ppsCompressed, (LPARAM)psSource, (LPARAM)aco);
731  if (FAILED(hr)) {
732  IAVIStream_Release(*ppsCompressed);
733  *ppsCompressed = NULL;
734  }
735 
736  return hr;
737 }
#define IAVIStream_Create(p, a, b)
Definition: vfw.h:1179
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4243
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
char CHAR
Definition: xmlstorage.h:175
#define IAVIStream_Release(p)
Definition: vfw.h:1177
long LONG
Definition: pedump.c:60
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
Definition: api.c:70
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by AVISaveVW().

◆ AVIMakeFileFromStreams()

HRESULT WINAPI AVIMakeFileFromStreams ( PAVIFILE ppfile,
int  nStreams,
PAVISTREAM ppStreams 
)

Definition at line 742 of file api.c.

744 {
745  TRACE("(%p,%d,%p)\n", ppfile, nStreams, ppStreams);
746 
747  if (nStreams < 0 || ppfile == NULL || ppStreams == NULL)
748  return AVIERR_BADPARAM;
749 
750  *ppfile = AVIFILE_CreateAVITempFile(nStreams, ppStreams);
751  if (*ppfile == NULL)
752  return AVIERR_MEMORY;
753 
754  return AVIERR_OK;
755 }
#define AVIERR_MEMORY
Definition: vfw.h:1745
smooth NULL
Definition: ftsmooth.c:416
INT nStreams
Definition: api.c:61
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define AVIERR_OK
Definition: vfw.h:1740
PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams) DECLSPEC_HIDDEN
Definition: tmpfile.c:220

◆ AVIMakeStreamFromClipboard()

HRESULT WINAPI AVIMakeStreamFromClipboard ( UINT  cfFormat,
HANDLE  hGlobal,
PAVISTREAM ppstream 
)

Definition at line 2217 of file api.c.

2219 {
2220  FIXME("(0x%08x,%p,%p), stub!\n", cfFormat, hGlobal, ppstream);
2221 
2222  if (ppstream == NULL)
2223  return AVIERR_BADHANDLE;
2224 
2225  return AVIERR_UNSUPPORTED;
2226 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743

◆ AVIPutFileOnClipboard()

HRESULT WINAPI AVIPutFileOnClipboard ( PAVIFILE  pfile)

Definition at line 2231 of file api.c.

2232 {
2233  FIXME("(%p), stub!\n", pfile);
2234 
2235  if (pfile == NULL)
2236  return AVIERR_BADHANDLE;
2237 
2238  return AVIERR_UNSUPPORTED;
2239 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743

◆ AVISaveA()

HRESULT WINAPIV AVISaveA ( LPCSTR  szFile,
CLSID pclsidHandler,
AVISAVECALLBACK  lpfnCallback,
int  nStreams,
PAVISTREAM  pavi,
LPAVICOMPRESSOPTIONS  lpOptions,
  ... 
)

Definition at line 2241 of file api.c.

2243 {
2244  __ms_va_list vl;
2245  int i;
2246  HRESULT ret;
2247  PAVISTREAM *streams;
2249 
2250  TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler, lpfnCallback,
2251  nStreams, pavi, lpOptions);
2252 
2253  if (nStreams <= 0) return AVIERR_BADPARAM;
2254 
2255  streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*streams));
2256  options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*options));
2257  if (!streams || !options)
2258  {
2259  ret = AVIERR_MEMORY;
2260  goto error;
2261  }
2262 
2263  streams[0] = pavi;
2264  options[0] = lpOptions;
2265 
2266  __ms_va_start(vl, lpOptions);
2267  for (i = 1; i < nStreams; i++)
2268  {
2269  streams[i] = va_arg(vl, PAVISTREAM);
2271  }
2272  __ms_va_end(vl);
2273 
2274  for (i = 0; i < nStreams; i++)
2275  TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]);
2276 
2277  ret = AVISaveVA(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options);
2278 error:
2279  HeapFree(GetProcessHeap(), 0, streams);
2281  return ret;
2282 }
static const char __ms_va_list
Definition: printf.c:70
#define error(str)
Definition: mkdosfs.c:1605
#define AVIERR_MEMORY
Definition: vfw.h:1745
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
INT nStreams
Definition: api.c:61
int options
Definition: main.c:106
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
int ret
#define va_arg(ap, T)
Definition: acmsvcex.h:89
#define __ms_va_end(list)
Definition: windef.h:443
HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStream, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
Definition: api.c:1512
#define __ms_va_start(list, arg)
Definition: windef.h:442
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ AVISaveOptions()

BOOL WINAPI AVISaveOptions ( HWND  hWnd,
UINT  uFlags,
INT  nStreams,
PAVISTREAM ppavi,
LPAVICOMPRESSOPTIONS ppOptions 
)

Definition at line 1429 of file api.c.

1431 {
1432  LPAVICOMPRESSOPTIONS pSavedOptions = NULL;
1433  INT ret, n;
1434 
1435  TRACE("(%p,0x%X,%d,%p,%p)\n", hWnd, uFlags, nStreams,
1436  ppavi, ppOptions);
1437 
1438  /* check parameters */
1439  if (nStreams <= 0 || ppavi == NULL || ppOptions == NULL)
1440  return AVIERR_BADPARAM;
1441 
1442  /* save options in case the user presses cancel */
1443  if (nStreams > 1) {
1444  pSavedOptions = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(AVICOMPRESSOPTIONS));
1445  if (pSavedOptions == NULL)
1446  return FALSE;
1447 
1448  for (n = 0; n < nStreams; n++) {
1449  if (ppOptions[n] != NULL)
1450  memcpy(pSavedOptions + n, ppOptions[n], sizeof(AVICOMPRESSOPTIONS));
1451  }
1452  }
1453 
1454  SaveOpts.uFlags = uFlags;
1455  SaveOpts.nStreams = nStreams;
1456  SaveOpts.ppavis = ppavi;
1457  SaveOpts.ppOptions = ppOptions;
1458 
1461 
1462  if (ret == -1)
1463  ret = FALSE;
1464 
1465  /* restore options when user pressed cancel */
1466  if (pSavedOptions != NULL) {
1467  if (ret == FALSE) {
1468  for (n = 0; n < nStreams; n++) {
1469  if (ppOptions[n] != NULL)
1470  memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
1471  }
1472  }
1473  HeapFree(GetProcessHeap(), 0, pSavedOptions);
1474  }
1475 
1476  return ret;
1477 }
HMODULE AVIFILE_hModule
Definition: factory.c:39
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
UINT uFlags
Definition: api.c:60
int32_t INT
Definition: typedefs.h:56
static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: api.c:1344
smooth NULL
Definition: ftsmooth.c:416
INT nStreams
Definition: api.c:61
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static struct @311 SaveOpts
LPAVICOMPRESSOPTIONS * ppOptions
Definition: api.c:63
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDD_SAVEOPTIONS
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_AVISaveOptions().

◆ AVISaveOptionsDlgProc()

static INT_PTR CALLBACK AVISaveOptionsDlgProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1344 of file api.c.

1346 {
1347  DWORD dwInterleave;
1348  BOOL bIsInterleaved;
1349  INT n;
1350 
1351  /*TRACE("(%p,%u,0x%04X,0x%08lX)\n", hWnd, uMsg, wParam, lParam);*/
1352 
1353  switch (uMsg) {
1354  case WM_INITDIALOG:
1355  SaveOpts.nCurrent = 0;
1356  if (SaveOpts.nStreams == 1) {
1358  return TRUE;
1359  }
1360 
1361  /* add streams */
1362  for (n = 0; n < SaveOpts.nStreams; n++) {
1363  AVISTREAMINFOW sInfo;
1364 
1365  AVIStreamInfoW(SaveOpts.ppavis[n], &sInfo, sizeof(sInfo));
1367  0L, (LPARAM)sInfo.szName);
1368  }
1369 
1370  /* select first stream */
1373 
1374  /* initialize interleave */
1375  if (SaveOpts.ppOptions[0] != NULL &&
1376  (SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_VALID)) {
1377  bIsInterleaved = (SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_INTERLEAVE);
1378  dwInterleave = SaveOpts.ppOptions[0]->dwInterleaveEvery;
1379  } else {
1380  bIsInterleaved = TRUE;
1381  dwInterleave = 0;
1382  }
1383  CheckDlgButton(hWnd, IDC_INTERLEAVE, bIsInterleaved);
1384  SetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, dwInterleave, FALSE);
1385  EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
1386  break;
1387  case WM_COMMAND:
1388  switch (LOWORD(wParam)) {
1389  case IDOK:
1390  /* get data from controls and save them */
1391  dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
1392  bIsInterleaved = IsDlgButtonChecked(hWnd, IDC_INTERLEAVE);
1393  for (n = 0; n < SaveOpts.nStreams; n++) {
1394  if (SaveOpts.ppOptions[n] != NULL) {
1395  if (bIsInterleaved) {
1396  SaveOpts.ppOptions[n]->dwFlags |= AVICOMPRESSF_INTERLEAVE;
1397  SaveOpts.ppOptions[n]->dwInterleaveEvery = dwInterleave;
1398  } else
1399  SaveOpts.ppOptions[n]->dwFlags &= ~AVICOMPRESSF_INTERLEAVE;
1400  }
1401  }
1402  /* fall through */
1403  case IDCANCEL:
1405  break;
1406  case IDC_INTERLEAVE:
1409  break;
1410  case IDC_STREAM:
1411  if (HIWORD(wParam) == CBN_SELCHANGE) {
1412  /* update control elements */
1414  }
1415  break;
1416  case IDC_OPTIONS:
1418  break;
1419  };
1420  return TRUE;
1421  };
1422 
1423  return FALSE;
1424 }
static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
Definition: api.c:1136
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define AVICOMPRESSF_VALID
Definition: vfw.h:1101
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:523
#define IDC_OPTIONS
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IDC_INTERLEAVE
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_ADDSTRING
Definition: winuser.h:1897
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
LONG_PTR LPARAM
Definition: windef.h:208
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDC_STREAM
static void AVISaveOptionsUpdate(HWND hWnd)
Definition: api.c:1256
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_INTERLEAVEEVERY
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static const WCHAR L[]
Definition: oid.c:1250
static struct @311 SaveOpts
#define CB_SETCURSEL
Definition: winuser.h:1922
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR szName[64]
Definition: avifil32.idl:46
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define HIWORD(l)
Definition: typedefs.h:246
#define AVICOMPRESSF_INTERLEAVE
Definition: vfw.h:1098
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
#define LOWORD(l)
Definition: pedump.c:82

Referenced by AVISaveOptions().

◆ AVISaveOptionsFmtChoose()

static BOOL AVISaveOptionsFmtChoose ( HWND  hWnd)
static

Definition at line 1136 of file api.c.

1137 {
1138  LPAVICOMPRESSOPTIONS pOptions = SaveOpts.ppOptions[SaveOpts.nCurrent];
1139  AVISTREAMINFOW sInfo;
1140 
1141  TRACE("(%p)\n", hWnd);
1142 
1143  if (pOptions == NULL || SaveOpts.ppavis[SaveOpts.nCurrent] == NULL) {
1144  ERR(": bad state!\n");
1145  return FALSE;
1146  }
1147 
1148  if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent],
1149  &sInfo, sizeof(sInfo)))) {
1150  ERR(": AVIStreamInfoW failed!\n");
1151  return FALSE;
1152  }
1153 
1154  if (sInfo.fccType == streamtypeVIDEO) {
1155  COMPVARS cv;
1156  BOOL ret;
1157 
1158  memset(&cv, 0, sizeof(cv));
1159 
1160  if ((pOptions->dwFlags & AVICOMPRESSF_VALID) == 0) {
1161  memset(pOptions, 0, sizeof(AVICOMPRESSOPTIONS));
1162  pOptions->fccType = streamtypeVIDEO;
1163  pOptions->fccHandler = comptypeDIB;
1164  pOptions->dwQuality = (DWORD)ICQUALITY_DEFAULT;
1165  }
1166 
1167  cv.cbSize = sizeof(cv);
1169  /*cv.fccType = pOptions->fccType; */
1170  cv.fccHandler = pOptions->fccHandler;
1171  cv.lQ = pOptions->dwQuality;
1172  cv.lpState = pOptions->lpParms;
1173  cv.cbState = pOptions->cbParms;
1174  if (pOptions->dwFlags & AVICOMPRESSF_KEYFRAMES)
1175  cv.lKey = pOptions->dwKeyFrameEvery;
1176  else
1177  cv.lKey = 0;
1178  if (pOptions->dwFlags & AVICOMPRESSF_DATARATE)
1179  cv.lDataRate = pOptions->dwBytesPerSecond / 1024; /* need kBytes */
1180  else
1181  cv.lDataRate = 0;
1182 
1184  SaveOpts.ppavis[SaveOpts.nCurrent], &cv, NULL);
1185 
1186  if (ret) {
1187  pOptions->fccHandler = cv.fccHandler;
1188  pOptions->lpParms = cv.lpState;
1189  pOptions->cbParms = cv.cbState;
1190  pOptions->dwQuality = cv.lQ;
1191  if (cv.lKey != 0) {
1192  pOptions->dwKeyFrameEvery = cv.lKey;
1193  pOptions->dwFlags |= AVICOMPRESSF_KEYFRAMES;
1194  } else
1195  pOptions->dwFlags &= ~AVICOMPRESSF_KEYFRAMES;
1196  if (cv.lDataRate != 0) {
1197  pOptions->dwBytesPerSecond = cv.lDataRate * 1024; /* need bytes */
1198  pOptions->dwFlags |= AVICOMPRESSF_DATARATE;
1199  } else
1200  pOptions->dwFlags &= ~AVICOMPRESSF_DATARATE;
1201  pOptions->dwFlags |= AVICOMPRESSF_VALID;
1202  }
1203  ICCompressorFree(&cv);
1204 
1205  return ret;
1206  } else if (sInfo.fccType == streamtypeAUDIO) {
1207  ACMFORMATCHOOSEW afmtc;
1208  MMRESULT ret;
1209  LONG size;
1210 
1211  /* FIXME: check ACM version -- Which version is needed? */
1212 
1213  memset(&afmtc, 0, sizeof(afmtc));
1214  afmtc.cbStruct = sizeof(afmtc);
1215  afmtc.fdwStyle = 0;
1216  afmtc.hwndOwner = hWnd;
1217 
1219  if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
1220  pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
1221  if (!pOptions->lpFormat) return FALSE;
1222  pOptions->cbFormat = size;
1223  } else if (pOptions->cbFormat < (DWORD)size) {
1224  void *new_buffer = HeapReAlloc(GetProcessHeap(), 0, pOptions->lpFormat, size);
1225  if (!new_buffer) return FALSE;
1226  pOptions->lpFormat = new_buffer;
1227  pOptions->cbFormat = size;
1228  }
1229  afmtc.pwfx = pOptions->lpFormat;
1230  afmtc.cbwfx = pOptions->cbFormat;
1231 
1232  size = 0;
1233  AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],
1234  sInfo.dwStart, &size);
1235  if (size < (LONG)sizeof(PCMWAVEFORMAT))
1236  size = sizeof(PCMWAVEFORMAT);
1237  afmtc.pwfxEnum = HeapAlloc(GetProcessHeap(), 0, size);
1238  if (afmtc.pwfxEnum != NULL) {
1239  AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
1240  sInfo.dwStart, afmtc.pwfxEnum, &size);
1242  }
1243 
1244  ret = acmFormatChooseW(&afmtc);
1245  if (ret == S_OK)
1246  pOptions->dwFlags |= AVICOMPRESSF_VALID;
1247 
1248  HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
1249  return ret == S_OK;
1250  } else {
1251  ERR(": unknown streamtype 0x%08X\n", sInfo.fccType);
1252  return FALSE;
1253  }
1254 }
#define AVICOMPRESSF_DATARATE
Definition: vfw.h:1099
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LPLONG formatsize)
Definition: api.c:550
LPVOID lpFormat
Definition: vfw.h:1110
#define AVICOMPRESSF_VALID
Definition: vfw.h:1101
DWORD cbStruct
Definition: msacm.h:462
DWORD dwKeyFrameEvery
Definition: vfw.h:1106
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:523
HWND hWnd
Definition: settings.c:17
MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc)
Definition: format.c:379
UINT MMRESULT
Definition: mmsystem.h:962
#define ICMF_COMPVARS_VALID
Definition: vfw.h:836
struct pcmwaveformat_tag PCMWAVEFORMAT
DWORD fccType
Definition: vfw.h:1104
#define DWORD
Definition: nt_native.h:44
#define AVIStreamFormatSize(pavi, lPos, plSize)
Definition: vfw.h:1436
#define comptypeDIB
Definition: vfw.h:147
DWORD fdwStyle
Definition: msacm.h:463
LONG lDataRate
Definition: vfw.h:829
DWORD dwBytesPerSecond
Definition: vfw.h:1108
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND hwndOwner
Definition: msacm.h:465
long LONG
Definition: pedump.c:60
PWAVEFORMATEX pwfx
Definition: msacm.h:467
#define ICQUALITY_DEFAULT
Definition: vfw.h:278
#define AVICOMPRESSF_KEYFRAMES
Definition: vfw.h:1100
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
Definition: msacm32_main.c:106
smooth NULL
Definition: ftsmooth.c:416
DWORD fdwEnum
Definition: msacm.h:477
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD fccHandler
Definition: vfw.h:1105
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG lQ
Definition: vfw.h:830
int ret
LONG lKey
Definition: vfw.h:828
DWORD dwQuality
Definition: vfw.h:1107
#define streamtypeAUDIO
Definition: aviriff.h:93
#define ACM_FORMATENUMF_CONVERT
Definition: msacm.h:168
static struct @311 SaveOpts
DWORD fccHandler
Definition: vfw.h:822
LPVOID lpState
Definition: vfw.h:832
DWORD dwFlags
Definition: vfw.h:1109
#define streamtypeVIDEO
Definition: aviriff.h:92
#define ERR(fmt,...)
Definition: debug.h:109
void VFWAPI ICCompressorFree(PCOMPVARS pc)
#define S_OK
Definition: intsafe.h:59
#define HeapReAlloc
Definition: compat.h:393
DWORD cbParms
Definition: vfw.h:1113
LONG cbSize
Definition: vfw.h:818
LONG cbState
Definition: vfw.h:833
DWORD cbFormat
Definition: vfw.h:1111
LPVOID lpParms
Definition: vfw.h:1112
BOOL VFWAPI ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData, PCOMPVARS pc, LPSTR lpszTitle)
DWORD dwFlags
Definition: vfw.h:819
Definition: vfw.h:817
#define memset(x, y, z)
Definition: compat.h:39
#define ACM_METRIC_MAX_SIZE_FORMAT
Definition: msacm.h:200
#define HeapFree(x, y, z)
Definition: compat.h:394
LPWAVEFORMATEX pwfxEnum
Definition: msacm.h:478

Referenced by AVISaveOptionsDlgProc().

◆ AVISaveOptionsFree()

HRESULT WINAPI AVISaveOptionsFree ( INT  nStreams,
LPAVICOMPRESSOPTIONS ppOptions 
)

Definition at line 1482 of file api.c.

1483 {
1484  TRACE("(%d,%p)\n", nStreams, ppOptions);
1485 
1486  if (nStreams < 0 || ppOptions == NULL)
1487  return AVIERR_BADPARAM;
1488 
1489  for (nStreams--; nStreams >= 0; nStreams--) {
1490  if (ppOptions[nStreams] != NULL) {
1492 
1493  if (ppOptions[nStreams]->lpParms != NULL) {
1494  HeapFree(GetProcessHeap(), 0, ppOptions[nStreams]->lpParms);
1496  ppOptions[nStreams]->cbParms = 0;
1497  }
1498  if (ppOptions[nStreams]->lpFormat != NULL) {
1501  ppOptions[nStreams]->cbFormat = 0;
1502  }
1503  }
1504  }
1505 
1506  return AVIERR_OK;
1507 }
LPVOID lpFormat
Definition: vfw.h:1110
#define AVICOMPRESSF_VALID
Definition: vfw.h:1101
smooth NULL
Definition: ftsmooth.c:416
INT nStreams
Definition: api.c:61
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
LPCWSTR lpFormat
Definition: trayclock.cpp:32
DWORD dwFlags
Definition: vfw.h:1109
#define AVIERR_OK
Definition: vfw.h:1740
LPAVICOMPRESSOPTIONS * ppOptions
Definition: api.c:63
DWORD cbParms
Definition: vfw.h:1113
DWORD cbFormat
Definition: vfw.h:1111
LPVOID lpParms
Definition: vfw.h:1112
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_AVISaveOptions().

◆ AVISaveOptionsUpdate()

static void AVISaveOptionsUpdate ( HWND  hWnd)
static

Definition at line 1256 of file api.c.

1257 {
1258  static const WCHAR szVideoFmt[]={'%','l','d','x','%','l','d','x','%','d',0};
1259  static const WCHAR szAudioFmt[]={'%','s',' ','%','s',0};
1260 
1261  WCHAR szFormat[128];
1262  AVISTREAMINFOW sInfo;
1263  LPVOID lpFormat;
1264  LONG size;
1265 
1266  TRACE("(%p)\n", hWnd);
1267 
1269  if (SaveOpts.nCurrent < 0)
1270  return;
1271 
1272  if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent], &sInfo, sizeof(sInfo))))
1273  return;
1274 
1275  AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,&size);
1276  if (size > 0) {
1277  szFormat[0] = 0;
1278 
1279  /* read format to build format description string */
1281  if (lpFormat != NULL) {
1282  if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
1283  if (sInfo.fccType == streamtypeVIDEO) {
1285  ICINFO icinfo;
1286 
1287  wsprintfW(szFormat, szVideoFmt, lpbi->biWidth,
1288  lpbi->biHeight, lpbi->biBitCount);
1289 
1290  if (lpbi->biCompression != BI_RGB) {
1291  HIC hic;
1292 
1293  hic = ICLocate(ICTYPE_VIDEO, sInfo.fccHandler, lpFormat,
1295  if (hic != NULL) {
1296  if (ICGetInfo(hic, &icinfo, sizeof(icinfo)) == S_OK)
1297  lstrcatW(szFormat, icinfo.szDescription);
1298  ICClose(hic);
1299  }
1300  } else {
1302  icinfo.szDescription,
1303  ARRAY_SIZE(icinfo.szDescription));
1304  lstrcatW(szFormat, icinfo.szDescription);
1305  }
1306  } else if (sInfo.fccType == streamtypeAUDIO) {
1307  ACMFORMATTAGDETAILSW aftd;
1308  ACMFORMATDETAILSW afd;
1309 
1310  memset(&aftd, 0, sizeof(aftd));
1311  memset(&afd, 0, sizeof(afd));
1312 
1313  aftd.cbStruct = sizeof(aftd);
1314  aftd.dwFormatTag = afd.dwFormatTag =
1315  ((PWAVEFORMATEX)lpFormat)->wFormatTag;
1316  aftd.cbFormatSize = afd.cbwfx = size;
1317 
1318  afd.cbStruct = sizeof(afd);
1319  afd.pwfx = lpFormat;
1320 
1321  if (acmFormatTagDetailsW(NULL, &aftd,
1324  wsprintfW(szFormat, szAudioFmt, afd.szFormat, aftd.szFormatTag);
1325  }
1326  }
1327  }
1329  }
1330 
1331  /* set text for format description */
1332  SetDlgItemTextW(hWnd, IDC_FORMATTEXT, szFormat);
1333 
1334  /* Disable option button for unsupported streamtypes */
1335  if (sInfo.fccType == streamtypeVIDEO ||
1336  sInfo.fccType == streamtypeAUDIO)
1338  else
1340  }
1341 
1342 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
PWAVEFORMATEX pwfx
Definition: msacm.h:507
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LPLONG formatsize)
Definition: api.c:550
#define TRUE
Definition: types.h:120
struct _WAVEFORMATEX * PWAVEFORMATEX
HMODULE AVIFILE_hModule
Definition: factory.c:39
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:523
#define IDC_OPTIONS
HWND hWnd
Definition: settings.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_GETCURSEL
Definition: winuser.h:1904
#define AVIStreamFormatSize(pavi, lPos, plSize)
Definition: vfw.h:1436
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define ACM_FORMATDETAILSF_FORMAT
Definition: msacm.h:161
LRESULT WINAPI ICClose(HIC hic)
long LONG
Definition: pedump.c:60
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
WCHAR szDescription[128]
Definition: vfw.h:291
#define IDC_STREAM
HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wMode)
Definition: msvideo_main.c:671
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:601
#define TRACE(s)
Definition: solgame.cpp:4
#define ACM_FORMATTAGDETAILSF_FORMATTAG
Definition: msacm.h:183
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails)
Definition: format.c:853
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define ICTYPE_VIDEO
Definition: mmreg.h:531
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:509
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define streamtypeAUDIO
Definition: aviriff.h:93
static struct @311 SaveOpts
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define IDC_FORMATTEXT
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define streamtypeVIDEO
Definition: aviriff.h:92
Definition: vfw.h:280
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
Definition: format.c:432
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD cbStruct
Definition: msacm.h:503
DWORD fccHandler
Definition: avifil32.idl:30
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:535
#define IDS_UNCOMPRESSED
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
DWORD dwFormatTag
Definition: msacm.h:505
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:35
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by AVISaveOptionsDlgProc().

◆ AVISaveVA()

HRESULT WINAPI AVISaveVA ( LPCSTR  szFile,
CLSID pclsidHandler,
AVISAVECALLBACK  lpfnCallback,
int  nStream,
PAVISTREAM ppavi,
LPAVICOMPRESSOPTIONS plpOptions 
)

Definition at line 1512 of file api.c.

1515 {
1516  LPWSTR wszFile = NULL;
1517  HRESULT hr;
1518  int len;
1519 
1520  TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler,
1521  lpfnCallback, nStream, ppavi, plpOptions);
1522 
1523  if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
1524  return AVIERR_BADPARAM;
1525 
1526  /* convert ASCII string to Unicode and call Unicode function */
1527  len = MultiByteToWideChar(CP_ACP, 0, szFile, -1, NULL, 0);
1528  if (len <= 0)
1529  return AVIERR_BADPARAM;
1530 
1531  wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1532  if (wszFile == NULL)
1533  return AVIERR_MEMORY;
1534 
1535  MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len);
1536 
1537  hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
1538  nStream, ppavi, plpOptions);
1539 
1541 
1542  return hr;
1543 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
Definition: api.c:1558
#define CP_ACP
Definition: compat.h:99
#define AVIERR_MEMORY
Definition: vfw.h:1745
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by AVISaveA().

◆ AVISaveVW()

HRESULT WINAPI AVISaveVW ( LPCWSTR  szFile,
CLSID pclsidHandler,
AVISAVECALLBACK  lpfnCallback,
int  nStreams,
PAVISTREAM ppavi,
LPAVICOMPRESSOPTIONS plpOptions 
)

Definition at line 1558 of file api.c.

1561 {
1562  LONG lStart[MAX_AVISTREAMS];
1563  PAVISTREAM pOutStreams[MAX_AVISTREAMS];
1564  PAVISTREAM pInStreams[MAX_AVISTREAMS];
1565  AVIFILEINFOW fInfo;
1566  AVISTREAMINFOW sInfo;
1567 
1568  PAVIFILE pfile = NULL; /* the output AVI file */
1569  LONG lFirstVideo = -1;
1570  int curStream;
1571 
1572  /* for interleaving ... */
1573  DWORD dwInterleave = 0; /* interleave rate */
1574  DWORD dwFileInitialFrames;
1575  LONG lFileLength;
1576  LONG lSampleInc;
1577 
1578  /* for reading/writing the data ... */
1579  LPVOID lpBuffer = NULL;
1580  LONG cbBuffer; /* real size of lpBuffer */
1581  LONG lBufferSize; /* needed bytes for format(s), etc. */
1582  LONG lReadBytes;
1583  LONG lReadSamples;
1584  HRESULT hres;
1585 
1586  TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_w(szFile), pclsidHandler,
1587  lpfnCallback, nStreams, ppavi, plpOptions);
1588 
1589  if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
1590  return AVIERR_BADPARAM;
1591  if (nStreams >= MAX_AVISTREAMS) {
1592  WARN("Can't write AVI with %d streams only supports %d -- change MAX_AVISTREAMS!\n", nStreams, MAX_AVISTREAMS);
1593  return AVIERR_INTERNAL;
1594  }
1595 
1596  if (lpfnCallback == NULL)
1597  lpfnCallback = AVIFILE_AVISaveDefaultCallback;
1598 
1599  /* clear local variable(s) */
1600  for (curStream = 0; curStream < nStreams; curStream++) {
1601  pInStreams[curStream] = NULL;
1602  pOutStreams[curStream] = NULL;
1603  }
1604 
1605  /* open output AVI file (create it if it doesn't exist) */
1607  pclsidHandler);
1608  if (FAILED(hres))
1609  return hres;
1610  AVIFileInfoW(pfile, &fInfo, sizeof(fInfo)); /* for dwCaps */
1611 
1612  /* initialize our data structures part 1 */
1613  for (curStream = 0; curStream < nStreams; curStream++) {
1614  PAVISTREAM pCurStream = ppavi[curStream];
1615 
1616  hres = AVIStreamInfoW(pCurStream, &sInfo, sizeof(sInfo));
1617  if (FAILED(hres))
1618  goto error;
1619 
1620  /* search first video stream and check for interleaving */
1621  if (sInfo.fccType == streamtypeVIDEO) {
1622  /* remember first video stream -- needed for interleaving */
1623  if (lFirstVideo < 0)
1624  lFirstVideo = curStream;
1625  } else if (!dwInterleave) {
1626  /* check if any non-video stream wants to be interleaved */
1627  WARN("options.flags=0x%X options.dwInterleave=%u\n",plpOptions[curStream]->dwFlags,plpOptions[curStream]->dwInterleaveEvery);
1628  if (plpOptions[curStream] != NULL &&
1629  plpOptions[curStream]->dwFlags & AVICOMPRESSF_INTERLEAVE)
1630  dwInterleave = plpOptions[curStream]->dwInterleaveEvery;
1631  }
1632 
1633  /* create de-/compressed stream interface if needed */
1634  pInStreams[curStream] = NULL;
1635  if (plpOptions[curStream] != NULL) {
1636  if (plpOptions[curStream]->fccHandler ||
1637  plpOptions[curStream]->lpFormat != NULL) {
1638  DWORD dwKeySave = plpOptions[curStream]->dwKeyFrameEvery;
1639 
1640  if (fInfo.dwCaps & AVIFILECAPS_ALLKEYFRAMES)
1641  plpOptions[curStream]->dwKeyFrameEvery = 1;
1642 
1643  hres = AVIMakeCompressedStream(&pInStreams[curStream], pCurStream,
1644  plpOptions[curStream], NULL);
1645  plpOptions[curStream]->dwKeyFrameEvery = dwKeySave;
1646  if (FAILED(hres) || pInStreams[curStream] == NULL) {
1647  pInStreams[curStream] = NULL;
1648  goto error;
1649  }
1650 
1651  /* test stream interface and update stream-info */
1652  hres = AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1653  if (FAILED(hres))
1654  goto error;
1655  }
1656  }
1657 
1658  /* now handle streams which will only be copied */
1659  if (pInStreams[curStream] == NULL) {
1660  pCurStream = pInStreams[curStream] = ppavi[curStream];
1661  AVIStreamAddRef(pCurStream);
1662  } else
1663  pCurStream = pInStreams[curStream];
1664 
1665  lStart[curStream] = sInfo.dwStart;
1666  } /* for all streams */
1667 
1668  /* check that first video stream is the first stream */
1669  if (lFirstVideo > 0) {
1670  PAVISTREAM pTmp = pInStreams[lFirstVideo];
1671  LONG lTmp = lStart[lFirstVideo];
1672 
1673  pInStreams[lFirstVideo] = pInStreams[0];
1674  pInStreams[0] = pTmp;
1675  lStart[lFirstVideo] = lStart[0];
1676  lStart[0] = lTmp;
1677  lFirstVideo = 0;
1678  }
1679 
1680  /* allocate buffer for formats, data, etc. of an initial size of 64 kBytes*/
1681  cbBuffer = 0x00010000;
1682  lpBuffer = HeapAlloc(GetProcessHeap(), 0, cbBuffer);
1683  if (lpBuffer == NULL) {
1684  hres = AVIERR_MEMORY;
1685  goto error;
1686  }
1687 
1688  AVIStreamInfoW(pInStreams[0], &sInfo, sizeof(sInfo));
1689  lFileLength = sInfo.dwLength;
1690  dwFileInitialFrames = 0;
1691  if (lFirstVideo >= 0) {
1692  /* check for correct version of the format
1693  * -- need at least BITMAPINFOHEADER or newer
1694  */
1695  lSampleInc = 1;
1696  lBufferSize = cbBuffer;
1697  hres = AVIStreamReadFormat(pInStreams[lFirstVideo], AVIStreamStart(pInStreams[lFirstVideo]), lpBuffer, &lBufferSize);
1698  if (lBufferSize < (LONG)sizeof(BITMAPINFOHEADER))
1700  if (FAILED(hres))
1701  goto error;
1702  } else /* use one second blocks for interleaving if no video present */
1703  lSampleInc = AVIStreamTimeToSample(pInStreams[0], 1000000);
1704 
1705  /* create output streams */
1706  for (curStream = 0; curStream < nStreams; curStream++) {
1707  AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1708 
1709  sInfo.dwInitialFrames = 0;
1710  if (dwInterleave != 0 && curStream > 0 && sInfo.fccType != streamtypeVIDEO) {
1711  /* 750 ms initial frames for non-video streams */
1712  sInfo.dwInitialFrames = AVIStreamTimeToSample(pInStreams[0], 750);
1713  }
1714 
1715  hres = AVIFileCreateStreamW(pfile, &pOutStreams[curStream], &sInfo);
1716  if (pOutStreams[curStream] != NULL && SUCCEEDED(hres)) {
1717  /* copy initial format for this stream */
1718  lBufferSize = cbBuffer;
1719  hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1720  lpBuffer, &lBufferSize);
1721  if (FAILED(hres))
1722  goto error;
1723  hres = AVIStreamSetFormat(pOutStreams[curStream], 0, lpBuffer, lBufferSize);
1724  if (FAILED(hres))
1725  goto error;
1726 
1727  /* try to copy stream handler data */
1728  lBufferSize = cbBuffer;
1729  hres = AVIStreamReadData(pInStreams[curStream], ckidSTREAMHANDLERDATA,
1730  lpBuffer, &lBufferSize);
1731  if (SUCCEEDED(hres) && lBufferSize > 0) {
1732  hres = AVIStreamWriteData(pOutStreams[curStream],ckidSTREAMHANDLERDATA,
1733  lpBuffer, lBufferSize);
1734  if (FAILED(hres))
1735  goto error;
1736  }
1737 
1738  if (dwFileInitialFrames < sInfo.dwInitialFrames)
1739  dwFileInitialFrames = sInfo.dwInitialFrames;
1740  lReadBytes =
1741  AVIStreamSampleToSample(pOutStreams[0], pInStreams[curStream],
1742  sInfo.dwLength);
1743  if (lFileLength < lReadBytes)
1744  lFileLength = lReadBytes;
1745  } else {
1746  /* creation of de-/compression stream interface failed */
1747  WARN("creation of (de-)compression stream failed for stream %d\n",curStream);
1748  AVIStreamRelease(pInStreams[curStream]);
1749  if (curStream + 1 >= nStreams) {
1750  /* move the others one up */
1751  PAVISTREAM *ppas = &pInStreams[curStream];
1752  int n = nStreams - (curStream + 1);
1753 
1754  do {
1755  *ppas = pInStreams[curStream + 1];
1756  } while (--n);
1757  }
1758  nStreams--;
1759  curStream--;
1760  }
1761  } /* create output streams for all input streams */
1762 
1763  /* have we still something to write, or lost everything? */
1764  if (nStreams <= 0)
1765  goto error;
1766 
1767  if (dwInterleave) {
1768  LONG lCurFrame = -dwFileInitialFrames;
1769 
1770  /* interleaved file */
1771  if (dwInterleave == 1)
1772  AVIFileEndRecord(pfile);
1773 
1774  for (; lCurFrame < lFileLength; lCurFrame += lSampleInc) {
1775  for (curStream = 0; curStream < nStreams; curStream++) {
1776  LONG lLastSample;
1777 
1778  hres = AVIStreamInfoW(pOutStreams[curStream], &sInfo, sizeof(sInfo));
1779  if (FAILED(hres))
1780  goto error;
1781 
1782  /* initial frames phase at the end for this stream? */
1783  if (-(LONG)sInfo.dwInitialFrames > lCurFrame)
1784  continue;
1785 
1786  if ((lFileLength - lSampleInc) <= lCurFrame) {
1787  lLastSample = AVIStreamLength(pInStreams[curStream]);
1788  lFirstVideo = lLastSample + AVIStreamStart(pInStreams[curStream]);
1789  } else {
1790  if (curStream != 0) {
1791  lFirstVideo =
1792  AVIStreamSampleToSample(pInStreams[curStream], pInStreams[0],
1793  (sInfo.fccType == streamtypeVIDEO ?
1794  (LONG)dwInterleave : lSampleInc) +
1795  sInfo.dwInitialFrames + lCurFrame);
1796  } else
1797  lFirstVideo = lSampleInc + (sInfo.dwInitialFrames + lCurFrame);
1798 
1799  lLastSample = AVIStreamEnd(pInStreams[curStream]);
1800  if (lLastSample <= lFirstVideo)
1801  lFirstVideo = lLastSample;
1802  }
1803 
1804  /* copy needed samples now */
1805  WARN("copy from stream %d samples %d to %d...\n",curStream,
1806  lStart[curStream],lFirstVideo);
1807  while (lFirstVideo > lStart[curStream]) {
1808  DWORD flags = 0;
1809 
1810  /* copy format in case it can change */
1811  lBufferSize = cbBuffer;
1812  hres = AVIStreamReadFormat(pInStreams[curStream], lStart[curStream],
1813  lpBuffer, &lBufferSize);
1814  if (FAILED(hres))
1815  goto error;
1816  AVIStreamSetFormat(pOutStreams[curStream], lStart[curStream],
1817  lpBuffer, lBufferSize);
1818 
1819  /* try to read data until we got it, or error */
1820  do {
1821  hres = AVIStreamRead(pInStreams[curStream], lStart[curStream],
1822  lFirstVideo - lStart[curStream], lpBuffer,
1823  cbBuffer, &lReadBytes, &lReadSamples);
1824  } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1825  (lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
1826  if (lpBuffer == NULL)
1827  hres = AVIERR_MEMORY;
1828  if (FAILED(hres))
1829  goto error;
1830 
1831  if (AVIStreamIsKeyFrame(pInStreams[curStream], (LONG)sInfo.dwStart))
1833  hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1834  lpBuffer, lReadBytes, flags, NULL, NULL);
1835  if (FAILED(hres))
1836  goto error;
1837 
1838  lStart[curStream] += lReadSamples;
1839  }
1840  lStart[curStream] = lFirstVideo;
1841  } /* stream by stream */
1842 
1843  /* need to close this block? */
1844  if (dwInterleave == 1) {
1845  hres = AVIFileEndRecord(pfile);
1846  if (FAILED(hres))
1847  break;
1848  }
1849 
1850  /* show progress */
1851  if (lpfnCallback(MulDiv(dwFileInitialFrames + lCurFrame, 100,
1852  dwFileInitialFrames + lFileLength))) {
1854  break;
1855  }
1856  } /* copy frame by frame */
1857  } else {
1858  /* non-interleaved file */
1859 
1860  for (curStream = 0; curStream < nStreams; curStream++) {
1861  /* show progress */
1862  if (lpfnCallback(MulDiv(curStream, 100, nStreams))) {
1864  goto error;
1865  }
1866 
1867  AVIStreamInfoW(pInStreams[curStream], &sInfo, sizeof(sInfo));
1868 
1869  if (sInfo.dwSampleSize != 0) {
1870  /* sample-based data like audio */
1871  while (sInfo.dwStart < sInfo.dwLength) {
1872  LONG lSamples = cbBuffer / sInfo.dwSampleSize;
1873 
1874  /* copy format in case it can change */
1875  lBufferSize = cbBuffer;
1876  hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1877  lpBuffer, &lBufferSize);
1878  if (FAILED(hres))
1879  goto error;
1880  AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
1881  lpBuffer, lBufferSize);
1882 
1883  /* limit to stream boundaries */
1884  if (lSamples != (LONG)(sInfo.dwLength - sInfo.dwStart))
1885  lSamples = sInfo.dwLength - sInfo.dwStart;
1886 
1887  /* now try to read until we get it, or an error occurs */
1888  do {
1889  lReadBytes = cbBuffer;
1890  lReadSamples = 0;
1891  hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
1892  lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
1893  } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1894  (lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
1895  if (lpBuffer == NULL)
1896  hres = AVIERR_MEMORY;
1897  if (FAILED(hres))
1898  goto error;
1899  if (lReadSamples != 0) {
1900  sInfo.dwStart += lReadSamples;
1901  hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1902  lpBuffer, lReadBytes, 0, NULL , NULL);
1903  if (FAILED(hres))
1904  goto error;
1905 
1906  /* show progress */
1907  if (lpfnCallback(MulDiv(sInfo.dwStart,100,nStreams*sInfo.dwLength)+
1908  MulDiv(curStream, 100, nStreams))) {
1910  goto error;
1911  }
1912  } else {
1913  if ((sInfo.dwLength - sInfo.dwStart) != 1) {
1915  goto error;
1916  }
1917  }
1918  }
1919  } else {
1920  /* block-based data like video */
1921  for (; sInfo.dwStart < sInfo.dwLength; sInfo.dwStart++) {
1922  DWORD flags = 0;
1923 
1924  /* copy format in case it can change */
1925  lBufferSize = cbBuffer;
1926  hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart,
1927  lpBuffer, &lBufferSize);
1928  if (FAILED(hres))
1929  goto error;
1930  AVIStreamSetFormat(pOutStreams[curStream], sInfo.dwStart,
1931  lpBuffer, lBufferSize);
1932 
1933  /* try to read block and resize buffer if necessary */
1934  do {
1935  lReadSamples = 0;
1936  lReadBytes = cbBuffer;
1937  hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
1938  lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
1939  } while ((hres == AVIERR_BUFFERTOOSMALL) &&
1940  (lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
1941  if (lpBuffer == NULL)
1942  hres = AVIERR_MEMORY;
1943  if (FAILED(hres))
1944  goto error;
1945  if (lReadSamples != 1) {
1947  goto error;
1948  }
1949 
1950  if (AVIStreamIsKeyFrame(pInStreams[curStream], (LONG)sInfo.dwStart))
1952  hres = AVIStreamWrite(pOutStreams[curStream], -1, lReadSamples,
1953  lpBuffer, lReadBytes, flags, NULL, NULL);
1954  if (FAILED(hres))
1955  goto error;
1956 
1957  /* show progress */
1958  if (lpfnCallback(MulDiv(sInfo.dwStart,100,nStreams*sInfo.dwLength)+
1959  MulDiv(curStream, 100, nStreams))) {
1961  goto error;
1962  }
1963  } /* copy all blocks */
1964  }
1965  } /* copy data stream by stream */
1966  }
1967 
1968  error:
1970  if (pfile != NULL) {
1971  for (curStream = 0; curStream < nStreams; curStream++) {
1972  if (pOutStreams[curStream] != NULL)
1973  AVIStreamRelease(pOutStreams[curStream]);
1974  if (pInStreams[curStream] != NULL)
1975  AVIStreamRelease(pInStreams[curStream]);
1976  }
1977 
1978  AVIFileRelease(pfile);
1979  }
1980 
1981  return hres;
1982 }
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LPLONG formatsize)
Definition: api.c:550
DWORD dwSampleSize
Definition: avifil32.idl:42
#define error(str)
Definition: mkdosfs.c:1605
#define AVIERR_INTERNAL
Definition: vfw.h:1746
#define AVIFILECAPS_ALLKEYFRAMES
Definition: vfw.h:1062
#define WARN(fmt,...)
Definition: debug.h:111
DWORD dwKeyFrameEvery
Definition: vfw.h:1106
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:523
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos, LPVOID format, LONG formatsize)
Definition: api.c:564
GLdouble n
Definition: glext.h:7729
#define AVIIF_KEYFRAME
Definition: aviriff.h:131
LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime)
Definition: api.c:928
ULONG WINAPI AVIFileRelease(PAVIFILE pfile)
Definition: api.c:292
#define AVIERR_MEMORY
Definition: vfw.h:1745
long LONG
Definition: pedump.c:60
LONG WINAPI AVIStreamLength(PAVISTREAM pstream)
Definition: api.c:877
#define debugstr_w
Definition: kernel32.h:32
HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp, LPLONG lpread)
Definition: api.c:612
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed, PAVISTREAM psSource, LPAVICOMPRESSOPTIONS aco, LPCLSID pclsidHandler)
Definition: api.c:690
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp, LONG size)
Definition: api.c:626
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
ULONG WINAPI AVIStreamAddRef(PAVISTREAM pstream)
Definition: api.c:435
DWORD dwInitialFrames
Definition: avifil32.idl:39
smooth NULL
Definition: ftsmooth.c:416
INT nStreams
Definition: api.c:61
HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, LPLONG bytesread, LPLONG samplesread)
Definition: api.c:578
#define AVIERR_BUFFERTOOSMALL
Definition: vfw.h:1758
#define AVIERR_USERABORT
Definition: vfw.h:1760
#define AVIERR_BADPARAM
Definition: vfw.h:1748
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile, PAVISTREAM *avis, LPAVISTREAMINFOW asi)
Definition: api.c:382
#define MAX_AVISTREAMS
HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples, LPVOID buffer, LONG buffersize, DWORD flags, LPLONG sampwritten, LPLONG byteswritten)
Definition: api.c:595
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ckidSTREAMHANDLERDATA
Definition: vfw.h:895
LONG HRESULT
Definition: typedefs.h:77
static BOOL WINAPI AVIFILE_AVISaveDefaultCallback(INT progress)
Definition: api.c:1548
#define AVIStreamIsKeyFrame(pavi, pos)
Definition: vfw.h:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG WINAPI AVIStreamRelease(PAVISTREAM pstream)
Definition: api.c:450
GLbitfield flags
Definition: glext.h:7161
#define OF_WRITE
Definition: winbase.h:118
DWORD dwInterleaveEvery
Definition: vfw.h:1114
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LONG WINAPI AVIStreamStart(PAVISTREAM pstream)
Definition: api.c:859
LPCWSTR lpFormat
Definition: trayclock.cpp:32
HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile)
Definition: api.c:422
#define AVIStreamSampleToSample(pavi1, pavi2, samp2)
Definition: vfw.h:1442
#define streamtypeVIDEO
Definition: aviriff.h:92
#define HeapReAlloc
Definition: compat.h:393
#define AVIStreamEnd(pavi)
Definition: vfw.h:1432
#define OF_CREATE
Definition: winbase.h:125
#define AVICOMPRESSF_INTERLEAVE
Definition: vfw.h:1098
#define AVIERR_FILEREAD
Definition: vfw.h:1751
DWORD dwCaps
Definition: avifil32.idl:72
HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:228
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define OF_SHARE_EXCLUSIVE
Definition: winbase.h:123
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile, LPAVIFILEINFOW afiw, LONG size)
Definition: api.c:333

Referenced by AVISaveVA(), and AVISaveW().

◆ AVISaveW()

HRESULT WINAPIV AVISaveW ( LPCWSTR  szFile,
CLSID pclsidHandler,
AVISAVECALLBACK  lpfnCallback,
int  nStreams,
PAVISTREAM  pavi,
LPAVICOMPRESSOPTIONS  lpOptions,
  ... 
)

Definition at line 2284 of file api.c.

2286 {
2287  __ms_va_list vl;
2288  int i;
2289  HRESULT ret;
2290  PAVISTREAM *streams;
2292 
2293  TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_w(szFile), pclsidHandler, lpfnCallback,
2294  nStreams, pavi, lpOptions);
2295 
2296  if (nStreams <= 0) return AVIERR_BADPARAM;
2297 
2298  streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*streams));
2299  options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(*options));
2300  if (!streams || !options)
2301  {
2302  ret = AVIERR_MEMORY;
2303  goto error;
2304  }
2305 
2306  streams[0] = pavi;
2307  options[0] = lpOptions;
2308 
2309  __ms_va_start(vl, lpOptions);
2310  for (i = 1; i < nStreams; i++)
2311  {
2312  streams[i] = va_arg(vl, PAVISTREAM);
2314  }
2315  __ms_va_end(vl);
2316 
2317  for (i = 0; i < nStreams; i++)
2318  TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]);
2319 
2320  ret = AVISaveVW(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options);
2321 error:
2322  HeapFree(GetProcessHeap(), 0, streams);
2324  return ret;
2325 }
static const char __ms_va_list
Definition: printf.c:70
#define error(str)
Definition: mkdosfs.c:1605
HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
Definition: api.c:1558
#define AVIERR_MEMORY
Definition: vfw.h:1745
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
#define debugstr_w
Definition: kernel32.h:32
INT nStreams
Definition: api.c:61
int options
Definition: main.c:106
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
int ret
#define va_arg(ap, T)
Definition: acmsvcex.h:89
#define __ms_va_end(list)
Definition: windef.h:443
#define __ms_va_start(list, arg)
Definition: windef.h:442
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ AVIStreamAddRef()

ULONG WINAPI AVIStreamAddRef ( PAVISTREAM  pstream)

Definition at line 435 of file api.c.

436 {
437  TRACE("(%p)\n", pstream);
438 
439  if (pstream == NULL) {
440  ERR(": bad handle passed!\n");
441  return 0;
442  }
443 
444  return IAVIStream_AddRef(pstream);
445 }
#define IAVIStream_AddRef(p)
Definition: vfw.h:1176
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by AVIFILE_CreateAVITempFile(), AVISaveVW(), and ITmpFile_fnGetStream().

◆ AVIStreamBeginStreaming()

LONG WINAPI AVIStreamBeginStreaming ( PAVISTREAM  pavi,
LONG  lStart,
LONG  lEnd,
LONG  lRate 
)

Definition at line 817 of file api.c.

818 {
819  IAVIStreaming* pstream = NULL;
820  HRESULT hr;
821 
822  TRACE("(%p,%d,%d,%d)\n", pavi, lStart, lEnd, lRate);
823 
824  if (pavi == NULL)
825  return AVIERR_BADHANDLE;
826 
827  hr = IAVIStream_QueryInterface(pavi, &IID_IAVIStreaming, (LPVOID*)&pstream);
828  if (SUCCEEDED(hr) && pstream != NULL) {
829  hr = IAVIStreaming_Begin(pstream, lStart, lEnd, lRate);
830  IAVIStreaming_Release(pstream);
831  } else
832  hr = AVIERR_OK;
833 
834  return hr;
835 }
HRESULT hr
Definition: shlfolder.c:183
#define IAVIStreaming_Begin(p, a, b, c)
Definition: vfw.h:1484
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define AVIERR_OK
Definition: vfw.h:1740
#define IAVIStreaming_Release(p)
Definition: vfw.h:1482
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AVIStreamCreate()

HRESULT WINAPI AVIStreamCreate ( PAVISTREAM ppavi,
LONG  lParam1,
LONG  lParam2,
LPCLSID  pclsidHandler 
)

Definition at line 465 of file api.c.

467 {
468  HRESULT hr;
469 
470  TRACE("(%p,0x%08X,0x%08X,%s)\n", ppavi, lParam1, lParam2,
471  debugstr_guid(pclsidHandler));
472 
473  if (ppavi == NULL)
474  return AVIERR_BADPARAM;
475 
476  *ppavi = NULL;
477  if (pclsidHandler == NULL)
478  return AVIERR_UNSUPPORTED;
479 
480  hr = CoCreateInstance(pclsidHandler, NULL, CLSCTX_INPROC, &IID_IAVIStream, (LPVOID*)ppavi);
481  if (FAILED(hr) || *ppavi == NULL)
482  return hr;
483 
484  hr = IAVIStream_Create(*ppavi, lParam1, lParam2);
485  if (FAILED(hr)) {
486  IAVIStream_Release(*ppavi);
487  *ppavi = NULL;
488  }
489 
490  return hr;
491 }
#define IAVIStream_Create(p, a, b)
Definition: vfw.h:1179
HRESULT hr
Definition: shlfolder.c:183
#define IAVIStream_Release(p)
Definition: vfw.h:1177
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234

◆ AVIStreamEndStreaming()

LONG WINAPI AVIStreamEndStreaming ( PAVISTREAM  pavi)

Definition at line 840 of file api.c.

841 {
842  IAVIStreaming* pstream = NULL;
843  HRESULT hr;
844 
845  TRACE("(%p)\n", pavi);
846 
847  hr = IAVIStream_QueryInterface(pavi, &IID_IAVIStreaming, (LPVOID*)&pstream);
848  if (SUCCEEDED(hr) && pstream != NULL) {
849  IAVIStreaming_End(pstream);
850  IAVIStreaming_Release(pstream);
851  }
852 
853  return AVIERR_OK;
854 }
HRESULT hr
Definition: shlfolder.c:183
#define IAVIStreaming_End(p)
Definition: vfw.h:1485
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define AVIERR_OK
Definition: vfw.h:1740
#define IAVIStreaming_Release(p)
Definition: vfw.h:1482
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ AVIStreamFindSample()

LONG WINAPI AVIStreamFindSample ( PAVISTREAM  pstream,
LONG  pos,
LONG  flags 
)

Definition at line 537 of file api.c.

538 {
539  TRACE("(%p,%d,0x%X)\n", pstream, pos, flags);
540 
541  if (pstream == NULL)
542  return -1;
543 
544  return IAVIStream_FindSample(pstream, pos, flags);
545 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
#define IAVIStream_FindSample(p, a, b)
Definition: vfw.h:1181

◆ AVIStreamGetFrame()

LPVOID WINAPI AVIStreamGetFrame ( PGETFRAME  pg,
LONG  pos 
)

Definition at line 665 of file api.c.

666 {
667  TRACE("(%p,%d)\n", pg, pos);
668 
669  if (pg == NULL)
670  return NULL;
671 
672  return IGetFrame_GetFrame(pg, pos);
673 }
#define IGetFrame_GetFrame(p, a)
Definition: vfw.h:1721
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVIFILE_OpenGetFrame(), AVIFILE_ReadFrame(), ICMStream_fnRead(), and ICMStream_fnReadFormat().

◆ AVIStreamGetFrameClose()

HRESULT WINAPI AVIStreamGetFrameClose ( PGETFRAME  pg)

Definition at line 678 of file api.c.

679 {
680  TRACE("(%p)\n", pg);
681 
682  if (pg != NULL)
683  return IGetFrame_Release(pg);
684  return 0;
685 }
#define IGetFrame_Release(p)
Definition: vfw.h:1719
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVIFILE_ReadFrame(), IAVIEditStream_fnRelease(), and ICMStream_fnRelease().

◆ AVIStreamGetFrameOpen()

PGETFRAME WINAPI AVIStreamGetFrameOpen ( PAVISTREAM  pstream,
LPBITMAPINFOHEADER  lpbiWanted 
)

Definition at line 640 of file api.c.

642 {
643  PGETFRAME pg = NULL;
644 
645  TRACE("(%p,%p)\n", pstream, lpbiWanted);
646 
647  if (FAILED(IAVIStream_QueryInterface(pstream, &IID_IGetFrame, (LPVOID*)&pg)) ||
648  pg == NULL) {
649  pg = AVIFILE_CreateGetFrame(pstream);
650  if (pg == NULL)
651  return NULL;
652  }
653 
654  if (FAILED(IGetFrame_SetFormat(pg, lpbiWanted, NULL, 0, 0, -1, -1))) {
655  IGetFrame_Release(pg);
656  return NULL;
657  }
658 
659  return pg;
660 }
#define IGetFrame_SetFormat(p, a, b, c, d, e, f)
Definition: vfw.h:1724
#define IGetFrame_Release(p)
Definition: vfw.h:1719
struct IGetFrame * PGETFRAME
Definition: vfw.h:40
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pstream) DECLSPEC_HIDDEN
Definition: getframe.c:487
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175

Referenced by AVIFILE_OpenGetFrame(), and AVIFILE_ReadFrame().

◆ AVIStreamInfoA()

HRESULT WINAPI AVIStreamInfoA ( PAVISTREAM  pstream,
LPAVISTREAMINFOA  asi,
LONG  size 
)

Definition at line 497 of file api.c.

499 {
500  AVISTREAMINFOW asiw;
501  HRESULT hres;
502 
503  TRACE("(%p,%p,%d)\n", pstream, asi, size);
504 
505  if (pstream == NULL)
506  return AVIERR_BADHANDLE;
507  if ((DWORD)size < sizeof(AVISTREAMINFOA))
508  return AVIERR_BADSIZE;
509 
510  hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
511 
512  memcpy(asi, &asiw, sizeof(asiw) - sizeof(asiw.szName));
513  WideCharToMultiByte(CP_ACP, 0, asiw.szName, -1, asi->szName,
514  sizeof(asi->szName), NULL, NULL);
515  asi->szName[sizeof(asi->szName) - 1] = 0;
516 
517  return hres;
518 }
#define WideCharToMultiByte
Definition: compat.h:101
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
#define CP_ACP
Definition: compat.h:99
CHAR szName[64]
Definition: vfw.h:1021
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define AVIERR_BADSIZE
Definition: vfw.h:1749
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR szName[64]
Definition: avifil32.idl:46

Referenced by EditStreamSetNameA(), test_ash1_corruption(), test_ash1_corruption2(), test_default_data(), and test_EditStreamSetInfo().

◆ AVIStreamInfoW()

HRESULT WINAPI AVIStreamInfoW ( PAVISTREAM  pstream,
LPAVISTREAMINFOW  asi,
LONG  size 
)

Definition at line 523 of file api.c.

525 {
526  TRACE("(%p,%p,%d)\n", pstream, asi, size);
527 
528  if (pstream == NULL)
529  return AVIERR_BADHANDLE;
530 
531  return IAVIStream_Info(pstream, asi, size);
532 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919

Referenced by AVIFILE_CreateAVITempFile(), AVISaveOptionsDlgProc(), AVISaveOptionsFmtChoose(), AVISaveOptionsUpdate(), AVISaveVW(), and ITmpFile_fnGetStream().

◆ AVIStreamLength()

LONG WINAPI AVIStreamLength ( PAVISTREAM  pstream)

Definition at line 877 of file api.c.

878 {
879  AVISTREAMINFOW asiw;
880 
881  TRACE("(%p)\n", pstream);
882 
883  if (pstream == NULL)
884  return 0;
885 
886  if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
887  return 0;
888 
889  return asiw.dwLength;
890 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVISaveVW().

◆ AVIStreamOpenFromFileA()

HRESULT WINAPI AVIStreamOpenFromFileA ( PAVISTREAM ppavi,
LPCSTR  szFile,
DWORD  fccType,
LONG  lParam,
UINT  mode,
LPCLSID  pclsidHandler 
)

Definition at line 761 of file api.c.

764 {
765  PAVIFILE pfile = NULL;
766  HRESULT hr;
767 
768  TRACE("(%p,%s,'%4.4s',%d,0x%X,%s)\n", ppavi, debugstr_a(szFile),
769  (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
770 
771  if (ppavi == NULL || szFile == NULL)
772  return AVIERR_BADPARAM;
773 
774  *ppavi = NULL;
775 
776  hr = AVIFileOpenA(&pfile, szFile, mode, pclsidHandler);
777  if (FAILED(hr) || pfile == NULL)
778  return hr;
779 
780  hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
781  IAVIFile_Release(pfile);
782 
783  return hr;
784 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:193
GLenum mode
Definition: glext.h:6217
#define IAVIFile_Release(p)
Definition: vfw.h:1604
#define IAVIFile_GetStream(p, a, b, c)
Definition: vfw.h:1607
LPARAM lParam
Definition: combotst.c:139

◆ AVIStreamOpenFromFileW()

HRESULT WINAPI AVIStreamOpenFromFileW ( PAVISTREAM ppavi,
LPCWSTR  szFile,
DWORD  fccType,
LONG  lParam,
UINT  mode,
LPCLSID  pclsidHandler 
)

Definition at line 789 of file api.c.

792 {
793  PAVIFILE pfile = NULL;
794  HRESULT hr;
795 
796  TRACE("(%p,%s,'%4.4s',%d,0x%X,%s)\n", ppavi, debugstr_w(szFile),
797  (char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
798 
799  if (ppavi == NULL || szFile == NULL)
800  return AVIERR_BADPARAM;
801 
802  *ppavi = NULL;
803 
804  hr = AVIFileOpenW(&pfile, szFile, mode, pclsidHandler);
805  if (FAILED(hr) || pfile == NULL)
806  return hr;
807 
808  hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
809  IAVIFile_Release(pfile);
810 
811  return hr;
812 }
HRESULT hr
Definition: shlfolder.c:183
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLenum mode
Definition: glext.h:6217
#define IAVIFile_Release(p)
Definition: vfw.h:1604
HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode, LPCLSID lpHandler)
Definition: api.c:228
#define IAVIFile_GetStream(p, a, b, c)
Definition: vfw.h:1607
LPARAM lParam
Definition: combotst.c:139

◆ AVIStreamRead()

HRESULT WINAPI AVIStreamRead ( PAVISTREAM  pstream,
LONG  start,
LONG  samples,
LPVOID  buffer,
LONG  buffersize,
LPLONG  bytesread,
LPLONG  samplesread 
)

Definition at line 578 of file api.c.

581 {
582  TRACE("(%p,%d,%d,%p,%d,%p,%p)\n", pstream, start, samples, buffer,
583  buffersize, bytesread, samplesread);
584 
585  if (pstream == NULL)
586  return AVIERR_BADHANDLE;
587 
588  return IAVIStream_Read(pstream, start, samples, buffer, buffersize,
589  bytesread, samplesread);
590 }
GLsizei samples
Definition: glext.h:7006
GLuint buffer
Definition: glext.h:5915
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define IAVIStream_Read(p, a, b, c, d, e, f)
Definition: vfw.h:1184
GLuint start
Definition: gl.h:1545

Referenced by AVISaveVW(), and IGetFrame_fnGetFrame().

◆ AVIStreamReadData()

HRESULT WINAPI AVIStreamReadData ( PAVISTREAM  pstream,
DWORD  fcc,
LPVOID  lp,
LPLONG  lpread 
)

Definition at line 612 of file api.c.

614 {
615  TRACE("(%p,'%4.4s',%p,%p)\n", pstream, (char*)&fcc, lp, lpread);
616 
617  if (pstream == NULL)
618  return AVIERR_BADHANDLE;
619 
620  return IAVIStream_ReadData(pstream, fcc, lp, lpread);
621 }
#define IAVIStream_ReadData(p, a, b, c)
Definition: vfw.h:1187
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVISaveVW().

◆ AVIStreamReadFormat()

HRESULT WINAPI AVIStreamReadFormat ( PAVISTREAM  pstream,
LONG  pos,
LPVOID  format,
LPLONG  formatsize 
)

Definition at line 550 of file api.c.

552 {
553  TRACE("(%p,%d,%p,%p)\n", pstream, pos, format, formatsize);
554 
555  if (pstream == NULL)
556  return AVIERR_BADHANDLE;
557 
558  return IAVIStream_ReadFormat(pstream, pos, format, formatsize);
559 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define IAVIStream_ReadFormat(p, a, b, c)
Definition: vfw.h:1182
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVIFILE_FormatsEqual(), AVISaveOptionsFmtChoose(), AVISaveOptionsUpdate(), AVISaveVW(), and test_default_data().

◆ AVIStreamRelease()

ULONG WINAPI AVIStreamRelease ( PAVISTREAM  pstream)

Definition at line 450 of file api.c.

451 {
452  TRACE("(%p)\n", pstream);
453 
454  if (pstream == NULL) {
455  ERR(": bad handle passed!\n");
456  return 0;
457  }
458 
459  return IAVIStream_Release(pstream);
460 }
#define IAVIStream_Release(p)
Definition: vfw.h:1177
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by AVISaveVW(), ITmpFile_fnRelease(), test_ash1_corruption(), test_ash1_corruption2(), test_AVISaveOptions(), test_default_data(), and test_EditStreamSetInfo().

◆ AVIStreamSampleToTime()

LONG WINAPI AVIStreamSampleToTime ( PAVISTREAM  pstream,
LONG  lSample 
)

Definition at line 895 of file api.c.

896 {
897  AVISTREAMINFOW asiw;
898  LONG time;
899 
900  TRACE("(%p,%d)\n", pstream, lSample);
901 
902  if (pstream == NULL)
903  return -1;
904 
905  if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
906  return -1;
907  if (asiw.dwRate == 0)
908  return -1;
909 
910  /* limit to stream bounds */
911  if (lSample < asiw.dwStart)
912  lSample = asiw.dwStart;
913  if (lSample > asiw.dwStart + asiw.dwLength)
914  lSample = asiw.dwStart + asiw.dwLength;
915 
916  if (asiw.dwRate / asiw.dwScale < 1000)
917  time = (LONG)(((float)lSample * asiw.dwScale * 1000) / asiw.dwRate);
918  else
919  time = (LONG)(((float)lSample * asiw.dwScale * 1000 + (asiw.dwRate - 1)) / asiw.dwRate);
920 
921  TRACE(" -> %d\n",time);
922  return time;
923 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
__u16 time
Definition: mkdosfs.c:366
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVIFILE_CreateAVITempFile().

◆ AVIStreamSetFormat()

HRESULT WINAPI AVIStreamSetFormat ( PAVISTREAM  pstream,
LONG  pos,
LPVOID  format,
LONG  formatsize 
)

Definition at line 564 of file api.c.

566 {
567  TRACE("(%p,%d,%p,%d)\n", pstream, pos, format, formatsize);
568 
569  if (pstream == NULL)
570  return AVIERR_BADHANDLE;
571 
572  return IAVIStream_SetFormat(pstream, pos, format, formatsize);
573 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define IAVIStream_SetFormat(p, a, b, c)
Definition: vfw.h:1183

Referenced by AVISaveVW().

◆ AVIStreamStart()

LONG WINAPI AVIStreamStart ( PAVISTREAM  pstream)

Definition at line 859 of file api.c.

860 {
861  AVISTREAMINFOW asiw;
862 
863  TRACE("(%p)\n", pstream);
864 
865  if (pstream == NULL)
866  return 0;
867 
868  if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
869  return 0;
870 
871  return asiw.dwStart;
872 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by AVIFILE_FormatsEqual(), AVISaveVW(), and test_default_data().

◆ AVIStreamTimeToSample()

LONG WINAPI AVIStreamTimeToSample ( PAVISTREAM  pstream,
LONG  lTime 
)

Definition at line 928 of file api.c.

929 {
930  AVISTREAMINFOW asiw;
931  ULONG sample;
932 
933  TRACE("(%p,%d)\n", pstream, lTime);
934 
935  if (pstream == NULL || lTime < 0)
936  return -1;
937 
938  if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
939  return -1;
940  if (asiw.dwScale == 0)
941  return -1;
942 
943  if (asiw.dwRate / asiw.dwScale < 1000)
944  sample = (LONG)((((float)asiw.dwRate * lTime) / (asiw.dwScale * 1000)));
945  else
946  sample = (LONG)(((float)asiw.dwRate * lTime + (asiw.dwScale * 1000 - 1)) / (asiw.dwScale * 1000));
947 
948  /* limit to stream bounds */
949  if (sample < asiw.dwStart)
950  sample = asiw.dwStart;
951  if (sample > asiw.dwStart + asiw.dwLength)
952  sample = asiw.dwStart + asiw.dwLength;
953 
954  TRACE(" -> %d\n", sample);
955  return sample;
956 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int ULONG
Definition: retypes.h:1

Referenced by AVIFILE_SaveIndex(), and AVISaveVW().

◆ AVIStreamWrite()

HRESULT WINAPI AVIStreamWrite ( PAVISTREAM  pstream,
LONG  start,
LONG  samples,
LPVOID  buffer,
LONG  buffersize,
DWORD  flags,
LPLONG  sampwritten,
LPLONG  byteswritten 
)

Definition at line 595 of file api.c.

598 {
599  TRACE("(%p,%d,%d,%p,%d,0x%X,%p,%p)\n", pstream, start, samples, buffer,
600  buffersize, flags, sampwritten, byteswritten);
601 
602  if (pstream == NULL)
603  return AVIERR_BADHANDLE;
604 
605  return IAVIStream_Write(pstream, start, samples, buffer, buffersize,
606  flags, sampwritten, byteswritten);
607 }
GLsizei samples
Definition: glext.h:7006
GLuint buffer
Definition: glext.h:5915
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define IAVIStream_Write(p, a, b, c, d, e, f, g)
Definition: vfw.h:1185
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
GLuint start
Definition: gl.h:1545

Referenced by AVISaveVW().

◆ AVIStreamWriteData()

HRESULT WINAPI AVIStreamWriteData ( PAVISTREAM  pstream,
DWORD  fcc,
LPVOID  lp,
LONG  size 
)

Definition at line 626 of file api.c.

628 {
629  TRACE("(%p,'%4.4s',%p,%d)\n", pstream, (char*)&fcc, lp, size);
630 
631  if (pstream == NULL)
632  return AVIERR_BADHANDLE;
633 
634  return IAVIStream_WriteData(pstream, fcc, lp, size);
635 }
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define IAVIStream_WriteData(p, a, b, c)
Definition: vfw.h:1188

Referenced by AVISaveVW().

◆ EditStreamClone()

HRESULT WINAPI EditStreamClone ( PAVISTREAM  pStream,
PAVISTREAM ppResult 
)

Definition at line 1987 of file api.c.

1988 {
1989  PAVIEDITSTREAM pEdit = NULL;
1990  HRESULT hr;
1991 
1992  TRACE("(%p,%p)\n", pStream, ppResult);
1993 
1994  if (pStream == NULL)
1995  return AVIERR_BADHANDLE;
1996  if (ppResult == NULL)
1997  return AVIERR_BADPARAM;
1998 
1999  *ppResult = NULL;
2000 
2001  hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2002  if (SUCCEEDED(hr) && pEdit != NULL) {
2003  hr = IAVIEditStream_Clone(pEdit, ppResult);
2004 
2005  IAVIEditStream_Release(pEdit);
2006  } else
2008 
2009  return hr;
2010 }
HRESULT hr
Definition: shlfolder.c:183
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define IAVIEditStream_Clone(p, a)
Definition: vfw.h:1516
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ EditStreamCopy()

HRESULT WINAPI EditStreamCopy ( PAVISTREAM  pStream,
LONG plStart,
LONG plLength,
PAVISTREAM ppResult 
)

Definition at line 2015 of file api.c.

2017 {
2018  PAVIEDITSTREAM pEdit = NULL;
2019  HRESULT hr;
2020 
2021  TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
2022 
2023  if (pStream == NULL)
2024  return AVIERR_BADHANDLE;
2025  if (plStart == NULL || plLength == NULL || ppResult == NULL)
2026  return AVIERR_BADPARAM;
2027 
2028  *ppResult = NULL;
2029 
2030  hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2031  if (SUCCEEDED(hr) && pEdit != NULL) {
2032  hr = IAVIEditStream_Copy(pEdit, plStart, plLength, ppResult);
2033 
2034  IAVIEditStream_Release(pEdit);
2035  } else
2037 
2038  return hr;
2039 }
#define IAVIEditStream_Copy(p, a, b, c)
Definition: vfw.h:1514
HRESULT hr
Definition: shlfolder.c:183
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ EditStreamCut()

HRESULT WINAPI EditStreamCut ( PAVISTREAM  pStream,
LONG plStart,
LONG plLength,
PAVISTREAM ppResult 
)

Definition at line 2044 of file api.c.

2046 {
2047  PAVIEDITSTREAM pEdit = NULL;
2048  HRESULT hr;
2049 
2050  TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
2051 
2052  if (ppResult != NULL)
2053  *ppResult = NULL;
2054  if (pStream == NULL)
2055  return AVIERR_BADHANDLE;
2056  if (plStart == NULL || plLength == NULL)
2057  return AVIERR_BADPARAM;
2058 
2059  hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2060  if (SUCCEEDED(hr) && pEdit != NULL) {
2061  hr = IAVIEditStream_Cut(pEdit, plStart, plLength, ppResult);
2062 
2063  IAVIEditStream_Release(pEdit);
2064  } else
2066 
2067  return hr;
2068 }
HRESULT hr
Definition: shlfolder.c:183
#define IAVIEditStream_Cut(p, a, b, c)
Definition: vfw.h:1513
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ EditStreamPaste()

HRESULT WINAPI EditStreamPaste ( PAVISTREAM  pDest,
LONG plStart,
LONG plLength,
PAVISTREAM  pSource,
LONG  lStart,
LONG  lEnd 
)

Definition at line 2073 of file api.c.

2075 {
2076  PAVIEDITSTREAM pEdit = NULL;
2077  HRESULT hr;
2078 
2079  TRACE("(%p,%p,%p,%p,%d,%d)\n", pDest, plStart, plLength,
2080  pSource, lStart, lEnd);
2081 
2082  if (pDest == NULL || pSource == NULL)
2083  return AVIERR_BADHANDLE;
2084  if (plStart == NULL || plLength == NULL || lStart < 0)
2085  return AVIERR_BADPARAM;
2086 
2087  hr = IAVIStream_QueryInterface(pDest, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2088  if (SUCCEEDED(hr) && pEdit != NULL) {
2089  hr = IAVIEditStream_Paste(pEdit, plStart, plLength, pSource, lStart, lEnd);
2090 
2091  IAVIEditStream_Release(pEdit);
2092  } else
2094 
2095  return hr;
2096 }
HRESULT hr
Definition: shlfolder.c:183
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define IAVIEditStream_Paste(p, a, b, c, d, e)
Definition: vfw.h:1515
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ EditStreamSetInfoA()

HRESULT WINAPI EditStreamSetInfoA ( PAVISTREAM  pstream,
LPAVISTREAMINFOA  asi,
LONG  size 
)

Definition at line 2101 of file api.c.

2103 {
2104  AVISTREAMINFOW asiw;
2105 
2106  TRACE("(%p,%p,%d)\n", pstream, asi, size);
2107 
2108  if (size >= 0 && size < sizeof(AVISTREAMINFOA))
2109  return AVIERR_BADSIZE;
2110 
2111  memcpy(&asiw, asi, sizeof(asiw) - sizeof(asiw.szName));
2112  MultiByteToWideChar(CP_ACP, 0, asi->szName, -1, asiw.szName, ARRAY_SIZE(asiw.szName));
2113 
2114  return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
2115 }
#define CP_ACP
Definition: compat.h:99
CHAR szName[64]
Definition: vfw.h:1021
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define AVIERR_BADSIZE
Definition: vfw.h:1749
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:2120
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR szName[64]
Definition: avifil32.idl:46
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by EditStreamSetNameA(), and test_EditStreamSetInfo().

◆ EditStreamSetInfoW()

HRESULT WINAPI EditStreamSetInfoW ( PAVISTREAM  pstream,
LPAVISTREAMINFOW  asi,
LONG  size 
)

Definition at line 2120 of file api.c.

2122 {
2123  PAVIEDITSTREAM pEdit = NULL;
2124  HRESULT hr;
2125 
2126  TRACE("(%p,%p,%d)\n", pstream, asi, size);
2127 
2128  if (size >= 0 && size < sizeof(AVISTREAMINFOA))
2129  return AVIERR_BADSIZE;
2130 
2131  hr = IAVIStream_QueryInterface(pstream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
2132  if (SUCCEEDED(hr) && pEdit != NULL) {
2133  hr = IAVIEditStream_SetInfo(pEdit, asi, size);
2134 
2135  IAVIEditStream_Release(pEdit);
2136  } else
2138 
2139  return hr;
2140 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_UNSUPPORTED
Definition: vfw.h:1743
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
#define AVIERR_BADSIZE
Definition: vfw.h:1749
#define IAVIEditStream_SetInfo(p, a, b)
Definition: vfw.h:1517
struct IAVIEditStream * PAVIEDITSTREAM
Definition: vfw.h:41
#define IAVIStream_QueryInterface(p, a, b)
Definition: vfw.h:1175
#define IAVIEditStream_Release(p)
Definition: vfw.h:1511
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by EditStreamSetInfoA(), and EditStreamSetNameW().

◆ EditStreamSetNameA()

HRESULT WINAPI EditStreamSetNameA ( PAVISTREAM  pstream,
LPCSTR  szName 
)

Definition at line 2145 of file api.c.

2146 {
2147  AVISTREAMINFOA asia;
2148  HRESULT hres;
2149 
2150  TRACE("(%p,%s)\n", pstream, debugstr_a(szName));
2151 
2152  if (pstream == NULL)
2153  return AVIERR_BADHANDLE;
2154  if (szName == NULL)
2155  return AVIERR_BADPARAM;
2156 
2157  hres = AVIStreamInfoA(pstream, &asia, sizeof(asia));
2158  if (FAILED(hres))
2159  return hres;
2160 
2161  memset(asia.szName, 0, sizeof(asia.szName));
2162  lstrcpynA(asia.szName, szName, ARRAY_SIZE(asia.szName));
2163 
2164  return EditStreamSetInfoA(pstream, &asia, sizeof(asia));
2165 }
CHAR szName[64]
Definition: vfw.h:1021
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
Definition: api.c:2101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi, LONG size)
Definition: api.c:497
#define ARRAY_SIZE(a)
Definition: main.h:24
#define lstrcpynA
Definition: compat.h:408
static const WCHAR szName[]
Definition: msipriv.h:1194
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_AVISaveOptions().

◆ EditStreamSetNameW()

HRESULT WINAPI EditStreamSetNameW ( PAVISTREAM  pstream,
LPCWSTR  szName 
)

Definition at line 2170 of file api.c.

2171 {
2172  AVISTREAMINFOW asiw;
2173  HRESULT hres;
2174 
2175  TRACE("(%p,%s)\n", pstream, debugstr_w(szName));
2176 
2177  if (pstream == NULL)
2178  return AVIERR_BADHANDLE;
2179  if (szName == NULL)
2180  return AVIERR_BADPARAM;
2181 
2182  hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
2183  if (FAILED(hres))
2184  return hres;
2185 
2186  memset(asiw.szName, 0, sizeof(asiw.szName));
2187  lstrcpynW(asiw.szName, szName, ARRAY_SIZE(asiw.szName));
2188 
2189  return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
2190 }
#define IAVIStream_Info(p, a, b)
Definition: vfw.h:1180
#define lstrcpynW
Definition: compat.h:397
#define debugstr_w
Definition: kernel32.h:32
#define AVIERR_BADHANDLE
Definition: vfw.h:1750
smooth NULL
Definition: ftsmooth.c:416
#define AVIERR_BADPARAM
Definition: vfw.h:1748
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi, LONG size)
Definition: api.c:2120
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR szName[64]
Definition: avifil32.idl:46
static const WCHAR szName[]
Definition: msipriv.h:1194
#define memset(x, y, z)
Definition: compat.h:39

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( avifile  )

Variable Documentation

◆ nCurrent

INT nCurrent

Definition at line 64 of file api.c.

◆ nStreams

◆ ppavis

PAVISTREAM* ppavis

Definition at line 62 of file api.c.

◆ ppOptions

◆ SaveOpts

◆ uFlags

Definition at line 60 of file api.c.

Referenced by CTrayBandSite::AddContextMenus(), AddMenuItem(), AppendMenuA(), AppendMenuW(), AVISaveOptions(), BrowserService_IEGetDisplayName(), CallbackEntry(), CallbackExtra(), ChildWindowFromPointEx(), ATL::CWindow::ChildWindowFromPointEx(), co_IntSendMessageTimeout(), co_IntSendMessageTimeoutSingle(), CreateIconFromResourceEx(), DECLARE_INTERFACE_(), ATL::CWindow::DeferWindowPos(), DeferWindowPos(), DefWndPrint(), DeleteMenu(), draw_diag_edge(), draw_rect_edge(), DrawCaption(), DrawCaptionTempA(), DrawCaptionTempW(), DrawThemeEdge(), DRIVER_getCallback(), DriverCallback(), ExitWindowsEx(), ExitWindowsWorker(), FileMenu_AddFilesForPidl(), FileMenu_Create(), FileMenu_InsertUsingPidl(), FileMenu_TrackPopupMenuEx(), FM_SetMenuParameter(), FormatMenuString(), get_mmioFromProfile(), CDefViewBckgrndMenu::GetCommandString(), CVfdShExt::GetCommandString(), BtrfsContextMenu::GetCommandString(), CRecycleBin::GetCommandString(), CCPLItemMenu::GetCommandString(), CRecycleBinItemContextMenu::GetCommandString(), CDefaultContextMenu::GetCommandString(), CQuickLaunchBand::GetCommandString(), CZipFolder::GetCommandString(), getDefaultIconLocation(), GetDisplayName(), CRecycleBin::GetDisplayNameOf(), CMergedFolder::GetDisplayNameOf(), CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::GetDisplayNameOf(), GetFullName(), GetIcon(), CNtObjectFolderExtractIcon::GetIconLocation(), CExtractIcon::GetIconLocation(), CShellLink::GetIconLocation(), getIconLocationForFolder(), GetMenuState(), GlobalAlloc(), GlobalFlags(), GlobalReAlloc(), IEGetNameAndFlags(), IEGetNameAndFlagsEx(), ImageList_Copy(), ImageList_LoadImageA(), ImageList_LoadImageW(), InsertMenuA(), InsertMenuW(), IntDrawDiagEdge(), IntDrawRectEdge(), IntGetMenuState(), CDefView::ItemCount(), keylist_GetKey(), keylist_GetKey2(), keylist_RemoveAllKeys(), keylist_RemoveKey(), keylist_SetKey(), keylist_SetKey2(), LISTVIEW_GetNextItem(), LocalAlloc(), LocalFlags(), LocalReAlloc(), LogoffShutdownThread(), MD_OnPrint(), MD_OnPrintClient(), MMIO_Flush(), MMIO_SetBuffer(), mmioAdvance(), mmioAscend(), mmioClose(), mmioCreateChunk(), mmioDescend(), mmioFlush(), mmioGetInfo(), mmioSetBuffer(), mmioSetInfo(), mmioStringToFOURCCA(), mmioStringToFOURCCW(), ModifyMenuA(), ModifyMenuW(), MyDrawCaptionTemp(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyIntDrawRectEdge(), NtUserDeleteMenu(), NtUserDrawCaption(), NtUserDrawCaptionTemp(), NtUserRemoveMenu(), NtUserSetWindowPos(), CDefView::OnStateChange(), PidlToSicIndex(), CDefViewBckgrndMenu::QueryContextMenu(), COpenWithMenu::QueryContextMenu(), CBandSiteMenu::QueryContextMenu(), CVfdShExt::QueryContextMenu(), BtrfsContextMenu::QueryContextMenu(), CRecycleBin::QueryContextMenu(), CNewMenu::QueryContextMenu(), CRecycleBinItemContextMenu::QueryContextMenu(), CDefaultContextMenu::QueryContextMenu(), CQuickLaunchBand::QueryContextMenu(), CShellLink::QueryContextMenu(), CZipFolder::QueryContextMenu(), CTrayWindow::QueryContextMenu(), RealUserDrawCaption(), RemoveMenu(), ResizeWnd(), RestartDialog(), RunFileDlg(), CNewMenu::SelectNewItem(), CExtractIcon::SetFlags(), SetMenuItemBitmaps(), CUserNotification::SetUpNotifyData(), SetWindowPos(), SHAddToRecentDocs(), SHChangeNotify(), SHChangeNotifyWrap(), SHCreateLinks(), SHDefExtractIconA(), SHDefExtractIconW(), SHDefExtractIconWrapW(), Shell_MergeMenus(), SHELL_PidlGetIconLocationW(), ShellBrowser_SetToolbarItems(), SHGetFileInfoW(), SHGetNewLinkInfoA(), SHGetNewLinkInfoW(), SHGetNewLinkInfoWrapW(), ShowHideMenuCtl(), SHUpdateImageA(), SHUpdateImageW(), sndPlaySoundA(), sndPlaySoundW(), test_browse_pidl_(), test_browse_pidl_sb_(), test_pack_MIDL_STUB_MESSAGE(), test_pack_NOTIFYICONDATAA(), test_pack_NOTIFYICONDATAW(), test_pack_TBINFO(), TestGlobalDiscard(), TestGlobalFlagsFixed(), TestGlobalFlagsMoveable(), ToAscii(), ToAsciiEx(), TOOLTIPS_CalcTipSize(), TOOLTIPS_customdraw_fill(), TOOLTIPS_Refresh(), TreeListEditLabel(), TreeListGetItemRect(), TreeListGetNextItem(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DFC_ButtonPush(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), unz64local_CheckCurrentFileCoherencyHeader(), UpdateToolTip(), UserDrawCaption(), and UserDrawCaptionText().