Files
go-astiav/filter_chain.go
Tryanks a541263dfd Now compatible with n8.0 (#178)
* n7.1: Migrate deprecated methods, fields, and definitions

* n7.1: Add new definitions

* n7.1: Add new field

* n7.1: Update doxygen url

* n8.0: Clean up remaining n7.x deprecations

* n8.0: Add new CodecIDs and fields

* n8.0: Migration to n8.0

* n8.0: Refactor swscale with Publicly expose struct SwsContext, enum SwsDither, and enum SwsAlphaBlend

n8.0: Stash commit

* n8.0: Update doxygen url

* n8.0: Fix windows.patch to apply new library.mak in n8.0

* n8.0: Clean up and organize the APIs, remove redundant implementations, and reorder the enum fields

* n8.0: Refactor SoftwareScaleContext to simplify and optimize update logic and remove redundant code

* Add tests for supported sample rates and frame rates in codec encoders

* Revert changes in `Free` and `Class`, other minor improvements

* Adapt the examples to the current library

* Update breaking changes
2026-01-13 15:10:38 +01:00

35 lines
861 B
Go

package astiav
//#include <libavfilter/avfilter.h>
import "C"
import (
"math"
"unsafe"
)
// https://ffmpeg.org/doxygen/8.0/structAVFilterChain.html
type FilterChain struct {
c *C.AVFilterChain
}
func newFilterChainFromC(c *C.AVFilterChain) *FilterChain {
if c == nil {
return nil
}
return &FilterChain{c: c}
}
// https://ffmpeg.org/doxygen/8.0/structAVFilterChain.html#aedebb337fac024e27b499fb3a0321f3e
func (fc *FilterChain) Filters() (fs []*FilterParams) {
fcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterParams)(nil))](*C.AVFilterParams))(unsafe.Pointer(fc.c.filters))
for i := 0; i < fc.NbFilters(); i++ {
fs = append(fs, newFilterParamsFromC(fcs[i]))
}
return
}
// https://ffmpeg.org/doxygen/8.0/structAVFilterChain.html#abacf5280bd6db0d37a304b0dd0b6c54d
func (fc *FilterChain) NbFilters() int {
return int(fc.c.nb_filters)
}