Browse Source

V2.1.0

1.新增mingw编译器支持
2.回调函数调整
叶海辉 6 years ago
parent
commit
b14cf038f2

BIN
bin32/VideoPlayer.exe


+ 3 - 0
module/VideoPlayer/VideoPlayer.pri

@@ -9,6 +9,7 @@ SOURCES +=  \
     $$PWD/src/VideoPlayer/Video/VideoPlayer_VideoThread.cpp \
     $$PWD/src/VideoPlayer/Audio/VideoPlayer_AudioThread.cpp \
     $$PWD/src/VideoPlayer/Audio/PcmVolumeControl.cpp \
+    $$PWD/src/EventHandle/VideoPlayerEventHandle.cpp
 
 HEADERS  += \
     $$PWD/src/AppConfig.h \
@@ -17,6 +18,8 @@ HEADERS  += \
     $$PWD/src/LogWriter/LogWriter.h \
     $$PWD/src/VideoPlayer/VideoPlayer.h \
     $$PWD/src/VideoPlayer/Audio/PcmVolumeControl.h \
+    $$PWD/src/EventHandle/VideoPlayerEventHandle.h \
+    $$PWD/src/types.h
 
 
 win32{

+ 1 - 1
module/VideoPlayer/src/AppConfig.cpp

@@ -17,7 +17,7 @@ void Sleep(long mSeconds)
 #endif
 
 int AppConfig::VERSION = 1;
-char AppConfig::VERSION_NAME[32] = "1.8.0";
+char AppConfig::VERSION_NAME[32] = "2.1.0";
 
 LogWriter* AppConfig::gLogWriter = new LogWriter;
 

+ 2 - 0
module/VideoPlayer/src/EventHandle/VideoPlayerEventHandle.cpp

@@ -0,0 +1,2 @@
+#include "VideoPlayerEventHandle.h"
+

+ 26 - 0
module/VideoPlayer/src/EventHandle/VideoPlayerEventHandle.h

@@ -0,0 +1,26 @@
+#ifndef VIDEOPLAYEREVENTHANDLE_H
+#define VIDEOPLAYEREVENTHANDLE_H
+
+#include "types.h"
+
+class VideoPlayerCallBack
+{
+public:
+    ///打开文件失败
+    virtual void onOpenVideoFileFailed(const int &code = 0) = 0;
+
+    ///打开sdl失败的时候回调此函数
+    virtual void onOpenSdlFailed(const int &code) = 0;
+
+    ///获取到视频时长的时候调用此函数
+    virtual void onTotalTimeChanged(const int64_t &uSec) = 0;
+
+    ///播放器状态改变的时候回调此函数
+    virtual void onPlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio) = 0;
+
+    ///显示rgb数据,此函数不宜做耗时操作,否则会影响播放的流畅性,传入的brgb32Buffer,在函数返回后既失效。
+    virtual void onDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height) = 0;
+
+};
+
+#endif // VIDEOPLAERYEVENTHANDLE_H

+ 1 - 1
module/VideoPlayer/src/LogWriter/LogWriter.cpp

@@ -85,7 +85,7 @@ void LogWriter::writeLog(int cameraId, const std::string &str)
     memset(mTmpBuffer, 0x0, TMPBUFFERLEN);
 
     sprintf(mTmpBuffer,"[%d-%02d-%02d %02d:%02d:%02d.%03d] %s\n",
-            sys.wYear, sys.wMonth, sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds, str);
+            sys.wYear, sys.wMonth, sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds, str.c_str());
 
     node.logStr = mTmpBuffer;
 

+ 1 - 0
module/VideoPlayer/src/LogWriter/LogWriter.h

@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <string>
 
 #include "Mutex/Cond.h"
 

+ 13 - 13
module/VideoPlayer/src/Mutex/Cond.cpp

@@ -2,7 +2,7 @@
 
 Cond::Cond()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     InitializeCriticalSection(&m_mutex);
     InitializeConditionVariable(&m_cond);
 #else
