Przeglądaj źródła

V1.7.0 代码修改

1.代码修改
叶海辉 6 lat temu
rodzic
commit
10eb2a3954

+ 12 - 9
VideoPlayer.pro

@@ -32,15 +32,18 @@ INCLUDEPATH += $$PWD/ffmpeg/include \
                $$PWD/SDL2/include \
                $$PWD/src
 
-LIBS += $$PWD/ffmpeg/lib/avcodec.lib \
-        $$PWD/ffmpeg/lib/avdevice.lib \
-        $$PWD/ffmpeg/lib/avfilter.lib \
-        $$PWD/ffmpeg/lib/avformat.lib \
-        $$PWD/ffmpeg/lib/avutil.lib \
-        $$PWD/ffmpeg/lib/postproc.lib \
-        $$PWD/ffmpeg/lib/swresample.lib \
-        $$PWD/ffmpeg/lib/swscale.lib \
-        $$PWD/SDL2/lib/x86/SDL2.lib
+#LIBS += $$PWD/ffmpeg/lib/avcodec.lib \
+#        $$PWD/ffmpeg/lib/avdevice.lib \
+#        $$PWD/ffmpeg/lib/avfilter.lib \
+#        $$PWD/ffmpeg/lib/avformat.lib \
+#        $$PWD/ffmpeg/lib/avutil.lib \
+#        $$PWD/ffmpeg/lib/postproc.lib \
+#        $$PWD/ffmpeg/lib/swresample.lib \
+#        $$PWD/ffmpeg/lib/swscale.lib \
+#        $$PWD/SDL2/lib/x86/SDL2.lib
+
+LIBS += -L$$PWD/ffmpeg/lib -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc -lswresample -lswscale
+LIBS += -L$$PWD/SDL2/lib/x86 -lSDL2
 
 RESOURCES += \
     resources.qrc

BIN
ffmpeg/bin/SDL2.dll


+ 1 - 3
src/main.cpp

@@ -15,10 +15,8 @@ int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
 
-    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
+    QTextCodec *codec = QTextCodec::codecForName("GBK");
     QTextCodec::setCodecForLocale(codec);
-//    QTextCodec::setCodecForCStrings(codec);
-//    QTextCodec::setCodecForTr(codec);
 
     VideoPlayer w;
     w.show();

+ 0 - 5
src/videoplayer/videoplayer.cpp

@@ -46,10 +46,6 @@ VideoPlayer::VideoPlayer(QWidget *parent) :
 
     mPlayer->setVideoWidget(ui->widget_videoPlayer);
 
-//    ui->horizontalSlider_videoPlayer->setValue(50);
-//    mPlayer->setVolume(0.5);
-
-
     mTimer = new QTimer; //定时器-获取当前视频时间
     connect(mTimer,SIGNAL(timeout()),this,SLOT(slotTimerTimeOut()));
     mTimer->setInterval(500);
@@ -444,7 +440,6 @@ void VideoPlayer::on_btnMenu_Close_clicked()
 //        qApp->sendEvent(ui->btnMenu_Close, &evt);
 //    });
 
-
 }
 
 void VideoPlayer::on_btnMenu_Max_clicked()

+ 1 - 2
src/videoplayer/videoplayer_thread.cpp

@@ -960,8 +960,7 @@ int VideoPlayer_Thread::openSDL()
     /* 把设置好的参数保存到大结构中 */
     is->audio_src_fmt = is->audio_tgt_fmt = AV_SAMPLE_FMT_S16;
     is->audio_src_freq = is->audio_tgt_freq = spec.freq;
-    is->audio_src_channel_layout = is->audio_tgt_channel_layout =
-            wanted_channel_layout;
+    is->audio_src_channel_layout = is->audio_tgt_channel_layout = wanted_channel_layout;
     is->audio_src_channels = is->audio_tgt_channels = spec.channels;
 
     is->audio_buf_size = 0;

+ 1 - 58
src/videoplayer/videoplayer_thread.h

@@ -91,63 +91,6 @@ typedef struct VideoState {
     bool isMute; //静音标识
     float mVolume; //0~1 超过1 表示放大倍数
 
-//    VideoState()
-//    {
-//        isMute = false;
-
-////        Init();
-//    }
-
-//    void Init()
-//    {
-//        player = NULL;
-//        readThreadFinished = false;
-//        videoThreadFinished = false;
-//        quit = false;
-//        audio_frame = NULL;
-//        video_clock = 0;
-//        audio_clock = 0;
-
-//        ic = NULL;
-//        videoStream = 0;
-//        audioStream = 0;
-//        audio_frame = NULL;// 解码音频过程中的使用缓存
-//        audio_st = NULL; //音频流
-//        audio_buf_size = 0;
-//        audio_buf_index = 0;
-//        audio_pkt_data = NULL;
-//        audio_pkt_size = 0;
-//        audio_buf = NULL;
-//        audio_src_channels = 0;
-//        audio_tgt_channels = 0;
-//        audio_src_channel_layout = 0;
-//        audio_tgt_channel_layout = 0;
-//        audio_src_freq = 0;
-//        audio_tgt_freq = 0;
-//        swr_ctx = NULL; //用于解码后的音频格式转换
-//        audio_hw_buf_size = false;
-
-//        audio_clock = 0; ///音频时钟
-//        video_clock = 0; ///<pts of last decoded frame / predicted pts of next decoded frame
-
-//        video_st = NULL;
-
-//        /// 跳转相关的变量
-//        seek_req = 0; //跳转标志
-//        seek_pos = 0; //跳转的位置 -- 微秒
-//        seek_flag_audio = 0;//跳转标志 -- 用于音频线程中
-//        seek_flag_video = 0;//跳转标志 -- 用于视频线程中
-//        seek_time = 0; //跳转的时间(秒)  值和seek_pos是一样的
-
-//        ///播放控制相关
-//        isPause = false;  //暂停标志
-//        quit = false;  //停止
-//        readFinished = false; //文件读取完毕
-//        readThreadFinished = false;
-//        videoThreadFinished = false;
-
-//    }
-
 } VideoState;
 
 class VideoPlayer_Thread : public QThread
@@ -204,7 +147,7 @@ private:
 
     PlayerState mPlayerState; //播放状态
 
-    ///用自己的控件替代SLD 是因为SDL会导致QSS样式失效
+    ///用自己的控件替代SDL 是因为SDL会导致QSS样式失效
     VideoPlayer_ShowVideoWidget *mVideoWidget; //显示视频用的控件
 
     bool mIsMute;