Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix positioning of full screen image based subtitles #5711

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ private TtmlRegion parseRegionAttributes(
/* lineType= */ Cue.LINE_TYPE_FRACTION,
lineAnchor,
width,
height,
/* textSizeType= */ Cue.TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING,
/* textSize= */ regionTextHeight);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,17 @@ public List<Cue> getCues(
byte[] bitmapData = Base64.decode(encodedBitmapData, Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapData, /* offset= */ 0, bitmapData.length);
TtmlRegion region = regionMap.get(regionImagePair.first);
boolean fullScreen = region.width == 1f && region.height == 1f;

cues.add(
new Cue(
bitmap,
region.position,
Cue.ANCHOR_TYPE_MIDDLE,
Cue.TYPE_UNSET,
region.line,
region.lineAnchor,
region.width,
/* height= */ Cue.DIMEN_UNSET));
fullScreen ? region.height : Cue.DIMEN_UNSET));
}

// Create text based cues.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public final @Cue.LineType int lineType;
public final @Cue.AnchorType int lineAnchor;
public final float width;
public final float height;
public final @Cue.TextSizeType int textSizeType;
public final float textSize;

Expand All @@ -39,6 +40,7 @@ public TtmlRegion(String id) {
/* lineType= */ Cue.TYPE_UNSET,
/* lineAnchor= */ Cue.TYPE_UNSET,
/* width= */ Cue.DIMEN_UNSET,
/* height= */ Cue.DIMEN_UNSET,
/* textSizeType= */ Cue.TYPE_UNSET,
/* textSize= */ Cue.DIMEN_UNSET);
}
Expand All @@ -50,6 +52,7 @@ public TtmlRegion(
@Cue.LineType int lineType,
@Cue.AnchorType int lineAnchor,
float width,
float height,
int textSizeType,
float textSize) {
this.id = id;
Expand All @@ -58,6 +61,7 @@ public TtmlRegion(
this.lineType = lineType;
this.lineAnchor = lineAnchor;
this.width = width;
this.height = height;
this.textSizeType = textSizeType;
this.textSize = textSize;
}
Expand Down