@@ -14,7 +14,7 @@ Cond::Cond()
 
 Cond::~Cond()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     DeleteCriticalSection(&m_mutex);
 #else
     pthread_mutex_destroy(&m_mutex);
@@ -23,10 +23,10 @@ Cond::~Cond()
 
 }
 
-//鍔犻攣
+//加锁
 int Cond::Lock()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     EnterCriticalSection(&m_mutex);
     return 0;
 #else
@@ -35,10 +35,10 @@ int Cond::Lock()
 
 }
 
-//瑙i攣
+//解锁
 int Cond::Unlock()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     LeaveCriticalSection(&m_mutex);
     return 0;
 #else
@@ -48,7 +48,7 @@ int Cond::Unlock()
 
 int Cond::Wait()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     DWORD ret = SleepConditionVariableCS((PCONDITION_VARIABLE)&m_cond, &m_mutex, INFINITE);
 #else
     int ret = pthread_cond_wait(&m_cond, &m_mutex);
@@ -58,15 +58,15 @@ int Cond::Wait()
 
 }
 
-//鍥哄畾鏃堕棿绛夊緟
+//固定时间等待
 int Cond::TimedWait(int second)
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     SleepConditionVariableCS((PCONDITION_VARIABLE)&m_cond, &m_mutex, second*1000);
     return 0;
 #else
     struct timespec abstime;
-    //鑾峰彇浠庡綋鍓嶆椂闂达紝骞跺姞涓婄瓑寰呮椂闂达紝 璁剧疆杩涚▼鐨勮秴鏃剁潯鐪犳椂闂�
+    //获取从当前时间,并加上等待时间, 设置进程的超时睡眠时间
     clock_gettime(CLOCK_REALTIME, &abstime);
     abstime.tv_sec += second;
     return pthread_cond_timedwait(&m_cond, &m_mutex, &abstime);
@@ -76,7 +76,7 @@ int Cond::TimedWait(int second)
 
 int Cond::Signal()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     int ret = 0;
     WakeConditionVariable((PCONDITION_VARIABLE)&m_cond);
 #else
@@ -85,10 +85,10 @@ int Cond::Signal()
     return ret;
 }
 
