File indexing completed on 2025-01-19 04:29:46
0001 /* 0002 SPDX-FileCopyrightText: 2017 Nicolas Carion 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include "assets/abstractassetsrepository.hpp" 0009 #include "assets/model/assetparametermodel.hpp" 0010 #include "definitions.h" 0011 #include <memory> 0012 #include <mutex> 0013 0014 /** @class TransitionsRepository 0015 @brief This class stores all the transitions that can be added by the user. 0016 You can query any transitions based on its name. 0017 Note that this class is a Singleton 0018 */ 0019 class TransitionsRepository : public AbstractAssetsRepository<AssetListType::AssetType> 0020 { 0021 0022 public: 0023 /** @brief Returns the instance of the Singleton */ 0024 static std::unique_ptr<TransitionsRepository> &get(); 0025 0026 /** @brief Creates and return an instance of a transition given its id. 0027 */ 0028 std::unique_ptr<Mlt::Transition> getTransition(const QString &transitionId) const; 0029 0030 /** @brief returns true if the transition corresponding to \@transitionId is a composition*/ 0031 bool isComposition(const QString &transitionId) const; 0032 0033 /** @brief returns true if the transition corresponding to \@transitionId is audio*/ 0034 bool isAudio(const QString &transitionId) const; 0035 0036 /** @brief Returns the id of the transition to be used for compositing */ 0037 const QString getCompositingTransition(); 0038 0039 protected: 0040 // Constructor is protected because class is a Singleton 0041 TransitionsRepository(); 0042 0043 /** @brief Retrieves the list of all available effects from Mlt*/ 0044 Mlt::Properties *retrieveListFromMlt() const override; 0045 0046 /** @brief Retrieves additional info about effects from a custom XML file 0047 The resulting assets are stored in customAssets 0048 */ 0049 void parseCustomAssetFile(const QString &file_name, std::unordered_map<QString, Info> &customAssets) const override; 0050 0051 /** @brief Returns the paths where the custom transitions' descriptions are stored */ 0052 QStringList assetDirs() const override; 0053 0054 /** @brief Returns the path to the transitions' blacklist*/ 0055 QString assetBlackListPath() const override; 0056 0057 /** @brief Returns the path to the effects' preferred list*/ 0058 QString assetPreferredListPath() const override; 0059 0060 void parseType(Mlt::Properties *metadata, Info &res) override; 0061 0062 /** @brief Returns the metadata associated with the given asset*/ 0063 Mlt::Properties *getMetadata(const QString &assetId) const override; 0064 0065 /** @brief Returns all transitions that can be represented as Single Track Transitions*/ 0066 static QSet<QString> getSingleTrackTransitions(); 0067 0068 static std::unique_ptr<TransitionsRepository> instance; 0069 static std::once_flag m_onceFlag; // flag to create the repository only once; 0070 };