/usr/share/webcamoid/qml/AudioInfo.qml is in webcamoid-data 8.1.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | /* Webcamoid, webcam capture application.
* Copyright (C) 2011-2017 Gonzalo Exequiel Pedone
*
* Webcamoid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Webcamoid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
*
* Web-Site: http://webcamoid.github.io/
*/
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import AkQml 1.0
Rectangle {
id: recAudioConfig
color: Qt.rgba(0, 0, 0, 0)
clip: true
width: 200
height: 400
property string iDevice: ""
property string iDescription: ""
property string oDescription: ""
function updateInputInfo()
{
iDevice = AudioLayer.audioInput.length > 0?
AudioLayer.audioInput[0]: "";
iDescription = AudioLayer.description(iDevice);
var audioCaps = Ak.newAudioCaps();
var supportedFormats = AudioLayer.supportedFormats(iDevice);
iSampleFormats.clear();
for (var format in supportedFormats)
iSampleFormats.append({format: audioCaps.sampleFormatFromString(supportedFormats[format]),
description: supportedFormats[format]});
var supportedChannels = AudioLayer.supportedChannels(iDevice);
iChannels.clear();
for (var channels in supportedChannels) {
var description =
supportedChannels[channels]
+ " - "
+ audioCaps.defaultChannelLayoutString(supportedChannels[channels]);
iChannels.append({channels: supportedChannels[channels],
description: description});
}
var supportedSampleRates = AudioLayer.supportedSampleRates(iDevice);
iSampleRates.clear();
for (var rate in supportedSampleRates)
iSampleRates.append({sampleRate: supportedSampleRates[rate],
description: supportedSampleRates[rate]});
var preferredFormat = Ak.newAudioCaps(AudioLayer.inputDeviceCaps);
cbxISampleFormats.currentIndex = supportedFormats.indexOf(audioCaps.sampleFormatToString(preferredFormat.format));
cbxIChannels.currentIndex = supportedChannels.indexOf(preferredFormat.channels);
cbxISampleRates.currentIndex = supportedSampleRates.indexOf(preferredFormat.rate);
}
function updateOutputInfo()
{
oDescription = AudioLayer.description(AudioLayer.audioOutput);
var audioCaps = Ak.newAudioCaps();
var supportedFormats = AudioLayer.supportedFormats(AudioLayer.audioOutput);
oSampleFormats.clear();
for (var format in supportedFormats)
oSampleFormats.append({format: audioCaps.sampleFormatFromString(supportedFormats[format]),
description: supportedFormats[format]});
var supportedChannels = AudioLayer.supportedChannels(AudioLayer.audioOutput);
oChannels.clear();
for (var channels in supportedChannels) {
var description =
supportedChannels[channels]
+ " - "
+ audioCaps.defaultChannelLayoutString(supportedChannels[channels]);
oChannels.append({channels: supportedChannels[channels],
description: description});
}
var supportedSampleRates = AudioLayer.supportedSampleRates(AudioLayer.audioOutput);
oSampleRates.clear();
for (var rate in supportedSampleRates)
oSampleRates.append({sampleRate: supportedSampleRates[rate],
description: supportedSampleRates[rate]});
var preferredFormat = Ak.newAudioCaps(AudioLayer.outputDeviceCaps);
cbxOSampleFormats.currentIndex = supportedFormats.indexOf(audioCaps.sampleFormatToString(preferredFormat.format));
cbxOChannels.currentIndex = supportedChannels.indexOf(preferredFormat.channels);
cbxOSampleRates.currentIndex = supportedSampleRates.indexOf(preferredFormat.rate);
}
function updateCaps(isInput)
{
var cbxSampleFormats = isInput? cbxISampleFormats: cbxOSampleFormats;
var cbxChannels = isInput? cbxIChannels: cbxOChannels;
var cbxSampleRates = isInput? cbxISampleRates: cbxOSampleRates;
var audioCaps = Ak.newAudioCaps()
if (cbxSampleFormats.model.count > 0
&& cbxChannels.model.count > 0
&& cbxSampleRates.model.count > 0) {
var bound = function (min, value, max) {
return Math.max(min, Math.min(value, max));
};
var sampleFormatsCI = bound(0, cbxSampleFormats.currentIndex, cbxSampleFormats.model.count - 1);
var channelsCI = bound(0, cbxChannels.currentIndex, cbxChannels.model.count - 1);
var sampleRatesCI = bound(0, cbxSampleRates.currentIndex, cbxSampleRates.model.count - 1);
audioCaps =
Ak.newAudioCaps(cbxSampleFormats.model.get(sampleFormatsCI).format,
cbxChannels.model.get(channelsCI).channels,
cbxSampleRates.model.get(sampleRatesCI).sampleRate);
}
if (isInput) {
var state = AudioLayer.inputState;
AudioLayer.inputState = AkElement.ElementStateNull;
AudioLayer.inputDeviceCaps = audioCaps.toCaps();
AudioLayer.inputState = state;
} else {
var state = AudioLayer.outputState;
AudioLayer.outputState = AkElement.ElementStateNull;
AudioLayer.outputDeviceCaps = audioCaps.toCaps();
AudioLayer.outputState = state;
}
}
Component.onCompleted: {
updateInputInfo();
updateOutputInfo();
}
Connections {
target: AudioLayer
onAudioInputChanged: updateInputInfo()
onAudioOutputChanged: updateOutputInfo()
}
Label {
id: lblDescription
text: qsTr("Description")
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.top
font.bold: true
}
ColumnLayout {
id: clyDescription
anchors.right: parent.right
anchors.left: parent.left
anchors.top: lblDescription.bottom
TextField {
id: txtODescription
text: oDescription
placeholderText: qsTr("Device description")
readOnly: true
Layout.fillWidth: true
}
TextField {
id: txtIDescription
text: iDescription
placeholderText: qsTr("Device description")
readOnly: true
Layout.fillWidth: true
visible: false
}
}
Label {
id: lblDevice
text: qsTr("Device id")
anchors.right: parent.right
anchors.left: parent.left
anchors.top: clyDescription.bottom
font.bold: true
}
ColumnLayout {
id: clyDevice
anchors.right: parent.right
anchors.left: parent.left
anchors.top: lblDevice.bottom
TextField {
id: txtODevice
text: AudioLayer.audioOutput
placeholderText: qsTr("Device id")
readOnly: true
Layout.fillWidth: true
}
TextField {
id: txtIDevice
text: AudioLayer.audioInput
placeholderText: qsTr("Device id")
readOnly: true
Layout.fillWidth: true
visible: false
}
}
GridLayout {
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.top: clyDevice.bottom
columns: 2
Label {
text: qsTr("Sample Format")
}
ColumnLayout {
ComboBox {
id: cbxOSampleFormats
model: ListModel {
id: oSampleFormats
}
textRole: "description"
Layout.fillWidth: true
onCurrentIndexChanged: updateCaps(false)
}
ComboBox {
id: cbxISampleFormats
model: ListModel {
id: iSampleFormats
}
textRole: "description"
Layout.fillWidth: true
visible: false
onCurrentIndexChanged: updateCaps(true)
}
}
Label {
text: qsTr("Channels")
}
ColumnLayout {
ComboBox {
id: cbxOChannels
model: ListModel {
id: oChannels
}
textRole: "description"
Layout.fillWidth: true
onCurrentIndexChanged: updateCaps(false)
}
ComboBox {
id: cbxIChannels
model: ListModel {
id: iChannels
}
textRole: "description"
Layout.fillWidth: true
visible: false
onCurrentIndexChanged: updateCaps(true)
}
}
Label {
text: qsTr("Sample Rate")
}
ColumnLayout {
ComboBox {
id: cbxOSampleRates
model: ListModel {
id: oSampleRates
}
textRole: "description"
Layout.fillWidth: true
onCurrentIndexChanged: updateCaps(false)
}
ComboBox {
id: cbxISampleRates
model: ListModel {
id: iSampleRates
}
textRole: "description"
Layout.fillWidth: true
visible: false
onCurrentIndexChanged: updateCaps(true)
}
}
Label {
Layout.fillHeight: true
}
}
states: [
State {
name: "showInputs"
PropertyChanges {
target: txtODescription
visible: false
}
PropertyChanges {
target: txtIDescription
visible: true
}
PropertyChanges {
target: txtODevice
visible: false
}
PropertyChanges {
target: txtIDevice
visible: true
}
PropertyChanges {
target: cbxOSampleFormats
visible: false
}
PropertyChanges {
target: cbxISampleFormats
visible: true
}
PropertyChanges {
target: cbxOChannels
visible: false
}
PropertyChanges {
target: cbxIChannels
visible: true
}
PropertyChanges {
target: cbxOSampleRates
visible: false
}
PropertyChanges {
target: cbxISampleRates
visible: true
}
}
]
}
|