mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add jdoc to SSA parsePosition(..) method
This commit is contained in:
parent
3b741e591f
commit
86efd1944e
1 changed files with 9 additions and 3 deletions
|
|
@ -204,7 +204,6 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse \pos{x,y} attribute
|
|
||||||
PointF position = parsePosition(lineValues[formatTextIndex]);
|
PointF position = parsePosition(lineValues[formatTextIndex]);
|
||||||
|
|
||||||
String text = lineValues[formatTextIndex]
|
String text = lineValues[formatTextIndex]
|
||||||
|
|
@ -285,10 +284,17 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
|
||||||
return timestampUs;
|
return timestampUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the position of an SSA dialogue line.
|
||||||
|
* The attribute is expected to be in this form: "\pos{x,y}".
|
||||||
|
*
|
||||||
|
* @param line The string to parse.
|
||||||
|
* @return The parsed position.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PointF parsePosition(String line){
|
private static PointF parsePosition(String line) {
|
||||||
Matcher matcher = SSA_POSITION_PATTERN.matcher(line);
|
Matcher matcher = SSA_POSITION_PATTERN.matcher(line);
|
||||||
if(!matcher.find()){
|
if (!matcher.find()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
float x = Float.parseFloat(matcher.group(1));
|
float x = Float.parseFloat(matcher.group(1));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue