MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / slotEnableAudioOutput

Method slotEnableAudioOutput

Plugins/Player/BackendPlayer.cpp:426–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426void CBackendPlayer::slotEnableAudioOutput(bool bEnable)
427{
428 if(bEnable && (-1 < m_pParameters->GetAudioOutput()
429 && m_pParameters->GetAudioOutput()
430 < QMediaDevices::audioInputs().size()))
431 {
432 m_AudioOutput.setDevice(
433 QMediaDevices::audioOutputs()
434 .at(m_pParameters->GetAudioOutput()));
435 m_AudioOutput.setMuted(m_pParameters->GetAudioOutputMuted());
436 m_AudioOutput.setVolume(m_pParameters->GetAudioOutputVolume());
437 m_AudioOutput.disconnect();
438 bool check = connect(m_pParameters,
439 &CParameterPlayer::sigAudioOutputMuted,
440 &m_AudioOutput, &QAudioOutput::setMuted);
441 Q_ASSERT(check);
442 check = connect(m_pParameters, &CParameterPlayer::sigAudioOutputVolume,
443 &m_AudioOutput, &QAudioOutput::setVolume);
444 Q_ASSERT(check);
445 check = connect(m_pParameters, &CParameterPlayer::sigAudioOutput,
446 this, [&](int nIndex) {
447 if(-1 < nIndex
448 && nIndex < QMediaDevices::audioOutputs().size())
449 m_AudioOutput.setDevice(
450 QMediaDevices::audioOutputs().at(nIndex));
451 });
452 Q_ASSERT(check);
453 switch (m_pParameters->GetType()) {
454 case CParameterPlayer::TYPE::Camera:
455 m_CaptureSession.setAudioOutput(&m_AudioOutput);
456 break;
457 case CParameterPlayer::TYPE::Url:
458 m_Player.setAudioOutput(&m_AudioOutput);
459 break;
460 default:
461 break;
462 }
463 } else {
464 m_Player.setAudioOutput(nullptr);
465 m_CaptureSession.setAudioOutput(nullptr);
466 m_AudioOutput.disconnect();
467 }
468}
469
470void CBackendPlayer::slotPositionChanged(qint64 pos)
471{

Callers

nothing calls this directly

Calls 4

GetAudioOutputMethod · 0.80
GetAudioOutputMutedMethod · 0.80
GetAudioOutputVolumeMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected