MythTV  master
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AudioOutputSettings Class Reference

#include <audiooutputsettings.h>

Collaboration diagram for AudioOutputSettings:
Collaboration graph
[legend]

Public Member Functions

 AudioOutputSettings (bool invalid=false)
 
 AudioOutputSettings (const AudioOutputSettings &)=default
 
 ~AudioOutputSettings ()
 
AudioOutputSettingsoperator= (const AudioOutputSettings &)
 
AudioOutputSettingsGetCleaned (bool newcopy=false)
 Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3 and DTS) Warning: do not call it twice in a row, will lead to invalid settings. More...
 
AudioOutputSettingsGetUsers (bool newcopy=false)
 Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3 and DTS) as well as the user settings If newcopy = false, assume GetCleaned was called before hand. More...
 
int GetNextRate ()
 
void AddSupportedRate (int rate)
 
bool IsSupportedRate (int rate)
 
int NearestSupportedRate (int rate)
 
int BestSupportedRate ()
 
AudioFormat GetNextFormat ()
 
void AddSupportedFormat (AudioFormat format)
 
bool IsSupportedFormat (AudioFormat format)
 
AudioFormat BestSupportedFormat ()
 
void AddSupportedChannels (int channels)
 
bool IsSupportedChannels (int channels)
 
int BestSupportedChannels ()
 
void setPassthrough (int val)
 
int canPassthrough () const
 
bool canFeature (DigitalFeature arg) const
 return DigitalFeature mask. More...
 
bool canFeature (unsigned int arg) const
 
bool canAC3 () const
 return true if device can or may support AC3 (deprecated, see canFeature()) More...
 
bool canDTS () const
 return true if device can or may support DTS (deprecated, see canFeature()) More...
 
bool canLPCM () const
 return true if device supports multichannels PCM (deprecated, see canFeature()) More...
 
bool IsInvalid () const
 return true if class instance is marked invalid. More...
 
void setFeature (DigitalFeature arg)
 set the provided digital feature possible values are: More...
 
void setFeature (unsigned int arg)
 
void setFeature (bool val, DigitalFeature arg)
 clear or set digital feature internal mask More...
 
void setFeature (bool val, int arg)
 
void SetBestSupportedChannels (int channels)
 Force set the greatest number of channels supported by the audio device. More...
 
int GetMaxHDRate () const
 return the highest iec958 rate supported. More...
 
QString FeaturesToString (void) const
 
bool hasELD () const
 get the ELD flag More...
 
bool hasValidELD ()
 
void setELD (QByteArray *ba)
 set ELD data More...
 
ELDgetELD (void)
 retrieve ELD data More...
 
int BestSupportedChannelsELD ()
 Reports best supported channel number, restricted to ELD range. More...
 
int BestSupportedPCMChannelsELD ()
 Reports best supported PCM channel number, restricted to ELD. More...
 

Static Public Member Functions

static int FormatToBits (AudioFormat format)
 
static const char * FormatToString (AudioFormat format)
 
static int SampleSize (AudioFormat format)
 
static AudioFormat AVSampleFormatToFormat (AVSampleFormat format, int bits=0)
 Return AVSampleFormat closest equivalent to AudioFormat. More...
 
static AVSampleFormat FormatToAVSampleFormat (AudioFormat format)
 Return AudioFormat closest equivalent to AVSampleFormat Note that FORMAT_S24LSB and FORMAT_S24 have no direct equivalent use S32 instead. More...
 
static QString FeaturesToString (DigitalFeature arg)
 Display in human readable form the digital features supported by the output device. More...
 
static QString GetPassthroughParams (int codec, int codec_profile, int &samplerate, int &channels, bool canDTSHDMA)
 Setup samplerate and number of channels for passthrough. More...
 

Private Member Functions

void SortSupportedChannels ()
 

Private Attributes

int m_passthrough {-1}
 passthrough status -1 : no 0: unknown 1: yes More...
 
unsigned int m_features {FEATURE_NONE}
 
bool m_invalid {false}
 
bool m_hasEld {false}
 will be set to true if we were able to retrieve the device ELD (EDID like Data). More...
 
ELD m_eld
 
std::vector< int > m_rates
 
std::vector< int > m_channels
 
std::vector< AudioFormatm_formats
 
rate_array::iterator m_srIt { }
 
format_array::iterator m_sfIt { }
 

Static Private Attributes

static const rate_array kStdRates
 
