Parse DASH forced-subtitle role value
Issue: google/ExoPlayer#9727 #minor-release PiperOrigin-RevId: 412266397
This commit is contained in:
parent
2054b29089
commit
a4c12ca97d
@ -1477,6 +1477,8 @@ public class DashManifestParser extends DefaultHandler
|
||||
case "main":
|
||||
return C.SELECTION_FLAG_DEFAULT;
|
||||
case "forced_subtitle":
|
||||
// Support both hyphen and underscore (https://github.com/google/ExoPlayer/issues/9727).
|
||||
case "forced-subtitle":
|
||||
return C.SELECTION_FLAG_FORCED;
|
||||
default:
|
||||
return 0;
|
||||
@ -1547,6 +1549,8 @@ public class DashManifestParser extends DefaultHandler
|
||||
case "caption":
|
||||
return C.ROLE_FLAG_CAPTION;
|
||||
case "forced_subtitle":
|
||||
// Support both hyphen and underscore (https://github.com/google/ExoPlayer/issues/9727).
|
||||
case "forced-subtitle":
|
||||
case "subtitle":
|
||||
return C.ROLE_FLAG_SUBTITLE;
|
||||
case "sign":
|
||||
|
@ -254,7 +254,13 @@ public class DashManifestParserTest {
|
||||
assertThat(format.selectionFlags).isEqualTo(C.SELECTION_FLAG_FORCED);
|
||||
assertThat(adaptationSets.get(1).type).isEqualTo(C.TRACK_TYPE_TEXT);
|
||||
|
||||
// Ensure that forced-subtitle and forced_subtitle are both parsed as a 'forced' text track.
|
||||
// https://github.com/google/ExoPlayer/issues/9727
|
||||
format = adaptationSets.get(2).representations.get(0).format;
|
||||
assertThat(format.roleFlags).isEqualTo(C.ROLE_FLAG_SUBTITLE);
|
||||
assertThat(format.selectionFlags).isEqualTo(C.SELECTION_FLAG_FORCED);
|
||||
|
||||
format = adaptationSets.get(3).representations.get(0).format;
|
||||
assertThat(format.containerMimeType).isEqualTo(MimeTypes.APPLICATION_TTML);
|
||||
assertThat(format.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_TTML);
|
||||
assertThat(format.codecs).isNull();
|
||||
@ -586,10 +592,11 @@ public class DashManifestParserTest {
|
||||
|
||||
assertThat(manifest.getPeriodCount()).isEqualTo(1);
|
||||
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
|
||||
assertThat(adaptationSets).hasSize(3);
|
||||
assertThat(adaptationSets).hasSize(4);
|
||||
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(0))).isEqualTo(C.TIME_UNSET);
|
||||
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(1))).isEqualTo(C.TIME_UNSET);
|
||||
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(2))).isEqualTo(C.TIME_UNSET);
|
||||
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(3))).isEqualTo(C.TIME_UNSET);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -13,11 +13,17 @@
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="0" mimeType="application/mp4" subsegmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:DASH:role:2011" value="forced_subtitle"/>
|
||||
<Role schemeIdUri="urn:mpeg:DASH:role:2011" value="forced-subtitle"/>
|
||||
<Representation id="0" codecs="stpp.ttml.im1t" bandwidth="16">
|
||||
<BaseURL>https://test.com/0</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="0" mimeType="application/mp4" subsegmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:DASH:role:2011" value="forced_subtitle"/>
|
||||
<Representation id="0" codecs="stpp.ttml.im1t" bandwidth="16">
|
||||
<BaseURL>https://test.com/0</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="0" mimeType="application/ttml+xml" subsegmentAlignment="true">
|
||||
<Representation id="0" bandwidth="16">
|
||||
<BaseURL>https://test.com/0</BaseURL>
|
||||
|
Loading…
x
Reference in New Issue
Block a user