mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Parse DASH forced-subtitle role value
Issue: google/ExoPlayer#9727 #minor-release PiperOrigin-RevId: 412266397
This commit is contained in:
parent
3cc64ae2df
commit
276f103c89
4 changed files with 22 additions and 2 deletions
|
|
@ -11,6 +11,9 @@
|
||||||
* Add a method to `AdPlaybackState` to allow resetting an ad group so that
|
* Add a method to `AdPlaybackState` to allow resetting an ad group so that
|
||||||
it can be played again
|
it can be played again
|
||||||
([#9615](https://github.com/google/ExoPlayer/issues/9615)).
|
([#9615](https://github.com/google/ExoPlayer/issues/9615)).
|
||||||
|
* DASH:
|
||||||
|
* Support the `forced-subtitle` track role
|
||||||
|
([#9727](https://github.com/google/ExoPlayer/issues/9727)).
|
||||||
* HLS:
|
* HLS:
|
||||||
* Support key-frame accurate seeking in HLS
|
* Support key-frame accurate seeking in HLS
|
||||||
([#2882](https://github.com/google/ExoPlayer/issues/2882)).
|
([#2882](https://github.com/google/ExoPlayer/issues/2882)).
|
||||||
|
|
|
||||||
|
|
@ -1475,6 +1475,8 @@ public class DashManifestParser extends DefaultHandler
|
||||||
case "main":
|
case "main":
|
||||||
return C.SELECTION_FLAG_DEFAULT;
|
return C.SELECTION_FLAG_DEFAULT;
|
||||||
case "forced_subtitle":
|
case "forced_subtitle":
|
||||||
|
// Support both hyphen and underscore (https://github.com/google/ExoPlayer/issues/9727).
|
||||||
|
case "forced-subtitle":
|
||||||
return C.SELECTION_FLAG_FORCED;
|
return C.SELECTION_FLAG_FORCED;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1545,6 +1547,8 @@ public class DashManifestParser extends DefaultHandler
|
||||||
case "caption":
|
case "caption":
|
||||||
return C.ROLE_FLAG_CAPTION;
|
return C.ROLE_FLAG_CAPTION;
|
||||||
case "forced_subtitle":
|
case "forced_subtitle":
|
||||||
|
// Support both hyphen and underscore (https://github.com/google/ExoPlayer/issues/9727).
|
||||||
|
case "forced-subtitle":
|
||||||
case "subtitle":
|
case "subtitle":
|
||||||
return C.ROLE_FLAG_SUBTITLE;
|
return C.ROLE_FLAG_SUBTITLE;
|
||||||
case "sign":
|
case "sign":
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,13 @@ public class DashManifestParserTest {
|
||||||
assertThat(format.selectionFlags).isEqualTo(C.SELECTION_FLAG_FORCED);
|
assertThat(format.selectionFlags).isEqualTo(C.SELECTION_FLAG_FORCED);
|
||||||
assertThat(adaptationSets.get(1).type).isEqualTo(C.TRACK_TYPE_TEXT);
|
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;
|
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.containerMimeType).isEqualTo(MimeTypes.APPLICATION_TTML);
|
||||||
assertThat(format.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_TTML);
|
assertThat(format.sampleMimeType).isEqualTo(MimeTypes.APPLICATION_TTML);
|
||||||
assertThat(format.codecs).isNull();
|
assertThat(format.codecs).isNull();
|
||||||
|
|
@ -586,10 +592,11 @@ public class DashManifestParserTest {
|
||||||
|
|
||||||
assertThat(manifest.getPeriodCount()).isEqualTo(1);
|
assertThat(manifest.getPeriodCount()).isEqualTo(1);
|
||||||
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
|
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(0))).isEqualTo(C.TIME_UNSET);
|
||||||
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(1))).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(2))).isEqualTo(C.TIME_UNSET);
|
||||||
|
assertThat(getAvailabilityTimeOffsetUs(adaptationSets.get(3))).isEqualTo(C.TIME_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,17 @@
|
||||||
</Representation>
|
</Representation>
|
||||||
</AdaptationSet>
|
</AdaptationSet>
|
||||||
<AdaptationSet id="0" mimeType="application/mp4" subsegmentAlignment="true">
|
<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">
|
<Representation id="0" codecs="stpp.ttml.im1t" bandwidth="16">
|
||||||
<BaseURL>https://test.com/0</BaseURL>
|
<BaseURL>https://test.com/0</BaseURL>
|
||||||
</Representation>
|
</Representation>
|
||||||
</AdaptationSet>
|
</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">
|
<AdaptationSet id="0" mimeType="application/ttml+xml" subsegmentAlignment="true">
|
||||||
<Representation id="0" bandwidth="16">
|
<Representation id="0" bandwidth="16">
|
||||||
<BaseURL>https://test.com/0</BaseURL>
|
<BaseURL>https://test.com/0</BaseURL>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue