mirror of
https://github.com/androidx/media.git
synced 2025-05-10 09:12:16 +08:00
Update MPEG-DASH AudioChannelConfiguration Parsing
Add support for schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration". https://dashif.org/identifiers/audio_source_metadata/ and clause 8.2 in ISO/IEC 23001-8.
This commit is contained in:
parent
b4658ae6ff
commit
1736e7cc85
@ -1279,13 +1279,21 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
protected int parseAudioChannelConfiguration(XmlPullParser xpp)
|
protected int parseAudioChannelConfiguration(XmlPullParser xpp)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
String schemeIdUri = parseString(xpp, "schemeIdUri", null);
|
String schemeIdUri = parseString(xpp, "schemeIdUri", null);
|
||||||
int audioChannels =
|
int audioChannels = Format.NO_VALUE;
|
||||||
"urn:mpeg:dash:23003:3:audio_channel_configuration:2011".equals(schemeIdUri)
|
switch (schemeIdUri) {
|
||||||
? parseInt(xpp, "value", Format.NO_VALUE)
|
case "urn:mpeg:dash:23003:3:audio_channel_configuration:2011":
|
||||||
: ("tag:dolby.com,2014:dash:audio_channel_configuration:2011".equals(schemeIdUri)
|
audioChannels = parseInt(xpp, "value", Format.NO_VALUE);
|
||||||
|| "urn:dolby:dash:audio_channel_configuration:2011".equals(schemeIdUri)
|
break;
|
||||||
? parseDolbyChannelConfiguration(xpp)
|
case "urn:mpeg:mpegB:cicp:ChannelConfiguration":
|
||||||
: Format.NO_VALUE);
|
audioChannels = parseMpegChannelConfiguration(xpp);
|
||||||
|
break;
|
||||||
|
case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":
|
||||||
|
case "urn:dolby:dash:audio_channel_configuration:2011":
|
||||||
|
audioChannels = parseDolbyChannelConfiguration(xpp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
xpp.next();
|
xpp.next();
|
||||||
} while (!XmlPullParserUtil.isEndTag(xpp, "AudioChannelConfiguration"));
|
} while (!XmlPullParserUtil.isEndTag(xpp, "AudioChannelConfiguration"));
|
||||||
@ -1651,6 +1659,25 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
return value == null ? defaultValue : value;
|
return value == null ? defaultValue : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the number of channels from the value attribute of an AudioElementConfiguration with
|
||||||
|
* schemeIdUri "urn:mpeg:mpegB:cicp:ChannelConfiguration", as defined by
|
||||||
|
* https://dashif.org/identifiers/audio_source_metadata/ and clause 8.2, in ISO/IEC 23001-8.
|
||||||
|
*
|
||||||
|
* @param xpp The parser from which to read.
|
||||||
|
* @return The parsed number of channels, or {@link Format#NO_VALUE} if the channel count could
|
||||||
|
* not be parsed.
|
||||||
|
*/
|
||||||
|
protected static int parseMpegChannelConfiguration(XmlPullParser xpp) {
|
||||||
|
int channelIndex = parseInt(xpp, "value", Format.NO_VALUE);
|
||||||
|
int[] channelCountMapping = new int[]{Format.NO_VALUE, 1, 2, 3, 4, 5, 6, 8, 2, 3, /* 0--9 */
|
||||||
|
4,7, 8, 24, 8, 12, 10, 12, 14, 12, /* 10--19 */
|
||||||
|
14 /* 20 */};
|
||||||
|
return (channelIndex >=0 && channelIndex < channelCountMapping.length)
|
||||||
|
? channelCountMapping[channelIndex]
|
||||||
|
: Format.NO_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the number of channels from the value attribute of an AudioElementConfiguration with
|
* Parses the number of channels from the value attribute of an AudioElementConfiguration with
|
||||||
* schemeIdUri "tag:dolby.com,2014:dash:audio_channel_configuration:2011", as defined by table E.5
|
* schemeIdUri "tag:dolby.com,2014:dash:audio_channel_configuration:2011", as defined by table E.5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user