Author: akhaldi
Date: Thu Aug 18 09:55:39 2016
New Revision: 72272

URL: http://svn.reactos.org/svn/reactos?rev=72272&view=rev
Log:
[AVIFIL32] Sync with Wine Staging 1.9.16. CORE-11866

Modified:
    trunk/reactos/dll/win32/avifil32/api.c
    trunk/reactos/dll/win32/avifil32/avifile_private.h
    trunk/reactos/dll/win32/avifil32/editstream.c
    trunk/reactos/dll/win32/avifil32/factory.c
    trunk/reactos/dll/win32/avifil32/tmpfile.c
    trunk/reactos/media/doc/README.WINE

Modified: trunk/reactos/dll/win32/avifil32/api.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/api.c?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/api.c      [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/api.c      [iso-8859-1] Thu Aug 18 
09:55:39 2016
@@ -1960,44 +1960,6 @@
 }
 
 /***********************************************************************
- *             CreateEditableStream    (AVIFIL32.@)
- */
-HRESULT WINAPI CreateEditableStream(PAVISTREAM *ppEditable, PAVISTREAM pSource)
-{
-  IAVIEditStream *pEdit = NULL;
-  HRESULT        hr;
-
-  TRACE("(%p,%p)\n", ppEditable, pSource);
-
-  if (ppEditable == NULL)
-    return AVIERR_BADPARAM;
-
-  *ppEditable = NULL;
-
-  if (pSource != NULL) {
-    hr = IAVIStream_QueryInterface(pSource, &IID_IAVIEditStream,
-                                  (LPVOID*)&pEdit);
-    if (SUCCEEDED(hr) && pEdit != NULL) {
-      hr = IAVIEditStream_Clone(pEdit, ppEditable);
-      IAVIEditStream_Release(pEdit);
-
-      return hr;
-    }
-  }
-
-  /* need own implementation of IAVIEditStream */
-  pEdit = AVIFILE_CreateEditStream(pSource);
-  if (pEdit == NULL)
-    return AVIERR_MEMORY;
-
-  hr = IAVIEditStream_QueryInterface(pEdit, &IID_IAVIStream,
-                                     (LPVOID*)ppEditable);
-  IAVIEditStream_Release(pEdit);
-
-  return hr;
-}
-
-/***********************************************************************
  *             EditStreamClone         (AVIFIL32.@)
  */
 HRESULT WINAPI EditStreamClone(PAVISTREAM pStream, PAVISTREAM *ppResult)

Modified: trunk/reactos/dll/win32/avifil32/avifile_private.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifile_private.h?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifile_private.h  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/avifile_private.h  [iso-8859-1] Thu Aug 18 
09:55:39 2016
@@ -65,7 +65,6 @@
 extern HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void 
**ret_iface) DECLSPEC_HIDDEN;
 extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;
 extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;
-extern PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream) 
DECLSPEC_HIDDEN;
 extern PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pstream) DECLSPEC_HIDDEN;
 extern PAVIFILE  AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM 
*ppStreams) DECLSPEC_HIDDEN;
 

Modified: trunk/reactos/dll/win32/avifil32/editstream.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/editstream.c?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/editstream.c       [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/editstream.c       [iso-8859-1] Thu Aug 18 
09:55:39 2016
@@ -52,6 +52,8 @@
   PGETFRAME            pg;         /* IGetFrame for pCurStream */
   LPBITMAPINFOHEADER   lpFrame;    /* frame of pCurStream */
 };
