dlls/avifil32: Bug fixes, implemented AVIBuildFilterW andAVISaveOptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo.

This patch fixes the following issues:

dlls/avifil32/api.c:
- implemented AVIBuildFilterW
- implemented AVISaveOptions

dlls/avifil32/avifile_private.h, dlls/avifil32/avifile_De.rc,
dlls/avifil32/avifile_En.rc:
- added dialog for AVISaveOptions

dlls/avifil32/getframe.c:
- Fixed little bug, that prevents ICCompressorChosse to work.

Index: dlls/avifil32/api.c
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/api.c,v
retrieving revision 1.9
diff -u -r1.9 api.c
--- dlls/avifil32/api.c	21 Oct 2002 23:40:38 -0000	1.9
+++ dlls/avifil32/api.c	22 Oct 2002 19:01:13 -0000
@@ -29,6 +29,7 @@
 #include "ole2.h"
 #include "shellapi.h"
 #include "vfw.h"
+#include "msacm.h"
 
 #include "avifile_private.h"
 
@@ -44,6 +45,27 @@
 				  LPUNKNOWN pUnkOuter,REFIID riid,LPVOID *ppv);
 
 /***********************************************************************
+ * for AVIBuildFilterW -- uses fixed size table
+ */
+#define MAX_FILTERS 30 /* 30 => 7kB */
+
+typedef struct _AVIFilter {
+  WCHAR szClsid[40];
+  WCHAR szExtensions[MAX_FILTERS * 7];
+} AVIFilter;
+
+/***********************************************************************
+ * for AVISaveOptions
+ */
+static struct {
+  UINT                  uFlags;
+  INT                   nStreams;
+  PAVISTREAM           *ppavis;
+  LPAVICOMPRESSOPTIONS *ppOptions;
+  INT                   nCurrent;
+} SaveOpts;
+
+/***********************************************************************
  * copied from dlls/ole32/compobj.c
  */
 static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
@@ -884,10 +906,21 @@
  */
 HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
 {
-  WCHAR  szAllFiles[40];
-  LONG   size;
+  static const WCHAR szClsid[] = {'C','L','S','I','D',0};
+  static const WCHAR szExtensionFmt[] = {';','*','.','%','s',0};
+  static const WCHAR szAVIFileExtensions[] =
+    {'A','V','I','F','i','l','e','\\','E','x','t','e','n','s','i','o','n','s',0};
+
+  AVIFilter *lp;
+  WCHAR      szAllFiles[40];
+  WCHAR      szFileExt[10];
+  WCHAR      szValue[128];
+  HKEY       hKey;
+  LONG       n, i;
+  LONG       size;
+  LONG       count = 0;
 
-  FIXME("(%p,%ld,%d): partial stub\n", szFilter, cbFilter, fSaving);
+  TRACE("(%p,%ld,%d)\n", szFilter, cbFilter, fSaving);
 
   /* check parameters */
   if (szFilter == NULL)
@@ -895,20 +928,107 @@
   if (cbFilter < 2)
     return AVIERR_BADSIZE;
 
-  /* FIXME:
-   *
+  lp = (AVIFilter*)GlobalAllocPtr(GHND, MAX_FILTERS * sizeof(AVIFilter));
+  if (lp == NULL)
+    return AVIERR_MEMORY;
+
+  /*
    * 1. iterate over HKEY_CLASSES_ROOT\\AVIFile\\Extensions and collect
    *    extensions and CLSID's
    * 2. iterate over collected CLSID's and copy it's description and it's
    *    extensions to szFilter if it fits
    *
-   * First filter is named "All multimedia files" and it's ilter is a
+   * First filter is named "All multimedia files" and it's filter is a
    * collection of all possible extensions except "*.*".
    */
+  if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) {
+    GlobalFreePtr(lp);
+    return AVIERR_ERROR;
+  }
+  for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)) == S_OK;n++) {
+    /* get CLSID to extension */
+    size = sizeof(szValue)/sizeof(szValue[0]);
+    if (RegQueryValueW(hKey, szFileExt, szValue, &size) != S_OK)
+      break;
+
+    /* search if the CLSID is already known */
+    for (i = 1; i <= count; i++) {
+      if (lstrcmpW(lp[i].szClsid, szValue) == 0)
+	break; /* a new one */
+    }
+
+    if (count - i == -1) {
+      /* it's a new CLSID */
+
+      /* FIXME: How do we get info's about read/write capabilities? */
+
+      if (count >= MAX_FILTERS) {
+	/* try to inform user of our full fixed size table */
+	ERR(": More than %d filters found! Adjust MAX_FILTERS in dlls/avifil32/api.c\n", MAX_FILTERS);
+	break;
+      }
+
+      lstrcpyW(lp[i].szClsid, szValue);
+
+      count++;
+    }
+
+    /* append extension to the filter */
+    wsprintfW(szValue, szExtensionFmt, szFileExt);
+    if (lp[i].szExtensions[0] == 0)
+      lstrcatW(lp[i].szExtensions, szValue + 1);
+    else
+      lstrcatW(lp[i].szExtensions, szValue);
+
+    /* also append to the "all multimedia"-filter */
+    if (lp[0].szExtensions[0] == 0)
+      lstrcatW(lp[0].szExtensions, szValue + 1);
+    else
+      lstrcatW(lp[0].szExtensions, szValue);
+  }
+  RegCloseKey(hKey);
+
+  /* 2. get descriptions for the CLSIDs and fill out szFilter */
+  if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != S_OK) {
+    GlobalFreePtr(lp);
+    return AVIERR_ERROR;
+  }
+  for (n = 0; n <= count; n++) {
+    /* first the description */
+    if (n != 0) {
+      size = sizeof(szValue)/sizeof(szValue[0]);
+      if (RegQueryValueW(hKey, lp[n].szClsid, szValue, &size) == S_OK) {
+	size = lstrlenW(szValue);
+	lstrcpynW(szFilter, szValue, cbFilter);
+      }
+    } else
+      size = LoadStringW(AVIFILE_hModule,IDS_ALLMULTIMEDIA,szFilter,cbFilter);
+
+    /* check for enough space */
+    size++;
+    if (cbFilter < size + lstrlenW(lp[n].szExtensions) + 2) {
+      szFilter[0] = 0;
+      szFilter[1] = 0;
+      GlobalFreePtr(lp);
+      RegCloseKey(hKey);
+      return AVIERR_BUFFERTOOSMALL;
+    }
+    cbFilter -= size;
+    szFilter += size;
+
+    /* and then the filter */
+    lstrcpynW(szFilter, lp[n].szExtensions, cbFilter);
+    size = lstrlenW(lp[n].szExtensions) + 1;
+    cbFilter -= size;
+    szFilter += size;
+  }
+
+  RegCloseKey(hKey);
+  GlobalFreePtr(lp);
 
   /* add "All files" "*.*" filter if enough space left */
   size = LoadStringW(AVIFILE_hModule, IDS_ALLFILES,
-		     szAllFiles, sizeof(szAllFiles));
+		     szAllFiles, sizeof(szAllFiles)) + 1;
   if (cbFilter > size) {
     int i;
 
@@ -920,22 +1040,356 @@
       }
     }
       
-    memcpy(szFilter, szAllFiles, size);
+    memcpy(szFilter, szAllFiles, size * sizeof(szAllFiles[0]));
+    szFilter += size;
+    szFilter[0] = 0;
+
+    return AVIERR_OK;
+  } else {
+    szFilter[0] = 0;
+    return AVIERR_BUFFERTOOSMALL;
+  }
+}
+
+static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
+{
+  LPAVICOMPRESSOPTIONS pOptions = SaveOpts.ppOptions[SaveOpts.nCurrent];
+  AVISTREAMINFOW       sInfo;
+
+  TRACE("(%p)\n", hWnd);
+
+  if (pOptions == NULL || SaveOpts.ppavis[SaveOpts.nCurrent] == NULL) {
+    ERR(": bad state!\n");
+    return FALSE;
+  }
+
+  if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent],
+			    &sInfo, sizeof(sInfo)))) {
+    ERR(": AVIStreamInfoW failed!\n");
+    return FALSE;
   }
 
