[PATCH 1/3] amstream: Implement IMediaStreamFilter::GetDuration.

Zebediah Figura zfigura at codeweavers.com
Fri Jul 24 10:12:45 CDT 2020


Hello Myah,

On 7/24/20 1:23 AM, Myah Caron wrote:
> Signed-off-by: Myah Caron <qsniyg at protonmail.com>
> ---
>  dlls/amstream/filter.c         | 24 ++++++++++++++++++++++--
>  dlls/amstream/tests/amstream.c |  7 +++++++
>  2 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c
> index 0a06e78180..ef23edfae3 100644
> --- a/dlls/amstream/filter.c
> +++ b/dlls/amstream/filter.c
> @@ -773,9 +773,29 @@ static HRESULT WINAPI filter_seeking_SetTimeFormat(IMediaSeeking *iface, const G
> 
>  static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
>  {
> -    FIXME("iface %p, duration %p, stub!\n", iface, duration);
> +    struct filter *filter = impl_from_IMediaSeeking(iface);
> +    IMediaSeeking *seeking;
> +    HRESULT hr;
> 
> -    return E_NOTIMPL;
> +    TRACE("iface %p, duration %p\n", iface, duration);
> +
> +    EnterCriticalSection(&filter->cs);
> +
> +    seeking = get_seeking(filter->seekable_stream);
> +
> +    if (!seeking)
> +    {
> +        LeaveCriticalSection(&filter->cs);
> +        return E_NOTIMPL;
> +    }
> +
> +    hr = IMediaSeeking_GetDuration(seeking, duration);
> +
> +    IMediaSeeking_Release(seeking);
> +
> +    LeaveCriticalSection(&filter->cs);
> +
> +    return hr;
>  }
> 
>  static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 8adf9db934..50b2d5a761 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -4815,6 +4815,7 @@ static void test_mediastreamfilter_set_positions(void)
>      IAMMediaStream *stream2;
>      IAMMediaStream *stream3;
>      LONGLONG stop_position;
> +    LONGLONG duration;
>      IMediaSeeking *seeking;
>      IGraphBuilder *graph;
>      IPin *pin1;
> @@ -4905,6 +4906,12 @@ static void test_mediastreamfilter_set_positions(void)
>      ok(source3.stop_position == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n",
>              wine_dbgstr_longlong(source3.stop_position));
> 
> +    duration = 0xdeadbeefdeadbeefULL;
> +    hr = IMediaSeeking_GetDuration(seeking, &duration);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(duration == 0x8000000000000000ULL, "Got duration %s.\n",
> +            wine_dbgstr_longlong(duration));
> +
>      source2.set_positions_hr = E_FAIL;
>      source1.current_position = 0xdeadbeefdeadbeefULL;
>      source1.stop_position = 0xdeadbeefdeadbeefULL;

I'm not necessarily opposed to putting multiple seeking tests in one
function, but in that case the function probably shouldn't be called
"test_mediastreamfilter_set_positions" any more. And given the way
amstream tests have been arranged thus far, I think it would be probably
better to put these tests in a new, dedicated function.

I also think it would be nice to test the code path where no duration or
IMediaSeeking interface is available, much like we already do in the
SetPositions() test.

> --
> 2.27.0
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200724/94220919/attachment.sig>


More information about the wine-devel mailing list