-//鍞ら啋鎵€鏈夌潯鐪犵嚎绋�
+//唤醒所有睡眠线程
 int Cond::Broadcast()
 {
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     WakeAllConditionVariable((PCONDITION_VARIABLE)&m_cond);
     return 0;
 #else

+ 14 - 6
module/VideoPlayer/src/Mutex/Cond.h

@@ -1,11 +1,19 @@
 #ifndef COND_H
 #define COND_H
 
-#if defined(WIN32)
+/// 注意Mingw的话使用的是linux下的api pthread
+/// 没有_MSC_VER这个宏 我们就认为他用的是mingw编译器
+
+#ifndef _MSC_VER
+#define MINGW
+#endif
+
+#if defined(WIN32) && !defined(MINGW)
     #include <winsock2.h>
     #include <windows.h>
 #else
     #include <pthread.h>
+    #include <time.h>
 #endif
 
 class Cond
@@ -14,27 +22,27 @@ public:
     Cond();
     ~Cond();
 
-    //涓婇攣
+    //上锁
     int Lock();
 
-    //瑙i攣
+    //解锁
     int Unlock();
 
     //
     int Wait();
 
-    //鍥哄畾鏃堕棿绛夊緟
+    //固定时间等待
     int TimedWait(int second);
 
     //
     int Signal();
 
-    //鍞ら啋鎵€鏈夌潯鐪犵嚎绋�
+    //唤醒所有睡眠线程
     int Broadcast();
 
 private:
 
-#if defined(WIN32)
+#if defined(WIN32) && !defined(MINGW)
     CRITICAL_SECTION m_mutex;
     RTL_CONDITION_VARIABLE m_cond;
 #else

+ 45 - 16
module/VideoPlayer/src/VideoPlayer/VideoPlayer.cpp

@@ -15,7 +15,9 @@ VideoPlayer::VideoPlayer()
     mConditon_Video = new Cond;
     mConditon_Audio = new Cond;
 
-    mPlayerState = Stop;
+    mPlayerState = VideoPlayer_Stop;
+
+    mVideoPlayerCallBack = nullptr;
 
     mAudioID = 0;
     mIsMute = false;
@@ -44,7 +46,7 @@ bool VideoPlayer::initPlayer()
 
 bool VideoPlayer::startPlay(const std::string &filePath)
 {
-    if (mPlayerState != Stop)
+    if (mPlayerState != VideoPlayer_Stop)
     {
         return false;
     }
@@ -79,7 +81,7 @@ bool VideoPlayer::play()
     mIsNeedPause = false;
     mIsPause = false;
 
-    if (mPlayerState != Pause)
+    if (mPlayerState != VideoPlayer_Pause)
     {
         return false;
     }
@@ -87,8 +89,8 @@ bool VideoPlayer::play()
     uint64_t pauseTime = av_gettime() - mVideoStartTime; //暂停了多长时间
     mVideoStartTime += pauseTime; //将暂停的时间加到开始播放的时间上,保证同步不受暂停的影响
 
-    mPlayerState = Playing;
-    doPlayerStateChanged(Playing, mVideoStream != nullptr, mAudioStream != nullptr);
+    mPlayerState = VideoPlayer_Playing;
+    doPlayerStateChanged(VideoPlayer_Playing, mVideoStream != nullptr, mAudioStream != nullptr);
 
     return true;
 }
@@ -97,28 +99,28 @@ bool VideoPlayer::pause()
 {
     mIsPause = true;
 
-    if (mPlayerState != Playing)
+    if (mPlayerState != VideoPlayer_Playing)
     {
         return false;
     }
 
     mPauseStartTime = av_gettime();
 
-    mPlayerState = Pause;
+    mPlayerState = VideoPlayer_Pause;
 
-    emit doPlayerStateChanged(Pause, mVideoStream != nullptr, mAudioStream != nullptr);
+    emit doPlayerStateChanged(VideoPlayer_Pause, mVideoStream != nullptr, mAudioStream != nullptr);
 
     return true;
 }
 
 bool VideoPlayer::stop(bool isWait)
 {
-    if (mPlayerState == Stop)
+    if (mPlayerState == VideoPlayer_Stop)
     {
         return false;
     }
 
-    mPlayerState = Stop;
+    mPlayerState = VideoPlayer_Stop;
     mIsQuit = true;
 
     if (isWait)
@@ -402,8 +404,8 @@ void VideoPlayer::readVideoFile()
 
 //    av_dump_format(pFormatCtx, 0, file_path, 0); //输出视频信息
 
-    mPlayerState = Playing;
-    doPlayerStateChanged(Playing, mVideoStream != nullptr, mAudioStream != nullptr);
+    mPlayerState = VideoPlayer_Playing;
+    doPlayerStateChanged(VideoPlayer_Playing, mVideoStream != nullptr, mAudioStream != nullptr);
 
     mVideoStartTime = av_gettime();
 OUTPUT("%s mIsQuit=%d \n", __FUNCTION__, mIsQuit);
@@ -529,7 +531,7 @@ end:
     clearAudioQuene();
     clearVideoQuene();
 
-    if (mPlayerState != Stop) //不是外部调用的stop 是正常播放结束
+    if (mPlayerState != VideoPlayer_Stop) //不是外部调用的stop 是正常播放结束
     {
         stop();
     }
@@ -574,7 +576,7 @@ end:
     avformat_close_input(&pFormatCtx);
     avformat_free_context(pFormatCtx);
 
-    doPlayerStateChanged(Stop, mVideoStream != nullptr, mAudioStream != nullptr);
+    doPlayerStateChanged(VideoPlayer_Stop, mVideoStream != nullptr, mAudioStream != nullptr);
 
     mIsReadThreadFinished = true;
 
@@ -641,28 +643,55 @@ void VideoPlayer::clearAudioQuene()
 void VideoPlayer::doOpenVideoFileFailed(const int &code)
 {
     OUTPUT("%s \n", __FUNCTION__);
+
+    if (mVideoPlayerCallBack != nullptr)
+    {
+        mVideoPlayerCallBack->onOpenVideoFileFailed(code);
+    }
+
 }
 
 ///打开sdl失败的时候回调此函数
 void VideoPlayer::doOpenSdlFailed(const int &code)
 {
     OUTPUT("%s \n", __FUNCTION__);
+
+    if (mVideoPlayerCallBack != nullptr)
+    {
+        mVideoPlayerCallBack->onOpenSdlFailed(code);
+    }
 }
 
 ///获取到视频时长的时候调用此函数
 void VideoPlayer::doTotalTimeChanged(const int64_t &uSec)
 {
     OUTPUT("%s \n", __FUNCTION__);
+
+    if (mVideoPlayerCallBack != nullptr)
+    {
+        mVideoPlayerCallBack->onTotalTimeChanged(uSec);
+    }
 }
 
 ///播放器状态改变的时候回调此函数
-void VideoPlayer::doPlayerStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio)
+void VideoPlayer::doPlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio)
 {
     OUTPUT("%s \n", __FUNCTION__);
+
+    if (mVideoPlayerCallBack != nullptr)
+    {
+        mVideoPlayerCallBack->onPlayerStateChanged(state, hasVideo, hasAudio);
+    }
+
 }
 
 ///显示rgb数据,此函数不宜做耗时操作,否则会影响播放的流畅性,传入的brgb32Buffer,在函数返回后既失效。
 void VideoPlayer::doDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height)
 {
-    OUTPUT("%s \n", __FUNCTION__);
+//    OUTPUT("%s \n", __FUNCTION__);
+
+    if (mVideoPlayerCallBack != nullptr)
+    {
+        mVideoPlayerCallBack->onDisplayVideo(brgb32Buffer, width, height);
+    }
 }

