Files
CorebreakerandHab Giorgis 001779d032 Working tutorial; More hooks to libav API; removes debbuging print
Missing constants, additional functions, remove errors
2019-04-07 13:45:00 -04:00

46 lines
1.0 KiB
Go

// 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 <stdio.h>
//#include <stdlib.h>
//#include <inttypes.h>
//#include <stdint.h>
//#include <string.h>
//#include <libavformat/avformat.h>
//#include <libavcodec/avcodec.h>
//#include <libavutil/avutil.h>
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),
}
}