static const format_array kStdFormats
 

Detailed Description

Definition at line 49 of file audiooutputsettings.h.

Constructor & Destructor Documentation

◆ AudioOutputSettings() [1/2]

AudioOutputSettings::AudioOutputSettings ( bool  invalid = false)
explicit

Definition at line 36 of file audiooutputsettings.cpp.

Referenced by GetCleaned().

◆ AudioOutputSettings() [2/2]

AudioOutputSettings::AudioOutputSettings ( const AudioOutputSettings )
default

◆ ~AudioOutputSettings()

AudioOutputSettings::~AudioOutputSettings ( )

Definition at line 43 of file audiooutputsettings.cpp.

Member Function Documentation

◆ operator=()

AudioOutputSettings & AudioOutputSettings::operator= ( const AudioOutputSettings rhs)

Definition at line 50 of file audiooutputsettings.cpp.

◆ GetCleaned()

AudioOutputSettings * AudioOutputSettings::GetCleaned ( bool  newcopy = false)

Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3 and DTS) Warning: do not call it twice in a row, will lead to invalid settings.

Definition at line 310 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::GetOutputSettingsCleaned(), and GetUsers().

◆ GetUsers()

AudioOutputSettings * AudioOutputSettings::GetUsers ( bool  newcopy = false)

Returns capabilities supported by the audio device amended to take into account the digital audio options (AC3 and DTS) as well as the user settings If newcopy = false, assume GetCleaned was called before hand.

Definition at line 367 of file audiooutputsettings.cpp.

◆ GetNextRate()

int AudioOutputSettings::GetNextRate ( )

◆ AddSupportedRate()

void AudioOutputSettings::AddSupportedRate ( int  rate)

◆ IsSupportedRate()

bool AudioOutputSettings::IsSupportedRate ( int  rate)

Definition at line 86 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::CanPassthrough(), and GetCleaned().

◆ NearestSupportedRate()

int AudioOutputSettings::NearestSupportedRate ( int  rate)

Definition at line 102 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::Reconfigure().

◆ BestSupportedRate()

int AudioOutputSettings::BestSupportedRate ( )

Definition at line 95 of file audiooutputsettings.cpp.

Referenced by AudioTestThread::AudioTestThread().

◆ GetNextFormat()

AudioFormat AudioOutputSettings::GetNextFormat ( )

Definition at line 118 of file audiooutputsettings.cpp.

Referenced by AudioOutputPulseAudio::GetOutputSettings().

◆ AddSupportedFormat()

void AudioOutputSettings::AddSupportedFormat ( AudioFormat  format)

◆ IsSupportedFormat()

bool AudioOutputSettings::IsSupportedFormat ( AudioFormat  format)

Definition at line 136 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::CanPassthrough(), and GetCleaned().

◆ BestSupportedFormat()

AudioFormat AudioOutputSettings::BestSupportedFormat ( )

◆ FormatToBits()

int AudioOutputSettings::FormatToBits ( AudioFormat  format)
static

◆ FormatToString()

const char * AudioOutputSettings::FormatToString ( AudioFormat  format)
static

Definition at line 167 of file audiooutputsettings.cpp.

Referenced by AddSupportedFormat(), and AudioOutputBase::Reconfigure().

◆ SampleSize()

int AudioOutputSettings::SampleSize ( AudioFormat  format)
static

◆ AVSampleFormatToFormat()

AudioFormat AudioOutputSettings::AVSampleFormatToFormat ( AVSampleFormat  format,
int  bits = 0 
)
static

◆ FormatToAVSampleFormat()

AVSampleFormat AudioOutputSettings::FormatToAVSampleFormat ( AudioFormat  format)
static

Return AudioFormat closest equivalent to AVSampleFormat Note that FORMAT_S24LSB and FORMAT_S24 have no direct equivalent use S32 instead.

Definition at line 225 of file audiooutputsettings.cpp.

Referenced by AudioConvert::Process().

◆ AddSupportedChannels()

void AudioOutputSettings::AddSupportedChannels ( int  channels)

◆ IsSupportedChannels()

bool AudioOutputSettings::IsSupportedChannels ( int  channels)

◆ BestSupportedChannels()

int AudioOutputSettings::BestSupportedChannels ( )

◆ setPassthrough()

void AudioOutputSettings::setPassthrough ( int  val)
inline

◆ canPassthrough()

int AudioOutputSettings::canPassthrough ( ) const
inline

◆ canFeature() [1/2]

bool AudioOutputSettings::canFeature ( DigitalFeature  arg) const
inline

return DigitalFeature mask.

possible values are:

  • FEATURE_AC3
  • FEATURE_DTS
  • FEATURE_LPCM
  • FEATURE_EAC3
  • FEATURE_TRUEHD
  • FEATURE_DTSHD

Definition at line 89 of file audiooutputsettings.h.

Referenced by AudioOutputBase::CanPassthrough(), GetMaxHDRate(), GetUsers(), AudioOutputBase::Reconfigure(), AudioOutputBase::SetupPassthrough(), TestDigitalFeature(), AudioConfigSettings::UpdateCapabilities(), and AudioSetupWizard::UpdateCapabilities().

◆ canFeature() [2/2]

bool AudioOutputSettings::canFeature ( unsigned int  arg) const
inline

Definition at line 91 of file audiooutputsettings.h.

◆ canAC3()

bool AudioOutputSettings::canAC3 ( ) const
inline

return true if device can or may support AC3 (deprecated, see canFeature())

Definition at line 98 of file audiooutputsettings.h.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ canDTS()

bool AudioOutputSettings::canDTS ( ) const
inline

return true if device can or may support DTS (deprecated, see canFeature())

Definition at line 103 of file audiooutputsettings.h.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ canLPCM()

bool AudioOutputSettings::canLPCM ( ) const
inline

return true if device supports multichannels PCM (deprecated, see canFeature())

Definition at line 108 of file audiooutputsettings.h.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ IsInvalid()

bool AudioOutputSettings::IsInvalid ( ) const
inline

return true if class instance is marked invalid.

if true, you can not assume any of the other method returned values are valid

Definition at line 114 of file audiooutputsettings.h.

Referenced by AudioConfigSettings::CheckConfiguration(), AudioConfigSettings::CheckPassthrough(), AudioOutput::GetAudioDeviceConfig(), and AudioSetupWizard::Init().

◆ setFeature() [1/4]

void AudioOutputSettings::setFeature ( DigitalFeature  arg)
inline

set the provided digital feature possible values are:

  • FEATURE_AC3
  • FEATURE_DTS
  • FEATURE_LPCM
  • FEATURE_EAC3
  • FEATURE_TRUEHD
  • FEATURE_DTSHD

Definition at line 126 of file audiooutputsettings.h.

Referenced by GetCleaned(), GetUsers(), setFeature(), AudioConfigSettings::UpdateCapabilities(), and AudioSetupWizard::UpdateCapabilities().

◆ setFeature() [2/4]

void AudioOutputSettings::setFeature ( unsigned int  arg)
inline

Definition at line 127 of file audiooutputsettings.h.

◆ setFeature() [3/4]

void AudioOutputSettings::setFeature ( bool  val,
DigitalFeature  arg 
)

clear or set digital feature internal mask

Definition at line 299 of file audiooutputsettings.cpp.

◆ setFeature() [4/4]

void AudioOutputSettings::setFeature ( bool  val,
int  arg 
)

Definition at line 291 of file audiooutputsettings.cpp.

◆ SetBestSupportedChannels()

void AudioOutputSettings::SetBestSupportedChannels ( int  channels)

Force set the greatest number of channels supported by the audio device.

Definition at line 272 of file audiooutputsettings.cpp.

Referenced by GetUsers(), AudioConfigSettings::UpdateCapabilities(), and AudioSetupWizard::UpdateCapabilities().

◆ GetMaxHDRate()

int AudioOutputSettings::GetMaxHDRate ( ) const

return the highest iec958 rate supported.

return 0 if no HD rate are supported

Definition at line 422 of file audiooutputsettings.cpp.

Referenced by AudioPlayer::GetMaxHDRate(), and AudioOutputBase::SetupPassthrough().

◆ FeaturesToString() [1/2]

QString AudioOutputSettings::FeaturesToString ( DigitalFeature  arg)
static

Display in human readable form the digital features supported by the output device.

Definition at line 451 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::Reconfigure().

◆ FeaturesToString() [2/2]

QString AudioOutputSettings::FeaturesToString ( void  ) const
inline

Definition at line 152 of file audiooutputsettings.h.

◆ GetPassthroughParams()

QString AudioOutputSettings::GetPassthroughParams ( int  codec,
int  codec_profile,
int &  samplerate,
int &  channels,
bool  canDTSHDMA 
)
static

