[PATCH 3/5] winegstreamer: Set MF_PD_DURATION on source's presentation descriptor.

Zebediah Figura z.figura12 at gmail.com
Mon Nov 2 10:54:18 CST 2020


On 11/2/20 10:26 AM, Derek Lesho wrote:
> Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
> ---
>  dlls/winegstreamer/media_source.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
> index 41a738525ca..b7f3e6c2946 100644
> --- a/dlls/winegstreamer/media_source.c
> +++ b/dlls/winegstreamer/media_source.c
> @@ -1237,6 +1237,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
>  
>      struct media_source *object = heap_alloc_zero(sizeof(*object));
>      IMFStreamDescriptor **descriptors = NULL;
> +    gint64 total_pres_time = 0;
>      unsigned int i;
>      HRESULT hr;
>      int ret;
> @@ -1347,6 +1348,28 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
>      heap_free(descriptors);
>      descriptors = NULL;
>  
> +    for (unsigned int i = 0; i < object->stream_count; i++)

Misplaced initializer.

> +    {
> +        GstQuery *query = gst_query_new_duration(GST_FORMAT_TIME);
> +        if (gst_pad_query(object->streams[i]->their_src, query))
> +        {
> +            gint64 stream_pres_time;
> +            gst_query_parse_duration(query, NULL, &stream_pres_time);

There is a gst_pad_query_duration() helper for this.

> +
> +            TRACE("Stream %u has duration %llu\n", i, (unsigned long long int) stream_pres_time);
> +
> +            if (stream_pres_time > total_pres_time)
> +                total_pres_time = stream_pres_time;
> +        }
> +        else
> +        {
> +            WARN("Unable to get presentation time of stream %u\n", i);
> +        }
> +    }
> +
> +    if (object->stream_count)
> +        IMFPresentationDescriptor_SetUINT64(object->pres_desc, &MF_PD_DURATION, total_pres_time / 100);
> +
>      object->state = SOURCE_STOPPED;
>  
>      *out_media_source = object;
> 


-------------- 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/20201102/a94e71d0/attachment-0001.sig>


More information about the wine-devel mailing list