mirror of
https://github.com/asticode/go-astiav.git
synced 2026-04-22 15:57:03 +08:00
a541263dfd
* 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
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package astiav
|
|
|
|
//#include <libavfilter/avfilter.h>
|
|
import "C"
|
|
import (
|
|
"math"
|
|
"unsafe"
|
|
)
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/structAVFilterGraphSegment.html
|
|
type FilterGraphSegment struct {
|
|
c *C.AVFilterGraphSegment
|
|
}
|
|
|
|
func newFilterGraphSegmentFromC(c *C.AVFilterGraphSegment) *FilterGraphSegment {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
return &FilterGraphSegment{c: c}
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/group__lavfi.html#ga51283edd8f3685e1f33239f360e14ae8
|
|
func (fgs *FilterGraphSegment) Free() {
|
|
if fgs.c != nil {
|
|
C.avfilter_graph_segment_free(&fgs.c)
|
|
}
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/structAVFilterGraphSegment.html#ad5a2779af221d1520490fe2719f9e39a
|
|
func (fgs *FilterGraphSegment) Chains() (cs []*FilterChain) {
|
|
ccs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterChain)(nil))](*C.AVFilterChain))(unsafe.Pointer(fgs.c.chains))
|
|
for i := 0; i < fgs.NbChains(); i++ {
|
|
cs = append(cs, newFilterChainFromC(ccs[i]))
|
|
}
|
|
return
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/structAVFilterGraphSegment.html#ab7563eca151d89e693f6258de5ce0214
|
|
func (fgs *FilterGraphSegment) NbChains() int {
|
|
return int(fgs.c.nb_chains)
|
|
}
|