Setup samplerate and number of channels for passthrough.

Definition at line 462 of file audiooutputsettings.cpp.

Referenced by AudioOutputBase::SetupPassthrough().

◆ hasELD()

bool AudioOutputSettings::hasELD ( ) const

get the ELD flag

Definition at line 542 of file audiooutputsettings.cpp.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ hasValidELD()

bool AudioOutputSettings::hasValidELD ( )

◆ setELD()

void AudioOutputSettings::setELD ( QByteArray *  ba)

set ELD data

Definition at line 547 of file audiooutputsettings.cpp.

◆ getELD()

ELD& AudioOutputSettings::getELD ( void  )
inline

retrieve ELD data

Definition at line 176 of file audiooutputsettings.h.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ BestSupportedChannelsELD()

int AudioOutputSettings::BestSupportedChannelsELD ( )

Reports best supported channel number, restricted to ELD range.

Definition at line 554 of file audiooutputsettings.cpp.

Referenced by AudioOutput::GetAudioDeviceConfig().

◆ BestSupportedPCMChannelsELD()

int AudioOutputSettings::BestSupportedPCMChannelsELD ( )

Reports best supported PCM channel number, restricted to ELD.

Definition at line 563 of file audiooutputsettings.cpp.

Referenced by GetCleaned().

◆ SortSupportedChannels()

void AudioOutputSettings::SortSupportedChannels ( )
private

Definition at line 265 of file audiooutputsettings.cpp.

Member Data Documentation

◆ m_passthrough

int AudioOutputSettings::m_passthrough {-1}
private

passthrough status -1 : no 0: unknown 1: yes

Definition at line 194 of file audiooutputsettings.h.

Referenced by GetCleaned(), and operator=().

◆ m_features

unsigned int AudioOutputSettings::m_features {FEATURE_NONE}
private

Definition at line 196 of file audiooutputsettings.h.

Referenced by operator=(), and setFeature().

◆ m_invalid

bool AudioOutputSettings::m_invalid {false}
private

Definition at line 198 of file audiooutputsettings.h.

Referenced by GetCleaned(), GetUsers(), and operator=().

◆ m_hasEld

bool AudioOutputSettings::m_hasEld {false}
private

will be set to true if we were able to retrieve the device ELD (EDID like Data).

ELD contains information about the audio processing capabilities of the device connected to the audio card ELD is usually retrieved from EDID CEA-861-E extension.

Definition at line 205 of file audiooutputsettings.h.

Referenced by hasELD(), hasValidELD(), operator=(), and setELD().

◆ m_eld

ELD AudioOutputSettings::m_eld
private

◆ m_rates

std::vector<int> AudioOutputSettings::m_rates
private

◆ m_channels

std::vector<int> AudioOutputSettings::m_channels
private

◆ m_formats

std::vector<AudioFormat> AudioOutputSettings::m_formats
private

◆ m_srIt

rate_array::iterator AudioOutputSettings::m_srIt { }
private

Definition at line 211 of file audiooutputsettings.h.

Referenced by AudioOutputSettings(), GetNextRate(), and operator=().

◆ m_sfIt

format_array::iterator AudioOutputSettings::m_sfIt { }
private

Definition at line 212 of file audiooutputsettings.h.

Referenced by AudioOutputSettings(), GetNextFormat(), and operator=().

◆ kStdRates

const rate_array AudioOutputSettings::kStdRates
staticprivate
Initial value:
{
5512, 8000, 11025, 16000, 22050, 32000, 44100,
48000, 88200, 96000, 176400, 192000
}

Definition at line 214 of file audiooutputsettings.h.

Referenced by AudioOutputSettings(), GetNextRate(), and operator=().

◆ kStdFormats

const format_array AudioOutputSettings::kStdFormats
staticprivate

The documentation for this class was generated from the following files:
FORMAT_U8
@ FORMAT_U8
Definition: audiooutputsettings.h:27
FORMAT_S16
@ FORMAT_S16
Definition: audiooutputsettings.h:28
FORMAT_S24
@ FORMAT_S24
Definition: audiooutputsettings.h:30
FORMAT_FLT
@ FORMAT_FLT
Definition: audiooutputsettings.h:32
FORMAT_S32
@ FORMAT_S32
Definition: audiooutputsettings.h:31
FORMAT_S24LSB
@ FORMAT_S24LSB
Definition: audiooutputsettings.h:29