Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef RECORDER_H
  2. #define RECORDER_H
  3.  
  4. #include <QObject>
  5. #include <QProcess>
  6. #include <QDesktopServices>
  7. #include <QTimer>
  8. #include <QApplication>
  9. #include <QTime>
  10.  
  11. #include <QDebug>
  12.  
  13. struct VideoDevice
  14. {// I'll keep other options in this struct too.
  15.     QString deviceName;
  16.     QString resolution;
  17. };
  18.  
  19. struct AudioDevice
  20. {// I'll keep other options in this struct too.
  21.     QString deviceName;
  22. };
  23.  
  24. class Recorder : public QObject
  25. {
  26.     Q_OBJECT
  27. public:
  28.     enum RecordingMode { AudioOnly = 0, VideoOnly, AudioVideo };
  29.     enum RecorderState { Recording = 0, Paused, Stopped };
  30.     explicit Recorder(QObject *parent = 0);
  31.     virtual ~Recorder();
  32.  
  33.     void setDevices( const AudioDevice &audioDevice, const VideoDevice &videoDevice );
  34.     void setAudioDevice( const AudioDevice &audioDevice );
  35.     const AudioDevice &audioDevice() const;
  36.     void setVideoDevice( const VideoDevice &videoDevice );
  37.     const VideoDevice &videoDevice() const;
  38.  
  39.     void setOutputFile( const QString &fileName );
  40.     const QString &fileName() const;
  41.  
  42. Q_SIGNALS:
  43.     void stateChanged( const RecorderState &state );
  44.  
  45. public Q_SLOTS:
  46.     void start( RecordingMode mode );
  47.     void stop();
  48.     void pause();
  49.  
  50. private Q_SLOTS:
  51.     void onFFMPEGstateChanged( QProcess::ProcessState state );
  52.  
  53.     void onTest();
  54.  
  55. private:
  56.     QProcess *m_ffmpeg;
  57.     RecordingMode m_mode;
  58.     VideoDevice m_videoDevice;
  59.     QString m_output;
  60.  
  61.     AudioDevice m_audioDevice;
  62. };
  63.  
  64.  
  65. #endif // RECORDER_H
Add Comment
Please, Sign In to add comment