From 5b04a31254619f154203f2f8f6c4640c3145e059 Mon Sep 17 00:00:00 2001 From: Quentin Renard Date: Mon, 23 Dec 2024 15:48:33 +0100 Subject: [PATCH] Added filter to filter context --- filter_context.go | 5 +++++ filter_graph_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/filter_context.go b/filter_context.go index c911a40..31ebc15 100644 --- a/filter_context.go +++ b/filter_context.go @@ -39,3 +39,8 @@ func (fc *FilterContext) Free() { func (fc *FilterContext) Class() *Class { return newClassFromC(unsafe.Pointer(fc.c)) } + +// https://ffmpeg.org/doxygen/7.0/structAVFilterContext.html#a6eee53e57dddfa7cca1cade870c8a44e +func (fc *FilterContext) Filter() *Filter { + return newFilterFromC(fc.c.filter) +} diff --git a/filter_graph_test.go b/filter_graph_test.go index 9e5d11d..9a5b6d2 100644 --- a/filter_graph_test.go +++ b/filter_graph_test.go @@ -144,6 +144,7 @@ func TestFilterGraph(t *testing.T) { buffersinkContext, err := fg.NewBuffersinkFilterContext(buffersink, "filter_out") require.NoError(t, err) + require.Equal(t, buffersink, buffersinkContext.FilterContext().Filter()) cl = buffersinkContext.FilterContext().Class() require.NotNil(t, cl) require.Equal(t, "AVFilter", cl.Name())