diff --git a/codec_hardware_config.go b/codec_hardware_config.go index 7b9d973..613c556 100644 --- a/codec_hardware_config.go +++ b/codec_hardware_config.go @@ -6,10 +6,10 @@ import "C" // https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/codec.h#L460 type CodecHardwareConfig struct { - c *C.AVCodecHWConfig + c *C.struct_AVCodecHWConfig } -func newCodecHardwareConfigFromC(c *C.AVCodecHWConfig) CodecHardwareConfig { +func newCodecHardwareConfigFromC(c *C.struct_AVCodecHWConfig) CodecHardwareConfig { return CodecHardwareConfig{c: c} } diff --git a/filter_graph.go b/filter_graph.go index 2d8c783..b9dcc06 100644 --- a/filter_graph.go +++ b/filter_graph.go @@ -43,6 +43,22 @@ func (g *FilterGraph) Class() *Class { return newClassFromC(unsafe.Pointer(g.c)) } +func (g *FilterGraph) ThreadCount() int { + return int(g.c.nb_threads) +} + +func (g *FilterGraph) SetThreadCount(threadCount int) { + g.c.nb_threads = C.int(threadCount) +} + +func (g *FilterGraph) ThreadType() ThreadType { + return ThreadType(g.c.thread_type) +} + +func (g *FilterGraph) SetThreadType(t ThreadType) { + g.c.thread_type = C.int(t) +} + type FilterArgs map[string]string func (args FilterArgs) String() string { diff --git a/filter_graph_test.go b/filter_graph_test.go index 46d750d..9ea02bf 100644 --- a/filter_graph_test.go +++ b/filter_graph_test.go @@ -17,6 +17,10 @@ func TestFilterGraph(t *testing.T) { cl := fg.Class() require.NotNil(t, cl) require.Equal(t, "AVFilterGraph", cl.Name()) + fg.SetThreadCount(2) + require.Equal(t, 2, fg.ThreadCount()) + fg.SetThreadType(ThreadTypeSlice) + require.Equal(t, ThreadTypeSlice, fg.ThreadType()) bufferSink := FindFilterByName("buffersink") require.NotNil(t, bufferSink) diff --git a/hardware_device_context.go b/hardware_device_context.go index c832745..ee97fe0 100644 --- a/hardware_device_context.go +++ b/hardware_device_context.go @@ -10,7 +10,7 @@ import ( // https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavutil/hwcontext.h#L61 type HardwareDeviceContext struct { - c *C.AVBufferRef + c *C.struct_AVBufferRef } func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary) (*HardwareDeviceContext, error) { diff --git a/thread_type.go b/thread_type.go index c824241..0db36d0 100644 --- a/thread_type.go +++ b/thread_type.go @@ -8,6 +8,7 @@ type ThreadType int // https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/avcodec.h#L1451 const ( - ThreadTypeFrame = ThreadType(C.FF_THREAD_FRAME) - ThreadTypeSlice = ThreadType(C.FF_THREAD_SLICE) + ThreadTypeFrame = ThreadType(C.FF_THREAD_FRAME) + ThreadTypeSlice = ThreadType(C.FF_THREAD_SLICE) + ThreadTypeUndefined = ThreadType(0) )