2023-10-19 14:31:46 CST W42D4

This commit is contained in:
aggresss
2023-10-19 14:31:46 +08:00
parent 762aa14362
commit 0f95831c39
52 changed files with 9140 additions and 4324 deletions

View File

@@ -75,25 +75,115 @@ func SwsGetCoefficients(colorspace int32) *int32 {
// SwsVector
type SwsVector C.struct_SwsVector
// Custom: GetCoeff gets `SwsVector.coeff` value.
func (sv *SwsVector) GetCoeff() *float64 {
return (*float64)(sv.coeff)
}
// Custom: SetCoeff sets `SwsVector.coeff` value.
func (sv *SwsVector) SetCoeff(v *float64) {
sv.coeff = (*C.double)(v)
}
// Custom: GetCoeffAddr gets `SwsVector.coeff` address.
func (sv *SwsVector) GetCoeffAddr() **float64 {
return (**float64)(unsafe.Pointer(&sv.coeff))
}
// Custom: GetLength gets `SwsVector.length` value.
func (sv *SwsVector) GetLength() int32 {
return (int32)(sv.length)
}
// Custom: SetLength sets `SwsVector.length` value.
func (sv *SwsVector) SetLength(v int32) {
sv.length = (C.int)(v)
}
// Custom: GetLengthAddr gets `SwsVector.length` address.
func (sv *SwsVector) GetLengthAddr() *int32 {
return (*int32)(&sv.length)
}
// SwsFilter
type SwsFilter C.struct_SwsFilter
// Custom: GetLumH gets `SwsFilter.lumH` value.
func (sf *SwsFilter) GetLumH() *SwsVector {
return (*SwsVector)(sf.lumH)
}
// Custom: SetLumH sets `SwsFilter.lumH` value.
func (sf *SwsFilter) SetLumH(v *SwsVector) {
sf.lumH = (*C.struct_SwsVector)(v)
}
// Custom: GetLumHAddr gets `SwsFilter.lumH` address.
func (sf *SwsFilter) GetLumHAddr() **SwsVector {
return (**SwsVector)(unsafe.Pointer(&sf.lumH))
}
// Custom: GetLumV gets `SwsFilter.lumV` value.
func (sf *SwsFilter) GetLumV() *SwsVector {
return (*SwsVector)(sf.lumV)
}
// Custom: SetLumV sets `SwsFilter.lumV` value.
func (sf *SwsFilter) SetLumV(v *SwsVector) {
sf.lumV = (*C.struct_SwsVector)(v)
}
// Custom: GetLumVAddr gets `SwsFilter.lumV` address.
func (sf *SwsFilter) GetLumVAddr() **SwsVector {
return (**SwsVector)(unsafe.Pointer(&sf.lumV))
}
// Custom: GetChrH gets `SwsFilter.chrH` value.
func (sf *SwsFilter) GetChrH() *SwsVector {
return (*SwsVector)(sf.chrH)
}
// Custom: SetChrH sets `SwsFilter.chrH` value.
func (sf *SwsFilter) SetChrH(v *SwsVector) {
sf.chrH = (*C.struct_SwsVector)(v)
}
// Custom: GetChrHAddr gets `SwsFilter.chrH` address.
func (sf *SwsFilter) GetChrHAddr() **SwsVector {
return (**SwsVector)(unsafe.Pointer(&sf.chrH))
}
// Custom: GetChrV gets `SwsFilter.chrV` value.
func (sf *SwsFilter) GetChrV() *SwsVector {
return (*SwsVector)(sf.chrV)
}
// Custom: SetChrV sets `SwsFilter.chrV` value.
func (sf *SwsFilter) SetChrV(v *SwsVector) {
sf.chrV = (*C.struct_SwsVector)(v)
}
// Custom: GetChrVAddr gets `SwsFilter.chrV` address.
func (sf *SwsFilter) GetChrVAddr() **SwsVector {
return (**SwsVector)(unsafe.Pointer(&sf.chrV))
}
// SwsContext
type SwsContext C.struct_SwsContext
// SwsIsSupportedInput returns a positive value if pix_fmt is a supported input format.
func SwsIsSupportedInput(pixFmt AvPixelFormat) int32 {
func SwsIsSupportedInput(pixFmt AVPixelFormat) int32 {
return (int32)(C.sws_isSupportedInput((C.enum_AVPixelFormat)(pixFmt)))
}
// SwsIsSupportedOutput returns a positive value if pix_fmt is a supported output format.
func SwsIsSupportedOutput(pixFmt AvPixelFormat) int32 {
func SwsIsSupportedOutput(pixFmt AVPixelFormat) int32 {
return (int32)(C.sws_isSupportedOutput((C.enum_AVPixelFormat)(pixFmt)))
}
// SwsIsSupportedEndiannessConversion returns a positive value
// if pix_fmt is a supported endianness conversion format.
func SwsIsSupportedEndiannessConversion(pixFmt AvPixelFormat) int32 {
func SwsIsSupportedEndiannessConversion(pixFmt AVPixelFormat) int32 {
return (int32)(C.sws_isSupportedEndiannessConversion((C.enum_AVPixelFormat)(pixFmt)))
}
@@ -114,8 +204,8 @@ func SwsFreeContext(sctx *SwsContext) {
}
// SwsGetcontext allocates and returns an SwsContext.
func SwsGetContext(srcW, srcH int32, srcFormat AvPixelFormat,
dstW, dstH int32, dstFormat AvPixelFormat,
func SwsGetContext(srcW, srcH int32, srcFormat AVPixelFormat,
dstW, dstH int32, dstFormat AVPixelFormat,
flags int32, srcFilter, dstFilter *SwsFilter, param *float64) *SwsContext {
return (*SwsContext)(C.sws_getContext((C.int)(srcW), (C.int)(srcH), (C.enum_AVPixelFormat)(srcFormat),
(C.int)(dstW), (C.int)(dstH), (C.enum_AVPixelFormat)(dstFormat),
@@ -137,11 +227,11 @@ func SwsScale(sctx *SwsContext, srcSlice []*uint8, srcStride []int32,
// SwsSetColorspaceDetails
func SwsSetColorSpaceDetails(sctx *SwsContext, invTable []int32, srcRange int32,
table []int32, dstRange int32, brightness, contrast, saturation int32) int32 {
if len(invTable) != 4 {
panic("invTable need len = 4")
if len(invTable) < 4 {
panic("invTable len < 4")
}
if len(table) != 4 {
panic("table need len = 4")
if len(table) < 4 {
panic("table len < 4")
}
return (int32)(C.sws_setColorspaceDetails((*C.struct_SwsContext)(sctx),
(*C.int)(unsafe.Pointer(&invTable[0])), (C.int)(srcRange),
@@ -152,11 +242,11 @@ func SwsSetColorSpaceDetails(sctx *SwsContext, invTable []int32, srcRange int32,
// SwsGetColorSpaceDetails
func SwsGetColorSpaceDetails(sctx *SwsContext, invTable []int32, srcRange *int32,
table []int32, dstRange *int32, brightness, contrast, saturation *int32) int32 {
if len(invTable) != 4 {
panic("invTable need len = 4")
if len(invTable) < 4 {
panic("invTable len < 4")
}
if len(table) != 4 {
panic("table need len = 4")
if len(table) < 4 {
panic("table len = 4")
}
invTablePtr := unsafe.Pointer(&invTable[0])
tablePtr := unsafe.Pointer(&table[0])
@@ -222,7 +312,7 @@ func SwsCloneVec(a *SwsVector) *SwsVector {
}
// Deprecated: No use
func SwsPrintVec2(a *SwsVector, logCtx *AvClass, logLevel int32) {
func SwsPrintVec2(a *SwsVector, logCtx *AVClass, logLevel int32) {
C.sws_printVec2((*C.struct_SwsVector)(a),
(*C.struct_AVClass)(logCtx), (C.int)(logLevel))
}
@@ -248,8 +338,8 @@ func SwsFreeFilter(filter *SwsFilter) {
// SwsGetCachedContext check if context can be reused, otherwise reallocate a new one.
func SwsGetCachedContext(context *SwsContext,
srcW, srcH int32, srcFormat AvPixelFormat,
dstW, dstH int32, dstFormat AvPixelFormat,
srcW, srcH int32, srcFormat AVPixelFormat,
dstW, dstH int32, dstFormat AVPixelFormat,
flags int32, srcFilter, dstFilter *SwsFilter, param *float64) *SwsContext {
return (*SwsContext)(C.sws_getCachedContext((*C.struct_SwsContext)(context),
(C.int)(srcW), (C.int)(srcH), (C.enum_AVPixelFormat)(srcFormat),
@@ -271,6 +361,6 @@ func SwsConvertPalette8ToPacked24(src, dst *uint8, numPixels int32, palette *uin
}
// SwsGetClass gets the AVClass for swsContext.
func SwsGetClass() *AvClass {
return (*AvClass)(C.sws_get_class())
func SwsGetClass() *AVClass {
return (*AVClass)(C.sws_get_class())
}