| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef AVPLAYERWIDGET_H
- #define AVPLAYERWIDGET_H
- #include <QWidget>
- #include <QPushButton>
- #include <QVBoxLayout>
- #include <QHBoxLayout>
- #include <QLabel>
- #include <QSlider>
- #include <QLineEdit>
- #include <QSharedPointer>
- class AVPlayer;
- class AVOpenGLWidget;
- class VideoFrame;
- class AVPlayerWidget : public QWidget
- {
- Q_OBJECT
- public:
- explicit AVPlayerWidget(QWidget *parent = nullptr);
- ~AVPlayerWidget();
- void play(const QString &url);
- void stop();
- void pause();
- void resume();
-
- // 兼容旧接口:基于房间ID控制播放
- void stopPlay();
- void setPlayRoomId(const QString &id);
- void startPlay();
-
- private Q_SLOTS:
- void ptsChangedSlot(unsigned int duration);
- void durationChangedSlot(unsigned int pts);
- void terminateSlot();
-
- // UI控制槽函数
- void onPlayButtonClicked();
- void onStopButtonClicked();
- void onPauseButtonClicked();
- void onTestPlayButtonClicked();
- void onVolumeChanged(int volume);
-
- // 视频帧处理
- void onFrameChanged(QSharedPointer<VideoFrame> frame);
-
- signals:
- void playStateChanged(bool isPlaying);
- private:
- void setupUI();
- void connectSignals();
-
- AVPlayer *m_player;
- AVOpenGLWidget *m_openglWidget;
-
- // UI组件
- QVBoxLayout *m_mainLayout;
- QHBoxLayout *m_controlLayout;
- QPushButton *m_playButton;
- QPushButton *m_pauseButton;
- QPushButton *m_stopButton;
- QPushButton *m_testPlayButton;
- QLabel *m_timeLabel;
- QSlider *m_volumeSlider;
- QLineEdit *m_urlEdit;
-
- bool m_isPlaying;
- bool m_isPaused;
- };
- #endif // AVPLAYERWIDGET_H
|