merge master and add SetHardwareDeviceContext (#126)

This commit is contained in:
oldma3095
2024-12-24 21:14:04 +08:00
committed by GitHub
parent 5b04a31254
commit ee2cb0ea59
3 changed files with 35 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ package astiav
import "C"
import (
"errors"
"math"
"unsafe"
)
@@ -154,3 +155,17 @@ func (g *FilterGraph) SendCommand(target, cmd, args string, f FilterCommandFlags
})
return
}
// https://ffmpeg.org/doxygen/7.0/structAVFilterGraph.html#a0ba5c820c760788ea5f8e40c476f9704
func (g *FilterGraph) NbFilters() int {
return int(g.c.nb_filters)
}
// https://ffmpeg.org/doxygen/7.0/structAVFilterGraph.html#a1dafd3d239f7c2f5e3ac109578ef926d
func (g *FilterGraph) Filters() (fs []*FilterContext) {
fcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterContext)(nil))](*C.AVFilterContext))(unsafe.Pointer(g.c.filters))
for i := 0; i < g.NbFilters(); i++ {
fs = append(fs, newFilterContext(fcs[i]))
}
return
}