This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: qv4l2: support querying TV standard and video presets.
Author:  Hans Verkuil <[email protected]>
Date:    Fri Oct 7 08:33:18 2011 +0200

Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 1b9dfaf5ffc624320d52fe4caa5f96d053530fef)

Signed-off-by: Gregor Jasny <[email protected]>

 utils/qv4l2/general-tab.cpp |   47 +++++++++++++++++++++++++++++++++++++++---
 utils/qv4l2/general-tab.h   |    5 ++++
 utils/qv4l2/v4l2-api.cpp    |   10 +++++++++
 utils/qv4l2/v4l2-api.h      |    2 +
 4 files changed, 60 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=b688c02bb9ef520bd240a60bf408afe9aa4a327f

diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp
index a306f16..3e97b4b 100644
--- a/utils/qv4l2/general-tab.cpp
+++ b/utils/qv4l2/general-tab.cpp
@@ -23,6 +23,7 @@
 
 #include <QSpinBox>
 #include <QComboBox>
+#include <QPushButton>
 
 #include <errno.h>
 
@@ -34,7 +35,9 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int 
n, QWidget *parent)
        m_cols(n),
        m_audioInput(NULL),
        m_tvStandard(NULL),
+       m_qryStandard(NULL),
        m_videoPreset(NULL),
+       m_qryPreset(NULL),
        m_freq(NULL),
        m_vidCapFormats(NULL),
        m_frameSize(NULL),
@@ -69,6 +72,10 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int 
n, QWidget *parent)
                } while (enum_std(vs));
                addWidget(m_tvStandard);
                connect(m_tvStandard, SIGNAL(activated(int)), 
SLOT(standardChanged(int)));
+               addLabel("");
+               m_qryStandard = new QPushButton("Query Standard", parent);
+               addWidget(m_qryStandard);
+               connect(m_qryStandard, SIGNAL(clicked()), 
SLOT(qryStdClicked()));
        }
 
        v4l2_dv_enum_preset preset;
@@ -80,6 +87,10 @@ GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int 
n, QWidget *parent)
                } while (enum_dv_preset(preset));
                addWidget(m_videoPreset);
                connect(m_videoPreset, SIGNAL(activated(int)), 
SLOT(presetChanged(int)));
+               addLabel("");
+               m_qryPreset = new QPushButton("Query Preset", parent);
+               addWidget(m_qryPreset);
+               connect(m_qryPreset, SIGNAL(clicked()), 
SLOT(qryPresetClicked()));
        }
 
        v4l2_input vin;
@@ -415,10 +426,14 @@ void GeneralTab::updateVideoInput()
                return;
        enum_input(in, true, input);
        m_videoInput->setCurrentIndex(input);
-       if (m_tvStandard)
+       if (m_tvStandard) {
                m_tvStandard->setEnabled(in.capabilities & V4L2_IN_CAP_STD);
-       if (m_videoPreset)
+               m_qryStandard->setEnabled(in.capabilities & V4L2_IN_CAP_STD);
+       }
+       if (m_videoPreset) {
                m_videoPreset->setEnabled(in.capabilities & 
V4L2_IN_CAP_PRESETS);
+               m_qryPreset->setEnabled(in.capabilities & V4L2_IN_CAP_PRESETS);
+       }
 }
 
 void GeneralTab::updateVideoOutput()
@@ -430,10 +445,14 @@ void GeneralTab::updateVideoOutput()
                return;
        enum_output(out, true, output);
        m_videoOutput->setCurrentIndex(output);
-       if (m_tvStandard)
+       if (m_tvStandard) {
                m_tvStandard->setEnabled(out.capabilities & V4L2_OUT_CAP_STD);
-       if (m_videoPreset)
+               m_qryStandard->setEnabled(out.capabilities & V4L2_OUT_CAP_STD);
+       }
+       if (m_videoPreset) {
                m_videoPreset->setEnabled(out.capabilities & 
V4L2_OUT_CAP_PRESETS);
+               m_qryPreset->setEnabled(out.capabilities & 
V4L2_OUT_CAP_PRESETS);
+       }
 }
 
 void GeneralTab::updateAudioInput()
