[AVIFIL32] Sync with Wine Staging 1.9.16. CORE-11866

svn path=/trunk/; revision=72272
This commit is contained in:
Amine Khaldi
2016-08-18 09:55:39 +00:00
parent 9c0416c9fd
commit 855d6e8644
6 changed files with 94 additions and 110 deletions
-38
View File
@@ -1959,44 +1959,6 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
return hres;
}
/***********************************************************************
* 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.@)
*/
@@ -65,7 +65,6 @@ extern HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, LPVOID *p
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;
+43 -7
View File
@@ -53,6 +53,8 @@ struct _IAVIEditStreamImpl {
LPBITMAPINFOHEADER lpFrame; /* frame of pCurStream */
};
static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *stream);
static inline IAVIEditStreamImpl *impl_from_IAVIEditStream(IAVIEditStream *iface)
{
return CONTAINING_RECORD(iface, IAVIEditStreamImpl, IAVIEditStream_iface);
@@ -381,15 +383,15 @@ static HRESULT WINAPI IAVIEditStream_fnCopy(IAVIEditStream*iface,LONG*plStart,
*(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 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
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 @@ static HRESULT WINAPI IAVIEditStream_fnSetInfo(IAVIEditStream*iface,
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 @@ static const struct IAVIStreamVtbl ieditstast = {
IEditAVIStream_fnSetInfo
};
PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream)
static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream)
{
IAVIEditStreamImpl *pedit = NULL;
@@ -1002,5 +1004,39 @@ PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream)
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;
}
+49 -62
View File
@@ -25,27 +25,11 @@ HMODULE AVIFILE_hModule = NULL;
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 @@ static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
static HRESULT AVIFILE_CreateClassFactory(const CLSID *pclsid, const IID *riid,
LPVOID *ppv)
static HRESULT WINAPI IClassFactory_fnQueryInterface(IClassFactory *iface, REFIID riid,
void **ppobj)
{
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);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppobj);
if ((IsEqualGUID(&IID_IUnknown, riid)) ||
(IsEqualGUID(&IID_IClassFactory, riid))) {
@@ -93,31 +52,30 @@ static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,
return E_NOINTERFACE;
}
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
static ULONG WINAPI IClassFactory_fnAddRef(IClassFactory *iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)\n", iface);
return ++(This->dwRef);
TRACE("(%p) ref = %u\n", This, ref);
return ref;
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)\n", iface);
if ((--(This->dwRef)) > 0)
return This->dwRef;
TRACE("(%p) ref = %u\n", This, ref);
HeapFree(GetProcessHeap(), 0, This);
if(!ref)
HeapFree(GetProcessHeap(), 0, This);
return 0;
return ref;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,
LPUNKNOWN pOuter,
REFIID riid,LPVOID *ppobj)
static HRESULT WINAPI IClassFactory_fnCreateInstance(IClassFactory *iface, IUnknown *pOuter,
REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
@@ -147,7 +105,7 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,
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);
@@ -156,6 +114,35 @@ static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL doloc
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)
{
#define SLASH(w) ((w) == '/' || (w) == '\\')
+1 -1
View File
@@ -260,5 +260,5 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
}
}
return (PAVIFILE)tmpFile;
return &tmpFile->IAVIFile_iface;
}
+1 -1
View File
@@ -48,7 +48,7 @@ reactos/dll/win32/advpack # Synced to WineStaging-1.9.11
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