DATV demod: process video and audio mute buttons coloring the same way. Make audio voulme log

pull/326/head
f4exb 2019-03-23 09:38:29 +01:00
rodzic 2d6730678d
commit af181914e1
6 zmienionych plików z 158 dodań i 100 usunięć

3
debian/changelog vendored
Wyświetl plik

@ -1,11 +1,12 @@
sdrangel (4.5.1-1) unstable; urgency=medium sdrangel (4.5.1-1) unstable; urgency=medium
* DATV demod: implemented audio processing
* Perseus: fixed cold start flawed init sequence * Perseus: fixed cold start flawed init sequence
* PlutoSDR: recognize networked devices * PlutoSDR: recognize networked devices
* FreeDV: internal FreeDV library to facilitate packaging * FreeDV: internal FreeDV library to facilitate packaging
* Fixed some constness in qrtplib * Fixed some constness in qrtplib
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 17 Mar 2019 20:14:18 +0100 -- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Fri, 22 Mar 2019 20:14:18 +0100
sdrangel (4.5.0-1) unstable; urgency=medium sdrangel (4.5.0-1) unstable; urgency=medium

Wyświetl plik

@ -124,6 +124,33 @@ bool DATVDemod::audioActive()
} }
} }
bool DATVDemod::videoActive()
{
if (m_objRegisteredVideoRender) {
return m_objRegisteredVideoRender->getVideoStreamIndex() >= 0;
} else {
return false;
}
}
bool DATVDemod::audioDecodeOK()
{
if (m_objRegisteredVideoRender) {
return m_objRegisteredVideoRender->getAudioDecodeOK();
} else {
return false;
}
}
bool DATVDemod::videoDecodeOK()
{
if (m_objRegisteredVideoRender) {
return m_objRegisteredVideoRender->getVideoDecodeOK();
} else {
return false;
}
}
bool DATVDemod::PlayVideo(bool blnStartStop) bool DATVDemod::PlayVideo(bool blnStartStop)
{ {

Wyświetl plik

@ -147,6 +147,9 @@ public:
bool SetTVScreen(TVScreen *objScreen); bool SetTVScreen(TVScreen *objScreen);
DATVideostream * SetVideoRender(DATVideoRender *objScreen); DATVideostream * SetVideoRender(DATVideoRender *objScreen);
bool audioActive(); bool audioActive();
bool audioDecodeOK();
bool videoActive();
bool videoDecodeOK();
bool PlayVideo(bool blnStartStop); bool PlayVideo(bool blnStartStop);

Wyświetl plik

@ -404,12 +404,32 @@ void DATVDemodGUI::tick()
ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed))); ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed)));
} }
if (m_objDATVDemod->audioActive()) { if (m_objDATVDemod->audioActive())
{
if (m_objDATVDemod->audioDecodeOK()) {
ui->audioMute->setStyleSheet("QToolButton { background-color : green; }"); ui->audioMute->setStyleSheet("QToolButton { background-color : green; }");
} else { } else {
ui->audioMute->setStyleSheet("QToolButton { background-color : red; }");
}
}
else
{
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
} }
if (m_objDATVDemod->videoActive())
{
if (m_objDATVDemod->videoDecodeOK()) {
ui->videoMute->setStyleSheet("QToolButton { background-color : green; }");
} else {
ui->videoMute->setStyleSheet("QToolButton { background-color : red; }");
}
}
else
{
ui->videoMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
m_intPreviousDecodedData = m_intLastDecodedData; m_intPreviousDecodedData = m_intLastDecodedData;
//Try to start video rendering //Try to start video rendering
@ -675,12 +695,6 @@ void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
ui->chkVS->setChecked(objMetaData->OK_VideoStream); ui->chkVS->setChecked(objMetaData->OK_VideoStream);
ui->chkDecoding->setChecked(objMetaData->OK_Decoding); ui->chkDecoding->setChecked(objMetaData->OK_Decoding);
if (objMetaData->OK_Decoding) {
ui->videoMute->setStyleSheet("QToolButton { background-color : green; }");
} else {
ui->videoMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
if (objMetaData->Height > 0) { if (objMetaData->Height > 0) {
ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height)); ui->screenTV_2->setFixedWidth((int)objMetaData->Width*(270.0f/(float)objMetaData->Height));
} }

Wyświetl plik

