mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-05 15:47:33 +08:00
2023-10-19 14:31:46 CST W42D4
This commit is contained in:
@@ -5,22 +5,22 @@ package ffmpeg
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AvRational
|
||||
type AvRational C.struct_AVRational
|
||||
// AVRational
|
||||
type AVRational C.struct_AVRational
|
||||
|
||||
// Custom: GetNum gets `AVRational.num` value.
|
||||
func (q *AvRational) GetNum() int32 {
|
||||
func (q *AVRational) GetNum() int32 {
|
||||
return (int32)(q.num)
|
||||
}
|
||||
|
||||
// Custom: GetDen gets `AVRational.den` value.
|
||||
func (q *AvRational) GetDen() int32 {
|
||||
func (q *AVRational) GetDen() int32 {
|
||||
return (int32)(q.den)
|
||||
}
|
||||
|
||||
// AvMakeQ creates an AVRational with numerator and denominator.
|
||||
func AvMakeQ(num, den int32) AvRational {
|
||||
return (AvRational)(C.av_make_q((C.int)(num), (C.int)(den)))
|
||||
func AvMakeQ(num, den int32) AVRational {
|
||||
return (AVRational)(C.av_make_q((C.int)(num), (C.int)(den)))
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -33,12 +33,12 @@ const (
|
||||
// 1 if `a > b`
|
||||
// -1 if `a < b`
|
||||
// `INT_MIN` if one of the values is of the form `0 / 0`
|
||||
func AvCmpQ(a, b AvRational) int32 {
|
||||
func AvCmpQ(a, b AVRational) int32 {
|
||||
return (int32)(C.av_cmp_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
}
|
||||
|
||||
// AvQ2d converts an AVRational to a `float64`.
|
||||
func AvQ2d(a AvRational) float64 {
|
||||
func AvQ2d(a AVRational) float64 {
|
||||
return (float64)(C.av_q2d((C.struct_AVRational)(a)))
|
||||
}
|
||||
|
||||
@@ -49,34 +49,34 @@ func AvReduce(dstNum, dstDen *int32, num, den, max int64) int32 {
|
||||
}
|
||||
|
||||
// AvMulQ multiplies two rationals.
|
||||
func AvMulQ(a, b AvRational) AvRational {
|
||||
return (AvRational)(C.av_mul_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
func AvMulQ(a, b AVRational) AVRational {
|
||||
return (AVRational)(C.av_mul_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
}
|
||||
|
||||
// AvDivQ divides one rational by another.
|
||||
func AvDivQ(a, b AvRational) AvRational {
|
||||
return (AvRational)(C.av_div_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
func AvDivQ(a, b AVRational) AVRational {
|
||||
return (AVRational)(C.av_div_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
}
|
||||
|
||||
// AvAddQ adds two rationals.
|
||||
func AvAddQ(a, b AvRational) AvRational {
|
||||
return (AvRational)(C.av_add_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
func AvAddQ(a, b AVRational) AVRational {
|
||||
return (AVRational)(C.av_add_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
}
|
||||
|
||||
// AvSubQ subtracts one rational from another.
|
||||
func AvSubQ(a, b AvRational) AvRational {
|
||||
return (AvRational)(C.av_sub_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
func AvSubQ(a, b AVRational) AVRational {
|
||||
return (AVRational)(C.av_sub_q((C.struct_AVRational)(a), (C.struct_AVRational)(b)))
|
||||
}
|
||||
|
||||
// AvInvQ invert a rational.
|
||||
// return 1 / q
|
||||
func AvInvQ(q AvRational) AvRational {
|
||||
return (AvRational)(C.av_inv_q((C.struct_AVRational)(q)))
|
||||
func AvInvQ(q AVRational) AVRational {
|
||||
return (AVRational)(C.av_inv_q((C.struct_AVRational)(q)))
|
||||
}
|
||||
|
||||
// AvD2Q converts a double precision floating point number to a rational.
|
||||
func AvD2Q(d float64, max int32) AvRational {
|
||||
return (AvRational)(C.av_d2q((C.double)(d), (C.int)(max)))
|
||||
func AvD2Q(d float64, max int32) AVRational {
|
||||
return (AVRational)(C.av_d2q((C.double)(d), (C.int)(max)))
|
||||
}
|
||||
|
||||
// AvNearerQ finds which of the two rationals is closer to another rational.
|
||||
@@ -84,24 +84,24 @@ func AvD2Q(d float64, max int32) AvRational {
|
||||
// 1 if `q1` is nearer to `q` than `q2`
|
||||
// -1 if `q2` is nearer to `q` than `q1`
|
||||
// 0 if they have the same distance
|
||||
func AvNearerQ(q, q1, q2 AvRational) int32 {
|
||||
func AvNearerQ(q, q1, q2 AVRational) int32 {
|
||||
return (int32)(C.av_nearer_q((C.struct_AVRational)(q),
|
||||
(C.struct_AVRational)(q1), (C.struct_AVRational)(q2)))
|
||||
}
|
||||
|
||||
// AvFindNearestQIdx finds the value in a list of rationals nearest a given reference rational.
|
||||
func AvFindNearestQIdx(q AvRational, qList *AvRational) int32 {
|
||||
func AvFindNearestQIdx(q AVRational, qList *AVRational) int32 {
|
||||
return (int32)(C.av_find_nearest_q_idx((C.struct_AVRational)(q), (*C.struct_AVRational)(qList)))
|
||||
}
|
||||
|
||||
// AvQ2intfloat Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point format.
|
||||
func AvQ2intfloat(q AvRational) uint32 {
|
||||
func AvQ2intfloat(q AVRational) uint32 {
|
||||
return (uint32)(C.av_q2intfloat((C.struct_AVRational)(q)))
|
||||
}
|
||||
|
||||
// AvGcdQ returns the best rational so that a and b are multiple of it.
|
||||
// If the resulting denominator is larger than max_den, return def.
|
||||
func AvGcdQ(a, b AvRational, maxDen int32, def AvRational) AvRational {
|
||||
return (AvRational)(C.av_gcd_q((C.struct_AVRational)(a), (C.struct_AVRational)(b),
|
||||
func AvGcdQ(a, b AVRational, maxDen int32, def AVRational) AVRational {
|
||||
return (AVRational)(C.av_gcd_q((C.struct_AVRational)(a), (C.struct_AVRational)(b),
|
||||
(C.int)(maxDen), (C.struct_AVRational)(def)))
|
||||
}
|
||||
|
Reference in New Issue
Block a user