Esempio n. 1
0
func (r *Rational) Compare(r2 *Rational) (int, bool) {
	res := C.av_cmp_q(r.CAVRational, r2.CAVRational)
	switch res {
	case 0, 1, -1:
		return int(res), true
	}
	return 0, false
}
func (time *Timestamp) Equals(ts Timestamp) bool {
	return time.Time == ts.Time && C.av_cmp_q(*ts.Timebase.GetAVRational(), *time.Timebase.GetAVRational()) == 0
}
func (r *Rational) Lower(r2 Rational) bool {
	return C.av_cmp_q(*r.GetAVRational(), *r2.GetAVRational()) < 0
}
func (r *Rational) Greater(r2 Rational) bool {
	return C.av_cmp_q(*r.GetAVRational(), *r2.GetAVRational()) > 0
}
func (r *Rational) Equals(r2 Rational) bool {
	return C.av_cmp_q(*r.GetAVRational(), *r2.GetAVRational()) == 0
}
func av_cmp_q(left, right Rational) int {
	var a C.AVRational = C.AVRational{C.int(left.Num), C.int(left.Den)}
	var b C.AVRational = C.AVRational{C.int(right.Num), C.int(right.Den)}
	return int(C.av_cmp_q(a, b))
}