/* Parsing for fps, which can be a fraction. Unfortunately, the spec for the header leaves out a lot of details, so this is mostly guessing.  */
static AVRational read_fps(const char *line, int *error)
/* Parsing for fps, which can be a fraction. Unfortunately, the spec for the header leaves out a lot of details, so this is mostly guessing.  */
static AVRational read_fps(const char *line, int *error)
{
    int64_t num, den = 1;
    AVRational result;
    num = read_int(line, &line, error);
    if (*line == '.')
        line++;
    for (; *line>='0' && *line<='9'; line++) {
        if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
            break;
        num  = 10 * num + *line - '0';
        den *= 10;
    }
    if (!num)
        *error = -1;
    av_reduce(&result.num, &result.den, num, den, 0x7FFFFFFF);
    return result;
}