## Revision 8163c870

View differences:

libavformat/utils.c
38 38
```    return LIBAVFORMAT_VERSION_INT;
```
39 39
```}
```
40 40

41
```static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den);
```
42
```static void av_frac_add(AVFrac *f, int64_t incr);
```
41
```/* fraction handling */
```
42

43
```/**
```
44
``` * f = val + (num / den) + 0.5.
```
45
``` *
```
46
``` * 'num' is normalized so that it is such as 0 <= num < den.
```
47
``` *
```
48
``` * @param f fractional number
```
49
``` * @param val integer value
```
50
``` * @param num must be >= 0
```
51
``` * @param den must be >= 1
```
52
``` */
```
53
```static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
```
54
```{
```
55
```    num += (den >> 1);
```
56
```    if (num >= den) {
```
57
```        val += num / den;
```
58
```        num = num % den;
```
59
```    }
```
60
```    f->val = val;
```
61
```    f->num = num;
```
62
```    f->den = den;
```
63
```}
```
64

65
```/**
```
66
``` * Fractional addition to f: f = f + (incr / f->den).
```
67
``` *
```
68
``` * @param f fractional number
```
69
``` * @param incr increment, can be positive or negative
```
70
``` */
```
71
```static void av_frac_add(AVFrac *f, int64_t incr)
```
72
```{
```
73
```    int64_t num, den;
```
74

75
```    num = f->num + incr;
```
76
```    den = f->den;
```
77
```    if (num < 0) {
```
78
```        f->val += num / den;
```
79
```        num = num % den;
```
80
```        if (num < 0) {
```
81
```            num += den;
```
82
```            f->val--;
```
83
```        }
```
84
```    } else if (num >= den) {
```
85
```        f->val += num / den;
```
86
```        num = num % den;
```
87
```    }
```
88
```    f->num = num;
```
89
```}
```
43 90

44 91
```/** head of registered input format linked list */
```
45 92
```AVInputFormat *first_iformat = NULL;
```
......
3171 3218
```    if(gcd>1)
```
3172 3219
```        av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);
```
3173 3220
```}
```
3174

3175
```/* fraction handling */
```
3176

3177
```/**
```
3178
``` * f = val + (num / den) + 0.5.
```
3179
``` *
```
3180
``` * 'num' is normalized so that it is such as 0 <= num < den.
```
3181
``` *
```
3182
``` * @param f fractional number
```
3183
``` * @param val integer value
```
3184
``` * @param num must be >= 0
```
3185
``` * @param den must be >= 1
```
3186
``` */
```
3187
```static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
```
3188
```{
```
3189
```    num += (den >> 1);
```
3190
```    if (num >= den) {
```
3191
```        val += num / den;
```
3192
```        num = num % den;
```
3193
```    }
```
3194
```    f->val = val;
```
3195
```    f->num = num;
```
3196
```    f->den = den;
```
3197
```}
```
3198

3199
```/**
```
3200
``` * Fractional addition to f: f = f + (incr / f->den).
```
3201
``` *
```
3202
``` * @param f fractional number
```
3203
``` * @param incr increment, can be positive or negative
```
3204
``` */
```
3205
```static void av_frac_add(AVFrac *f, int64_t incr)
```
3206
```{
```
3207
```    int64_t num, den;
```
3208

3209
```    num = f->num + incr;
```
3210
```    den = f->den;
```
3211
```    if (num < 0) {
```
3212
```        f->val += num / den;
```
3213
```        num = num % den;
```
3214
```        if (num < 0) {
```
3215
```            num += den;
```
3216
```            f->val--;
```
3217
```        }
```
3218
```    } else if (num >= den) {
```
3219
```        f->val += num / den;
```
3220
```        num = num % den;
```
3221
```    }
```
3222
```    f->num = num;
```
3223
```}
```

Also available in: Unified diff