From 7521b8be1384deeff1e7a5a0762bbbcfab1f483f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 25 Feb 2014 23:20:48 +0100 Subject: [PATCH] qv4l2: two field related fixes Update the field combobox when changing inputs. Don't clear the field combobox unless at least one valid field could be found. This to prevent the combobox from clearing when trying to change it while streaming is in progress. Signed-off-by: Hans Verkuil --- utils/qv4l2/general-tab.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp index 9184ac2..50f4f9d 100644 --- a/utils/qv4l2/general-tab.cpp +++ b/utils/qv4l2/general-tab.cpp @@ -663,6 +663,7 @@ void GeneralTab::inputChanged(int input) updateAudioInput(); updateVideoInput(); + updateVidCapFormat(); } void GeneralTab::outputChanged(int output) @@ -1148,21 +1149,25 @@ void GeneralTab::updateVidCapFields() { v4l2_format fmt; v4l2_format tmp; + bool first = true; g_fmt_cap(fmt); - m_vidCapFields->clear(); - for (__u32 f = V4L2_FIELD_NONE; f <= V4L2_FIELD_INTERLACED_BT; f++) { tmp = fmt; tmp.fmt.pix.field = f; if (!s_fmt(tmp) || tmp.fmt.pix.field != f) continue; + if (first) { + m_vidCapFields->clear(); + first = false; + } m_vidCapFields->addItem(field2s(f)); if (fmt.fmt.pix.field == f) m_vidCapFields->setCurrentIndex(m_vidCapFields->count() - 1); } - s_fmt(fmt); + if (!first) + s_fmt(fmt); } void GeneralTab::updateFrameSize() -- 2.7.4