mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-29 10:42:32 +08:00
Expose pointer to underlying AVCodecContext (#95)
* feat: expose pointer to underlying C object * feat: add ut
This commit is contained in:
@@ -340,6 +340,10 @@ func (cc *CodecContext) SetExtraHardwareFrames(n int) {
|
|||||||
cc.c.extra_hw_frames = C.int(n)
|
cc.c.extra_hw_frames = C.int(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cc *CodecContext) UnsafePointer() unsafe.Pointer {
|
||||||
|
return unsafe.Pointer(cc.c)
|
||||||
|
}
|
||||||
|
|
||||||
type CodecContextPixelFormatCallback func(pfs []PixelFormat) PixelFormat
|
type CodecContextPixelFormatCallback func(pfs []PixelFormat) PixelFormat
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package astiav
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@@ -40,6 +41,7 @@ func TestCodecContext(t *testing.T) {
|
|||||||
require.Equal(t, 1, cc1.ThreadCount())
|
require.Equal(t, 1, cc1.ThreadCount())
|
||||||
require.Equal(t, ThreadType(3), cc1.ThreadType())
|
require.Equal(t, ThreadType(3), cc1.ThreadType())
|
||||||
require.Equal(t, 320, cc1.Width())
|
require.Equal(t, 320, cc1.Width())
|
||||||
|
require.Equal(t, unsafe.Pointer(cc1.c), cc1.UnsafePointer())
|
||||||
cl := cc1.Class()
|
cl := cc1.Class()
|
||||||
require.NotNil(t, cl)
|
require.NotNil(t, cl)
|
||||||
require.Equal(t, "AVCodecContext", cl.Name())
|
require.Equal(t, "AVCodecContext", cl.Name())
|
||||||
|
|||||||
Reference in New Issue
Block a user