Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f53453d5 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Fix a subtitle bug: multiple blank lines in SubRip(srt) file."

parents b1e72b68 7e6265e0
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ status_t TimedTextParser::readNextLine(off64_t *offset, AString *data) {
 *  Subtitle number
 *  Start time --> End time
 *  Text of subtitle (one or more lines)
 *  Blank line
 *  Blank lines
 *
 * .srt file example:
 *  1
@@ -143,15 +143,20 @@ status_t TimedTextParser::getNextInSrtFileFormat(
        off64_t *offset, int64_t *startTimeUs, TextInfo *info) {
    AString data;
    status_t err;

    // To skip blank lines.
    do {
        if ((err = readNextLine(offset, &data)) != OK) {
            return err;
        }
        data.trim();
    } while(data.empty());

    // Just ignore the first non-blank line which is subtitle sequence number.

    // to skip the first line
    if ((err = readNextLine(offset, &data)) != OK) {
        return err;
    }

    int hour1, hour2, min1, min2, sec1, sec2, msec1, msec2;
    // the start time format is: hours:minutes:seconds,milliseconds
    // 00:00:24,600 --> 00:00:27,800