Skip to content

Commit

Permalink
feat: add setter and getter for extra_hw_frames
Browse files Browse the repository at this point in the history
  • Loading branch information
l0rem1psum committed Mar 12, 2024
1 parent d3d2df8 commit a3a029b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions codec_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ func (cc *CodecContext) SetHardwareDeviceContext(hdc *HardwareDeviceContext) {
}
}

func (cc *CodecContext) ExtraHwFrames() int {
return int(cc.c.extra_hw_frames)
}

func (cc *CodecContext) SetExtraHardwareFrames(n int) {
cc.c.extra_hw_frames = C.int(n)
}

type CodecContextPixelFormatCallback func(pfs []PixelFormat) PixelFormat

var (
Expand Down
2 changes: 2 additions & 0 deletions codec_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func TestCodecContext(t *testing.T) {
cc4.SetThreadType(ThreadTypeSlice)
cc4.SetTimeBase(NewRational(15, 1))
cc4.SetWidth(16)
cc4.SetExtraHardwareFrames(4)
require.Equal(t, int64(1), cc4.BitRate())
require.True(t, cc4.ChannelLayout().Equal(ChannelLayout21))
require.Equal(t, 3, cc4.Channels())
Expand All @@ -115,6 +116,7 @@ func TestCodecContext(t *testing.T) {
require.Equal(t, ThreadTypeSlice, cc4.ThreadType())
require.Equal(t, NewRational(15, 1), cc4.TimeBase())
require.Equal(t, 16, cc4.Width())
require.Equal(t, 4, cc4.ExtraHwFrames())

// TODO Test ReceivePacket
// TODO Test SendPacket
Expand Down

0 comments on commit a3a029b

Please sign in to comment.