mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 19:28:47 -05:00
DATV demod: player refactoring: preliminary cleanup (1)
This commit is contained in:
parent
dcae5e29e2
commit
45b12a1c2d
@ -30,11 +30,11 @@ extern "C"
|
|||||||
#include "datvideorender.h"
|
#include "datvideorender.h"
|
||||||
|
|
||||||
DATVideoRender::DATVideoRender(QWidget *parent) :
|
DATVideoRender::DATVideoRender(QWidget *parent) :
|
||||||
TVScreen(true, parent), m_parentWidget(parent)
|
TVScreen(true, parent),
|
||||||
|
m_parentWidget(parent)
|
||||||
{
|
{
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
m_isFullScreen = false;
|
m_isFullScreen = false;
|
||||||
m_isFFMPEGInitialized = false;
|
|
||||||
m_isOpen = false;
|
m_isOpen = false;
|
||||||
m_formatCtx = nullptr;
|
m_formatCtx = nullptr;
|
||||||
m_videoDecoderCtx = nullptr;
|
m_videoDecoderCtx = nullptr;
|
||||||
@ -59,11 +59,7 @@ DATVideoRender::DATVideoRender(QWidget *parent) :
|
|||||||
m_audioDecodeOK = false;
|
m_audioDecodeOK = false;
|
||||||
m_videoDecodeOK = false;
|
m_videoDecodeOK = false;
|
||||||
|
|
||||||
// for (int i = 0; i < m_audioFifoBufferSize; i++)
|
av_log_set_level(AV_LOG_FATAL);
|
||||||
// {
|
|
||||||
// m_audioFifoBuffer[2*i] = 8192.0f * sin((M_PI * i)/(m_audioFifoBufferSize/1000.0f));
|
|
||||||
// m_audioFifoBuffer[2*i+1] = m_audioFifoBuffer[2*i];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DATVideoRender::~DATVideoRender()
|
DATVideoRender::~DATVideoRender()
|
||||||
@ -161,25 +157,6 @@ void DATVideoRender::ResetMetaData()
|
|||||||
emit onMetaDataChanged(new DataTSMetaData2(m_metaData));
|
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()
|
bool DATVideoRender::PreprocessStream()
|
||||||
{
|
{
|
||||||
AVDictionary *opts = nullptr;
|
AVDictionary *opts = nullptr;
|
||||||
@ -189,6 +166,8 @@ bool DATVideoRender::PreprocessStream()
|
|||||||
int intRet = -1;
|
int intRet = -1;
|
||||||
char *buffer = nullptr;
|
char *buffer = nullptr;
|
||||||
|
|
||||||
|
ResetMetaData();
|
||||||
|
|
||||||
//Identify stream
|
//Identify stream
|
||||||
|
|
||||||
if (avformat_find_stream_info(m_formatCtx, nullptr) < 0)
|
if (avformat_find_stream_info(m_formatCtx, nullptr) < 0)
|
||||||
@ -393,14 +372,6 @@ bool DATVideoRender::OpenStream(DATVideostream *device)
|
|||||||
m_metaData.OK_Data = true;
|
m_metaData.OK_Data = true;
|
||||||
emit onMetaDataChanged(new DataTSMetaData2(m_metaData));
|
emit onMetaDataChanged(new DataTSMetaData2(m_metaData));
|
||||||
|
|
||||||
InitializeFFMPEG();
|
|
||||||
|
|
||||||
if (!m_isFFMPEGInitialized)
|
|
||||||
{
|
|
||||||
qDebug() << "DATVideoRender::OpenStream FFMPEG not initialized";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!device->open(QIODevice::ReadOnly))
|
if (!device->open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
qDebug() << "DATVideoRender::OpenStream cannot open QIODevice";
|
qDebug() << "DATVideoRender::OpenStream cannot open QIODevice";
|
||||||
|
@ -136,7 +136,6 @@ class DATVideoRender : public TVScreen
|
|||||||
|
|
||||||
bool m_isFullScreen;
|
bool m_isFullScreen;
|
||||||
|
|
||||||
bool m_isFFMPEGInitialized;
|
|
||||||
bool m_isOpen;
|
bool m_isOpen;
|
||||||
|
|
||||||
SwsContext *m_swsCtx;
|
SwsContext *m_swsCtx;
|
||||||
@ -167,7 +166,6 @@ class DATVideoRender : public TVScreen
|
|||||||
bool m_audioDecodeOK;
|
bool m_audioDecodeOK;
|
||||||
bool m_videoDecodeOK;
|
bool m_videoDecodeOK;
|
||||||
|
|
||||||
bool InitializeFFMPEG();
|
|
||||||
bool PreprocessStream();
|
bool PreprocessStream();
|
||||||
void ResetMetaData();
|
void ResetMetaData();
|
||||||
|
|
||||||
|
@ -54,17 +54,6 @@ void DATVideostream::cleanUp()
|
|||||||
m_intPercentBuffer = 0;
|
m_intPercentBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DATVideostream::setMemoryLimit(int intMemoryLimit)
|
|
||||||
{
|
|
||||||
if (intMemoryLimit <= 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_intMemoryLimit = intMemoryLimit;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DATVideostream::resetTotalReceived()
|
void DATVideostream::resetTotalReceived()
|
||||||
{
|
{
|
||||||
m_intTotalReceived = 0;
|
m_intTotalReceived = 0;
|
||||||
|
@ -41,7 +41,6 @@ public:
|
|||||||
int ThreadTimeOut;
|
int ThreadTimeOut;
|
||||||
|
|
||||||
int pushData(const char * chrData, int intSize);
|
int pushData(const char * chrData, int intSize);
|
||||||
bool setMemoryLimit(int intMemoryLimit);
|
|
||||||
void resetTotalReceived();
|
void resetTotalReceived();
|
||||||
void cleanUp();
|
void cleanUp();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user