19#include "libavcodec/defs.h"
20#include "libavutil/avutil.h"
23#define LOC QString("AOS: ")
27 5512, 8000, 11025, 16000, 22050, 32000, 44100,
28 48000, 88200, 96000, 176400, 192000
38 m_srIt(kStdRates.begin()),
39 m_sfIt(kStdFormats.begin())
82 LOG(VB_AUDIO, LOG_INFO,
LOC +
83 QString(
"Sample rate %1 is supported").arg(rate));
88 if (
m_rates.empty() && rate == 48000)
109 [rate](
const auto entry){ return entry >= rate; } );
130 LOG(VB_AUDIO, LOG_INFO,
LOC +
175 case FORMAT_FLT:
return "32 bit floating point";
177 default:
return "unknown";
201 switch (av_get_packed_sample_fmt(format))
207 case AV_SAMPLE_FMT_S32:
234 default:
return AV_SAMPLE_FMT_NONE;
241 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"%1 channel(s) are supported")
251 [channels](
const auto entry)
252 { return entry == channels; } );
280 std::back_inserter(
tmp),
281 [channels](
int value){ return channels > value; } );
338 LOG(VB_AUDIO, LOG_INFO,
LOC +
"may be AC3 or DTS capable");
398 if (max_channels > 2 && !bLPCM)
400 if (max_channels == 2 && (bAC3 || bDTS))
403 cur_channels = std::min(cur_channels, max_channels);
435static const std::array<featureStruct,7>
feature {{
449 for (
const auto & [flag, name] :
feature)
452 tmp += QString::fromStdString(name);
454 return tmp.join(
",");
468 case AV_CODEC_ID_AC3:
471 case AV_CODEC_ID_EAC3:
472 samplerate = samplerate * 4;
473 log =
"Dolby Digital Plus (E-AC3)";
475 case AV_CODEC_ID_DTS:
476 switch(codec_profile)
478 case AV_PROFILE_DTS_ES:
481 case AV_PROFILE_DTS_96_24:
484 case AV_PROFILE_DTS_HD_HRA:
486 log =
"DTS-HD High-Res";
488 case AV_PROFILE_DTS_HD_MA:
497 log =
"DTS-HD High-Res";
506 case AV_CODEC_ID_TRUEHD:
522 log =
"TrueHD: Unsupported samplerate";
545 m_eld =
eld(ba->constData(), ba->size());
555 return eldc < chan ? eldc : chan;
564 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