File indexing completed on 2024-12-22 04:12:16

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef VIDEO_SAVER_H_
0008 #define VIDEO_SAVER_H_
0009 
0010 #include <QObject>
0011 
0012 #include "kis_types.h"
0013 
0014 #include <KisImportExportFilter.h>
0015 
0016 class KisDocument;
0017 class KisAnimationRenderingOptions;
0018 
0019 #include "kritaui_export.h"
0020 
0021 class KRITAUI_EXPORT KisAnimationVideoSaver : public QObject {
0022     Q_OBJECT
0023 public:
0024     /**
0025      * @brief KisAnimationVideoSaver
0026      * This is the object that takes an animation document and config and tells ffmpeg
0027      * to render it via KisFFMpegWrapper.
0028      * @param doc the document to use for rendering.
0029      * @param ffmpegPath the path to the ffmpeg executable.
0030      * @param batchMode whether Krita is in batchmode and we can thus not show gui widgets.
0031      */
0032     KisAnimationVideoSaver(KisDocument* doc, bool batchMode);
0033     ~KisAnimationVideoSaver() override;
0034 
0035     /**
0036      * @brief image
0037      * @return get the image used by this exporter.
0038      */
0039     KisImageSP image();
0040 
0041     /**
0042      * @brief encode the main encoding function.
0043      * This in turn calls runFFMpeg, which is a private function inside this class.
0044      * @param filename the filename to which to render the animation.
0045      * @param configuration the configuration
0046      * @return whether it is successful or had another failure.
0047      */
0048     KisImportExportErrorCode encode(const QString &savedFilesMask, const KisAnimationRenderingOptions &options);
0049 
0050     static KisImportExportErrorCode convert(KisDocument *document, const QString &savedFilesMask, const KisAnimationRenderingOptions &options, bool batchMode);
0051 
0052 private:
0053     KisImageSP m_image;
0054     KisDocument* m_doc;
0055     bool m_batchMode;
0056 };
0057 
0058 #endif