19#include "libavutil/avutil.h"
22#define LOC QString("AOS: ")
26 5512, 8000, 11025, 16000, 22050, 32000, 44100,
27 48000, 88200, 96000, 176400, 192000
37 m_srIt(kStdRates.begin()),
38 m_sfIt(kStdFormats.begin())
81 LOG(VB_AUDIO, LOG_INFO,
LOC +
82 QString(
"Sample rate %1 is supported").arg(rate));
87 if (
m_rates.empty() && rate == 48000)
108 [rate](
const auto entry){ return entry >= rate; } );
129 LOG(VB_AUDIO, LOG_INFO,
LOC +
174 case FORMAT_FLT:
return "32 bit floating point";
176 default:
return "unknown";
200 switch (av_get_packed_sample_fmt(format))
206 case AV_SAMPLE_FMT_S32:
233 default:
return AV_SAMPLE_FMT_NONE;
240 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"%1 channel(s) are supported")
250 [channels](
const auto entry)
251 { return entry == channels; } );
279 std::back_inserter(
tmp),
280 [channels](
int value){ return channels > value; } );
337 LOG(VB_AUDIO, LOG_INFO,
LOC +
"may be AC3 or DTS capable");
397 if (max_channels > 2 && !bLPCM)
399 if (max_channels == 2 && (bAC3 || bDTS))
402 cur_channels = std::min(cur_channels, max_channels);
434static const std::array<featureStruct,7>
feature {{
448 for (
const auto & [flag, name] :
feature)
451 tmp += QString::fromStdString(name);
453 return tmp.join(
",");
467 case AV_CODEC_ID_AC3:
470 case AV_CODEC_ID_EAC3:
471 samplerate = samplerate * 4;
472 log =
"Dolby Digital Plus (E-AC3)";
474 case AV_CODEC_ID_DTS:
475 switch(codec_profile)
477 case FF_PROFILE_DTS_ES:
480 case FF_PROFILE_DTS_96_24:
483 case FF_PROFILE_DTS_HD_HRA:
485 log =
"DTS-HD High-Res";
487 case FF_PROFILE_DTS_HD_MA:
496 log =
"DTS-HD High-Res";
505 case AV_CODEC_ID_TRUEHD:
521 log =
"TrueHD: Unsupported samplerate";
544 m_eld =
eld(ba->constData(), ba->size());
554 return eldc < chan ? eldc : chan;
563 return eldc < chan ? eldc : chan;
static const std::array< featureStruct, 7 > feature
std::array< const int, 12 > rate_array
std::array< const AudioFormat, 6 > format_array
bool IsSupportedChannels(int channels)
QString FeaturesToString(void) const
AudioOutputSettings * GetUsers(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
int BestSupportedChannels()
static int SampleSize(AudioFormat format)
AudioFormat BestSupportedFormat()
void setELD(QByteArray *ba)
set ELD data
bool canFeature(DigitalFeature arg) const
return DigitalFeature mask.
std::vector< AudioFormat > m_formats
AudioFormat GetNextFormat()
int BestSupportedChannelsELD()
Reports best supported channel number, restricted to ELD range.
static const format_array kStdFormats
void AddSupportedRate(int rate)
rate_array::iterator m_srIt
int GetMaxHDRate() const
return the highest iec958 rate supported.
static AVSampleFormat FormatToAVSampleFormat(AudioFormat format)
Return AudioFormat closest equivalent to AVSampleFormat Note that FORMAT_S24LSB and FORMAT_S24 have n...
bool IsSupportedRate(int rate)
format_array::iterator m_sfIt
std::vector< int > m_rates
AudioOutputSettings(bool invalid=false)
bool hasELD() const
get the ELD flag
void SetBestSupportedChannels(int channels)
Force set the greatest number of channels supported by the audio device.
int NearestSupportedRate(int rate)
AudioOutputSettings * GetCleaned(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
static AudioFormat AVSampleFormatToFormat(AVSampleFormat format, int bits=0)
Return AVSampleFormat closest equivalent to AudioFormat.
std::vector< int > m_channels
void setPassthrough(int val)
static const char * FormatToString(AudioFormat format)
static int FormatToBits(AudioFormat format)
int BestSupportedPCMChannelsELD()
Reports best supported PCM channel number, restricted to ELD.
void AddSupportedChannels(int channels)
void setFeature(DigitalFeature arg)
set the provided digital feature possible values are:
void SortSupportedChannels()
static QString GetPassthroughParams(int codec, int codec_profile, int &samplerate, int &channels, bool canDTSHDMA)
Setup samplerate and number of channels for passthrough.
void AddSupportedFormat(AudioFormat format)
static const rate_array kStdRates
bool IsSupportedFormat(AudioFormat format)
bool m_hasEld
will be set to true if we were able to retrieve the device ELD (EDID like Data).
AudioOutputSettings & operator=(const AudioOutputSettings &)
int m_passthrough
passthrough status -1 : no 0: unknown 1: yes
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
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)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
None log(str msg, int level=LOGDEBUG)
const DigitalFeature flag