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
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package astiav
|
|
|
|
//#include <libavfilter/buffersrc.h>
|
|
import "C"
|
|
|
|
type BuffersrcFilterContext struct {
|
|
fc *FilterContext
|
|
}
|
|
|
|
func newBuffersrcFilterContext(fc *FilterContext) *BuffersrcFilterContext {
|
|
return &BuffersrcFilterContext{fc: fc}
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/group__lavfi__buffersrc.html#ga73ed90c3c3407f36e54d65f91faaaed9
|
|
func (bfc *BuffersrcFilterContext) AddFrame(f *Frame, fs BuffersrcFlags) error {
|
|
var cf *C.AVFrame
|
|
if f != nil {
|
|
cf = f.c
|
|
}
|
|
return newError(C.av_buffersrc_add_frame_flags(bfc.fc.c, cf, C.int(fs)))
|
|
}
|
|
|
|
func (bfc *BuffersrcFilterContext) FilterContext() *FilterContext {
|
|
return bfc.fc
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/group__lavfi.html#ga8c15af28902395399fe455f6f8236848
|
|
func (bfc *BuffersrcFilterContext) Initialize(d *Dictionary) error {
|
|
var dc **C.AVDictionary
|
|
if d != nil {
|
|
dc = &d.c
|
|
}
|
|
return newError(C.avfilter_init_dict(bfc.fc.c, dc))
|
|
}
|
|
|
|
// https://ffmpeg.org/doxygen/8.0/group__lavfi__buffersrc.html#ga398cd2a84f8b4a588197ab9d90135048
|
|
func (bfc *BuffersrcFilterContext) SetParameters(bfcp *BuffersrcFilterContextParameters) error {
|
|
return newError(C.av_buffersrc_parameters_set(bfc.fc.c, bfcp.c))
|
|
}
|