From 45b12a1c2d16c728f6e9f79e200087ef9804456e Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 4 Apr 2021 10:33:35 +0200 Subject: [PATCH] DATV demod: player refactoring: preliminary cleanup (1) --- .../channelrx/demoddatv/datvideorender.cpp | 39 +++---------------- plugins/channelrx/demoddatv/datvideorender.h | 2 - .../channelrx/demoddatv/datvideostream.cpp | 11 ------ plugins/channelrx/demoddatv/datvideostream.h | 1 - 4 files changed, 5 insertions(+), 48 deletions(-) diff --git a/plugins/channelrx/demoddatv/datvideorender.cpp b/plugins/channelrx/demoddatv/datvideorender.cpp index d23ea44a5..381575ac5 100644 --- a/plugins/channelrx/demoddatv/datvideorender.cpp +++ b/plugins/channelrx/demoddatv/datvideorender.cpp @@ -30,11 +30,11 @@ extern "C" #include "datvideorender.h" DATVideoRender::DATVideoRender(QWidget *parent) : - TVScreen(true, parent), m_parentWidget(parent) + TVScreen(true, parent), + m_parentWidget(parent) { installEventFilter(this); m_isFullScreen = false; - m_isFFMPEGInitialized = false; m_isOpen = false; m_formatCtx = nullptr; m_videoDecoderCtx = nullptr; @@ -59,11 +59,7 @@ DATVideoRender::DATVideoRender(QWidget *parent) : m_audioDecodeOK = false; m_videoDecodeOK = false; - // for (int i = 0; i < m_audioFifoBufferSize; i++) - // { - // m_audioFifoBuffer[2*i] = 8192.0f * sin((M_PI * i)/(m_audioFifoBufferSize/1000.0f)); - // m_audioFifoBuffer[2*i+1] = m_audioFifoBuffer[2*i]; - // } + av_log_set_level(AV_LOG_FATAL); } DATVideoRender::~DATVideoRender() @@ -161,25 +157,6 @@ void DATVideoRender::ResetMetaData() emit onMetaDataChanged(new DataTSMetaData2(m_metaData)); } -bool DATVideoRender::InitializeFFMPEG() -{ - ResetMetaData(); - - if (m_isFFMPEGInitialized) - { - return false; - } - - //avcodec_register_all(); - //av_register_all(); - av_log_set_level(AV_LOG_FATAL); - //av_log_set_level(AV_LOG_ERROR); - - m_isFFMPEGInitialized = true; - - return true; -} - bool DATVideoRender::PreprocessStream() { AVDictionary *opts = nullptr; @@ -189,6 +166,8 @@ bool DATVideoRender::PreprocessStream() int intRet = -1; char *buffer = nullptr; + ResetMetaData(); + //Identify stream if (avformat_find_stream_info(m_formatCtx, nullptr) < 0) @@ -393,14 +372,6 @@ bool DATVideoRender::OpenStream(DATVideostream *device) m_metaData.OK_Data = true; emit onMetaDataChanged(new DataTSMetaData2(m_metaData)); - InitializeFFMPEG(); - - if (!m_isFFMPEGInitialized) - { - qDebug() << "DATVideoRender::OpenStream FFMPEG not initialized"; - return false; - } - if (!device->open(QIODevice::ReadOnly)) { qDebug() << "DATVideoRender::OpenStream cannot open QIODevice"; diff --git a/plugins/channelrx/demoddatv/datvideorender.h b/plugins/channelrx/demoddatv/datvideorender.h index 0f395a5c8..b66110fe6 100644 --- a/plugins/channelrx/demoddatv/datvideorender.h +++ b/plugins/channelrx/demoddatv/datvideorender.h @@ -136,7 +136,6 @@ class DATVideoRender : public TVScreen bool m_isFullScreen; - bool m_isFFMPEGInitialized; bool m_isOpen; SwsContext *m_swsCtx; @@ -167,7 +166,6 @@ class DATVideoRender : public TVScreen bool m_audioDecodeOK; bool m_videoDecodeOK; - bool InitializeFFMPEG(); bool PreprocessStream(); void ResetMetaData(); diff --git a/plugins/channelrx/demoddatv/datvideostream.cpp b/plugins/channelrx/demoddatv/datvideostream.cpp index 227b3d350..387c12e0b 100644 --- a/plugins/channelrx/demoddatv/datvideostream.cpp +++ b/plugins/channelrx/demoddatv/datvideostream.cpp @@ -54,17 +54,6 @@ void DATVideostream::cleanUp() m_intPercentBuffer = 0; } -bool DATVideostream::setMemoryLimit(int intMemoryLimit) -{ - if (intMemoryLimit <= 0) { - return false; - } - - m_intMemoryLimit = intMemoryLimit; - - return true; -} - void DATVideostream::resetTotalReceived() { m_intTotalReceived = 0; diff --git a/plugins/channelrx/demoddatv/datvideostream.h b/plugins/channelrx/demoddatv/datvideostream.h index f429a009f..38903cf58 100644 --- a/plugins/channelrx/demoddatv/datvideostream.h +++ b/plugins/channelrx/demoddatv/datvideostream.h @@ -41,7 +41,6 @@ public: int ThreadTimeOut; int pushData(const char * chrData, int intSize); - bool setMemoryLimit(int intMemoryLimit); void resetTotalReceived(); void cleanUp();