[vlc-devel] [PATCH 14/39] input: resource: split input_resource_GetVout()

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 7 10:33:51 CEST 2019


On 2019-10-06 21:04, Alexandre Janniaux wrote:
> Hi,
> 
> Should we really expose a GetDisplay in input_resource?
> Not that I don't see any use for it, but previously it was
> hidden behind the vout_thread, and it doesn't actually get
> something. Maybe this could be renamed into a
> `input_resource_ReconfigureVout` or something like this if
> it would be used to recreate the display ?

Indeed, the Display name makes sense in the past where the display still 
provides the rendering buffers. But that's about to change.

input_resource_ReconfigureVout() sounds right.

> If I follow the tracks correctly for the future, it means that:
> 
> + we create the vout_thread within the input ressource
> + the vout_window is created together with vout_thread through
>    vout_Create (no vout_RequestWindow ?)

For each vout created (but there's one cached in input resources) 
there's a vout_display_window_New() done.

> + we request the decoder device in the input resources which
>    calls vout_GetDevice
> + we configure the rest of the pipeline (decoder, etc)
> + when pictures are ready, we will (re)configure the Display with
>    this added function.
> 
> Is it correct ?

Yes, it's missing the video context pushed from the decoder to the 
filters to the display.

> Regards,
> --
> Alexandre Janniaux
> Videolabs
> 
> On Wed, Oct 02, 2019 at 04:23:29PM +0200, Steve Lhomme wrote:
>> So we can create the display separately, when the video context will be created.
>>
>> The first call creates/gets the vout and the decoder device. The other call
>> creates/gets the display module.
>> ---
>>   src/input/decoder.c  | 52 +++++++++++++++++++++++++-------------------
>>   src/input/resource.c | 23 ++++++++++++++------
>>   src/input/resource.h |  1 +
>>   3 files changed, 47 insertions(+), 29 deletions(-)
>>
>> diff --git a/src/input/decoder.c b/src/input/decoder.c
>> index af6633edd2a..4e39acbcbe6 100644
>> --- a/src/input/decoder.c
>> +++ b/src/input/decoder.c
>> @@ -527,36 +527,44 @@ static int CreateVoutIfNeeded(struct decoder_owner *p_owner)
>>       p_owner->p_vout = NULL; // the DecoderThread should not use the old vout anymore
>>       vlc_mutex_unlock( &p_owner->lock );
>>
>> -    unsigned dpb_size;
>> -    switch( p_dec->fmt_in.i_codec )
>> -    {
>> -    case VLC_CODEC_HEVC:
>> -    case VLC_CODEC_H264:
>> -    case VLC_CODEC_DIRAC: /* FIXME valid ? */
>> -        dpb_size = 18;
>> -        break;
>> -    case VLC_CODEC_AV1:
>> -        dpb_size = 10;
>> -        break;
>> -    case VLC_CODEC_VP5:
>> -    case VLC_CODEC_VP6:
>> -    case VLC_CODEC_VP6F:
>> -    case VLC_CODEC_VP8:
>> -        dpb_size = 3;
>> -        break;
>> -    default:
>> -        dpb_size = 2;
>> -        break;
>> -    }
>>       enum vlc_vout_order order;
>>       vout_configuration_t cfg = {
>>           .vout = p_vout, .clock = p_owner->p_clock, .fmt = &fmt,
>> -        .dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1,
>>           .mouse_event = MouseEvent, .mouse_opaque = p_dec
>>       };
>>       vlc_decoder_device *dec_dev = NULL;
>>       p_vout = input_resource_GetVoutDecoderDevice( p_owner->p_resource,
>>                                       &cfg, &order, &dec_dev );
>> +    if (p_vout)
>> +    {
>> +        unsigned dpb_size;
>> +        switch( p_dec->fmt_in.i_codec )
>> +        {
>> +        case VLC_CODEC_HEVC:
>> +        case VLC_CODEC_H264:
>> +        case VLC_CODEC_DIRAC: /* FIXME valid ? */
>> +            dpb_size = 18;
>> +            break;
>> +        case VLC_CODEC_AV1:
>> +            dpb_size = 10;
>> +            break;
>> +        case VLC_CODEC_VP5:
>> +        case VLC_CODEC_VP6:
>> +        case VLC_CODEC_VP6F:
>> +        case VLC_CODEC_VP8:
>> +            dpb_size = 3;
>> +            break;
>> +        default:
>> +            dpb_size = 2;
>> +            break;
>> +        }
>> +        cfg.dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1;
>> +        cfg.vout = p_vout;
>> +        if (input_resource_GetDisplay( p_owner->p_resource, dec_dev, &cfg) != 0)
>> +        {
>> +            p_vout = NULL;
>> +        }
>> +    }
>>       if (p_vout)
>>           decoder_Notify(p_owner, on_vout_added, p_vout, order);
>>
>> diff --git a/src/input/resource.c b/src/input/resource.c
>> index 71cbbda2f6c..704964df5d0 100644
>> --- a/src/input/resource.c
>> +++ b/src/input/resource.c
>> @@ -431,14 +431,25 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
>>           *pp_dec_dev = vout_GetDevice(cfg);
>>       }
>>
>> -    if (vout_Request(cfg, pp_dec_dev ? *pp_dec_dev : NULL, p_resource->p_input)) {
>> +    vout = cfg->vout;
>> +
>> +out:
>> +    vlc_mutex_unlock( &p_resource->lock );
>> +    return vout;
>> +}
>> +
>> +int input_resource_GetDisplay(input_resource_t *p_resource,
>> +                              vlc_decoder_device *dec_dev,
>> +                              const vout_configuration_t *cfg)
>> +{
>> +    vlc_mutex_lock( &p_resource->lock );
>> +    if (vout_Request(cfg, dec_dev, p_resource->p_input)) {
>>           input_resource_PutVoutLocked(p_resource, cfg->vout, false);
>>           vlc_mutex_unlock(&p_resource->lock);
>> -        return NULL;
>> +        return -1;
>>       }
>>
>> -    vout = cfg->vout;
>> -    DisplayVoutTitle(p_resource, vout);
>> +    DisplayVoutTitle(p_resource, cfg->vout);
>>
>>       /* Send original viewpoint to the input in order to update other ESes */
>>       if (p_resource->p_input != NULL)
>> @@ -447,10 +458,8 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
>>           input_ControlPush(p_resource->p_input, INPUT_CONTROL_SET_INITIAL_VIEWPOINT,
>>                             &param);
>>       }
>> -
>> -out:
>>       vlc_mutex_unlock( &p_resource->lock );
>> -    return vout;
>> +    return 0;
>>   }
>>
>>   vout_thread_t *input_resource_HoldVout( input_resource_t *p_resource )
>> diff --git a/src/input/resource.h b/src/input/resource.h
>> index 537033c9d7c..baa78dea5cc 100644
>> --- a/src/input/resource.h
>> +++ b/src/input/resource.h
>> @@ -41,6 +41,7 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *,
>>                                         const vout_configuration_t *,
>>                                         enum vlc_vout_order *order,
>>                                         vlc_decoder_device **);
>> +int input_resource_GetDisplay(input_resource_t *, vlc_decoder_device *, const vout_configuration_t *);
>>   void input_resource_PutVout(input_resource_t *, vout_thread_t *);
>>
>>   /**
>> --
>> 2.17.1
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list