File indexing completed on 2024-04-21 04:52:39

0001 /*
0002 SPDX-FileCopyrightText: 2014 Till Theato <root@ttill.de>
0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QString>
0009 #include <memory>
0010 
0011 namespace Mlt {
0012 class Repository;
0013 }
0014 
0015 /** @class MltConnection
0016     @brief Initializes MLT and provides access to its API.
0017     This is where the Mlt Factory is initialized, as well as the producers
0018  */
0019 class MltConnection
0020 {
0021 
0022 public:
0023     /** @brief Open connection to the MLT framework
0024      */
0025     static void construct(const QString &mltPath);
0026 
0027     /** @brief Returns a pointer to the MLT Repository*/
0028     std::unique_ptr<Mlt::Repository> &getMltRepository();
0029 
0030     /** @brief Returns a pointer to the instance of the singleton */
0031     static std::unique_ptr<MltConnection> &self();
0032 
0033     /** @brief Updates the list of available Lumas
0034      */
0035     static void refreshLumas();
0036 
0037 protected:
0038     /** @brief Open connection to the MLT framework
0039         This constructor should be called only once
0040     */
0041     MltConnection(const QString &mltPath);
0042 
0043     /** @brief Locates the MLT environment.
0044      * @param mltPath (optional) path to MLT environment
0045      *
0046      * It tries to set the paths of the MLT profiles and renderer, using
0047      * mltPath, MLT_PREFIX, searching for the binary `melt`, or asking to the
0048      * user. It doesn't fill any list of profiles, while its name suggests so. */
0049     void locateMeltAndProfilesPath(const QString &mltPath = QString());
0050 
0051     static std::unique_ptr<MltConnection> m_self;
0052 
0053     /** @brief The MLT repository, useful for filter/producer requests */
0054     std::unique_ptr<Mlt::Repository> m_repository;
0055 };