Browse Source

V0.2.19
1、修复了视频播放器的设置进度的问题,解决了设置超过长度的bug

Apple 6 months ago
parent
commit
a5378e5a13

+ 21 - 2
common/VideoPlayer/DecodeVedio.cpp → common/VedioPlayer/DecodeVedio.cpp

@@ -108,9 +108,27 @@ void DecodeVedio::setCurrentPos(quint64 pos)
         std::this_thread::sleep_for(std::chrono::milliseconds(1));
     }
     m_isSeek = true;
+    /* 这个是int64最大的正数值 */
+    if(pos > 9223372036854775807)
+    {
+        pos = 0;
+    }
     /* 去掉队列中已有的图片数目对应的时长,单位是us */
-    int queueNumFPS = m_queueImage.count() * ( 1000.0f / m_fps ) * 1000 ;
+    qint64 queueNumFPS = m_queueImage.count() * ( 1000.0f / m_fps ) * 1000 ;
     qint64 target_pos = m_startPos + pos - queueNumFPS;
+    qint64 end_pos = m_startPos + m_duration;
+    /* 检查是否超过视频大小 */
+    if(target_pos > end_pos)
+    {
+        /* 跳转到最后 */
+        target_pos = end_pos;
+        // SPDLOG_DEBUG("现在的位置:{} 时长:{} 跳转到最后30帧",target_pos, m_duration);
+    }
+    if(target_pos < m_startPos)
+    {
+        target_pos = m_startPos;
+        // SPDLOG_DEBUG("现在的位置:{} 时长:{} 跳转到开始",target_pos, m_startPos);
+    }
     m_currentPos = target_pos;
     SPDLOG_DEBUG("设置播放位置:{}",target_pos);
     /* 第二个参数设置为-1,表示所有流都跳转 */
@@ -657,5 +675,6 @@ void DecodeVedio::do_startDecodeVedio()
     m_pauseDecode = false;
     /* 进入解码,直到播放完成或者手动退出 */
     decodeVedio();
-    SPDLOG_TRACE("播放完成...");
+    SPDLOG_TRACE("Decode播放完成...");
+
 }

+ 0 - 0
common/VideoPlayer/DecodeVedio.h → common/VedioPlayer/DecodeVedio.h


+ 1 - 1
common/VideoPlayer/VideoPlayer.cpp → common/VedioPlayer/VideoPlayer.cpp

@@ -374,7 +374,7 @@ void VideoPlayer::do_refreshOneUI()
 /* 播放完成 */
 void VideoPlayer::do_playCompleted()
 {
-    SPDLOG_INFO("播放完成...");
+    SPDLOG_INFO("Video 播放完成...");
     m_timerRefreshUI.stop();
     m_playStatus = false;
     if(m_funcPlayCB != nullptr)

+ 0 - 0
common/VideoPlayer/VideoPlayer.h → common/VedioPlayer/VideoPlayer.h