/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************************/ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H #include "sys_inc.h" #include "video_player.h" #include #include #include #include #include #include #include #include #include #include class VideoWidget : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT public: VideoWidget(QWidget * parent = 0, Qt::WindowFlags f = Qt::Widget); ~VideoWidget(); void play(QString url, QString user, QString pass); void pause(); void stop(); void snapshot(); BOOL record(); void stopRecord(); void setMute(BOOL flag); BOOL micphone(); BOOL isPlaying(); BOOL isMute() {return m_bMute;} BOOL isRecording(); QString getUrl() { return m_url; } QString getUser() { return m_acct; } QString getPass() { return m_pass; } private slots: void slotImageReady(AVFrame * frame); void slotPlayerNotify(int event); void slotReconn(); void slotSnapshoted(AVFrame * frame); signals: void callState(QWidget *, int); void snapshotResult(bool); void recordResult(bool); void updateStatistics(int); void imageReady(); void widgetSelecting(QWidget *); protected: void mousePressEvent(QMouseEvent * event); void initializeGL(); void paintGL(); private: void closePlayer(); void closeVideo(); void makeCall(); QRect getVideoRenderRect(int videoW, int videoH); void startRecord(); QString getBaseName(QString &url); private: QString m_url; QString m_acct; QString m_pass; QString m_base; CVideoPlayer * m_pPlayer; QTimer m_timerReconn; BOOL m_bMute; BOOL m_bRecording; QMutex m_mutex; AVFrame * m_pRenderFrame; #ifdef BACKCHANNEL int m_nBackChannelFlag; #endif QOpenGLShaderProgram * program; QOpenGLBuffer vbo; GLuint textureUniformY; GLuint textureUniformU; GLuint textureUniformV; QOpenGLTexture* textureY = nullptr; QOpenGLTexture* textureU = nullptr; QOpenGLTexture* textureV = nullptr; GLuint idY, idU, idV; }; #endif