Go to the documentation of this file.
17 #include "libavutil/avutil.h"
21 #define LOC QString("AOS: ")
25 5512, 8000, 11025, 16000, 22050, 32000, 44100,
26 48000, 88200, 96000, 176400, 192000
80 LOG(VB_AUDIO, LOG_INFO,
LOC +
81 QString(
"Sample rate %1 is supported").
arg(rate));
86 if (
m_rates.empty() && rate == 48000)
107 [rate](
const auto entry){ return entry >= rate; } );
128 LOG(VB_AUDIO, LOG_INFO,
LOC +
173 case FORMAT_FLT:
return "32 bit floating point";
175 default:
return "unknown";
199 switch (av_get_packed_sample_fmt(format))
205 case AV_SAMPLE_FMT_S32:
232 default:
return AV_SAMPLE_FMT_NONE;
239 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"%1 channel(s) are supported")
249 [channels](
const auto entry)
250 { return entry == channels; } );
277 std::back_inserter(
tmp),
278 [channels](
int value){ return channels > value; } );
335 LOG(VB_AUDIO, LOG_INFO,
LOC +
"may be AC3 or DTS capable");
395 if (max_channels > 2 && !bLPCM)
397 if (max_channels == 2 && (bAC3 || bDTS))
400 if (cur_channels > max_channels)
401 cur_channels = max_channels;
433 static const std::array<featureStruct,7>
feature {{
446 for (
const auto & [flag, name] :
feature)
449 tmp += QString::fromStdString(name);
451 return tmp.join(
",");
465 case AV_CODEC_ID_AC3:
468 case AV_CODEC_ID_EAC3:
469 samplerate = samplerate * 4;
470 log =
"Dolby Digital Plus (E-AC3)";
472 case AV_CODEC_ID_DTS:
473 switch(codec_profile)
475 case FF_PROFILE_DTS_ES:
478 case FF_PROFILE_DTS_96_24:
481 case FF_PROFILE_DTS_HD_HRA:
483 log =
"DTS-HD High-Res";
485 case FF_PROFILE_DTS_HD_MA:
494 log =
"DTS-HD High-Res";
503 case AV_CODEC_ID_TRUEHD:
519 log =
"TrueHD: Unsupported samplerate";
542 m_eld =
eld(ba->constData(), ba->size());
552 return eldc < chan ? eldc : chan;
561 return eldc < chan ? eldc : chan;
void SortSupportedChannels()
bool IsSupportedChannels(int channels)
bool IsSupportedRate(int rate)
static AudioFormat AVSampleFormatToFormat(AVSampleFormat format, int bits=0)
Return AVSampleFormat closest equivalent to AudioFormat.
void setPassthrough(int val)
void AddSupportedFormat(AudioFormat format)
AudioOutputSettings & operator=(const AudioOutputSettings &)
static AVSampleFormat FormatToAVSampleFormat(AudioFormat format)
Return AudioFormat closest equivalent to AVSampleFormat Note that FORMAT_S24LSB and FORMAT_S24 have n...
QString FeaturesToString(void) const
static int FormatToBits(AudioFormat format)
static const rate_array kStdRates
std::array< const int, 12 > rate_array
arg(title).arg(filename).arg(doDelete))
static int SampleSize(AudioFormat format)
std::vector< int > m_channels
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
format_array::iterator m_sfIt
void AddSupportedChannels(int channels)
AudioOutputSettings * GetCleaned(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
AudioOutputSettings * GetUsers(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
std::vector< int > m_rates
int GetMaxHDRate() const
return the highest iec958 rate supported.
int BestSupportedChannelsELD()
Reports best supported channel number, restricted to ELD range.
static const std::array< featureStruct, 7 > feature
AudioOutputSettings(bool invalid=false)
int BestSupportedChannels()
static const format_array kStdFormats
const DigitalFeature flag
std::array< const AudioFormat, 6 > format_array
void AddSupportedRate(int rate)
bool hasELD() const
get the ELD flag
int m_passthrough
passthrough status -1 : no 0: unknown 1: yes
int BestSupportedPCMChannelsELD()
Reports best supported PCM channel number, restricted to ELD.
bool canFeature(DigitalFeature arg) const
return DigitalFeature mask.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void setFeature(DigitalFeature arg)
set the provided digital feature possible values are:
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
bool IsSupportedFormat(AudioFormat format)
static QString GetPassthroughParams(int codec, int codec_profile, int &samplerate, int &channels, bool canDTSHDMA)
Setup samplerate and number of channels for passthrough.
std::vector< AudioFormat > m_formats
int NearestSupportedRate(int rate)
bool m_hasEld
will be set to true if we were able to retrieve the device ELD (EDID like Data).
rate_array::iterator m_srIt
static const char * FormatToString(AudioFormat format)
AudioFormat BestSupportedFormat()
void setELD(QByteArray *ba)
set ELD data
void SetBestSupportedChannels(int channels)
Force set the greatest number of channels supported by the audio device.
AudioFormat GetNextFormat()
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)