diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-06-29 01:06:20 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2006-06-29 01:06:20 +0200 |
commit | 24b1fd51ad61526a8e259344df1353193148e97b (patch) | |
tree | 23aa75f11f489b8183662eed2ff1fbd55977dcaf /test | |
parent | 24461bbacbddc49d1b13d6f2da9f66e13e68a680 (diff) | |
download | mediapointer-dvb-s2-24b1fd51ad61526a8e259344df1353193148e97b.tar.gz mediapointer-dvb-s2-24b1fd51ad61526a8e259344df1353193148e97b.tar.bz2 |
Update audio input after changing video input
From: Hans Verkuil <hverkuil@xs4all.nl>
Changing the video input implies an audio input change. So update the
audio input combobox.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'test')
-rw-r--r-- | test/qv4l2/qv4l2.cpp | 12 | ||||
-rw-r--r-- | test/qv4l2/qv4l2.h | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/test/qv4l2/qv4l2.cpp b/test/qv4l2/qv4l2.cpp index 2299b9be7..ba43ad5c8 100644 --- a/test/qv4l2/qv4l2.cpp +++ b/test/qv4l2/qv4l2.cpp @@ -115,6 +115,7 @@ void ApplicationWindow::setDevice(const QString &device) ctrlMap.clear(); widgetMap.clear(); classMap.clear(); + audioInput = NULL; fd = ::open(device, O_RDONLY); if (fd >= 0) { @@ -170,13 +171,13 @@ void ApplicationWindow::addGeneralTab() if (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) { QLabel *label = new QLabel("Input Audio", grid); label->setAlignment(Qt::AlignRight); - QComboBox *combo = new QComboBox(grid); + audioInput = new QComboBox(grid); vaudio.index = 0; while (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) { - combo->insertItem((char *)vaudio.name); + audioInput->insertItem((char *)vaudio.name); vaudio.index++; } - connect(combo, SIGNAL(activated(int)), SLOT(inputAudioChanged(int))); + connect(audioInput, SIGNAL(activated(int)), SLOT(inputAudioChanged(int))); cnt++; } @@ -706,6 +707,11 @@ void ApplicationWindow::closeEvent( QCloseEvent* ce ) void ApplicationWindow::inputChanged(int input) { ioctl(fd, VIDIOC_S_INPUT, &input); + struct v4l2_audio vaudio; + memset(&vaudio, 0, sizeof(vaudio)); + if (audioInput && ioctl(fd, VIDIOC_G_AUDIO, &vaudio) >= 0) { + audioInput->setCurrentItem(vaudio.index); + } } void ApplicationWindow::outputChanged(int output) diff --git a/test/qv4l2/qv4l2.h b/test/qv4l2/qv4l2.h index 75b423ebf..1b3bc4ed6 100644 --- a/test/qv4l2/qv4l2.h +++ b/test/qv4l2/qv4l2.h @@ -21,7 +21,7 @@ #define __user #include <linux/videodev2.h> -class QTextEdit; +class QComboBox; typedef std::vector<unsigned> ClassIDVec; typedef std::map<unsigned, ClassIDVec> ClassMap; @@ -78,6 +78,9 @@ private: CtrlMap ctrlMap; WidgetMap widgetMap; ClassMap classMap; + + // General tab + QComboBox *audioInput; }; |