Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	filter_context.go
  • Loading branch information
oldma3095 committed Dec 24, 2024
2 parents 9a24afc + 5b04a31 commit 1540ebf
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func FindFilterByName(n string) *Filter {
return newFilterFromC(C.avfilter_get_by_name(cn))
}

// https://ffmpeg.org/doxygen/7.0/structAVFilter.html#a632c76418742ad4f4dccbd4db40badd0
func (f *Filter) Flags() FilterFlags {
return FilterFlags(f.c.flags)
}

// https://ffmpeg.org/doxygen/7.0/structAVFilter.html#a28a4776f344f91055f42a4c2a1b15c0c
func (f *Filter) Name() string {
return C.GoString(f.c.name)
Expand Down
5 changes: 5 additions & 0 deletions filter_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ func (fc *FilterContext) SetHardwareDeviceContext(hdc *HardwareDeviceContext) {
fc.c.hw_device_ctx = nil
}
}

// https://ffmpeg.org/doxygen/7.0/structAVFilterContext.html#a6eee53e57dddfa7cca1cade870c8a44e
func (fc *FilterContext) Filter() *Filter {
return newFilterFromC(fc.c.filter)
}
18 changes: 18 additions & 0 deletions filter_flag.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package astiav

//#include <libavfilter/avfilter.h>
import "C"

// https://ffmpeg.org/doxygen/7.0/group__lavfi.html#gae6ed6c10a03508829bdf17560e3e10e5
type FilterFlag int64

const (
FilterFlagDynamicInputs = FilterFlag(C.AVFILTER_FLAG_DYNAMIC_INPUTS)
FilterFlagDynamicOutputs = FilterFlag(C.AVFILTER_FLAG_DYNAMIC_OUTPUTS)
FilterFlagSliceThreads = FilterFlag(C.AVFILTER_FLAG_SLICE_THREADS)
FilterFlagMetadataOnly = FilterFlag(C.AVFILTER_FLAG_METADATA_ONLY)
FilterFlagHardwareDevice = FilterFlag(C.AVFILTER_FLAG_HWDEVICE)
FilterFlagSupportTimelineGeneric = FilterFlag(C.AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC)
FilterFlagSupportTimelineInternal = FilterFlag(C.AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
FilterFlagSupportTimeline = FilterFlag(C.AVFILTER_FLAG_SUPPORT_TIMELINE)
)
1 change: 1 addition & 0 deletions filter_graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ func TestFilter(t *testing.T) {
require.NotNil(t, f)
require.Equal(t, "format", f.Name())
require.Equal(t, "format", f.String())
require.True(t, f.Flags().Has(FilterFlagMetadataOnly))
}
20 changes: 20 additions & 0 deletions flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions flags_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/cmd/flags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var list = []listItem{
{Name: "CodecContext", Suffix: "2"},
{Name: "CodecHardwareConfigMethod"},
{Name: "Dictionary"},
{Name: "Filter"},
{Name: "FilterCommand"},
{Name: "FormatContext"},
{Name: "FormatContextCtx"},
Expand Down

0 comments on commit 1540ebf

Please sign in to comment.