| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #pragma once
- #include <QCheckBox>
- #include <QLayout>
- #include <QPushButton>
- #include <QTime>
- #include <QTimer>
- #include <QWidget>
- #include "audio_widget.h"
- #include "qcombobox.h"
- #include "qstatusbar.h"
- #include "recorder/audio_recorder.h"
- #include "recorder/video_recorder.h"
- #include "ui/opengl_video_widget.h"
- #include "ui/settings_page.h"
- class AvRecorder : public QWidget
- {
- Q_OBJECT
- public:
- AvRecorder(QWidget* parent = nullptr);
- ~AvRecorder();
- bool start();
- QWidget* statusBar() const { return m_statusBar; }
- void setSettings(const SettingsPage::Param& param);
- private:
- SettingsPage::Param m_settingsParam;
- QVBoxLayout* initListUi();
- QVBoxLayout* initAudioUi();
- QVBoxLayout* initOtherUi();
- void initStatusBarUi();
- void updateCaptureList();
- void startCapture(VideoCapturer::Method method);
- void stopCapture();
- void startPreview();
- void dealCapture();
- void stopPreview();
- bool startStream(std::string_view path, std::string_view format);
- void stopStream();
- bool startSyncRecord(); // 开始同步录像
- void stopSyncRecord(); // 停止同步录像
- void initConnect();
- private:
- AudioRecorder m_audioRecorder;
- VideoRecorder m_videoRecorder;
- AvMuxer m_avMuxer;
- AvMuxer m_recordMuxer; // 添加用于同步录像的Muxer
- // VideoRender m_videoRender;
- OpenGLVideoWidget* m_glWidget;
- AudioWidget* m_microphoneWidget = nullptr;
- AudioWidget* m_speakerWidget = nullptr;
- QPushButton* m_recordBtn = nullptr;
- QPushButton* m_liveBtn = nullptr;
- QPushButton* m_settingsBtn = nullptr;
- QCheckBox* m_isDrawCursorBox = nullptr;
- QCheckBox* m_syncRecordBox = nullptr; // 添加同步录像的复选框
- Timer m_videoRenderTimer;
- QTimer m_otherTimer;
- QComboBox* m_captureComboBox = nullptr;
- QPushButton* m_updateListBtn = nullptr;
- bool m_isRecord = false;
- bool m_isLive = false;
- bool m_isSyncRecord = false; // 是否同步录像
- QComboBox* m_captureMethodBox = nullptr;
- QLabel* m_captureStatusLabel = nullptr;
- QLabel* m_captureTimeLabel = nullptr;
- QLabel* m_fpsLabel = nullptr;
- QLabel* m_videoEncodeLabel = nullptr;
- QLabel* m_videolossRate = nullptr;
- QTime m_recordTime;
- bool m_isLocked = false;
- QStatusBar* m_statusBar = nullptr;
- };
|