File indexing completed on 2024-04-28 04:52:20
0001 /* 0002 SPDX-FileCopyrightText: 2023 Julius Künzel <jk.kdedev@smartlab.uber.space> 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include "bin/model/markerlistmodel.hpp" 0009 #include "doc/kdenlivedoc.h" 0010 #include "renderpresets/renderpresetmodel.hpp" 0011 0012 class RenderRequest 0013 { 0014 public: 0015 RenderRequest(); 0016 0017 struct RenderJob 0018 { 0019 QString playlistPath; 0020 QString outputPath; 0021 QString subtitlePath; 0022 }; 0023 0024 /** @brief Set frame range that should be rendered 0025 * @param in The in point in frames. -1 means project start. 0026 * @param out The out point in frames. -1 means project end. 0027 */ 0028 void setBounds(int in, int out); 0029 void setOutputFile(const QString &filename); 0030 void setPresetParams(const RenderPresetParams ¶ms); 0031 /** @brief Load render params from a profile name */ 0032 void loadPresetParams(const QString &profileName); 0033 void setDelayedRendering(bool enabled); 0034 void setProxyRendering(bool enabled); 0035 void setEmbedSubtitles(bool enabled); 0036 void setTwoPass(bool enabled); 0037 void setAudioFilePerTrack(bool enabled); 0038 void setGuideParams(std::weak_ptr<MarkerListModel> model, bool enableMultiExport, int filterCategory); 0039 void setOverlayData(const QString &data); 0040 0041 std::vector<RenderJob> process(); 0042 0043 QStringList errorMessages(); 0044 0045 static QStringList argsByJob(const RenderJob &job); 0046 0047 private: 0048 struct RenderSection 0049 { 0050 int in; 0051 int out; 0052 QString name; 0053 }; 0054 0055 QString m_overlayData; 0056 bool m_proxyRendering = false; 0057 RenderPresetParams m_presetParams; 0058 bool m_audioFilePerTrack = false; 0059 bool m_delayedRendering = false; 0060 QString m_outputFile; 0061 bool m_embedSubtitles = false; 0062 int m_boundingIn; 0063 int m_boundingOut; 0064 std::weak_ptr<MarkerListModel> m_guidesModel; 0065 bool m_guideMultiExport = false; 0066 int m_guideCategory = -1; /// category used as filter if @variable guideMultiExport is @value true 0067 bool m_twoPass = false; 0068 0069 QStringList m_errors; 0070 0071 void setDocGeneralParams(QDomDocument doc, int in, int out); 0072 void setDocTwoPassParams(int pass, QDomDocument &doc, const QString &outputFile); 0073 std::vector<RenderSection> getGuideSections(); 0074 static void prepareMultiAudioFiles(std::vector<RenderJob> &jobs, const QDomDocument &doc, const QString &playlistFile, const QString &targetFile, 0075 const QUuid &uuid); 0076 0077 static QString createEmptyTempFile(const QString &extension); 0078 0079 /** @brief Create a new empty playlist (*.mlt) file and @returns the filename of the created file. 0080 * This is different to @fn createEmptyTempFile since it also takes delayed rendering in to account 0081 * and hence might create a persistent file instead of a temp file. 0082 */ 0083 QString generatePlaylistFile(); 0084 0085 /** @brief Create Render jobs for a render section. 0086 * There might be multiple jobs for one section for each pass in case of 2pass or each audio track in case of multi audio track export 0087 * @param jobs the vector to which the jobs will be added 0088 */ 0089 void createRenderJobs(std::vector<RenderJob> &jobs, const QDomDocument &doc, const QString &playlistPath, QString outputPath, const QString &subtitlePath, 0090 const QUuid &uuid); 0091 0092 void addErrorMessage(const QString &error); 0093 };