Resolve some TODO comments that are now fixed by the new parsing support

This commit is contained in:
Ian Baker 2025-01-06 15:13:18 +00:00
parent 618c2cf952
commit 8d9cb7e5d0
3 changed files with 10 additions and 26 deletions

View File

@ -308,13 +308,9 @@ public final class DelegatingSubtitleDecoderTtmlParserTest {
cue = getOnlyCueAtTimeUs(subtitle, 9_000_000);
assertThat(cue.text.toString()).isEqualTo("dolor");
assertThat(cue.position).isEqualTo(Cue.DIMEN_UNSET);
assertThat(cue.line).isEqualTo(Cue.DIMEN_UNSET);
assertThat(cue.size).isEqualTo(Cue.DIMEN_UNSET);
// TODO: Should be as below, once https://github.com/google/ExoPlayer/issues/2953 is fixed.
// assertEquals(10f / 100f, cue.position);
// assertEquals(80f / 100f, cue.line);
// assertEquals(1f, cue.size);
assertThat(cue.position).isEqualTo(10f / 100f);
assertThat(cue.line).isEqualTo(80f / 100f);
assertThat(cue.size).isEqualTo(1f);
cue = getOnlyCueAtTimeUs(subtitle, 21_000_000);
assertThat(cue.text.toString()).isEqualTo("They first said this");

View File

@ -406,13 +406,9 @@ public final class TtmlParser implements SubtitleParser {
return null;
}
} else {
Log.w(TAG, "Ignoring region without an origin");
return null;
// TODO: Should default to top left as below in this case, but need to fix
// https://github.com/google/ExoPlayer/issues/2953 first.
// Origin is omitted. Default to top left.
// position = 0;
// line = 0;
position = 0;
line = 0;
}
float width;
@ -461,13 +457,9 @@ public final class TtmlParser implements SubtitleParser {
return null;
}
} else {
Log.w(TAG, "Ignoring region without an extent");
return null;
// TODO: Should default to extent of parent as below in this case, but need to fix
// https://github.com/google/ExoPlayer/issues/2953 first.
// Extent is omitted. Default to extent of parent.
// width = 1;
// height = 1;
width = 1;
height = 1;
}
@Cue.AnchorType int lineAnchor = Cue.ANCHOR_TYPE_START;

View File

@ -487,13 +487,9 @@ public final class TtmlParserTest {
cue = Iterables.getOnlyElement(allCues.get(2).cues);
assertThat(cue.text.toString()).isEqualTo("dolor");
assertThat(cue.position).isEqualTo(Cue.DIMEN_UNSET);
assertThat(cue.line).isEqualTo(Cue.DIMEN_UNSET);
assertThat(cue.size).isEqualTo(Cue.DIMEN_UNSET);
// TODO: Should be as below, once https://github.com/google/ExoPlayer/issues/2953 is fixed.
// assertEquals(10f / 100f, cue.position);
// assertEquals(80f / 100f, cue.line);
// assertEquals(1f, cue.size);
assertThat(cue.position).isEqualTo(10f / 100f);
assertThat(cue.line).isEqualTo(80f / 100f);
assertThat(cue.size).isEqualTo(1f);
cue = Iterables.getOnlyElement(allCues.get(3).cues);
assertThat(cue.text.toString()).isEqualTo("They first said this");