// Use of this source code is governed by a MIT license that can be found in the LICENSE file. // Giorgis (habtom@giorgis.io) //Package avcodec contains the codecs (decoders and encoders) provided by the libavcodec library //Provides some generic global options, which can be set on all the encoders and decoders. package avcodec //#cgo pkg-config: libavformat libavcodec libavutil //#include //#include //#include //#include //#include //#include //#include //#include import "C" import "fmt" func (r Rational) Num() int { return int(r.num) } func (r Rational) Den() int { return int(r.den) } func (r Rational) String() string { return fmt.Sprintln("%d/%d", int(r.num), int(r.den)) } func (r *Rational) Assign(o Rational) { r.Set(o.Num(), o.Den()) } func (r *Rational) Set(num, den int) { r.num, r.den = C.int(num), C.int(den) } func NewRational(num, den int) Rational { return Rational{ num: C.int(num), den: C.int(den), } }