-  return AVIERR_OK;
+  if (sInfo.fccType == streamtypeVIDEO) {
+    COMPVARS cv;
+    BOOL     ret;
+
+    memset(&cv, 0, sizeof(cv));
+
+    if ((pOptions->dwFlags & AVICOMPRESSF_VALID) == 0) {
+      memset(pOptions, 0, sizeof(AVICOMPRESSOPTIONS));
+      pOptions->fccType    = streamtypeVIDEO;
+      pOptions->fccHandler = comptypeDIB;
+      pOptions->dwQuality  = ICQUALITY_DEFAULT;
+    }
+
+    cv.cbSize     = sizeof(cv);
+    cv.dwFlags    = ICMF_COMPVARS_VALID;
+    //cv.fccType    = pOptions->fccType;
+    cv.fccHandler = pOptions->fccHandler;
+    cv.lQ         = pOptions->dwQuality;
+    cv.lpState    = pOptions->lpParms;
+    cv.cbState    = pOptions->cbParms;
+    if (pOptions->dwFlags & AVICOMPRESSF_KEYFRAMES)
+      cv.lKey = pOptions->dwKeyFrameEvery;
+    else
+      cv.lKey = 0;
+    if (pOptions->dwFlags & AVICOMPRESSF_DATARATE)
+      cv.lDataRate = pOptions->dwBytesPerSecond / 1024; /* need kBytes */
+    else
+      cv.lDataRate = 0;
+
+    ret = ICCompressorChoose(hWnd, SaveOpts.uFlags, NULL,
+			     SaveOpts.ppavis[SaveOpts.nCurrent], &cv, NULL);
+
+    if (ret) {
+      pOptions->lpParms   = cv.lpState;
+      pOptions->cbParms   = cv.cbState;
+      pOptions->dwQuality = cv.lQ;
+      if (cv.lKey != 0) {
+	pOptions->dwKeyFrameEvery = cv.lKey;
+	pOptions->dwFlags |= AVICOMPRESSF_KEYFRAMES;
+      } else
+	pOptions->dwFlags &= ~AVICOMPRESSF_KEYFRAMES;
+      if (cv.lDataRate != 0) {
+	pOptions->dwBytesPerSecond = cv.lDataRate * 1024; /* need bytes */
+	pOptions->dwFlags |= AVICOMPRESSF_DATARATE;
+      } else
+	pOptions->dwFlags &= ~AVICOMPRESSF_DATARATE;
+      pOptions->dwFlags  |= AVICOMPRESSF_VALID;
+    }
+    ICCompressorFree(&cv);
+
+    return ret;
+  } else if (sInfo.fccType == streamtypeAUDIO) {
+    ACMFORMATCHOOSEW afmtc;
+    MMRESULT         ret;
+    LONG             size;
+
+    /* FIXME: check ACM version -- Which version is needed? */
+
+    memset(&afmtc, 0, sizeof(afmtc));
+    afmtc.cbStruct  = sizeof(afmtc);
+    afmtc.fdwStyle  = 0;
+    afmtc.hwndOwner = hWnd;
+
+    acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size);
+    if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
+      pOptions->lpFormat = GlobalAllocPtr(GMEM_MOVEABLE, size);
+      pOptions->cbFormat = size;
+    } else if (pOptions->cbFormat < size) {
+      pOptions->lpFormat = GlobalReAllocPtr(pOptions->lpFormat, size, GMEM_MOVEABLE);
+      pOptions->cbFormat = size;
+    }
+    if (pOptions->lpFormat == NULL)
+      return FALSE;
+    afmtc.pwfx  = pOptions->lpFormat;
+    afmtc.cbwfx = pOptions->cbFormat;
+
+    size = 0;
+    AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],
+			sInfo.dwStart, &size);
+    if (size < sizeof(PCMWAVEFORMAT))
+      size = sizeof(PCMWAVEFORMAT);
+    afmtc.pwfxEnum = GlobalAllocPtr(GHND, size);
+    if (afmtc.pwfxEnum != NULL) {
+      AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
+			  sInfo.dwStart, afmtc.pwfxEnum, &size);
+      afmtc.fdwEnum = ACM_FORMATENUMF_CONVERT;
+    }
+
+    ret = acmFormatChooseW(&afmtc);
+    if (ret == S_OK)
+      pOptions->dwFlags |= AVICOMPRESSF_VALID;
+
+    if (afmtc.pwfxEnum != NULL)
+      GlobalFreePtr(afmtc.pwfxEnum);
+
+    return (ret == S_OK ? TRUE : FALSE);
+  } else {
+    ERR(": unknown streamtype 0x%08lX\n", sInfo.fccType);
+    return FALSE;
+  }
+}
+
+static void AVISaveOptionsUpdate(HWND hWnd)
+{
+  static const WCHAR szVideoFmt[]={'%','l','d','x','%','l','d','x','%','d',0};
+  static const WCHAR szAudioFmt[]={'%','s',' ','%','s',0};
+
+  WCHAR          szFormat[128];
+  AVISTREAMINFOW sInfo;
+  LPVOID         lpFormat;
+  LONG           size;
+
+  TRACE("(%p)\n", hWnd);
+
+  SaveOpts.nCurrent = SendDlgItemMessageW(hWnd,IDC_STREAM,CB_GETCURSEL,0,0);
+  if (SaveOpts.nCurrent < 0)
+    return;
+
+  if (FAILED(AVIStreamInfoW(SaveOpts.ppavis[SaveOpts.nCurrent], &sInfo, sizeof(sInfo))))
+    return;
+
+  AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,&size);
+  if (size > 0) {
+    szFormat[0] = 0;
+
+    /* read format to build format descriotion string */
+    lpFormat = GlobalAllocPtr(GHND, size);
+    if (lpFormat != NULL) {
+      if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
+	if (sInfo.fccType == streamtypeVIDEO) {
+	  LPBITMAPINFOHEADER lpbi = lpFormat;
+	  ICINFO icinfo;
+
+	  wsprintfW(szFormat, szVideoFmt, lpbi->biWidth,
+		    lpbi->biHeight, lpbi->biBitCount);
+
+	  if (lpbi->biCompression != BI_RGB) {
+	    HIC    hic;
+
+	    hic = ICLocate(ICTYPE_VIDEO, sInfo.fccHandler, lpFormat,
+			   NULL, ICMODE_DECOMPRESS);
+	    if (hic != (HIC)NULL) {
+	      if (ICGetInfo(hic, &icinfo, sizeof(icinfo)) == S_OK)
+		lstrcatW(szFormat, icinfo.szDescription);
+	      ICClose(hic);
+	    }
+	  } else {
+	    LoadStringW(AVIFILE_hModule, IDS_UNCOMPRESSED,
+			icinfo.szDescription, sizeof(icinfo.szDescription));
+	    lstrcatW(szFormat, icinfo.szDescription);
+	  }
+	} else if (sInfo.fccType == streamtypeAUDIO) {
+	  ACMFORMATTAGDETAILSW aftd;
+	  ACMFORMATDETAILSW    afd;
+
+	  memset(&aftd, 0, sizeof(aftd));
+	  memset(&afd, 0, sizeof(afd));
+
+	  aftd.cbStruct     = sizeof(aftd);
+	  aftd.dwFormatTag  = afd.dwFormatTag =
+	    ((PWAVEFORMATEX)lpFormat)->wFormatTag;
+	  aftd.cbFormatSize = afd.cbwfx = size;
+
+	  afd.cbStruct      = sizeof(afd);
+	  afd.pwfx          = lpFormat;
+
+	  if (acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd,
+				   ACM_FORMATTAGDETAILSF_FORMATTAG) == S_OK) {
+	    if (acmFormatDetailsW(NULL,&afd,ACM_FORMATDETAILSF_FORMAT) == S_OK)
+	      wsprintfW(szFormat, szAudioFmt, afd.szFormat, aftd.szFormatTag);
+	  }
+	}
+      }
+      GlobalFreePtr(lpFormat);
+    }
+
+    /* set text for format description */
+    SetDlgItemTextW(hWnd, IDC_FORMATTEXT, szFormat);
+
+    /* Disable option button for unsupported streamtypes */
+    if (sInfo.fccType == streamtypeVIDEO ||
+	sInfo.fccType == streamtypeAUDIO)
+      EnableWindow(GetDlgItem(hWnd, IDC_OPTIONS), TRUE);
+    else
+      EnableWindow(GetDlgItem(hWnd, IDC_OPTIONS), FALSE);
+  }
+
+}
+
+BOOL CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
+				    WPARAM wParam, LPARAM lParam)
+{
+  DWORD dwInterleave;
+  BOOL  bIsInterleaved;
+  INT   n;
+
+  /*TRACE("(%p,%u,0x%04X,0x%08lX)\n", hWnd, uMsg, wParam, lParam);*/
+
+  switch (uMsg) {
+  case WM_INITDIALOG:
+    SaveOpts.nCurrent = 0;
+    if (SaveOpts.nStreams == 1) {
+      EndDialog(hWnd, AVISaveOptionsFmtChoose(hWnd));
+      return FALSE;
+    }
+
+    /* add streams */
+    for (n = 0; n < SaveOpts.nStreams; n++) {
+      AVISTREAMINFOW sInfo;
+
+      AVIStreamInfoW(SaveOpts.ppavis[n], &sInfo, sizeof(sInfo));
+      SendDlgItemMessageW(hWnd, IDC_STREAM, CB_ADDSTRING,
+			  0L, (LPARAM)sInfo.szName);
+    }
+
+    /* select first stream */
+    SendDlgItemMessageW(hWnd, IDC_STREAM, CB_SETCURSEL, 0, 0);
+    SendMessageW(hWnd, WM_COMMAND,
+		 GET_WM_COMMAND_MPS(IDC_STREAM, hWnd, CBN_SELCHANGE));
+
+    /* initialize interleave */
+    if (SaveOpts.ppOptions[0] != NULL &&
+	(SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_VALID)) {
+      bIsInterleaved = (SaveOpts.ppOptions[0]->dwFlags & AVICOMPRESSF_INTERLEAVE);
+      dwInterleave = SaveOpts.ppOptions[0]->dwInterleaveEvery;
+    } else {
+      bIsInterleaved = TRUE;
+      dwInterleave   = 0;
+    }
+    CheckDlgButton(hWnd, IDC_INTERLEAVE, bIsInterleaved);
+    SetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, dwInterleave, FALSE);
+    EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
+    break;
+  case WM_COMMAND:
+    switch (GET_WM_COMMAND_CMD(wParam, lParam)) {
+    case IDOK:
+      /* get data from controls and save them */
+      dwInterleave   = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
+      bIsInterleaved = IsDlgButtonChecked(hWnd, IDC_INTERLEAVE);
+      for (n = 0; n < SaveOpts.nStreams; n++) {
+	if (SaveOpts.ppOptions[n] != NULL) {
+	  if (bIsInterleaved) {
+	    SaveOpts.ppOptions[n]->dwFlags |= AVICOMPRESSF_INTERLEAVE;
+	    SaveOpts.ppOptions[n]->dwInterleaveEvery = dwInterleave;
+	  } else
+	    SaveOpts.ppOptions[n]->dwFlags &= ~AVICOMPRESSF_INTERLEAVE;
+	}
+      }
+      /* fall through */
+    case IDCANCEL:
+      EndDialog(hWnd, GET_WM_COMMAND_CMD(wParam, lParam) == IDOK);
+      break;
+    case IDC_INTERLEAVE:
+      EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY),
+		   IsDlgButtonChecked(hWnd, IDC_INTERLEAVE));
+      break;
+    case IDC_STREAM:
+      if (GET_WM_COMMAND_CMD(wParam, lParam) == CBN_SELCHANGE) {
+	/* update control elements */
+	AVISaveOptionsUpdate(hWnd);
+      }
+      break;
+    case IDC_OPTIONS:
+      AVISaveOptionsFmtChoose(hWnd);
+      break;
+    };
+    return FALSE;
+  };
+
+  return TRUE;
 }
 
 /***********************************************************************
  *		AVISaveOptions		(AVIFIL32.@)
  */
-BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStream,
+BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
 			   PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *ppOptions)
 {
-  FIXME("(%p,0x%X,%d,%p,%p): stub\n", hWnd, uFlags, nStream,
+  LPAVICOMPRESSOPTIONS pSavedOptions = NULL;
+  INT ret, n;
+
+  TRACE("(%p,0x%X,%d,%p,%p)\n", hWnd, uFlags, nStreams,
 	ppavi, ppOptions);
 
-  return FALSE;
+  /* check parameters */
+  if (nStreams <= 0 || ppavi == NULL || ppOptions == NULL)
+    return AVIERR_BADPARAM;
+
+  /* save options for case user press cancel */
+  if (ppOptions != NULL && nStreams > 1) {
+    pSavedOptions = GlobalAllocPtr(GHND,nStreams * sizeof(AVICOMPRESSOPTIONS));
+    if (pSavedOptions == NULL)
+      return FALSE;
+
+    for (n = 0; n < nStreams; n++) {
+      if (ppOptions[n] != NULL)
+	memcpy(pSavedOptions + n, ppOptions[n], sizeof(AVICOMPRESSOPTIONS));
+    }
+  }
+
+  SaveOpts.uFlags    = uFlags;
+  SaveOpts.nStreams  = nStreams;
+  SaveOpts.ppavis    = ppavi;
+  SaveOpts.ppOptions = ppOptions;
+
+  ret = DialogBoxW(AVIFILE_hModule, MAKEINTRESOURCEW(IDD_SAVEOPTIONS),
+		   hWnd, AVISaveOptionsDlgProc);
+
+  if (ret == -1)
+    ret = FALSE;
+
+  /* restore options when user pressed cancel */
+  if (pSavedOptions != NULL && ret == FALSE) {
+    for (n = 0; n < nStreams; n++) {
+      if (ppOptions[n] != NULL)
+	memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
+    }
+    GlobalFreePtr(pSavedOptions);
+  }
+
+  return (BOOL)ret;
 }
 
 /***********************************************************************
Index: dlls/avifil32/avifile_De.rc
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/avifile_De.rc,v
retrieving revision 1.2
diff -u -r1.2 avifile_De.rc
--- dlls/avifil32/avifile_De.rc	21 Oct 2002 23:40:38 -0000	1.2
+++ dlls/avifil32/avifile_De.rc	22 Oct 2002 19:01:14 -0000
@@ -18,10 +18,29 @@
 
 LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
 
+IDD_SAVEOPTIONS DIALOG FIXED IMPURE  43, 37, 196, 82
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Komprimierungsoptionen"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT           "&Wählen Sie die Eingangsdaten aus:",-1,2,5,114,10
+    COMBOBOX        IDC_STREAM,2,18,134,61,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
+    PUSHBUTTON      "&Optionen...",IDC_OPTIONS,145,17,45,14
+    AUTOCHECKBOX    "&Interleave alle",IDC_INTERLEAVE,3,42,60,11,WS_TABSTOP
+    EDITTEXT        IDC_INTERLEAVEEVERY,66,41,32,12,ES_AUTOHSCROLL
+    LTEXT           "Einzelbilder",-1,104,43,36,9
+    LTEXT           "Akuelles Format:",-1,3,56,53,9
+    LTEXT           "This space for rent",IDC_FORMATTEXT,55,56,90,26
+    DEFPUSHBUTTON   "OK",IDOK,145,42,45,14
+    PUSHBUTTON      "Abbrechen",IDCANCEL,145,61,45,14
+END
+
 STRINGTABLE DISCARDABLE
 {
   IDS_WAVESTREAMFORMAT	"Waveform: %s"
   IDS_WAVEFILETYPE	"Waveform"
+  IDS_ALLMULTIMEDIA	"Alle Multimedia-Dateien"
   IDS_ALLFILES		"Alle Dateien (*.*)@*.*"
   IDS_VIDEO		"Video"
   IDS_AUDIO		"Audio"
Index: dlls/avifil32/avifile_En.rc
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/avifile_En.rc,v
retrieving revision 1.2
diff -u -r1.2 avifile_En.rc
--- dlls/avifil32/avifile_En.rc	21 Oct 2002 23:40:38 -0000	1.2
+++ dlls/avifil32/avifile_En.rc	22 Oct 2002 19:01:14 -0000
@@ -18,10 +18,29 @@
 
 LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
 
+IDD_SAVEOPTIONS DIALOG FIXED IMPURE  43, 37, 196, 82
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Compressoptions"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LTEXT           "&Choose a stream:",-1,2,5,114,10
+    COMBOBOX        IDC_STREAM,2,18,134,61,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
+    PUSHBUTTON      "&Options...",IDC_OPTIONS,145,17,45,14
+    AUTOCHECKBOX    "&Interleave every",IDC_INTERLEAVE,3,42,60,11,WS_TABSTOP
+    EDITTEXT        IDC_INTERLEAVEEVERY,66,41,32,12,ES_AUTOHSCROLL
+    LTEXT           "frames",-1,104,43,36,9
+    LTEXT           "Current format:",-1,3,56,53,9
+    LTEXT           "This space for rent",IDC_FORMATTEXT,55,56,90,26
+    DEFPUSHBUTTON   "OK",IDOK,145,42,45,14
+    PUSHBUTTON      "Cancel",IDCANCEL,145,61,45,14
+END
+
 STRINGTABLE DISCARDABLE
 {
   IDS_WAVESTREAMFORMAT	"Waveform: %s"
   IDS_WAVEFILETYPE	"Waveform"
+  IDS_ALLMULTIMEDIA	"All multimedia files"
   IDS_ALLFILES		"All files (*.*)@*.*"
   IDS_VIDEO		"video"
   IDS_AUDIO		"audio"
Index: dlls/avifil32/avifile_private.h
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/avifile_private.h,v
retrieving revision 1.6
diff -u -r1.6 avifile_private.h
--- dlls/avifil32/avifile_private.h	21 Oct 2002 23:40:38 -0000	1.6
+++ dlls/avifil32/avifile_private.h	22 Oct 2002 19:01:14 -0000
@@ -37,8 +37,16 @@
                          (lp)->biClrUsed * sizeof(RGBQUAD))
 #endif
 
+#define IDD_SAVEOPTIONS      0x0100
+#define IDC_INTERLEAVE       0x0110
+#define IDC_INTERLEAVEEVERY  0x0111
+#define IDC_STREAM           0x0112
+#define IDC_OPTIONS          0x0113
+#define IDC_FORMATTEXT       0x0114
+
 #define IDS_WAVESTREAMFORMAT 0x0100
 #define IDS_WAVEFILETYPE     0x0101
+#define IDS_ALLMULTIMEDIA    0x0184
 #define IDS_ALLFILES         0x0185
 #define IDS_VIDEO            0x0189
 #define IDS_AUDIO            0x0190
Index: dlls/avifil32/getframe.c
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/getframe.c,v
retrieving revision 1.1
diff -u -r1.1 getframe.c
--- dlls/avifil32/getframe.c	18 Oct 2002 00:24:41 -0000	1.1
+++ dlls/avifil32/getframe.c	22 Oct 2002 19:01:14 -0000
@@ -224,7 +224,7 @@
     LONG lNext = AVIStreamFindSample(This->pStream, lPos, FIND_KEY|FIND_PREV);
 
     if (lNext == -1)
-      lNext = 0; /* first frame is always a keyframe */
+      return NULL;
     if (lNext <= This->lCurrentFrame && This->lCurrentFrame < lPos)
       lNext++;
 
@@ -338,6 +338,8 @@
 
   /* get input format from stream */
   if (This->lpInFormat == NULL) {
+    HRESULT hr;
+
     This->cbInBuffer = sInfo.dwSuggestedBufferSize;
     if (This->cbInBuffer == 0)
       This->cbInBuffer = 1024;
@@ -351,7 +353,11 @@
       return AVIERR_MEMORY;
     }
 
-    AVIStreamReadFormat(This->pStream, sInfo.dwStart, This->lpInFormat, &This->cbInFormat);
+    hr = AVIStreamReadFormat(This->pStream, sInfo.dwStart, This->lpInFormat, &This->cbInFormat);
+    if (FAILED(hr)) {
+      AVIFILE_CloseCompressor(This);
+      return hr;
+    }
 
     This->lpInBuffer = ((LPBYTE)This->lpInFormat) + This->cbInFormat;
   }


  Michael

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux