[vlc-devel] [PATCH 2/7] qt: add API to detach video surface in the Compositor

Pierre Lamot pierre at videolabs.io
Mon Aug 17 09:15:05 CEST 2020


On 2020-08-17 08:57, Steve Lhomme wrote:
> On 2020-08-14 18:49, Pierre Lamot wrote:
>> ---
>>   modules/gui/qt/Makefile.am                    |  1 +
>>   modules/gui/qt/maininterface/compositor.hpp   | 29 
>> ++++++++++++++++++-
>>   .../gui/qt/maininterface/compositor_dcomp.cpp | 17 +++++++++++
>>   .../gui/qt/maininterface/compositor_dcomp.hpp |  6 +++-
>>   .../gui/qt/maininterface/compositor_dummy.cpp | 19 +++++++++++-
>>   .../gui/qt/maininterface/compositor_dummy.hpp |  6 +++-
>>   6 files changed, 74 insertions(+), 4 deletions(-)
>> 
>> diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
>> index 35f0d34f5e..86add9398b 100644
>> --- a/modules/gui/qt/Makefile.am
>> +++ b/modules/gui/qt/Makefile.am
>> @@ -291,6 +291,7 @@ nodist_libqt_plugin_la_SOURCES = \
>>   	gui/qt/dialogs/sout/sout.moc.cpp \
>>   	gui/qt/dialogs/sout/sout_widgets.moc.cpp \
>>   	gui/qt/dialogs/toolbar/toolbareditor.moc.cpp \
>> +	gui/qt/maininterface/compositor.moc.cpp \
>>   	gui/qt/maininterface/compositor_dummy.moc.cpp \
>>   	gui/qt/maininterface/interface_window_handler.moc.cpp \
>>   	gui/qt/maininterface/main_interface.moc.cpp \
>> diff --git a/modules/gui/qt/maininterface/compositor.hpp 
>> b/modules/gui/qt/maininterface/compositor.hpp
>> index aef4e11a32..d5f2494fdd 100644
>> --- a/modules/gui/qt/maininterface/compositor.hpp
>> +++ b/modules/gui/qt/maininterface/compositor.hpp
>> @@ -32,8 +32,21 @@ class MainInterface;
>>     namespace vlc {
>>   -class Compositor {
>> +class Compositor : public QObject {
>> +    Q_OBJECT
>>   public:
>> +    enum VideoSurfaceTarget {
>> +        UNDEF       = 0x0, //video not embed
> 
> This doesn't seem like a good name for that.

OK

> 
>> +        EMBED       = 0x1, //embed in the main interface
>> +        WINDOWED    = 0x2, //in a separate window
>> +        FULLSCREEN  = 0x4, //in a fullscreen window (this is 
>> diffenrent than setting the main window fullscreen)
> 
> *different
> 
>> +    };
>> +    Q_ENUM(VideoSurfaceTarget)
>> +
>> +
>> +    inline Compositor(QObject* parent)
>> +        : QObject(parent)
>> +    {}
>>         virtual ~Compositor() = default;
>>   @@ -42,8 +55,22 @@ public:
>>         virtual bool setupVoutWindow(vout_window_t *p_wnd) = 0;
>>   +    /**
>> +     * @brief setVideoSurface move the video to a different surface
>> +     * @param target the destination (embed, windowed, ...)
>> +     * @param targetParam dependent on @a target
>> +     */
>> +    virtual void setVideoSurface(VideoSurfaceTarget target, QVariant 
>> targetParam = QVariant()) = 0;
>> +    virtual VideoSurfaceTarget getVideoSurface(QVariant* param = 
>> nullptr) = 0;
>> +
>> +    /// returns a bitmask of supported video surface target modes
>> +    virtual VideoSurfaceTarget getSupportedVideoSurfaceModes() const 
>> = 0;
>> +
>>       //factory
>>       static Compositor* createCompositor(intf_thread_t *p_intf);
>> +
>> +signals:
>> +    virtual void videoSurfaceChanged(VideoSurfaceTarget target, 
>> QVariant targetParam);
>>   };
>>     diff --git a/modules/gui/qt/maininterface/compositor_dcomp.cpp 
>> b/modules/gui/qt/maininterface/compositor_dcomp.cpp
>> index 27d4a9d026..1b0b3d6517 100644
>> --- a/modules/gui/qt/maininterface/compositor_dcomp.cpp
>> +++ b/modules/gui/qt/maininterface/compositor_dcomp.cpp
>> @@ -307,4 +307,21 @@ bool 
>> CompositorDirectComposition::setupVoutWindow(vout_window_t *p_wnd)
>>       return true;
>>   }
>>   +Compositor::VideoSurfaceTarget 
>> CompositorDirectComposition::getSupportedVideoSurfaceModes() const
>> +{
>> +    return VideoSurfaceTarget::UNDEF;
> 
> By default the video is not embeded ?

By default, the functionality is not provided. But we may consider that 
this is Embed for DComp and Windowed for dummy.

>> +}
>> +
>> +void CompositorDirectComposition::setVideoSurface(VideoSurfaceTarget 
>> target, QVariant targetParam)
>> +{
>> +    //N/A
>> +}
>> +
>> +Compositor::VideoSurfaceTarget 
>> CompositorDirectComposition::getVideoSurface(QVariant* param)
>> +{
>> +    if (param)
>> +        *param = QVariant();
>> +    return VideoSurfaceTarget::UNDEF;
>> +}
>> +
>>   }
>> diff --git a/modules/gui/qt/maininterface/compositor_dcomp.hpp 
>> b/modules/gui/qt/maininterface/compositor_dcomp.hpp
>> index 1c415daf2a..47ab504fb2 100644
>> --- a/modules/gui/qt/maininterface/compositor_dcomp.hpp
>> +++ b/modules/gui/qt/maininterface/compositor_dcomp.hpp
>> @@ -38,7 +38,7 @@ class MainInterface;
>>     namespace vlc {
>>   -class CompositorDirectComposition : public QObject, public 
>> Compositor
>> +class CompositorDirectComposition : public Compositor
>>   {
>>       Q_OBJECT
>>   public:
>> @@ -52,6 +52,10 @@ public:
>>         bool setupVoutWindow(vout_window_t *p_wnd) override;
>>   +    void setVideoSurface(VideoSurfaceTarget target, QVariant 
>> targetParam = QVariant()) override;
>> +    VideoSurfaceTarget getVideoSurface(QVariant* param = nullptr) 
>> override;
>> +    virtual VideoSurfaceTarget getSupportedVideoSurfaceModes() const 
>> override;
>> +
>>   private:
>>       static int window_enable(struct vout_window_t *, const 
>> vout_window_cfg_t *);
>>       static void window_disable(struct vout_window_t *);
>> diff --git a/modules/gui/qt/maininterface/compositor_dummy.cpp 
>> b/modules/gui/qt/maininterface/compositor_dummy.cpp
>> index 81e5d3f867..0f21b89a33 100644
>> --- a/modules/gui/qt/maininterface/compositor_dummy.cpp
>> +++ b/modules/gui/qt/maininterface/compositor_dummy.cpp
>> @@ -24,7 +24,7 @@
>>   namespace vlc {
>>     CompositorDummy::CompositorDummy(intf_thread_t *p_intf, QObject* 
>> parent)
>> -    : QObject(parent)
>> +    : Compositor(parent)
>>       , m_intf(p_intf)
>>   {
>>   }
>> @@ -55,6 +55,23 @@ void CompositorDummy::destroyMainInterface()
>>       }
>>   }
>>   +void CompositorDummy::setVideoSurface(VideoSurfaceTarget, QVariant)
>> +{
>> +    //N/A
>> +}
>> +
>> +Compositor::VideoSurfaceTarget 
>> CompositorDummy::getSupportedVideoSurfaceModes() const
>> +{
>> +    return VideoSurfaceTarget::UNDEF;
> 
> By default the video is not embeded ?
> 
>> +}
>> +
>> +Compositor::VideoSurfaceTarget 
>> CompositorDummy::getVideoSurface(QVariant* param)
>> +{
>> +    if (param)
>> +        *param = QVariant();
>> +    return VideoSurfaceTarget::UNDEF;
>> +}
>> +
>>   bool CompositorDummy::setupVoutWindow(vout_window_t*)
>>   {
>>       //dummy compositor doesn't handle window intergration
>> diff --git a/modules/gui/qt/maininterface/compositor_dummy.hpp 
>> b/modules/gui/qt/maininterface/compositor_dummy.hpp
>> index 51647d1ac0..39b033536c 100644
>> --- a/modules/gui/qt/maininterface/compositor_dummy.hpp
>> +++ b/modules/gui/qt/maininterface/compositor_dummy.hpp
>> @@ -29,7 +29,7 @@ class MainInterface;
>>     namespace vlc {
>>   -class CompositorDummy : public QObject, public Compositor
>> +class CompositorDummy : public Compositor
>>   {
>>       Q_OBJECT
>>   public:
>> @@ -39,6 +39,10 @@ public:
>>       virtual MainInterface *makeMainInterface() override;
>>       virtual void destroyMainInterface() override;
>>   +    virtual void setVideoSurface(VideoSurfaceTarget target, 
>> QVariant targetParam = QVariant()) override;
>> +    VideoSurfaceTarget getSupportedVideoSurfaceModes() const 
>> override;
>> +    VideoSurfaceTarget getVideoSurface(QVariant* param = nullptr) 
>> override;
>> +
>>       bool setupVoutWindow(vout_window_t *p_wnd) override;
>>     protected:
>> -- 2.25.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