Moved all c code to .h and .c files + removed struc_ prefix when not needed

This commit is contained in:
Quentin Renard
2024-09-05 11:38:25 +02:00
parent e7c92c0115
commit 09a88834bb
45 changed files with 304 additions and 276 deletions

View File

@@ -12,10 +12,10 @@ import (
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavfilter/avfilter.h#L67
type FilterContext struct {
c *C.struct_AVFilterContext
c *C.AVFilterContext
}
func newFilterContext(c *C.struct_AVFilterContext) *FilterContext {
func newFilterContext(c *C.AVFilterContext) *FilterContext {
if c == nil {
return nil
}
@@ -32,7 +32,7 @@ func (fc *FilterContext) Free() {
}
func (fc *FilterContext) BuffersrcAddFrame(f *Frame, fs BuffersrcFlags) error {
var cf *C.struct_AVFrame
var cf *C.AVFrame
if f != nil {
cf = f.c
}
@@ -40,7 +40,7 @@ func (fc *FilterContext) BuffersrcAddFrame(f *Frame, fs BuffersrcFlags) error {
}
func (fc *FilterContext) BuffersinkGetFrame(f *Frame, fs BuffersinkFlags) error {
var cf *C.struct_AVFrame
var cf *C.AVFrame
if f != nil {
cf = f.c
}
@@ -60,7 +60,7 @@ func (fc *FilterContext) NbOutputs() int {
}
func (fc *FilterContext) Inputs() (ls []*FilterLink) {
lcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.struct_AVFilterLink)(nil))](*C.struct_AVFilterLink))(unsafe.Pointer(fc.c.inputs))
lcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterLink)(nil))](*C.AVFilterLink))(unsafe.Pointer(fc.c.inputs))
for i := 0; i < fc.NbInputs(); i++ {
ls = append(ls, newFilterLinkFromC(lcs[i]))
}
@@ -68,7 +68,7 @@ func (fc *FilterContext) Inputs() (ls []*FilterLink) {
}
func (fc *FilterContext) Outputs() (ls []*FilterLink) {
lcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.struct_AVFilterLink)(nil))](*C.struct_AVFilterLink))(unsafe.Pointer(fc.c.outputs))
lcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterLink)(nil))](*C.AVFilterLink))(unsafe.Pointer(fc.c.outputs))
for i := 0; i < fc.NbOutputs(); i++ {
ls = append(ls, newFilterLinkFromC(lcs[i]))
}