+
+static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *stream);
 
 static inline IAVIEditStreamImpl *impl_from_IAVIEditStream(IAVIEditStream 
*iface)
 {
@@ -381,15 +383,15 @@
     *(LPDWORD)plLength = This->sInfo.dwStart + This->sInfo.dwLength -
       *(LPDWORD)plStart;
 
-  pEdit = (IAVIEditStreamImpl*)AVIFILE_CreateEditStream(NULL);
+  pEdit = AVIFILE_CreateEditStream(NULL);
   if (pEdit == NULL)
     return AVIERR_MEMORY;
 
-  hr = IAVIEditStream_Paste((PAVIEDITSTREAM)pEdit, &start, plLength, 
&This->IAVIStream_iface,
+  hr = IAVIEditStream_Paste(&pEdit->IAVIEditStream_iface, &start, plLength, 
&This->IAVIStream_iface,
                             *plStart, *plStart + *plLength);
   *plStart = start;
   if (FAILED(hr))
-    IAVIEditStream_Release((PAVIEDITSTREAM)pEdit);
+    IAVIEditStream_Release(&pEdit->IAVIEditStream_iface);
   else
     *ppResult = &This->IAVIStream_iface;
 
@@ -597,7 +599,7 @@
     return AVIERR_BADPARAM;
   *ppResult = NULL;
 
-  pEdit = (IAVIEditStreamImpl*)AVIFILE_CreateEditStream(NULL);
+  pEdit = AVIFILE_CreateEditStream(NULL);
   if (pEdit == NULL)
     return AVIERR_MEMORY;
   if (This->nStreams > pEdit->nTableSize) {
@@ -638,7 +640,7 @@
   This->sInfo.dwRate    = asi->dwRate;
   This->sInfo.dwScale   = asi->dwScale;
   This->sInfo.dwQuality = asi->dwQuality;
-  CopyRect(&This->sInfo.rcFrame, &asi->rcFrame);
+  This->sInfo.rcFrame   = asi->rcFrame;
   memcpy(This->sInfo.szName, asi->szName, sizeof(asi->szName));
   This->sInfo.dwEditCount++;
 
@@ -988,7 +990,7 @@
   IEditAVIStream_fnSetInfo
 };
 
-PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream)
+static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream)
 {
   IAVIEditStreamImpl *pedit = NULL;
 
@@ -1002,5 +1004,39 @@
 
   IAVIStream_Create(&pedit->IAVIStream_iface, (LPARAM)pstream, 0);
 
-  return (PAVIEDITSTREAM)pedit;
-}
+  return pedit;
+}
+
+/***********************************************************************
+ *             CreateEditableStream     (AVIFIL32.@)
+ */
+HRESULT WINAPI CreateEditableStream(IAVIStream **editable, IAVIStream *src)
+{
+    IAVIEditStream *edit = NULL;
+    IAVIEditStreamImpl *editobj;
+    HRESULT hr;
+
+    TRACE("(%p,%p)\n", editable, src);
+
+    if (!editable)
+        return AVIERR_BADPARAM;
+    *editable = NULL;
+
+    if (src) {
+        hr = IAVIStream_QueryInterface(src, &IID_IAVIEditStream, 
(void**)&edit);
+        if (SUCCEEDED(hr) && edit) {
+            hr = IAVIEditStream_Clone(edit, editable);
+            IAVIEditStream_Release(edit);
+
+            return hr;
+        }
+    }
+
+    /* Need own implementation of IAVIEditStream */
+    editobj = AVIFILE_CreateEditStream(src);
+    if (!editobj)
+        return AVIERR_MEMORY;
+    *editable = &editobj->IAVIStream_iface;
+
+    return S_OK;
+}

Modified: trunk/reactos/dll/win32/avifil32/factory.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/factory.c?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/factory.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/factory.c  [iso-8859-1] Thu Aug 18 
09:55:39 2016
@@ -25,27 +25,11 @@
 static BOOL    AVIFILE_bLocked;
 static UINT    AVIFILE_uUseCount;
 
-static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY 
iface,REFIID riid,LPVOID *ppobj);
-static ULONG   WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface);
-static ULONG   WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface);
-static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY 
iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj);
-static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL 
dolock);
-
-static const IClassFactoryVtbl iclassfact = {
-  IClassFactory_fnQueryInterface,
-  IClassFactory_fnAddRef,
-  IClassFactory_fnRelease,
-  IClassFactory_fnCreateInstance,
-  IClassFactory_fnLockServer
-};
-
 typedef struct
 {
-  /* IUnknown fields */
   IClassFactory IClassFactory_iface;
-  DWORD         dwRef;
-
-  CLSID  clsid;
+  LONG ref;
+  CLSID clsid;
 } IClassFactoryImpl;
 
 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
@@ -53,35 +37,10 @@
   return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
 }
 