@ -54,6 +54,9 @@ DATVideoRender::DATVideoRender(QWidget *parent) : TVScreen(true, parent)
m_frame = nullptr; m_frame = nullptr;
m_frameCount = -1; m_frameCount = -1;
m_audioDecodeOK = false;
m_videoDecodeOK = false;
// for (int i = 0; i < m_audioFifoBufferSize; i++) // 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] = 8192.0f * sin((M_PI * i)/(m_audioFifoBufferSize/1000.0f));
@ -487,12 +490,9 @@ bool DATVideoRender::RenderStream()
gotFrame = 0; gotFrame = 0;
if (new_decode(m_videoDecoderCtx, m_frame, &gotFrame, &packet) < 0) if (new_decode(m_videoDecoderCtx, m_frame, &gotFrame, &packet) >= 0)
{ {
qDebug() << "DATVideoProcess::RenderStream decoding video packet error"; m_videoDecodeOK = true;
m_running = false;
return false;
}
if (gotFrame) if (gotFrame)
{ {
@ -578,6 +578,12 @@ bool DATVideoRender::RenderStream()
m_frameCount++; m_frameCount++;
} }
} }
else
{
m_videoDecodeOK = false;
// qDebug() << "DATVideoProcess::RenderStream video decode error";
}
}
// Audio channel // Audio channel
else if ((packet.stream_index == m_audioStreamIndex) && (m_audioFifo) && (swr_is_initialized(m_audioSWR)) && (!m_audioMute)) else if ((packet.stream_index == m_audioStreamIndex) && (m_audioFifo) && (swr_is_initialized(m_audioSWR)) && (!m_audioMute))
{ {
@ -592,8 +598,9 @@ bool DATVideoRender::RenderStream()
gotFrame = 0; gotFrame = 0;
if (new_decode(m_audioDecoderCtx, m_frame, &gotFrame, &packet) >= 0) if (new_decode(m_audioDecoderCtx, m_frame, &gotFrame, &packet) >= 0)
//if (avcodec_decode_audio4(m_audioDecoderCtx, m_frame, &gotFrame, &packet) >= 0) // old style
{ {
m_audioDecodeOK = true;
if (gotFrame) if (gotFrame)
{ {
int16_t *audioBuffer; int16_t *audioBuffer;
@ -639,7 +646,8 @@ bool DATVideoRender::RenderStream()
} }
else else
{ {
qDebug("DATVideoRender::RenderStream: audio decode error"); m_audioDecodeOK = false;
// qDebug("DATVideoRender::RenderStream: audio decode error");
} }
} }
@ -648,14 +656,13 @@ bool DATVideoRender::RenderStream()
//********** Rendering ********** //********** Rendering **********
m_running = false; m_running = false;
return true; return true;
} }
void DATVideoRender::setAudioVolume(int audioVolume) void DATVideoRender::setAudioVolume(int audioVolume)
{ {
int audioVolumeConstrained = audioVolume < 0 ? 0 : audioVolume > 100 ? 100 : audioVolume; int audioVolumeConstrained = audioVolume < 0 ? 0 : audioVolume > 100 ? 100 : audioVolume;
m_audioVolume = audioVolumeConstrained / 100.0f; m_audioVolume = pow(10.0, audioVolumeConstrained*0.02 - 2.0); // .01 -> 1 log
} }
void DATVideoRender::setResampler() void DATVideoRender::setResampler()

Wyświetl plik

@ -103,6 +103,9 @@ class DATVideoRender : public TVScreen
void setVideoMute(bool videoMute) { m_videoMute = videoMute; } void setVideoMute(bool videoMute) { m_videoMute = videoMute; }
void setAudioVolume(int audioVolume); void setAudioVolume(int audioVolume);
bool getAudioDecodeOK() const { return m_audioDecodeOK; }
bool getVideoDecodeOK() const { return m_videoDecodeOK; }
struct DataTSMetaData2 MetaData; struct DataTSMetaData2 MetaData;
private: private:
@ -138,6 +141,9 @@ class DATVideoRender : public TVScreen
int m_currentRenderWidth; int m_currentRenderWidth;
int m_currentRenderHeight; int m_currentRenderHeight;
bool m_audioDecodeOK;
bool m_videoDecodeOK;
bool InitializeFFMPEG(); bool InitializeFFMPEG();
bool PreprocessStream(); bool PreprocessStream();
void ResetMetaData(); void ResetMetaData();