1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

ATV Modulator: added camera details to the GUI

This commit is contained in:
f4exb 2017-03-11 06:57:22 +01:00
parent 2adf6da86d
commit 41fac50526
7 changed files with 133 additions and 27 deletions

View File

@ -624,6 +624,14 @@ void ATVMod::scanCameras()
m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(CV_CAP_PROP_FPS); m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(CV_CAP_PROP_FPS);
m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_WIDTH); m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_WIDTH);
m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_HEIGHT); m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_HEIGHT);
m_cameras.back().m_videoFPS = m_cameras.back().m_videoFPS < 0 ? 25.0f : m_cameras.back().m_videoFPS;
qDebug("ATVMod::scanCameras: [%d] FPS: %f %dx%d",
i,
m_cameras.back().m_videoFPS,
m_cameras.back().m_videoWidth ,
m_cameras.back().m_videoHeight);
} }
else else
{ {
@ -634,13 +642,6 @@ void ATVMod::scanCameras()
if (m_cameras.size() > 0) if (m_cameras.size() > 0)
{ {
m_cameraIndex = 0; m_cameraIndex = 0;
MsgReportCameraData *report;
report = MsgReportCameraData::create(
m_cameras[0].m_cameraNumber,
m_cameras[0].m_videoFPS,
m_cameras[0].m_videoWidth,
m_cameras[0].m_videoHeight);
getOutputMessageQueue()->push(report);
} }
} }
@ -652,3 +653,21 @@ void ATVMod::releaseCameras()
} }
} }
void ATVMod::getCameraNumbers(std::vector<int>& numbers)
{
for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it) {
numbers.push_back(it->m_cameraNumber);
}
if (m_cameras.size() > 0)
{
m_cameraIndex = 0;
MsgReportCameraData *report;
report = MsgReportCameraData::create(
m_cameras[0].m_cameraNumber,
m_cameras[0].m_videoFPS,
m_cameras[0].m_videoWidth,
m_cameras[0].m_videoHeight);
getOutputMessageQueue()->push(report);
}
}

View File

@ -214,7 +214,7 @@ public:
public: public:
int getdeviceNumber() const { return m_deviceNumber; } int getdeviceNumber() const { return m_deviceNumber; }
int getFPS() const { return m_fps; } float getFPS() const { return m_fps; }
int getWidth() const { return m_width; } int getWidth() const { return m_width; }
int getHeight() const { return m_height; } int getHeight() const { return m_height; }
@ -233,13 +233,13 @@ public:
protected: protected:
int m_deviceNumber; int m_deviceNumber;
int m_fps; float m_fps;
int m_width; int m_width;
int m_height; int m_height;
MsgReportCameraData( MsgReportCameraData(
int deviceNumber, int deviceNumber,
int fps, float fps,
int width, int width,
int height) : int height) :
Message(), Message(),
@ -271,11 +271,7 @@ public:
Real getMagSq() const { return m_movingAverage.average(); } Real getMagSq() const { return m_movingAverage.average(); }
void getCameraNumbers(std::vector<int>& numbers) { void getCameraNumbers(std::vector<int>& numbers);
for (std::vector<ATVCamera>::iterator it = m_cameras.begin(); it != m_cameras.end(); ++it) {
numbers.push_back(it->m_cameraNumber);
}
}
static int getSampleRateUnits(ATVStd std); static int getSampleRateUnits(ATVStd std);
@ -349,7 +345,7 @@ private:
{ } { }
}; };
typedef struct ATVCamera struct ATVCamera
{ {
cv::VideoCapture m_camera; //!< camera object cv::VideoCapture m_camera; //!< camera object
cv::Mat m_videoframeOriginal; //!< camera non resized image cv::Mat m_videoframeOriginal; //!< camera non resized image
@ -364,7 +360,7 @@ private:
ATVCamera() : ATVCamera() :
m_cameraNumber(-1), m_cameraNumber(-1),
m_videoFPS(25), m_videoFPS(25.0f),
m_videoWidth(1), m_videoWidth(1),
m_videoHeight(1), m_videoHeight(1),
m_videoFx(1.0f), m_videoFx(1.0f),

View File

@ -164,7 +164,10 @@ bool ATVModGUI::handleMessage(const Message& message)
} }
else if (ATVMod::MsgReportCameraData::match(message)) else if (ATVMod::MsgReportCameraData::match(message))
{ {
// TODO ATVMod::MsgReportCameraData& rpt = (ATVMod::MsgReportCameraData&) message;
ui->cameraDeviceNumber->setText(tr("#%1").arg(rpt.getdeviceNumber()));
ui->camerFPS->setText(tr("%1 FPS").arg(rpt.getFPS(), 0, 'f', 2));
ui->cameraImageSize->setText(tr("%1x%2").arg(rpt.getWidth()).arg(rpt.getHeight()));
return true; return true;
} }
else else
@ -270,7 +273,7 @@ void ATVModGUI::on_playLoop_toggled(bool checked)
applySettings(); applySettings();
} }
void ATVModGUI::on_play_toggled(bool checked) void ATVModGUI::on_playVideo_toggled(bool checked)
{ {
ui->navTimeSlider->setEnabled(!checked); ui->navTimeSlider->setEnabled(!checked);
m_enableNavTime = !checked; m_enableNavTime = !checked;
@ -406,7 +409,7 @@ void ATVModGUI::applySettings()
ui->uniformLevel->value() / 100.0f, ui->uniformLevel->value() / 100.0f,
(ATVMod::ATVModulation) ui->modulation->currentIndex(), (ATVMod::ATVModulation) ui->modulation->currentIndex(),
ui->playLoop->isChecked(), ui->playLoop->isChecked(),
ui->play->isChecked(), ui->playVideo->isChecked(),
ui->channelMute->isChecked()); ui->channelMute->isChecked());
} }
} }