+ 22 - 20
module/VideoPlayer/src/VideoPlayer/VideoPlayer.h

@@ -30,6 +30,8 @@ extern "C"
 }
 
 #include "AppConfig.h"
+#include "types.h"
+#include "EventHandle/VideoPlayerEventHandle.h"
 
 #define SDL_AUDIO_BUFFER_SIZE 1024
 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
@@ -48,20 +50,18 @@ extern "C"
 class VideoPlayer
 {
 public:
-
-    enum PlayerState
-    {
-        Playing,
-        Pause,
-        Stop
-    };
-
-    explicit VideoPlayer();
+    VideoPlayer();
     ~VideoPlayer();
 
     ///初始化播放器(必需要调用一次)
     static bool initPlayer();
 
+    /**
+     * @brief setVideoPlayerCallBack 设置播放器回调函数
+     * @param pointer
+     */
+    void setVideoPlayerCallBack(VideoPlayerCallBack *pointer){mVideoPlayerCallBack=pointer;}
+
     bool startPlay(const std::string &filePath);
 
     bool replay(); //重新播放
@@ -90,13 +90,12 @@ protected:
 private:
     std::string mFilePath; //视频文件路径
 
-    PlayerState mPlayerState; //播放状态
+    VideoPlayerState mPlayerState; //播放状态
 
     ///音量相关变量
     bool  mIsMute;
     float mVolume; //音量 0~1 超过1 表示放大倍数
 
-
     /// 跳转相关的变量
     int             seek_req; //跳转标志
     int64_t         seek_pos; //跳转的位置 -- 微秒
@@ -165,25 +164,28 @@ private:
     int openSDL();
     void closeSDL();
 
-    /// 以下函数,用于输出信息给界面
-    /// 当使用界面类继承了本类之后,以下函数不会执行
-protected:
+
+    ///回调函数相关,主要用于输出信息给界面
+private:
+    ///回调函数
+    VideoPlayerCallBack *mVideoPlayerCallBack;
+
     ///打开文件失败
-    virtual void doOpenVideoFileFailed(const int &code = 0);
+    void doOpenVideoFileFailed(const int &code = 0);
 
     ///打开sdl失败的时候回调此函数
-    virtual void doOpenSdlFailed(const int &code);
+    void doOpenSdlFailed(const int &code);
 
     ///获取到视频时长的时候调用此函数
-    virtual void doTotalTimeChanged(const int64_t &uSec);
+    void doTotalTimeChanged(const int64_t &uSec);
 
     ///播放器状态改变的时候回调此函数
-    virtual void doPlayerStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio);
+    void doPlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio);
 
     ///显示rgb数据,此函数不宜做耗时操作,否则会影响播放的流畅性,传入的brgb32Buffer,在函数返回后既失效。
