mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-06 16:46:52 +08:00
Added filter thread methods
This commit is contained in:
@@ -6,10 +6,10 @@ import "C"
|
|||||||
|
|
||||||
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/codec.h#L460
|
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/codec.h#L460
|
||||||
type CodecHardwareConfig struct {
|
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}
|
return CodecHardwareConfig{c: c}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,22 @@ func (g *FilterGraph) Class() *Class {
|
|||||||
return newClassFromC(unsafe.Pointer(g.c))
|
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
|
type FilterArgs map[string]string
|
||||||
|
|
||||||
func (args FilterArgs) String() string {
|
func (args FilterArgs) String() string {
|
||||||
|
@@ -17,6 +17,10 @@ func TestFilterGraph(t *testing.T) {
|
|||||||
cl := fg.Class()
|
cl := fg.Class()
|
||||||
require.NotNil(t, cl)
|
require.NotNil(t, cl)
|
||||||
require.Equal(t, "AVFilterGraph", cl.Name())
|
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")
|
bufferSink := FindFilterByName("buffersink")
|
||||||
require.NotNil(t, bufferSink)
|
require.NotNil(t, bufferSink)
|
||||||
|
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavutil/hwcontext.h#L61
|
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavutil/hwcontext.h#L61
|
||||||
type HardwareDeviceContext struct {
|
type HardwareDeviceContext struct {
|
||||||
c *C.AVBufferRef
|
c *C.struct_AVBufferRef
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary) (*HardwareDeviceContext, error) {
|
func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary) (*HardwareDeviceContext, error) {
|
||||||
|
@@ -10,4 +10,5 @@ type ThreadType int
|
|||||||
const (
|
const (
|
||||||
ThreadTypeFrame = ThreadType(C.FF_THREAD_FRAME)
|
ThreadTypeFrame = ThreadType(C.FF_THREAD_FRAME)
|
||||||
ThreadTypeSlice = ThreadType(C.FF_THREAD_SLICE)
|
ThreadTypeSlice = ThreadType(C.FF_THREAD_SLICE)
|
||||||
|
ThreadTypeUndefined = ThreadType(0)
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user