@@ -496,6 +515,16 @@ void GeneralTab::updateStandard()
        updateVidCapFormat();
 }
 
+void GeneralTab::qryStdClicked()
+{
+       v4l2_std_id std;
+
+       if (query_std(std)) {
+               s_std(std);
+               updateStandard();
+       }
+}
+
 void GeneralTab::updatePreset()
 {
        __u32 preset;
@@ -519,6 +548,16 @@ void GeneralTab::updatePreset()
        updateVidCapFormat();
 }
 
+void GeneralTab::qryPresetClicked()
+{
+       v4l2_dv_preset preset;
+
+       if (query_dv_preset(preset)) {
+               s_dv_preset(preset.preset);
+               updatePreset();
+       }
+}
+
 void GeneralTab::updateFreq()
 {
        v4l2_frequency f;
diff --git a/utils/qv4l2/general-tab.h b/utils/qv4l2/general-tab.h
index ae20127..0a3e304 100644
--- a/utils/qv4l2/general-tab.h
+++ b/utils/qv4l2/general-tab.h
@@ -29,6 +29,7 @@
 
 class QComboBox;
 class QSpinBox;
+class QPushButton;
 
 class GeneralTab: public QGridLayout, public v4l2
 {
@@ -48,7 +49,9 @@ private slots:
        void inputAudioChanged(int);
        void outputAudioChanged(int);
        void standardChanged(int);
+       void qryStdClicked();
        void presetChanged(int);
+       void qryPresetClicked();
        void freqTableChanged(int);
        void freqChannelChanged(int);
        void freqChanged(int);
@@ -101,7 +104,9 @@ private:
        QComboBox *m_audioInput;
        QComboBox *m_audioOutput;
        QComboBox *m_tvStandard;
+       QPushButton *m_qryStandard;
        QComboBox *m_videoPreset;
+       QPushButton *m_qryPreset;
        QSpinBox  *m_freq;
        QComboBox *m_freqTable;
        QComboBox *m_freqChannel;
diff --git a/utils/qv4l2/v4l2-api.cpp b/utils/qv4l2/v4l2-api.cpp
index e87e9ea..c2ec98f 100644
--- a/utils/qv4l2/v4l2-api.cpp
+++ b/utils/qv4l2/v4l2-api.cpp
@@ -204,6 +204,11 @@ bool v4l2::s_std(v4l2_std_id std)
        return ioctl("Set TV Standard", VIDIOC_S_STD, &std);
 }
 
+bool v4l2::query_std(v4l2_std_id &std)
+{
+       return ioctl("Query TV Standard", VIDIOC_QUERYSTD, &std);
+}
+
 bool v4l2::g_dv_preset(__u32 &preset)
 {
        struct v4l2_dv_preset p;
@@ -224,6 +229,11 @@ bool v4l2::s_dv_preset(__u32 preset)
        return ioctl("Set Preset", VIDIOC_S_DV_PRESET, &p);
 }
 
+bool v4l2::query_dv_preset(v4l2_dv_preset &preset)
+{
+       return ioctl("Query Preset", VIDIOC_QUERY_DV_PRESET, &preset);
+}
+
 
 bool v4l2::g_frequency(v4l2_frequency &freq)
 {
diff --git a/utils/qv4l2/v4l2-api.h b/utils/qv4l2/v4l2-api.h
index c2fac1c..892b536 100644
--- a/utils/qv4l2/v4l2-api.h
+++ b/utils/qv4l2/v4l2-api.h
@@ -65,8 +65,10 @@ public:
        bool s_audout(int output);
        bool s_std(v4l2_std_id std);
        bool g_std(v4l2_std_id &std);
+       bool query_std(v4l2_std_id &std);
        bool s_dv_preset(__u32 preset);
        bool g_dv_preset(__u32 &preset);
+       bool query_dv_preset(v4l2_dv_preset &preset);
        bool g_frequency(v4l2_frequency &freq);
        bool s_frequency(v4l2_frequency &freq);
        bool s_frequency(int freq);

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to