qv4l2: add 'Use Record Priority' option
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 20 Jul 2014 15:53:33 +0000 (17:53 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sun, 20 Jul 2014 15:53:33 +0000 (17:53 +0200)
When set switch to V4L2_PRIORITY_RECORD when streaming.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/general-tab.cpp
utils/qv4l2/general-tab.h
utils/qv4l2/qv4l2.cpp
utils/v4l2-compliance/cv4l-helpers.h

index 8b865ee..978eb46 100644 (file)
@@ -24,7 +24,6 @@
 #include <QSpinBox>
 #include <QSlider>
 #include <QComboBox>
-#include <QCheckBox>
 #include <QPushButton>
 #include <QToolButton>
 #include <QLineEdit>
@@ -223,7 +222,7 @@ GeneralTab::GeneralTab(const QString &device, cv4l_fd *fd, int n, QWidget *paren
        formatSection(fmt);
 
 capture_method:
-       addLabel("Capture Method");
+       addLabel("Streaming Method");
        m_capMethods = new QComboBox(parent);
        if (has_streaming()) {
                cv4l_queue q;
@@ -253,6 +252,10 @@ capture_method:
        }
        addWidget(m_capMethods);
 
+       addLabel("Use Record Priority");
+       m_recordPrio = new QCheckBox(parentWidget());
+       addWidget(m_recordPrio);
+
        if (!isRadio() && !isVbi() && !m_isOutput && (has_crop() || has_compose())) {
                addTitle("Cropping & Compose Settings");
                cropSection();
index 2f50d22..84955f0 100644 (file)
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <QSpinBox>
+#include <QCheckBox>
 #include <QDoubleSpinBox>
 #include <QStackedWidget>
 #include <sys/time.h>
@@ -71,6 +72,11 @@ public:
        bool isVbi() const { return m_isVbi; }
        bool isSlicedVbi() const;
        bool isPlanar() const { return m_isPlanar; }
+       __u32 usePrio() const
+       {
+               return m_recordPrio->isChecked() ?
+                       V4L2_PRIORITY_RECORD : V4L2_PRIORITY_DEFAULT;
+       }
        void setHaveBuffers(bool haveBuffers);
        void sourceChange(const v4l2_event &ev);
        void sourceChangeSubscribe();
@@ -239,6 +245,8 @@ private:
        int query_dv_timings(v4l2_dv_timings &timings) { return m_fd->query_dv_timings(timings); }
        int g_frequency(v4l2_frequency &freq, unsigned index = 0) { return m_fd->g_frequency(freq, index); }
        int s_frequency(v4l2_frequency &freq) { return m_fd->s_frequency(freq); }
+       int g_priority(__u32 &prio) { return m_fd->g_priority(prio); }
+       int s_priority(__u32 prio = V4L2_PRIORITY_DEFAULT) { return m_fd->s_priority(prio); }
        int streamon(__u32 type = 0) { return m_fd->streamon(type); }
        int streamoff(__u32 type = 0) { return m_fd->streamoff(type); }
        int querybuf(v4l_buffer &buf, unsigned index) { return m_fd->querybuf(buf, index); }
@@ -334,6 +342,7 @@ private:
        QComboBox *m_frameInterval;
        QComboBox *m_vidOutFormats;
        QComboBox *m_capMethods;
+       QCheckBox *m_recordPrio;
        QComboBox *m_vbiMethods;
        QComboBox *m_audioInDevice;
        QComboBox *m_audioOutDevice;
index b0e5d4f..a9c9dc9 100644 (file)
@@ -425,8 +425,10 @@ bool ApplicationWindow::startCapture()
 {
        startAudio();
 
-       if (m_genTab->isRadio())
+       if (m_genTab->isRadio()) {
+               s_priority(m_genTab->usePrio());
                return true;
+       }
 
        m_queue.init(g_type(), m_capMethod);
 
@@ -438,6 +440,7 @@ bool ApplicationWindow::startCapture()
        case methodRead:
                m_snapshotAct->setEnabled(true);
                m_genTab->setHaveBuffers(true);
+               s_priority(m_genTab->usePrio());
                /* Nothing to do. */
                return true;
 
@@ -471,6 +474,7 @@ bool ApplicationWindow::startCapture()
                }
                m_snapshotAct->setEnabled(true);
                m_genTab->setHaveBuffers(true);
+               s_priority(m_genTab->usePrio());
                return true;
        }
 
@@ -722,6 +726,8 @@ void ApplicationWindow::stopCapture()
 {
        stopAudio();
 
+       s_priority(V4L2_PRIORITY_DEFAULT);
+
        if (m_genTab->isRadio())
                return;
 
index 0702766..7664b05 100644 (file)
@@ -309,6 +309,16 @@ public:
                return cv4l_ioctl(VIDIOC_S_FREQUENCY, &freq);
        }
 
+       int g_priority(__u32 &prio)
+       {
+               return cv4l_ioctl(VIDIOC_G_PRIORITY, &prio);
+       }
+
+       int s_priority(__u32 prio = V4L2_PRIORITY_DEFAULT)
+       {
+               return cv4l_ioctl(VIDIOC_S_PRIORITY, &prio);
+       }
+
        int streamon(__u32 type = 0)
        {
                if (type == 0)