View File

@ -68,7 +68,7 @@ private slots:
void on_imageFileDialog_clicked(bool checked); void on_imageFileDialog_clicked(bool checked);
void on_videoFileDialog_clicked(bool checked); void on_videoFileDialog_clicked(bool checked);
void on_play_toggled(bool checked); void on_playVideo_toggled(bool checked);
void on_playLoop_toggled(bool checked); void on_playLoop_toggled(bool checked);
void on_navTimeSlider_valueChanged(int value); void on_navTimeSlider_valueChanged(int value);

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>342</width> <width>386</width>
<height>364</height> <height>364</height>
</rect> </rect>
</property> </property>
@ -39,13 +39,13 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>320</width> <width>360</width>
<height>341</height> <height>341</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>280</width> <width>360</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -536,7 +536,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="play"> <widget class="ButtonSwitch" name="playVideo">
<property name="toolTip"> <property name="toolTip">
<string>Record file play/pause</string> <string>Record file play/pause</string>
</property> </property>
@ -656,13 +656,100 @@
<layout class="QHBoxLayout" name="camLayout"> <layout class="QHBoxLayout" name="camLayout">
<item> <item>
<widget class="QLabel" name="camLabel"> <widget class="QLabel" name="camLabel">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Cam</string> <string/>
</property>
<property name="pixmap">
<pixmap resource="../../../sdrbase/resources/res.qrc">:/camera.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="camSelect"/> <widget class="ButtonSwitch" name="playCamera">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/pause.png</normalon>
<disabledoff>:/play.png</disabledoff>
<disabledon>:/play.png</disabledon>:/play.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="camSelect">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Select camera</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="cameraDeviceNumber">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>camera device number</string>
</property>
<property name="text">
<string>--</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="camerFPS">
<property name="minimumSize">
<size>
<width>66</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>camera FPS</string>
</property>
<property name="text">
<string>--</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="cameraImageSize">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>camera image size</string>
</property>
<property name="text">
<string>--</string>
</property>
</widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_4">

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

View File

@ -74,5 +74,6 @@
<file>film_reel.png</file> <file>film_reel.png</file>
<file>film.png</file> <file>film.png</file>
<file>picture.png</file> <file>picture.png</file>
<file>camera.png</file>
</qresource> </qresource>
</RCC> </RCC>