Commit 76235640 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfsrcsnk/wave: Store media format structure.

parent bfdf5c77
MODULE = mfsrcsnk.dll MODULE = mfsrcsnk.dll
IMPORTLIB = mfsrcsnk IMPORTLIB = mfsrcsnk
IMPORTS = mfplat mfuuid uuid IMPORTS = ole32 mfplat mfuuid uuid
EXTRADLLFLAGS = -Wb,--prefer-native EXTRADLLFLAGS = -Wb,--prefer-native
......
...@@ -64,6 +64,7 @@ struct wave_sink ...@@ -64,6 +64,7 @@ struct wave_sink
IMFMediaEventQueue *stream_event_queue; IMFMediaEventQueue *stream_event_queue;
IMFPresentationClock *clock; IMFPresentationClock *clock;
WAVEFORMATEX *fmt;
IMFByteStream *bytestream; IMFByteStream *bytestream;
unsigned int flags; unsigned int flags;
...@@ -144,6 +145,7 @@ static ULONG WINAPI wave_sink_Release(IMFFinalizableMediaSink *iface) ...@@ -144,6 +145,7 @@ static ULONG WINAPI wave_sink_Release(IMFFinalizableMediaSink *iface)
if (sink->stream_event_queue) if (sink->stream_event_queue)
IMFMediaEventQueue_Release(sink->stream_event_queue); IMFMediaEventQueue_Release(sink->stream_event_queue);
IMFByteStream_Release(sink->bytestream); IMFByteStream_Release(sink->bytestream);
CoTaskMemFree(sink->fmt);
DeleteCriticalSection(&sink->cs); DeleteCriticalSection(&sink->cs);
free(sink); free(sink);
} }
...@@ -679,6 +681,7 @@ HRESULT WINAPI MFCreateWAVEMediaSink(IMFByteStream *bytestream, IMFMediaType *me ...@@ -679,6 +681,7 @@ HRESULT WINAPI MFCreateWAVEMediaSink(IMFByteStream *bytestream, IMFMediaType *me
{ {
struct wave_sink *object; struct wave_sink *object;
DWORD flags = 0; DWORD flags = 0;
UINT32 size;
HRESULT hr; HRESULT hr;
TRACE("%p, %p, %p.\n", bytestream, media_type, sink); TRACE("%p, %p, %p.\n", bytestream, media_type, sink);
...@@ -689,11 +692,17 @@ HRESULT WINAPI MFCreateWAVEMediaSink(IMFByteStream *bytestream, IMFMediaType *me ...@@ -689,11 +692,17 @@ HRESULT WINAPI MFCreateWAVEMediaSink(IMFByteStream *bytestream, IMFMediaType *me
if (FAILED(hr = IMFByteStream_GetCapabilities(bytestream, &flags))) return hr; if (FAILED(hr = IMFByteStream_GetCapabilities(bytestream, &flags))) return hr;
if (!(flags & MFBYTESTREAM_IS_WRITABLE)) return E_INVALIDARG; if (!(flags & MFBYTESTREAM_IS_WRITABLE)) return E_INVALIDARG;
/* FIXME: do basic media type validation */
if (!(object = calloc(1, sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
/* FIXME: do basic media type validation */
if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(media_type, &object->fmt, &size, 0)))
{
WARN("Failed to produce WAVEFORMATEX representation, hr %#lx.\n", hr);
goto failed;
}
object->IMFFinalizableMediaSink_iface.lpVtbl = &wave_sink_vtbl; object->IMFFinalizableMediaSink_iface.lpVtbl = &wave_sink_vtbl;
object->IMFMediaEventGenerator_iface.lpVtbl = &wave_sink_events_vtbl; object->IMFMediaEventGenerator_iface.lpVtbl = &wave_sink_events_vtbl;
object->IMFStreamSink_iface.lpVtbl = &wave_stream_sink_vtbl; object->IMFStreamSink_iface.lpVtbl = &wave_stream_sink_vtbl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment