ReactOS  0.4.14-dev-98-gb0d4763
audiodata.c File Reference
#include "wine/debug.h"
#include "winbase.h"
#include "amstream_private.h"
Include dependency graph for audiodata.c:

Go to the source code of this file.

Classes

struct  AMAudioDataImpl
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (amstream)
 
static AMAudioDataImplimpl_from_IAudioData (IAudioData *iface)
 
static HRESULT WINAPI IAudioDataImpl_QueryInterface (IAudioData *iface, REFIID riid, void **ret_iface)
 
static ULONG WINAPI IAudioDataImpl_AddRef (IAudioData *iface)
 
static ULONG WINAPI IAudioDataImpl_Release (IAudioData *iface)
 
static HRESULT WINAPI IAudioDataImpl_SetBuffer (IAudioData *iface, DWORD size, BYTE *data, DWORD flags)
 
static HRESULT WINAPI IAudioDataImpl_GetInfo (IAudioData *iface, DWORD *length, BYTE **data, DWORD *actual_data)
 
static HRESULT WINAPI IAudioDataImpl_SetActual (IAudioData *iface, DWORD data_valid)
 
static HRESULT WINAPI IAudioDataImpl_GetFormat (IAudioData *iface, WAVEFORMATEX *wave_format_current)
 
static HRESULT WINAPI IAudioDataImpl_SetFormat (IAudioData *iface, const WAVEFORMATEX *wave_format)
 
HRESULT AMAudioData_create (IUnknown *pUnkOuter, LPVOID *ppObj)
 

Variables

typedef helpstring
 
static const struct IAudioDataVtbl AudioData_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file audiodata.c.

Function Documentation

◆ AMAudioData_create()

HRESULT AMAudioData_create ( IUnknown pUnkOuter,
LPVOID ppObj 
)

Definition at line 222 of file audiodata.c.

223 {
225 
226  TRACE("(%p,%p)\n", pUnkOuter, ppObj);
227 
228  if (pUnkOuter)
229  return CLASS_E_NOAGGREGATION;
230 
232  if (!object)
233  return E_OUTOFMEMORY;
234 
235  object->IAudioData_iface.lpVtbl = &AudioData_Vtbl;
236  object->ref = 1;
237 
238  object->wave_format.wFormatTag = WAVE_FORMAT_PCM;
239  object->wave_format.nChannels = 1;
240  object->wave_format.nSamplesPerSec = 11025;
241  object->wave_format.wBitsPerSample = 16;
242  object->wave_format.nBlockAlign = object->wave_format.wBitsPerSample * object->wave_format.nChannels / 8;
243  object->wave_format.nAvgBytesPerSec = object->wave_format.nBlockAlign * object->wave_format.nSamplesPerSec;
244 
245  *ppObj = &object->IAudioData_iface;
246 
247  return S_OK;
248 }
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const struct IAudioDataVtbl AudioData_Vtbl
Definition: audiodata.c:207
void * object
Definition: jmemsys.h:48

◆ IAudioDataImpl_AddRef()

static ULONG WINAPI IAudioDataImpl_AddRef ( IAudioData iface)
static

Definition at line 62 of file audiodata.c.

63 {
66 
67  TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
68 
69  return ref;
70 }
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IAudioDataImpl_GetFormat()

static HRESULT WINAPI IAudioDataImpl_GetFormat ( IAudioData iface,
WAVEFORMATEX wave_format_current 
)
static

Definition at line 170 of file audiodata.c.

171 {
173 
174  TRACE("(%p)->(%p)\n", iface, wave_format_current);
175 
176  if (!wave_format_current)
177  {
178  return E_POINTER;
179  }
180 
181  *wave_format_current = This->wave_format;
182 
183  return S_OK;
184 }
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ IAudioDataImpl_GetInfo()

static HRESULT WINAPI IAudioDataImpl_GetInfo ( IAudioData iface,
DWORD length,
BYTE **  data,
DWORD actual_data 
)
static

Definition at line 126 of file audiodata.c.

127 {
129 
130  TRACE("(%p)->(%p,%p,%p)\n", iface, length, data, actual_data);
131 
132  if (!This->data)
133  {
134  return MS_E_NOTINIT;
135  }
136 
137  if (length)
138  {
139  *length = This->size;
140  }
141  if (data)
142  {
143  *data = This->data;
144  }
145  if (actual_data)
146  {
147  *actual_data = This->actual_data;
148  }
149 
150  return S_OK;
151 }
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define S_OK
Definition: intsafe.h:59

◆ IAudioDataImpl_QueryInterface()

static HRESULT WINAPI IAudioDataImpl_QueryInterface ( IAudioData iface,
REFIID  riid,
void **  ret_iface 
)
static

Definition at line 46 of file audiodata.c.