-static HRESULT AVIFILE_CreateClassFactory(const CLSID *pclsid, const IID *riid,
-                                         LPVOID *ppv)
-{
-  IClassFactoryImpl *pClassFactory = NULL;
-  HRESULT            hr;
-
-  *ppv = NULL;
-
-  pClassFactory = HeapAlloc(GetProcessHeap(), 0, sizeof(*pClassFactory));
-  if (pClassFactory == NULL)
-    return E_OUTOFMEMORY;
-
-  pClassFactory->IClassFactory_iface.lpVtbl = &iclassfact;
-  pClassFactory->dwRef     = 0;
-  pClassFactory->clsid     = *pclsid;
-
-  hr = IClassFactory_QueryInterface(&pClassFactory->IClassFactory_iface, riid, 
ppv);
-  if (FAILED(hr)) {
-    HeapFree(GetProcessHeap(), 0, pClassFactory);
-    *ppv = NULL;
-  }
-
-  return hr;
-}
-
-static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,
-                                                    REFIID riid,LPVOID *ppobj)
-{
-  TRACE("(%p,%p,%p)\n", iface, riid, ppobj);
+static HRESULT WINAPI IClassFactory_fnQueryInterface(IClassFactory *iface, 
REFIID riid,
+        void **ppobj)
+{
+  TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppobj);
 
   if ((IsEqualGUID(&IID_IUnknown, riid)) ||
       (IsEqualGUID(&IID_IClassFactory, riid))) {
@@ -93,31 +52,30 @@
   return E_NOINTERFACE;
 }
 
-static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
-{
-  IClassFactoryImpl *This = impl_from_IClassFactory(iface);
-
-  TRACE("(%p)\n", iface);
-
-  return ++(This->dwRef);
-}
-
-static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
-{
-  IClassFactoryImpl *This = impl_from_IClassFactory(iface);
-
-  TRACE("(%p)\n", iface);
-  if ((--(This->dwRef)) > 0)
-    return This->dwRef;
-
-  HeapFree(GetProcessHeap(), 0, This);
-
-  return 0;
-}
-
-static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,
-                                                    LPUNKNOWN pOuter,
-                                                    REFIID riid,LPVOID *ppobj)
+static ULONG WINAPI IClassFactory_fnAddRef(IClassFactory *iface)
+{
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref = %u\n", This, ref);
+    return ref;
+}
+
+static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface)
+{
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref = %u\n", This, ref);
+
+    if(!ref)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
+}
+
+static HRESULT WINAPI IClassFactory_fnCreateInstance(IClassFactory *iface, 
IUnknown *pOuter,
+        REFIID riid, void **ppobj)
 {
   IClassFactoryImpl *This = impl_from_IClassFactory(iface);
 
@@ -147,13 +105,42 @@
   return E_NOINTERFACE;
 }
 
-static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL 
dolock)
+static HRESULT WINAPI IClassFactory_fnLockServer(IClassFactory *iface, BOOL 
dolock)
 {
   TRACE("(%p,%d)\n",iface,dolock);
 
   AVIFILE_bLocked = dolock;
 
   return S_OK;
+}
+
+static const IClassFactoryVtbl iclassfact = {
+    IClassFactory_fnQueryInterface,
+    IClassFactory_fnAddRef,
+    IClassFactory_fnRelease,
+    IClassFactory_fnCreateInstance,
+    IClassFactory_fnLockServer
+};
+
+static HRESULT AVIFILE_CreateClassFactory(const CLSID *clsid, const IID *riid, 
void **ppv)
+{
+    IClassFactoryImpl *cf;
+    HRESULT hr;
+
+    *ppv = NULL;
+
+    cf = HeapAlloc(GetProcessHeap(), 0, sizeof(*cf));
+    if (!cf)
+        return E_OUTOFMEMORY;
+
+    cf->IClassFactory_iface.lpVtbl = &iclassfact;
+    cf->ref = 1;
+    cf->clsid = *clsid;
+
+    hr = IClassFactory_QueryInterface(&cf->IClassFactory_iface, riid, ppv);
+    IClassFactory_Release(&cf->IClassFactory_iface);
+
+    return hr;
 }
 
 LPCWSTR AVIFILE_BasenameW(LPCWSTR szPath)

Modified: trunk/reactos/dll/win32/avifil32/tmpfile.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/tmpfile.c?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/tmpfile.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/tmpfile.c  [iso-8859-1] Thu Aug 18 
09:55:39 2016
@@ -260,5 +260,5 @@
     }
   }
 
-  return (PAVIFILE)tmpFile;
-}
+  return &tmpFile->IAVIFile_iface;
+}

Modified: trunk/reactos/media/doc/README.WINE
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=72272&r1=72271&r2=72272&view=diff
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Thu Aug 18 09:55:39 2016
@@ -48,7 +48,7 @@
 reactos/dll/win32/atl                 # Synced to WineStaging-1.9.16
 reactos/dll/win32/atl80               # Synced to WineStaging-1.9.11
 reactos/dll/win32/atl100              # Synced to WineStaging-1.9.11
-reactos/dll/win32/avifil32            # Synced to WineStaging-1.9.11
+reactos/dll/win32/avifil32            # Synced to WineStaging-1.9.16
 reactos/dll/win32/bcrypt              # Synced to WineStaging-1.9.4
 reactos/dll/win32/browseui            # Out of sync
 reactos/dll/win32/cabinet             # Synced to WineStaging-1.9.11


Reply via email to