deinterlace: improve framerate transform

Handle G_MAXINT in the framerates better. If we cannot double or divide the
framerate, clamp to the smallest/largest possible value we can express instead
of failing.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683861
This commit is contained in:
Wim Taymans 2012-09-12 13:28:07 +02:00
parent 6d9f9bf11a
commit 1c64a91a50

View file

@ -2071,28 +2071,28 @@ gst_fraction_double (gint * n_out, gint * d_out, gboolean half)
if (d == 0)
return FALSE;
if (n == 0 || (n == G_MAXINT && d == 1))
if (n == 0)
return TRUE;
gcd = gst_util_greatest_common_divisor (n, d);
n /= gcd;
d /= gcd;
if (!half) {
if (G_MAXINT / 2 >= ABS (n)) {
n *= 2;
} else if (d >= 2) {
d /= 2;
} else {
return FALSE;
}
} else {
if (half) {
if (G_MAXINT / 2 >= ABS (d)) {
d *= 2;
} else if (n >= 2) {
} else if (n >= 2 && n != G_MAXINT) {
n /= 2;
} else {
return FALSE;
d = G_MAXINT;
}
} else {
if (G_MAXINT / 2 >= ABS (n)) {
n *= 2;
} else if (d >= 2 && d != G_MAXINT) {
d /= 2;
} else {
n = G_MAXINT;
}
}