47 {
48  TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
49 
50  if (IsEqualGUID(riid, &IID_IUnknown) ||
51  IsEqualGUID(riid, &IID_IAudioData))
52  {
53  IAudioData_AddRef(iface);
54  *ret_iface = iface;
55  return S_OK;
56  }
57 
58  ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
59  return E_NOINTERFACE;
60 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ IAudioDataImpl_Release()

static ULONG WINAPI IAudioDataImpl_Release ( IAudioData iface)
static

Definition at line 72 of file audiodata.c.

73 {
76 
77  TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
78 
79  if (!ref)
80  {
81  if (This->data_owned)
82  {
83  CoTaskMemFree(This->data);
84  }
85 
87  }
88 
89  return ref;
90 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ IAudioDataImpl_SetActual()

static HRESULT WINAPI IAudioDataImpl_SetActual ( IAudioData iface,
DWORD  data_valid 
)
static

Definition at line 153 of file audiodata.c.

154 {
156 
157  TRACE("(%p)->(%u)\n", iface, data_valid);
158 
159  if (data_valid > This->size)
160  {
161  return E_INVALIDARG;
162  }
163 
164  This->actual_data = data_valid;
165 
166  return S_OK;
167 }
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ IAudioDataImpl_SetBuffer()

static HRESULT WINAPI IAudioDataImpl_SetBuffer ( IAudioData iface,
DWORD  size,
BYTE data,
DWORD  flags 
)
static

Definition at line 93 of file audiodata.c.

94 {
96 
97  TRACE("(%p)->(%u,%p,%x)\n", iface, size, data, flags);
98 
99  if (!size)
100  {
101  return E_INVALIDARG;
102  }
103 
104  if (This->data_owned)
105  {
106  CoTaskMemFree(This->data);
107  This->data_owned = FALSE;
108  }
109 
110  This->size = size;
111  This->data = data;
112 
113  if (!This->data)
114  {
115  This->data = CoTaskMemAlloc(This->size);
116  This->data_owned = TRUE;
117  if (!This->data)
118  {
119  return E_OUTOFMEMORY;
120  }
121  }
122 
123  return S_OK;
124 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ IAudioDataImpl_SetFormat()

static HRESULT WINAPI IAudioDataImpl_SetFormat ( IAudioData iface,
const WAVEFORMATEX wave_format 
)
static

Definition at line 186 of file audiodata.c.

187 {
189 
190  TRACE("(%p)->(%p)\n", iface, wave_format);
191 
192  if (!wave_format)
193  {
194  return E_POINTER;
195  }
196 
197  if (WAVE_FORMAT_PCM != wave_format->wFormatTag)
198  {
199  return E_INVALIDARG;
200  }
201 
202  This->wave_format = *wave_format;
203 
204  return S_OK;
205 }
static AMAudioDataImpl * impl_from_IAudioData(IAudioData *iface)
Definition: audiodata.c:40
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ impl_from_IAudioData()

static AMAudioDataImpl* impl_from_IAudioData ( IAudioData iface)
inlinestatic

Definition at line 40 of file audiodata.c.

41 {
42  return CONTAINING_RECORD(iface, AMAudioDataImpl, IAudioData_iface);
43 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by IAudioDataImpl_AddRef(), IAudioDataImpl_GetFormat(), IAudioDataImpl_GetInfo(), IAudioDataImpl_Release(), IAudioDataImpl_SetActual(), IAudioDataImpl_SetBuffer(), and IAudioDataImpl_SetFormat().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( amstream  )

Variable Documentation

◆ AudioData_Vtbl

const struct IAudioDataVtbl AudioData_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IAudioDataImpl_GetFormat(IAudioData *iface, WAVEFORMATEX *wave_format_current)
Definition: audiodata.c:170
static HRESULT WINAPI IAudioDataImpl_QueryInterface(IAudioData *iface, REFIID riid, void **ret_iface)
Definition: audiodata.c:46
static HRESULT WINAPI IAudioDataImpl_SetActual(IAudioData *iface, DWORD data_valid)
Definition: audiodata.c:153
static ULONG WINAPI IAudioDataImpl_AddRef(IAudioData *iface)
Definition: audiodata.c:62
static HRESULT WINAPI IAudioDataImpl_SetBuffer(IAudioData *iface, DWORD size, BYTE *data, DWORD flags)
Definition: audiodata.c:93
static ULONG WINAPI IAudioDataImpl_Release(IAudioData *iface)
Definition: audiodata.c:72
static HRESULT WINAPI IAudioDataImpl_GetInfo(IAudioData *iface, DWORD *length, BYTE **data, DWORD *actual_data)
Definition: audiodata.c:126
static HRESULT WINAPI IAudioDataImpl_SetFormat(IAudioData *iface, const WAVEFORMATEX *wave_format)
Definition: audiodata.c:186

Definition at line 207 of file audiodata.c.

Referenced by AMAudioData_create().

◆ helpstring

typedef helpstring

Referenced by add_func_desc(), and get_func_flags().