mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
DATV demod: audio test (1)
This commit is contained in:
parent
3d86752411
commit
4f1247301f
@ -15,6 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
@ -39,6 +41,7 @@ DATVideoRender::DATVideoRender(QWidget *parent) : TVScreen(true, parent)
|
|||||||
m_audioFifo = nullptr;
|
m_audioFifo = nullptr;
|
||||||
m_audioSWR = nullptr;
|
m_audioSWR = nullptr;
|
||||||
m_audioSampleRate = 48000;
|
m_audioSampleRate = 48000;
|
||||||
|
m_audioTestIndex = 0;
|
||||||
m_videoStreamIndex = -1;
|
m_videoStreamIndex = -1;
|
||||||
m_audioStreamIndex = -1;
|
m_audioStreamIndex = -1;
|
||||||
|
|
||||||
@ -47,6 +50,12 @@ DATVideoRender::DATVideoRender(QWidget *parent) : TVScreen(true, parent)
|
|||||||
|
|
||||||
m_frame = nullptr;
|
m_frame = nullptr;
|
||||||
m_frameCount = -1;
|
m_frameCount = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < 512; i++)
|
||||||
|
{
|
||||||
|
m_audioTest[2*i] = 32768.0f * sin((M_PI * i)/256.0f);
|
||||||
|
m_audioTest[2*i+1] = m_audioTest[2*i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DATVideoRender::eventFilter(QObject *obj, QEvent *event)
|
bool DATVideoRender::eventFilter(QObject *obj, QEvent *event)
|
||||||
@ -556,13 +565,14 @@ bool DATVideoRender::RenderStream()
|
|||||||
uint16_t *audioBuffer;
|
uint16_t *audioBuffer;
|
||||||
av_samples_alloc((uint8_t**) &audioBuffer, nullptr, 2, m_frame->nb_samples, AV_SAMPLE_FMT_S16, 0);
|
av_samples_alloc((uint8_t**) &audioBuffer, nullptr, 2, m_frame->nb_samples, AV_SAMPLE_FMT_S16, 0);
|
||||||
int frame_count = swr_convert(m_audioSWR, (uint8_t**) &audioBuffer, m_frame->nb_samples, (const uint8_t**) m_frame->data, m_frame->nb_samples);
|
int frame_count = swr_convert(m_audioSWR, (uint8_t**) &audioBuffer, m_frame->nb_samples, (const uint8_t**) m_frame->data, m_frame->nb_samples);
|
||||||
int res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], frame_count);
|
|
||||||
|
|
||||||
if (res != frame_count)
|
// int res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], frame_count);
|
||||||
{
|
|
||||||
qDebug("DATVideoRender::RenderStream: %u/%u audio samples written", res, frame_count);
|
// if (res != frame_count)
|
||||||
m_audioFifo->clear();
|
// {
|
||||||
}
|
// qDebug("DATVideoRender::RenderStream: %u/%u audio samples written", res, frame_count);
|
||||||
|
// m_audioFifo->clear();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,8 @@ class DATVideoRender : public TVScreen
|
|||||||
AudioFifo *m_audioFifo;
|
AudioFifo *m_audioFifo;
|
||||||
struct SwrContext* m_audioSWR;
|
struct SwrContext* m_audioSWR;
|
||||||
int m_audioSampleRate;
|
int m_audioSampleRate;
|
||||||
|
uint16_t m_audioTest[1024];
|
||||||
|
int m_audioTestIndex;
|
||||||
|
|
||||||
uint8_t *m_pbytDecodedData[4];
|
uint8_t *m_pbytDecodedData[4];
|
||||||
int m_pintDecodedLineSize[4];
|
int m_pintDecodedLineSize[4];
|
||||||
|
Loading…
Reference in New Issue
Block a user