-    virtual void doDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height);
-
+    void doDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height);
 
 };
 
+
 #endif // VIDEOPLAYER_H

+ 14 - 0
module/VideoPlayer/src/types.h

@@ -0,0 +1,14 @@
+#ifndef TYPES_H
+#define TYPES_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+enum VideoPlayerState
+{
+    VideoPlayer_Playing,
+    VideoPlayer_Pause,
+    VideoPlayer_Stop
+};
+
+#endif // TYPES_H

+ 13 - 12
src/Widget/VideoPlayerWidget.cpp

@@ -16,7 +16,7 @@
 #include <QMouseEvent>
 #include <QMessageBox>
 
-Q_DECLARE_METATYPE(VideoPlayer::PlayerState)
+Q_DECLARE_METATYPE(VideoPlayerState)
 
 VideoPlayerWidget::VideoPlayerWidget(QWidget *parent) :
     DragAbleWidget(parent),
@@ -31,7 +31,7 @@ VideoPlayerWidget::VideoPlayerWidget(QWidget *parent) :
     setAttribute(Qt::WA_TranslucentBackground);
 
     //因为VideoPlayer::PlayerState是自定义的类型 要跨线程传递需要先注册一下
-    qRegisterMetaType<VideoPlayer::PlayerState>();
+    qRegisterMetaType<VideoPlayerState>();
 
     connect(this, &VideoPlayerWidget::sig_OpenVideoFileFailed, this, &VideoPlayerWidget::slotOpenVideoFileFailed);
     connect(this, &VideoPlayerWidget::sig_OpenSdlFailed, this, &VideoPlayerWidget::slotOpenSdlFailed);
@@ -53,7 +53,8 @@ VideoPlayerWidget::VideoPlayerWidget(QWidget *parent) :
     ui->page_video->installEventFilter(this);
     ui->widget_container->installEventFilter(this);
 
-    mPlayer = this;
+    mPlayer = new VideoPlayer();
+    mPlayer->setVideoPlayerCallBack(this);
 
     mTimer = new QTimer; //定时器-获取当前视频时间
     connect(mTimer, &QTimer::timeout, this, &VideoPlayerWidget::slotTimerTimeOut);
@@ -223,25 +224,25 @@ void VideoPlayerWidget::slotBtnClick(bool isChecked)
 }
 
 ///打开文件失败
-void VideoPlayerWidget::doOpenVideoFileFailed(const int &code)
+void VideoPlayerWidget::onOpenVideoFileFailed(const int &code)
 {
     emit sig_OpenVideoFileFailed(code);
 }
 
 ///打开SDL失败的时候回调此函数
-void VideoPlayerWidget::doOpenSdlFailed(const int &code)
+void VideoPlayerWidget::onOpenSdlFailed(const int &code)
 {
     emit sig_OpenSdlFailed(code);
 }
 
 ///获取到视频时长的时候调用此函数
-void VideoPlayerWidget::doTotalTimeChanged(const int64_t &uSec)
+void VideoPlayerWidget::onTotalTimeChanged(const int64_t &uSec)
 {
     emit sig_TotalTimeChanged(uSec);
 }
 
 ///播放器状态改变的时候回调此函数
-void VideoPlayerWidget::doPlayerStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio)
+void VideoPlayerWidget::onPlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio)
 {
     emit sig_PlayerStateChanged(state, hasVideo, hasAudio);
 }
