amstream: Store parent as struct audio_stream in audio stream sample.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Baskanov 2020-04-22 02:30:06 +07:00 committed by Alexandre Julliard
parent 18502ed9c6
commit e7f0917665
1 changed files with 25 additions and 25 deletions

View File

@ -27,10 +27,31 @@ WINE_DEFAULT_DEBUG_CHANNEL(amstream);
static const WCHAR sink_id[] = L"I{A35FF56B-9FDA-11D0-8FDF-00C04FD9189D}"; static const WCHAR sink_id[] = L"I{A35FF56B-9FDA-11D0-8FDF-00C04FD9189D}";
struct audio_stream
{
IAMMediaStream IAMMediaStream_iface;
IAudioMediaStream IAudioMediaStream_iface;
IMemInputPin IMemInputPin_iface;
IPin IPin_iface;
LONG ref;
IMultiMediaStream* parent;
MSPID purpose_id;
STREAM_TYPE stream_type;
CRITICAL_SECTION cs;
IMediaStreamFilter *filter;
IPin *peer;
IMemAllocator *allocator;
AM_MEDIA_TYPE mt;
WAVEFORMATEX format;
FILTER_STATE state;
};
typedef struct { typedef struct {
IAudioStreamSample IAudioStreamSample_iface; IAudioStreamSample IAudioStreamSample_iface;
LONG ref; LONG ref;
IMediaStream *parent; struct audio_stream *parent;
IAudioData *audio_data; IAudioData *audio_data;
} IAudioStreamSampleImpl; } IAudioStreamSampleImpl;
@ -146,7 +167,7 @@ static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
IAudioStreamSampleImpl_GetAudioData IAudioStreamSampleImpl_GetAudioData
}; };
static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample) static HRESULT audiostreamsample_create(struct audio_stream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample)
{ {
IAudioStreamSampleImpl *object; IAudioStreamSampleImpl *object;
@ -158,7 +179,7 @@ static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *a
object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl; object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
object->ref = 1; object->ref = 1;
object->parent = (IMediaStream*)parent; object->parent = parent;
object->audio_data = audio_data; object->audio_data = audio_data;
*audio_stream_sample = &object->IAudioStreamSample_iface; *audio_stream_sample = &object->IAudioStreamSample_iface;
@ -166,27 +187,6 @@ static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *a
return S_OK; return S_OK;
} }
struct audio_stream
{
IAMMediaStream IAMMediaStream_iface;
IAudioMediaStream IAudioMediaStream_iface;
IMemInputPin IMemInputPin_iface;
IPin IPin_iface;
LONG ref;
IMultiMediaStream* parent;
MSPID purpose_id;
STREAM_TYPE stream_type;
CRITICAL_SECTION cs;
IMediaStreamFilter *filter;
IPin *peer;
IMemAllocator *allocator;
AM_MEDIA_TYPE mt;
WAVEFORMATEX format;
FILTER_STATE state;
};
static inline struct audio_stream *impl_from_IAMMediaStream(IAMMediaStream *iface) static inline struct audio_stream *impl_from_IAMMediaStream(IAMMediaStream *iface)
{ {
return CONTAINING_RECORD(iface, struct audio_stream, IAMMediaStream_iface); return CONTAINING_RECORD(iface, struct audio_stream, IAMMediaStream_iface);
@ -565,7 +565,7 @@ static HRESULT WINAPI audio_IAudioMediaStream_CreateSample(IAudioMediaStream *if
if (!audio_data) if (!audio_data)
return E_POINTER; return E_POINTER;
return audiostreamsample_create(iface, audio_data, sample); return audiostreamsample_create(This, audio_data, sample);
} }
static const struct IAudioMediaStreamVtbl audio_IAudioMediaStream_vtbl = static const struct IAudioMediaStreamVtbl audio_IAudioMediaStream_vtbl =