Go to the documentation of this file.
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);
434 static 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;
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
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()
None log(str msg, int level=LOGDEBUG)
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)