@@ -271,9 +272,9 @@ void VideoPlayerWidget::slotTotalTimeChanged(const qint64 &uSec)
 
 }
 
-void VideoPlayerWidget::slotStateChanged(const PlayerState &state, const bool &hasVideo, const bool &hasAudio)
+void VideoPlayerWidget::slotStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio)
 {
-    if (state == VideoPlayer::Stop)
+    if (state == VideoPlayer_Stop)
     {
         ui->stackedWidget->setCurrentWidget(ui->page_open);
 
@@ -287,7 +288,7 @@ void VideoPlayerWidget::slotStateChanged(const PlayerState &state, const bool &h
         mTimer->stop();
 
     }
-    else if (state == VideoPlayer::Playing)
+    else if (state == VideoPlayer_Playing)
     {
         if (hasVideo)
         {
@@ -303,7 +304,7 @@ void VideoPlayerWidget::slotStateChanged(const PlayerState &state, const bool &h
 
         mTimer->start();
     }
-    else if (state == VideoPlayer::Pause)
+    else if (state == VideoPlayer_Pause)
     {
         ui->pushButton_pause->hide();
         ui->pushButton_play->show();
@@ -311,7 +312,7 @@ void VideoPlayerWidget::slotStateChanged(const PlayerState &state, const bool &h
 }
 
 ///显示rgb数据,此函数不宜做耗时操作,否则会影响播放的流畅性,传入的brgb32Buffer,在函数返回后既失效。
-void VideoPlayerWidget::doDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height)
+void VideoPlayerWidget::onDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height)
 {
 //    qDebug()<<__FUNCTION__<<width<<height;
 

+ 8 - 8
src/Widget/VideoPlayerWidget.h

@@ -23,7 +23,7 @@ class VideoPlayerWidget;
 }
 
 ///这个是播放器的主界面 包括那些按钮和进度条之类的
-class VideoPlayerWidget : public DragAbleWidget, public VideoPlayer
+class VideoPlayerWidget : public DragAbleWidget, public VideoPlayerCallBack
 {
     Q_OBJECT
 
@@ -56,33 +56,33 @@ private slots:
     ///以下函数,用于输出信息给界面
 protected:
     ///打开文件失败
-    void doOpenVideoFileFailed(const int &code);
+    void onOpenVideoFileFailed(const int &code);
 
     ///打开sdl失败的时候回调此函数
-    void doOpenSdlFailed(const int &code);
+    void onOpenSdlFailed(const int &code);
 
     ///获取到视频时长的时候调用此函数
-    void doTotalTimeChanged(const int64_t &uSec);
+    void onTotalTimeChanged(const int64_t &uSec);
 
     ///播放器状态改变的时候回调此函数
-    void doPlayerStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio);
+    void onPlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio);
 
     ///显示rgb数据,此函数不宜做耗时操作,否则会影响播放的流畅性,传入的brgb32Buffer,在函数返回后既失效。
-    void doDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height);
+    void onDisplayVideo(const uint8_t *brgb32Buffer, const int &width, const int &height);
 
     ///由于不能在子线程中操作界面,因此需要通过信号槽的方式,将上面函数转移到主线程
 signals:
     void sig_OpenVideoFileFailed(const int &code);
     void sig_OpenSdlFailed(const int &code);
     void sig_TotalTimeChanged(const qint64 &Usec);
-    void sig_PlayerStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio);
+    void sig_PlayerStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio);
     void sig_DisplayVideo(const QImage &image);
 
 private slots:
     void slotOpenVideoFileFailed(const int &code);
     void slotOpenSdlFailed(const int &code);
     void slotTotalTimeChanged(const qint64 &uSec);
-    void slotStateChanged(const VideoPlayer::PlayerState &state, const bool &hasVideo, const bool &hasAudio);
+    void slotStateChanged(const VideoPlayerState &state, const bool &hasVideo, const bool &hasAudio);
     void slotDisplayVideo(const QImage &image);
 
 };