kopia lustrzana https://github.com/f4exb/sdrangel
Merge pull request #866 from srcejon/dab_images
Add support for displaying images broadcast in the DAB demodulator GUIpull/875/head
commit
8b5ebbd1b5
|
@ -451,27 +451,42 @@ if (ZLIB_FOUND AND FAAD_FOUND)
|
|||
set(DAB_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libdab_lib${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
|
||||
endif()
|
||||
if (WIN32)
|
||||
set(PTHREADS_OPT_FOR_DAB "-DPTHREADS=${PTHREADS4W_LIBRARIES}" CACHE INTERNAL "")
|
||||
else()
|
||||
set(PTHREADS_OPT_FOR_DAB "" CACHE INTERNAL "")
|
||||
endif()
|
||||
ExternalProject_Add(dab
|
||||
GIT_REPOSITORY https://github.com/srcejon/dab-cmdline.git
|
||||
GIT_TAG msvc
|
||||
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dab"
|
||||
SOURCE_SUBDIR "library"
|
||||
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
|
||||
-DFFTW3F_INCLUDE_DIRS=${FFTW3F_INCLUDE_DIRS}
|
||||
-DFFTW3F_LIBRARIES=${FFTW3F_LIBRARIES}
|
||||
-DFAAD_INCLUDE_DIR=${FAAD_INCLUDE_DIR}
|
||||
-DFAAD_LIBRARY=${FAAD_LIBRARY}
|
||||
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
|
||||
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
|
||||
${PTHREADS_OPT_FOR_DAB}
|
||||
BUILD_BYPRODUCTS "${DAB_LIBRARIES}"
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
ExternalProject_Add(dab
|
||||
GIT_REPOSITORY https://github.com/srcejon/dab-cmdline.git
|
||||
GIT_TAG msvc
|
||||
DEPENDS ${PTHREADS4W_DEPENDS}
|
||||
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dab"
|
||||
SOURCE_SUBDIR "library"
|
||||
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
|
||||
-DFFTW3F_INCLUDE_DIRS=${FFTW3F_INCLUDE_DIRS}
|
||||
-DFFTW3F_LIBRARIES=${FFTW3F_LIBRARIES}
|
||||
-DFAAD_INCLUDE_DIR=${FAAD_INCLUDE_DIR}
|
||||
-DFAAD_LIBRARY=${FAAD_LIBRARY}
|
||||
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
|
||||
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
|
||||
-DPTHREADS=${PTHREADS4W_LIBRARIES}
|
||||
BUILD_BYPRODUCTS "${DAB_LIBRARIES}"
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
else(WIN32)
|
||||
ExternalProject_Add(dab
|
||||
GIT_REPOSITORY https://github.com/srcejon/dab-cmdline.git
|
||||
GIT_TAG msvc
|
||||
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dab"
|
||||
SOURCE_SUBDIR "library"
|
||||
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
|
||||
-DFFTW3F_INCLUDE_DIRS=${FFTW3F_INCLUDE_DIRS}
|
||||
-DFFTW3F_LIBRARIES=${FFTW3F_LIBRARIES}
|
||||
-DFAAD_INCLUDE_DIR=${FAAD_INCLUDE_DIR}
|
||||
-DFAAD_LIBRARY=${FAAD_LIBRARY}
|
||||
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
|
||||
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
|
||||
BUILD_BYPRODUCTS "${DAB_LIBRARIES}"
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
endif(WIN32)
|
||||
ExternalProject_Get_Property(dab source_dir binary_dir)
|
||||
set(DAB_FOUND ON CACHE INTERNAL "")
|
||||
set(DAB_EXTERNAL ON CACHE INTERNAL "")
|
||||
|
|
|
@ -48,6 +48,7 @@ MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABProgramQuality, Message)
|
|||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABFIBQuality, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABSampleRate, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABData, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABMOTData, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABReset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABResetService, Message)
|
||||
|
||||
|
@ -232,6 +233,16 @@ bool DABDemod::handleMessage(const Message& cmd)
|
|||
|
||||
return true;
|
||||
}
|
||||
else if (MsgDABMOTData::match(cmd))
|
||||
{
|
||||
MsgDABMOTData& report = (MsgDABMOTData&)cmd;
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
getMessageQueueToGUI()->push(new MsgDABMOTData(report));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgDABReset::match(cmd))
|
||||
{
|
||||
MsgDABReset& report = (MsgDABReset&)cmd;
|
||||
|
|
|
@ -250,6 +250,29 @@ public:
|
|||
{ }
|
||||
};
|
||||
|
||||
class MsgDABMOTData : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString getFilename() const { return m_filename; }
|
||||
int getContentSubType() const { return m_contentSubType; }
|
||||
|
||||
static MsgDABMOTData* create(const QString& filename, int contentSubType)
|
||||
{
|
||||
return new MsgDABMOTData(filename, contentSubType);
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_filename;
|
||||
int m_contentSubType;
|
||||
|
||||
MsgDABMOTData(const QString& filename, int contentSubType) :
|
||||
Message(),
|
||||
m_filename(filename),
|
||||
m_contentSubType(contentSubType)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgDABReset : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
|
|
|
@ -180,6 +180,8 @@ void DABDemodGUI::on_programs_cellDoubleClicked(int row, int column)
|
|||
double frequencyInHz = ui->programs->item(row, PROGRAMS_COL_FREQUENCY)->data(Qt::UserRole).toDouble();
|
||||
ChannelWebAPIUtils::setCenterFrequency(m_dabDemod->getDeviceSetIndex(), frequencyInHz-m_settings.m_inputFrequencyOffset);
|
||||
|
||||
clearProgram();
|
||||
|
||||
applySettings();
|
||||
}
|
||||
|
||||
|
@ -261,6 +263,16 @@ bool DABDemodGUI::handleMessage(const Message& message)
|
|||
ui->data->setText(report.getData());
|
||||
return true;
|
||||
}
|
||||
else if (DABDemod::MsgDABMOTData::match(message))
|
||||
{
|
||||
DABDemod::MsgDABMOTData& report = (DABDemod::MsgDABMOTData&) message;
|
||||
QPixmap pixmap(report.getFilename());
|
||||
ui->motImage->resize(ui->motImage->width(), pixmap.height());
|
||||
ui->motImage->setVisible(true);
|
||||
ui->motImage->setPixmap(pixmap, pixmap.size());
|
||||
arrangeRollups();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -452,6 +464,8 @@ DABDemodGUI::DABDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
|||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
|
||||
ui->motImage->setVisible(false);
|
||||
|
||||
// Resize the table using dummy data
|
||||
resizeTable();
|
||||
// Allow user to reorder columns
|
||||
|
@ -557,11 +571,8 @@ void DABDemodGUI::enterEvent(QEvent*)
|
|||
m_channelMarker.setHighlighted(true);
|
||||
}
|
||||
|
||||
void DABDemodGUI::resetService()
|
||||
void DABDemodGUI::clearProgram()
|
||||
{
|
||||
// Reset DAB audio service, to avoid unpleasent noise when changing frequency
|
||||
DABDemod::MsgDABResetService* message = DABDemod::MsgDABResetService::create();
|
||||
m_dabDemod->getInputMessageQueue()->push(message);
|
||||
// Clear current program
|
||||
ui->program->setText("-");
|
||||
ui->ensemble->setText("-");
|
||||
|
@ -571,6 +582,17 @@ void DABDemodGUI::resetService()
|
|||
ui->bitrate->setText("-");
|
||||
ui->sampleRate->setText("-");
|
||||
ui->data->setText("");
|
||||
ui->motImage->setPixmap(QPixmap());
|
||||
ui->motImage->setVisible(false);
|
||||
arrangeRollups();
|
||||
}
|
||||
|
||||
void DABDemodGUI::resetService()
|
||||
{
|
||||
// Reset DAB audio service, to avoid unpleasent noise when changing frequency
|
||||
DABDemod::MsgDABResetService* message = DABDemod::MsgDABResetService::create();
|
||||
m_dabDemod->getInputMessageQueue()->push(message);
|
||||
clearProgram();
|
||||
}
|
||||
|
||||
void DABDemodGUI::on_channel_currentIndexChanged(int index)
|
||||
|
|
|
@ -85,6 +85,7 @@ private:
|
|||
void leaveEvent(QEvent*);
|
||||
void enterEvent(QEvent*);
|
||||
void resetService();
|
||||
void clearProgram();
|
||||
void resizeTable();
|
||||
QAction *createCheckableItem(QString& text, int idx, bool checked);
|
||||
|
||||
|
|
|
@ -825,6 +825,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ScaledImage" name="motImage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="statistics" native="true">
|
||||
|
@ -1006,6 +1022,11 @@
|
|||
<header>gui/levelmeter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ScaledImage</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/scaledimage.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>programs</tabstop>
|
||||
|
|
|
@ -274,11 +274,10 @@ void programQualityHandler(int16_t frames, int16_t rs, int16_t aac, void *ctx)
|
|||
sink->programQuality(frames, rs, aac);
|
||||
}
|
||||
|
||||
void motDataHandler(std::string data, int a, void *ctx)
|
||||
void motDataHandler(std::string filename, int contentsubType, void *ctx)
|
||||
{
|
||||
(void)data;
|
||||
(void)a;
|
||||
(void)ctx;
|
||||
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||
sink->motData(filename.c_str(), contentsubType);
|
||||
}
|
||||
|
||||
void DABDemodSink::systemData(bool sync, int16_t snr, int32_t freqOffset)
|
||||
|
@ -343,6 +342,15 @@ void DABDemodSink::data(const QString& data)
|
|||
}
|
||||
}
|
||||
|
||||
void DABDemodSink::motData(const QString& filename, int contentSubType)
|
||||
{
|
||||
if (getMessageQueueToChannel())
|
||||
{
|
||||
DABDemod::MsgDABMOTData *msg = DABDemod::MsgDABMOTData::create(filename, contentSubType);
|
||||
getMessageQueueToChannel()->push(msg);
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t scale(int16_t sample, float factor)
|
||||
{
|
||||
int32_t prod = (int32_t)(((int32_t)sample) * factor);
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
void programQuality(int16_t frames, int16_t rs, int16_t aac);
|
||||
void fibQuality(int16_t percent);
|
||||
void data(const QString& data);
|
||||
void motData(const QString& filename, int contentSubType);
|
||||
|
||||
private:
|
||||
struct MagSqLevelsStore
|
||||
|
|
Ładowanie…
Reference in New Issue