evr/presenter: Add a helpe for input processing.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
603b00fe55
commit
e4ec280ec7
|
@ -40,6 +40,11 @@ enum presenter_state
|
||||||
PRESENTER_STATE_PAUSED,
|
PRESENTER_STATE_PAUSED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum presenter_flags
|
||||||
|
{
|
||||||
|
PRESENTER_MIXER_HAS_INPUT = 0x1,
|
||||||
|
};
|
||||||
|
|
||||||
enum streaming_thread_message
|
enum streaming_thread_message
|
||||||
{
|
{
|
||||||
EVRM_STOP = WM_USER,
|
EVRM_STOP = WM_USER,
|
||||||
|
@ -82,6 +87,7 @@ struct video_presenter
|
||||||
SIZE native_ratio;
|
SIZE native_ratio;
|
||||||
unsigned int ar_mode;
|
unsigned int ar_mode;
|
||||||
unsigned int state;
|
unsigned int state;
|
||||||
|
unsigned int flags;
|
||||||
CRITICAL_SECTION cs;
|
CRITICAL_SECTION cs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -311,6 +317,50 @@ static HRESULT video_presenter_end_streaming(struct video_presenter *presenter)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT video_presenter_process_input(struct video_presenter *presenter)
|
||||||
|
{
|
||||||
|
MFT_OUTPUT_DATA_BUFFER buffer;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
IMFSample *sample;
|
||||||
|
DWORD status;
|
||||||
|
|
||||||
|
if (!presenter->media_type)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
while (hr == S_OK)
|
||||||
|
{
|
||||||
|
if (!(presenter->flags & PRESENTER_MIXER_HAS_INPUT))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (FAILED(hr = IMFVideoSampleAllocator_AllocateSample(presenter->allocator, &sample)))
|
||||||
|
{
|
||||||
|
WARN("Failed to allocate a sample, hr %#x.\n", hr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&buffer, 0, sizeof(buffer));
|
||||||
|
buffer.pSample = sample;
|
||||||
|
|
||||||
|
if (FAILED(hr = IMFTransform_ProcessOutput(presenter->mixer, 0, 1, &buffer, &status)))
|
||||||
|
{
|
||||||
|
/* FIXME: failure path probably needs to handle some errors specifically */
|
||||||
|
presenter->flags &= ~PRESENTER_MIXER_HAS_INPUT;
|
||||||
|
IMFSample_Release(sample);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (buffer.pEvents)
|
||||||
|
IMFCollection_Release(buffer.pEvents);
|
||||||
|
|
||||||
|
/* FIXME: for now drop output sample back to the pool */
|
||||||
|
IMFSample_Release(sample);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
|
static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
|
||||||
{
|
{
|
||||||
struct video_presenter *presenter = impl_from_IUnknown(iface);
|
struct video_presenter *presenter = impl_from_IUnknown(iface);
|
||||||
|
@ -511,6 +561,10 @@ static HRESULT WINAPI video_presenter_ProcessMessage(IMFVideoPresenter *iface, M
|
||||||
case MFVP_MESSAGE_ENDSTREAMING:
|
case MFVP_MESSAGE_ENDSTREAMING:
|
||||||
hr = video_presenter_end_streaming(presenter);
|
hr = video_presenter_end_streaming(presenter);
|
||||||
break;
|
break;
|
||||||
|
case MFVP_MESSAGE_PROCESSINPUTNOTIFY:
|
||||||
|
presenter->flags |= PRESENTER_MIXER_HAS_INPUT;
|
||||||
|
hr = video_presenter_process_input(presenter);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("Unsupported message %u.\n", message);
|
FIXME("Unsupported message %u.\n", message);
|
||||||
hr = E_NOTIMPL;
|
hr = E_NOTIMPL;
|
||||||
|
|
Loading…
Reference in New Issue