Commit 71da6a71 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Create wg_sample from IMFSample within wg_transform_push_mf.

parent 77a4b4b4
......@@ -544,19 +544,13 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
{
struct color_convert *impl = impl_from_IMFTransform(iface);
struct wg_sample *wg_sample;
HRESULT hr;
TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags);
if (!impl->wg_transform)
return MF_E_TRANSFORM_TYPE_NOT_SET;
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
return wg_transform_push_mf(impl->wg_transform, wg_sample,
impl->wg_sample_queue);
return wg_transform_push_mf(impl->wg_transform, sample, impl->wg_sample_queue);
}
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
......
......@@ -130,7 +130,7 @@ HRESULT wg_sample_create_mf(IMFSample *sample, struct wg_sample **out);
HRESULT wg_sample_create_quartz(IMediaSample *sample, struct wg_sample **out);
void wg_sample_release(struct wg_sample *wg_sample);
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *sample,
HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
struct wg_sample_queue *queue);
HRESULT wg_transform_push_quartz(struct wg_transform *transform, struct wg_sample *sample,
struct wg_sample_queue *queue);
......
......@@ -585,18 +585,13 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
{
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
struct wg_sample *wg_sample;
HRESULT hr;
TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags);
if (!decoder->wg_transform)
return MF_E_TRANSFORM_TYPE_NOT_SET;
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
return wg_transform_push_mf(decoder->wg_transform, wg_sample, decoder->wg_sample_queue);
return wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue);
}
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
......
......@@ -513,19 +513,13 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
{
struct resampler *impl = impl_from_IMFTransform(iface);
struct wg_sample *wg_sample;
HRESULT hr;
TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags);
if (!impl->wg_transform)
return MF_E_TRANSFORM_TYPE_NOT_SET;
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
return wg_transform_push_mf(impl->wg_transform, wg_sample,
impl->wg_sample_queue);
return wg_transform_push_mf(impl->wg_transform, sample, impl->wg_sample_queue);
}
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
......
......@@ -521,19 +521,13 @@ static HRESULT WINAPI video_processor_ProcessMessage(IMFTransform *iface, MFT_ME
static HRESULT WINAPI video_processor_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
{
struct video_processor *impl = impl_from_IMFTransform(iface);
struct wg_sample *wg_sample;
HRESULT hr;
TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags);
if (!impl->wg_transform)
return MF_E_TRANSFORM_TYPE_NOT_SET;
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
return wg_transform_push_mf(impl->wg_transform, wg_sample,
impl->wg_sample_queue);
return wg_transform_push_mf(impl->wg_transform, sample, impl->wg_sample_queue);
}
static HRESULT WINAPI video_processor_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
......
......@@ -252,28 +252,31 @@ HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
HRESULT wg_transform_push_mf(struct wg_transform *transform, IMFSample *sample,
struct wg_sample_queue *queue)
{
struct sample *sample = unsafe_mf_from_wg_sample(wg_sample);
struct wg_sample *wg_sample;
LONGLONG time, duration;
UINT32 value;
HRESULT hr;
TRACE_(mfplat)("transform %p, wg_sample %p, queue %p.\n", transform, wg_sample, queue);
TRACE_(mfplat)("transform %p, sample %p, queue %p.\n", transform, sample, queue);
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
if (SUCCEEDED(IMFSample_GetSampleTime(sample->u.mf.sample, &time)))
if (SUCCEEDED(IMFSample_GetSampleTime(sample, &time)))
{
sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
sample->wg_sample.pts = time;
wg_sample->flags |= WG_SAMPLE_FLAG_HAS_PTS;
wg_sample->pts = time;
}
if (SUCCEEDED(IMFSample_GetSampleDuration(sample->u.mf.sample, &duration)))
if (SUCCEEDED(IMFSample_GetSampleDuration(sample, &duration)))
{
sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
sample->wg_sample.duration = duration;
wg_sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
wg_sample->duration = duration;
}
if (SUCCEEDED(IMFSample_GetUINT32(sample->u.mf.sample, &MFSampleExtension_CleanPoint, &value)) && value)
sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
if (SUCCEEDED(IMFSample_GetUINT32(sample, &MFSampleExtension_CleanPoint, &value)) && value)
wg_sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
wg_sample_queue_begin_append(queue, wg_sample);
hr = wg_transform_push_data(transform, wg_sample);
......
......@@ -529,7 +529,6 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
{
struct wma_decoder *decoder = impl_from_IMFTransform(iface);
struct wg_sample *wg_sample;
MFT_INPUT_STREAM_INFO info;
DWORD total_length;
HRESULT hr;
......@@ -547,10 +546,7 @@ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFS
if (total_length % info.cbSize)
return S_OK;
if (FAILED(hr = wg_sample_create_mf(sample, &wg_sample)))
return hr;
return wg_transform_push_mf(decoder->wg_transform, wg_sample, decoder->wg_sample_queue);
return wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue);
}
static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
......
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