[vlc-devel] [PATCH 1/6] vout_window: add rendering suspension/resuming callbacks

Steve Lhomme robux4 at ycbcr.xyz
Fri Feb 5 09:23:03 UTC 2021


On 2021-02-05 10:17, Thomas Guillem wrote:
> Hello,
> 
> Why not using vout_window_ReportState()? That use the following enum:
> 
> VOUT_WINDOW_STATE_ABOVE
> VOUT_WINDOW_STATE_BELOW
> 
> It doesn't seem to be used by any vout modules for now. And maybe the core implementation is not correct for you need.

Not sure what you mean by that. It's implementated in many window 
modules and used in the core when triggering "video-on-top".

> 
> On Fri, Feb 5, 2021, at 10:01, Alexandre Janniaux wrote:
>> Those callbacks are used by vout_window implementations in environment
>> where the rendering is constrained by the application state. The design
>> case for those events is iOS where application must not draw onto its
>> surface when they have been moved to the background, but it should be
>> generalizable to every cases where the window is in a state such as no
>> more rendering is needed for it.
>> ---
>>   include/vlc_vout_window.h | 33 +++++++++++++++++++++++++++++++++
>>   1 file changed, 33 insertions(+)
>>
>> diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
>> index ea16d4b414..b02c451794 100644
>> --- a/include/vlc_vout_window.h
>> +++ b/include/vlc_vout_window.h
>> @@ -289,6 +289,25 @@ struct vout_window_callbacks {
>>        */
>>       void (*output_event)(struct vout_window_t *,
>>                            const char *id, const char *desc);
>> +
>> +    /**
>> +     * Callback for window rendering suspension.
>> +     *
>> +     * This callback function (if non-NULL) signals that the window has been
>> +     * suspended and should not be used for rendering after the end of this
>> +     * function until the `resumed` event is submitted. Typicaly use case of
>> +     * this event is when the application has been moved to the background
>> +     * and should not draw anything.
>> +     */
>> +    void (*rendering_suspended)(struct vout_window_t *);
>> +
>> +    /**
>> +     * Callback for resuming window rendering.
>> +     *
>> +     * This callback function (if non-NULL) signals that the window has been
>> +     * resumed and can be rendered.
>> +     */
>> +    void (*rendering_resumed)(struct vout_window_t *);
>>   };
>>   
>>   /**
>> @@ -692,5 +711,19 @@ static inline void
>> vout_window_ReportOutputDevice(vout_window_t *window,
>>           window->owner.cbs->output_event(window, id, name);
>>   }
>>   
>> +static inline void
>> +vout_window_ReportRenderingSuspended(vout_window_t *window)
>> +{
>> +    if (window->owner.cbs->rendering_suspended != NULL)
>> +        window->owner.cbs->rendering_suspended(window);
>> +}
>> +
>> +static inline void
>> +vout_window_ReportRenderingResumed(vout_window_t *window)
>> +{
>> +    if (window->owner.cbs->rendering_resumed != NULL)
>> +        window->owner.cbs->rendering_resumed(window);
>> +}
>> +
>>   /** @} */
>>   #endif /* VLC_VOUT_WINDOW_H */
>> -- 
>> 2.28.0
>>
>> _______________________________________________
>> 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