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

SRT files with ♪ in them cause "ERR: Unrecognized block" #50

Open
nabeards opened this issue Oct 28, 2018 · 1 comment
Open

SRT files with ♪ in them cause "ERR: Unrecognized block" #50

nabeards opened this issue Oct 28, 2018 · 1 comment

Comments

@nabeards
Copy link

Is it possible to support SRT captions that contain the ♪ (music note)? When running flv+srt with these captions, I get the "ERR: Unrecognized block". It looks like the code would need to be updated around here to fix this:

if (strnstr(data, "REGION", line_length) != NULL) {

If you can give me some direction on just exactly where it's failing, I may be able to put together a pull request.

Thanks,
nabeards

@nabeards
Copy link
Author

I think I found a solution by modifying the utf8_line_length function in utf8.c as follows:

size_t utf8_line_length(const utf8_char_t* data)
{
    size_t len = 0;
    size_t utf8_len = 0;
    size_t i = 0;

    for (len = 0; 0 != data[len]; ++len) {
        if ('\r' == data[len]) {
            if ('\n' == data[len + 1]) {
                return len + 2; // windows
            } else {
                return len + 1; // unix
            }
        } else if ('\n' == data[len]) {
            if ('\r' == data[len + 1]) {
                return len + 2; // riscos
            } else {
                return len + 1; // macos
            }
        }
    }

    for (i = 0; i < len; i++) {
        utf8_len += (data[i] & 0xc0) != 0x80;
    }

    return utf8_len;
}

Thoughts?
nabeards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant