Nikolay Sivov : dmime: Don't expose IDirectMusicAudioPath impl details.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Apr 28 09:10:39 CDT 2015
Module: wine
Branch: master
Commit: b3d1b1f239a5b534cd1b9a50fbfef32733b1911f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3d1b1f239a5b534cd1b9a50fbfef32733b1911f
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Apr 27 01:49:04 2015 +0300
dmime: Don't expose IDirectMusicAudioPath impl details.
---
dlls/dmime/audiopath.c | 38 ++++++++++++++++++++++++++++++++++++++
dlls/dmime/dmime_private.h | 25 +++----------------------
dlls/dmime/performance.c | 39 +++++++++++++++------------------------
3 files changed, 56 insertions(+), 46 deletions(-)
diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c
index 66e218c..bd789c2 100644
--- a/dlls/dmime/audiopath.c
+++ b/dlls/dmime/audiopath.c
@@ -22,6 +22,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
+struct IDirectMusicAudioPathImpl {
+ /* IUnknown fields */
+ const IUnknownVtbl *UnknownVtbl;
+ const IDirectMusicAudioPathVtbl *AudioPathVtbl;
+ const IDirectMusicObjectVtbl *ObjectVtbl;
+ const IPersistStreamVtbl *PersistStreamVtbl;
+ LONG ref;
+
+ /* IDirectMusicAudioPathImpl fields */
+ LPDMUS_OBJECTDESC pDesc;
+
+ IDirectMusicPerformance8* pPerf;
+ IDirectMusicGraph* pToolGraph;
+ IDirectSoundBuffer* pDSBuffer;
+ IDirectSoundBuffer* pPrimary;
+
+ BOOL fActive;
+};
+
+void set_audiopath_perf_pointer(IDirectMusicAudioPath *iface, IDirectMusicPerformance8 *performance)
+{
+ ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
+ This->pPerf = performance;
+}
+
+void set_audiopath_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
+{
+ ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
+ This->pDSBuffer = buffer;
+}
+
+void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath *iface, IDirectSoundBuffer *buffer)
+{
+ ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, AudioPathVtbl, iface);
+ This->pPrimary = buffer;
+}
+
/*****************************************************************************
* IDirectMusicAudioPathImpl implementation
*/
@@ -72,6 +109,7 @@ static ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface)
if (This->pDSBuffer) {
IDirectSoundBuffer8_Release(This->pDSBuffer);
}
+ This->pPerf = NULL;
HeapFree(GetProcessHeap(), 0, This);
}
diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h
index 35b51a2..fa44a4d 100644
--- a/dlls/dmime/dmime_private.h
+++ b/dlls/dmime/dmime_private.h
@@ -78,6 +78,9 @@ extern HRESULT WINAPI create_dmtempotrack(REFIID riid, void **ret_iface) DECLSPE
extern HRESULT WINAPI create_dmtimesigtrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
extern HRESULT WINAPI create_dmwavetrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
+extern void set_audiopath_perf_pointer(IDirectMusicAudioPath*,IDirectMusicPerformance8*) DECLSPEC_HIDDEN;
+extern void set_audiopath_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*) DECLSPEC_HIDDEN;
+extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*) DECLSPEC_HIDDEN;
/*****************************************************************************
* Auxiliary definitions
@@ -121,28 +124,6 @@ typedef struct DMUSIC_PRIVATE_PCHANNEL_ {
} DMUSIC_PRIVATE_PCHANNEL, *LPDMUSIC_PRIVATE_PCHANNEL;
/*****************************************************************************
- * IDirectMusicAudioPathImpl implementation structure
- */
-struct IDirectMusicAudioPathImpl {
- /* IUnknown fields */
- const IUnknownVtbl *UnknownVtbl;
- const IDirectMusicAudioPathVtbl *AudioPathVtbl;
- const IDirectMusicObjectVtbl *ObjectVtbl;
- const IPersistStreamVtbl *PersistStreamVtbl;
- LONG ref;
-
- /* IDirectMusicAudioPathImpl fields */
- LPDMUS_OBJECTDESC pDesc;
-
- IDirectMusicPerformance8* pPerf;
- IDirectMusicGraph* pToolGraph;
- IDirectSoundBuffer* pDSBuffer;
- IDirectSoundBuffer* pPrimary;
-
- BOOL fActive;
-};
-
-/*****************************************************************************
* IDirectMusicLyricsTrack implementation structure
*/
struct IDirectMusicLyricsTrack
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 25e86f9..b8c37b0 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -987,7 +987,6 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
IUnknown *pSourceConfig, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
- IDirectMusicAudioPathImpl *default_path;
IDirectMusicAudioPath *pPath;
FIXME("(%p, %p, %d, %p): stub\n", This, pSourceConfig, fActivate, ppNewPath);
@@ -997,8 +996,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
}
create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
- default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl));
- default_path->pPerf = &This->IDirectMusicPerformance8_iface;
+ set_audiopath_perf_pointer(pPath, iface);
/** TODO */
@@ -1011,11 +1009,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
- IDirectMusicAudioPathImpl *default_path;
IDirectMusicAudioPath *pPath;
DSBUFFERDESC desc;
WAVEFORMATEX format;
- LPDIRECTSOUNDBUFFER buffer;
+ IDirectSoundBuffer *buffer, *primary_buffer;
HRESULT hr = S_OK;
FIXME("(%p)->(%d, %d, %d, %p): semi-stub\n", This, dwType, dwPChannelCount, fActivate, ppNewPath);
@@ -1024,9 +1021,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
return E_POINTER;
}
- create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
- default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl));
- default_path->pPerf = &This->IDirectMusicPerformance8_iface;
+ *ppNewPath = NULL;
/* Secondary buffer description */
memset(&format, 0, sizeof(format));
@@ -1064,33 +1059,29 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
format.nAvgBytesPerSec *=2;
break;
default:
- HeapFree(GetProcessHeap(), 0, default_path);
- *ppNewPath = NULL;
return E_INVALIDARG;
}
/* FIXME: Should we create one secondary buffer for each PChannel? */
hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL);
- if (FAILED(hr)) {
- HeapFree(GetProcessHeap(), 0, default_path);
- *ppNewPath = NULL;
+ if (FAILED(hr))
return DSERR_BUFFERLOST;
- }
- default_path->pDSBuffer = buffer;
/* Update description for creating primary buffer */
desc.dwFlags |= DSBCAPS_PRIMARYBUFFER;
desc.dwBufferBytes = 0;
desc.lpwfxFormat = NULL;
- hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &buffer, NULL);
+ hr = IDirectSound8_CreateSoundBuffer ((LPDIRECTSOUND8) This->pDirectSound, &desc, &primary_buffer, NULL);
if (FAILED(hr)) {
- IDirectSoundBuffer_Release(default_path->pDSBuffer);
- HeapFree(GetProcessHeap(), 0, default_path);
- *ppNewPath = NULL;
+ IDirectSoundBuffer_Release(buffer);
return DSERR_BUFFERLOST;
}
- default_path->pPrimary = buffer;
+
+ create_dmaudiopath(&IID_IDirectMusicAudioPath, (void**)&pPath);
+ set_audiopath_perf_pointer(pPath, iface);
+ set_audiopath_dsound_buffer(pPath, buffer);
+ set_audiopath_primary_dsound_buffer(pPath, buffer);
*ppNewPath = pPath;
@@ -1105,15 +1096,15 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_SetDefaultAudioPath(IDirectMu
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
FIXME("(%p, %p): semi-stub\n", This, pAudioPath);
- if (NULL != This->pDefaultPath) {
+
+ if (This->pDefaultPath) {
IDirectMusicAudioPath_Release(This->pDefaultPath);
- ((IDirectMusicAudioPathImpl*) This->pDefaultPath)->pPerf = NULL;
This->pDefaultPath = NULL;
}
This->pDefaultPath = pAudioPath;
- if (NULL != This->pDefaultPath) {
+ if (This->pDefaultPath) {
IDirectMusicAudioPath_AddRef(This->pDefaultPath);
- ((IDirectMusicAudioPathImpl*)This->pDefaultPath)->pPerf = &This->IDirectMusicPerformance8_iface;
+ set_audiopath_perf_pointer(This->pDefaultPath, iface);
}
return S_OK;
More information about the wine-cvs
mailing list