1 /* 2 SPDX-FileCopyrightText: 2017 Nicolas Carion 3 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 4 */ 5 6 #ifndef PROFILEMODEL_H 7 #define PROFILEMODEL_H 8 9 #include "profileinfo.hpp" 10 #include <QDomElement> 11 #include <QString> 12 #include <memory> 13 14 #include <mlt++/MltProfile.h> 15 16 /** @class ProfileModel 17 @brief This is a wrapper around Mlt::Profile to be used by the rest of kdenlive. 18 It has implicit conversion to Mlt::Profile so you can use it directly in calls to Mlt backend. 19 */ 20 class ProfileModel : public ProfileInfo 21 { 22 23 public: 24 ProfileModel() = delete; 25 26 /** @brief Constructs a profile using the path to the profile description 27 */ 28 ProfileModel(const QString &path); 29 ~ProfileModel() override = default; 30 31 bool is_valid() const override; 32 QString description() const override; 33 int frame_rate_num() const override; 34 int frame_rate_den() const override; 35 double fps() const override; 36 int width() const override; 37 int height() const override; 38 bool progressive() const override; 39 int sample_aspect_num() const override; 40 int sample_aspect_den() const override; 41 double sar() const override; 42 int display_aspect_num() const override; 43 int display_aspect_den() const override; 44 double dar() const override; 45 int is_explicit() const; 46 void set_explicit(int b); 47 int colorspace() const override; 48 mlt_profile get_profile() const; 49 QString path() const override; 50 adjustDimensions()51 void adjustDimensions() override{}; 52 53 /** @brief get underlying profile. Use with caution*/ profile()54 Mlt::Profile &profile() { return *m_profile.get(); }; 55 56 protected: 57 QString m_path; 58 bool m_invalid; 59 QString m_description; 60 61 std::unique_ptr<Mlt::Profile> m_profile; 62 }; 63 64 /** @class ProfileParam 65 @brief This class serves to describe the parameters of a profile 66 */ 67 class ProfileParam : public ProfileInfo 68 { 69 public: 70 ProfileParam() = delete; 71 72 ProfileParam(QDomElement element); 73 ProfileParam(ProfileInfo *p); 74 ProfileParam(Mlt::Profile *p); 75 ProfileParam(ProfileParam *p); 76 77 QString path() const override; 78 QString description() const override; 79 int frame_rate_num() const override; 80 int frame_rate_den() const override; 81 int width() const override; 82 int height() const override; 83 bool progressive() const override; 84 int sample_aspect_num() const override; 85 int sample_aspect_den() const override; 86 int display_aspect_num() const override; 87 int display_aspect_den() const override; 88 int colorspace() const override; 89 double fps() const override; 90 double sar() const override; 91 double dar() const override; 92 93 // A profile's width should always be a multiple of 8 94 void adjustDimensions() override; 95 bool is_valid() const override; 96 97 QString m_path; 98 QString m_description; 99 int m_frame_rate_num; 100 int m_frame_rate_den; 101 int m_width; 102 int m_height; 103 bool m_progressive; 104 int m_sample_aspect_num; 105 int m_sample_aspect_den; 106 int m_display_aspect_num; 107 int m_display_aspect_den; 108 int m_colorspace; 109 double m_fps; 110 double m_sar; 111 double m_dar; 112 }; 113 114 #endif 115