fragmentcollector_mpd.cpp
/**
 * @brief Get representation index of desired codec
 *
 * @param[in]  adaptationSet   Adaptation set object
 * @param[out] selectedRepType Type of desired representation
 *
 * @retval index of desired representation
 */
@brief Get representation index of desired codec
@param[in]  adaptationSet   Adaptation set object
@param[out] selectedRepType Type of desired representation

@retval index of desired representation
@brief Get representation index of desired codec @param [ in ] adaptationSet Adaptation set object @param [ out ] selectedRepType Type of desired representation @retval index of desired representation
static int GetDesiredCodecIndex(IAdaptationSet *adaptationSet, AudioType &selectedRepType)
{
	const std::vector<IRepresentation *> representation = adaptationSet->GetRepresentation();
	int selectedRepIdx = -1;
	uint32_t selectedRepBandwidth = 0;
	const std::vector<string> adapCodecs = adaptationSet->GetCodecs();
	for (int representationIndex = 0; representationIndex < representation.size(); representationIndex++)
	{
		const dash::mpd::IRepresentation *rep = representation.at(representationIndex);
		uint32_t bandwidth = rep->GetBandwidth();
		const std::vector<string> codecs = rep->GetCodecs();
		AudioType audioType = eAUDIO_UNKNOWN;
		string codecValue="";
		if(codecs.size())
			codecValue=codecs.at(0);
		else if(adapCodecs.size()) 
			codecValue = adapCodecs.at(0);
		if (codecValue == "ec+3")
		{
#ifndef __APPLE__
			audioType = eAUDIO_ATMOS;
#endif
		}
		else if (codecValue == "ec-3")
		{
#ifndef __APPLE__
			audioType = eAUDIO_DDPLUS;
#endif
		}
		else 
		{
			audioType = eAUDIO_AAC;
		}
		if (selectedRepType == eAUDIO_UNKNOWN || 
			(selectedRepType == audioType && bandwidth>selectedRepBandwidth) || 
			(selectedRepType < eAUDIO_ATMOS && audioType == eAUDIO_ATMOS && !gpGlobalConfig->disableATMOS && !gpGlobalConfig->disableEC3) || 
			(selectedRepType < eAUDIO_DDPLUS && audioType == eAUDIO_DDPLUS && !gpGlobalConfig->disableEC3) || 
			(selectedRepType != eAUDIO_AAC && audioType == eAUDIO_AAC && gpGlobalConfig->disableEC3) 
			)
		{
			selectedRepIdx = representationIndex;
			selectedRepType = audioType;
			selectedRepBandwidth = bandwidth;
		}
	}
	return selectedRepIdx;
}
static int GetDesiredCodecIndex ( IAdaptationSet * adaptationSet , AudioType & selectedRepType ) { const std :: vector < IRepresentation * > representation = adaptationSet -> GetRepresentation ( ) ; int selectedRepIdx = -1 ; uint32_t selectedRepBandwidth = 0 ; const std :: vector < string > adapCodecs = adaptationSet -> GetCodecs ( ) ; for ( int representationIndex = 0 ; representationIndex < representation . size ( ) ; representationIndex ++ ) { const dash :: mpd :: IRepresentation * rep = representation . at ( representationIndex ) ; uint32_t bandwidth = rep -> GetBandwidth ( ) ; const std :: vector < string > codecs = rep -> GetCodecs ( ) ; AudioType audioType = eAUDIO_UNKNOWN ; string codecValue = " " ; if ( codecs . size ( ) ) codecValue = codecs . at ( 0 ) ; else if ( adapCodecs . size ( ) ) codecValue = adapCodecs . at ( 0 ) ; if ( codecValue == " " ) { #ifndef __APPLE__ audioType = eAUDIO_ATMOS ; #endif } else if ( codecValue == " " ) { #ifndef __APPLE__ audioType = eAUDIO_DDPLUS ; #endif } else { audioType = eAUDIO_AAC ; } if ( selectedRepType == eAUDIO_UNKNOWN || ( selectedRepType == audioType && bandwidth > selectedRepBandwidth ) || ( selectedRepType < eAUDIO_ATMOS && audioType == eAUDIO_ATMOS && ! gpGlobalConfig -> disableATMOS && ! gpGlobalConfig -> disableEC3 ) || ( selectedRepType < eAUDIO_DDPLUS && audioType == eAUDIO_DDPLUS && ! gpGlobalConfig -> disableEC3 ) || ( selectedRepType != eAUDIO_AAC && audioType == eAUDIO_AAC && gpGlobalConfig -> disableEC3 ) ) { selectedRepIdx = representationIndex ; selectedRepType = audioType ; selectedRepBandwidth = bandwidth ; } } return selectedRepIdx ; }
@brief Get representation index of desired codec
 @param[in]  adaptationSet   Adaptation set object
 @param[out] selectedRepType Type of desired representation
@brief Get representation index of desired codec @param [ in ] adaptationSet Adaptation set object @param [ out ] selectedRepType Type of desired representation
// check for codec defined in Adaptation Set // check if Representation includec codec // else check if Adaptation has codec defn // else no codec defined , go with unknown // if( codecValue == "aac" || codecValue.find("mp4") != std::string::npos ) // needed? /*
		* By default the audio profile selection priority is set as ATMOS then DD+ then AAC
		* Note that this check comes after the check of selected language.
		* disableATMOS: avoid use of ATMOS track
		* disableEC3: avoid use of DDPLUS and ATMOS tracks
		*/ // anything better than nothing // same type but better quality // promote to atmos // promote to ddplus // force AAC