/* Distances are only comparable, if same time bases are used for computing distances. */
static int64_t ts_distance(int64_t ts_hi, AVRational tb_hi, int64_t ts_lo, AVRational tb_lo)
/* Distances are only comparable, if same time bases are used for computing distances. */
static int64_t ts_distance(int64_t ts_hi, AVRational tb_hi, int64_t ts_lo, AVRational tb_lo)
{
    int64_t hi, lo;
    hi = ts_hi * tb_hi.num * tb_lo.den;
    lo = ts_lo * tb_lo.num * tb_hi.den;
    return hi - lo;
}