18 #include "libavutil/avutil.h" 22 #define LOC QString("AOS: ") 25 m_invalid(invalid), m_eld(
ELD())
28 sizeof(
srs) /
sizeof(
int));
78 LOG(VB_AUDIO, LOG_INFO,
LOC +
79 QString(
"Sample rate %1 is supported").arg(rate));
84 if (
m_rates.empty() && rate == 48000)
87 vector<int>::iterator it;
108 vector<int>::iterator it;
133 LOG(VB_AUDIO, LOG_INFO,
LOC +
143 vector<AudioFormat>::iterator it;
183 case FORMAT_FLT:
return "32 bit floating point";
185 default:
return "unknown";
209 switch (av_get_packed_sample_fmt(format))
215 case AV_SAMPLE_FMT_S32:
242 default:
return AV_SAMPLE_FMT_NONE;
249 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"%1 channel(s) are supported")
258 vector<int>::iterator it;
289 vector<int>::reverse_iterator it;
352 LOG(VB_AUDIO, LOG_INFO,
LOC +
"may be AC3 or DTS capable");
412 if (max_channels > 2 && !bLPCM)
414 if (max_channels == 2 && (bAC3 || bDTS))
417 if (cur_channels > max_channels)
418 cur_channels = max_channels;
445 #define ARG(x) ((tmp.isEmpty() ? "" : ",") + QString(x)) 460 const char *feature_str[] = {
473 if (arg & feature[i])
474 tmp +=
ARG(feature_str[i]);
490 case AV_CODEC_ID_AC3:
493 case AV_CODEC_ID_EAC3:
494 samplerate = samplerate * 4;
495 log =
"Dolby Digital Plus (E-AC3)";
497 case AV_CODEC_ID_DTS:
498 switch(codec_profile)
500 case FF_PROFILE_DTS_ES:
503 case FF_PROFILE_DTS_96_24:
506 case FF_PROFILE_DTS_HD_HRA:
508 log =
"DTS-HD High-Res";
510 case FF_PROFILE_DTS_HD_MA:
519 log =
"DTS-HD High-Res";
528 case AV_CODEC_ID_TRUEHD:
544 log =
"TrueHD: Unsupported samplerate";
567 m_eld =
ELD(ba->constData(), ba->size());
577 return eldc < chan ? eldc : chan;
586 return eldc < chan ? eldc : chan;
int NearestSupportedRate(int rate)
static const AudioFormat fmts[]
int BestSupportedChannels()
bool IsSupportedChannels(int channels)
void setELD(QByteArray *ba)
set ELD data
bool IsSupportedFormat(AudioFormat format)
int BestSupportedPCMChannelsELD()
Reports best supported PCM channel number, restricted to ELD.
void setPassthrough(int val)
void SetBestSupportedChannels(int channels)
Force set the greatest number of channels supported by the audio device.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int BestSupportedChannelsELD()
Reports best supported channel number, restricted to ELD range.
static const char * FormatToString(AudioFormat format)
static int FormatToBits(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
std::vector< int >::iterator m_sr_it
AudioFormat BestSupportedFormat()
std::vector< AudioFormat > m_sf
AudioOutputSettings(bool invalid=false)
void setFeature(DigitalFeature arg)
set the provided digital feature possible values are:
static int SampleSize(AudioFormat format)
QString FeaturesToString(void)
bool canFeature(DigitalFeature arg)
return DigitalFeature mask.
bool m_has_eld
will be set to true if we were able to retrieve the device ELD (EDID like Data).
std::vector< int > m_channels
AudioOutputSettings & operator=(const AudioOutputSettings &)
int GetNumSetting(const QString &key, int defaultval=0)
#define LOG(_MASK_, _LEVEL_, _STRING_)
AudioOutputSettings * GetCleaned(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
std::vector< AudioFormat >::iterator m_sf_it
bool GetBoolSetting(const QString &key, bool defaultval=false)
void AddSupportedRate(int rate)
AudioFormat GetNextFormat()
bool IsSupportedRate(int rate)
int GetMaxHDRate()
return the highest iec958 rate supported.
std::vector< int > m_rates
AudioOutputSettings * GetUsers(bool newcopy=false)
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
void AddSupportedFormat(AudioFormat format)
bool hasELD()
get the ELD flag
static AudioFormat AVSampleFormatToFormat(AVSampleFormat format, int bits=0)
Return AVSampleFormat closest equivalent to AudioFormat.
int m_passthrough
passthrough status -1 : no 0: unknown 1: yes
void AddSupportedChannels(int channels)
void SortSupportedChannels()
static AVSampleFormat FormatToAVSampleFormat(AudioFormat format)
Return AudioFormat closest equivalent to AVSampleFormat Note that FORMAT_S24LSB and FORMAT_S24 have n...