Skip to content
Snippets Groups Projects
Select Git revision
  • 5aa17595d30c22ff781290c030ad7158ae9ae4e2
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/windowsReleaseTest
  • release/releaseTest
  • release/releaseWindowsTest
  • release/201910
  • release/qt/201910
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • 4.0.0
  • 2.2.0
  • 2.1.0
  • 2.0.1
  • 2.0.0
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.0
31 results

fileutils.cpp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    directrenderer.cpp 3.26 KiB
    /*
     *  Copyright (C) 2012-2023 Savoir-faire Linux Inc.
     *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
     *  Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
     *  Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
     *
     *  This library is free software; you can redistribute it and/or
     *  modify it under the terms of the GNU Lesser General Public
     *  License as published by the Free Software Foundation; either
     *  version 2.1 of the License, or (at your option) any later version.
     *
     *  This library is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     *  Lesser General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
    
    #include "directrenderer.h"
    
    #include "dbus/videomanager.h"
    #include "videomanager_interface.h"
    
    #include <QMutex>
    
    namespace lrc {
    namespace video {
    
    using namespace lrc::api::video;
    
    struct DirectRenderer::Impl : public QObject
    {
        Q_OBJECT
    public:
        Impl(DirectRenderer* parent)
            : QObject(nullptr)
            , parent_(parent)
        {
            configureTarget();
            if (!VideoManager::instance().registerSinkTarget(parent_->id(), target))
                qWarning() << "Cannot register " << parent_->id();
        };
        ~Impl()
        {
            parent_->stopRendering();
            VideoManager::instance().registerSinkTarget(parent_->id(), {});
        }
    
        // sink target callbacks
        void configureTarget()
        {
            using namespace std::placeholders;
            target.pull = std::bind(&Impl::pullCallback, this);
            target.push = std::bind(&Impl::pushCallback, this, _1);
        };
    
        libjami::FrameBuffer pullCallback()
        {
            QMutexLocker lk(&mutex);
            if (!frameBufferPtr) {
                frameBufferPtr.reset(av_frame_alloc());
            }
    
            // A response to this signal should be used to provide client
            // allocated buffer specs via the AVFrame structure.
            // Important: Subscription to this signal MUST be synchronous(Qt::DirectConnection).
            Q_EMIT parent_->frameBufferRequested(frameBufferPtr.get());