File indexing completed on 2024-04-21 04:51:51

0001 /*
0002     SPDX-FileCopyrightText: 2015 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003     This file is part of Kdenlive. See www.kdenlive.org.
0004 
0005     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include "definitions.h"
0011 
0012 #include <QProcess>
0013 #include <QUrl>
0014 
0015 class Monitor;
0016 class QAction;
0017 class QToolBar;
0018 class QComboBox;
0019 class QCheckBox;
0020 class QSlider;
0021 class QToolButton;
0022 
0023 namespace Mlt {
0024 class Producer;
0025 }
0026 
0027 /** @class RecManager
0028     @brief All recording specific features are gathered here
0029     @author Jean-Baptiste Mardelle
0030  */
0031 class RecManager : public QObject
0032 {
0033     Q_OBJECT
0034 
0035     enum CaptureDevice {
0036         Video4Linux = 0,
0037         ScreenGrab = 1,
0038         // Not implemented
0039         Firewire = 2,
0040         BlackMagic = 3
0041     };
0042 
0043 public:
0044     explicit RecManager(Monitor *parent = nullptr);
0045     ~RecManager() override;
0046     QToolBar *toolbar() const;
0047     void stopCapture();
0048     QAction *recAction() const;
0049     /** @brief: stop capture and hide rec panel **/
0050     void stop();
0051 
0052 private:
0053     Monitor *m_monitor;
0054     QAction *m_switchRec;
0055     QString m_captureFolder;
0056     QUrl m_captureFile;
0057     QString m_recError;
0058     QProcess *m_captureProcess{nullptr};
0059     QAction *m_recAction;
0060     QAction *m_playAction;
0061     QAction *m_showLogAction;
0062     QToolBar *m_recToolbar;
0063     QToolButton *m_audioCaptureButton;
0064     QComboBox *m_device_selector;
0065     QComboBox *m_audio_device;
0066     QCheckBox *m_recVideo;
0067     QCheckBox *m_recAudio;
0068     QSlider *m_audioCaptureSlider;
0069     bool m_checkAudio{false};
0070     bool m_checkVideo{false};
0071     Mlt::Producer *createV4lProducer();
0072     int m_screenIndex{0};
0073 
0074 private Q_SLOTS:
0075     void slotSetScreen(int ScreenIndex);
0076     void slotRecord(bool record);
0077     void slotPreview(bool record);
0078     void slotProcessStatus(int exitCode, QProcess::ExitStatus exitStatus);
0079     void slotReadProcessInfo();
0080     void showRecConfig();
0081     void slotVideoDeviceChanged(int ix = -1);
0082     void slotAudioDeviceChanged(int ix = -1);
0083     void slotShowLog();
0084     void slotSetVolume(int);
0085 Q_SIGNALS:
0086     void addClipToProject(const QUrl &);
0087     void warningMessage(const QString &, int timeout = 5000, const QList<QAction *> &actions = QList<QAction *>());
0088 };