Skip to content

Commit

Permalink
Frame.Copy(dst *Frame) (#127)
Browse files Browse the repository at this point in the history
* OpenIOContextWithDictionary

* OpenIOContext

* OpenIOContext

* IOInterrupterCB

* OpenIOContext(filename string, flags IOContextFlags, ii *IOInterrupter, d *Dictionary)

* Program and Discard

* Program and Discard

* Program and Discard

* Program and Discard

* Program and Discard

* Program and Discard

* CodecContext
MaxBFrames()
SetMaxBFrames(n int)

* another pr

* delete Flags()

* delete Flags()

* delete Flags()

* delete PmtVersion()

* SetStreamIndex

* SetStreamIndex

* MaxBFrames()
SetMaxBFrames(n int)
RcMaxRate()
SetRcMaxRate(n int64)
RcMinRate()
SetRcMinRate(n int64)
RcBufferSize()
SetRcBufferSize(n int)

* rename rate control methods

* test passed

* bufferSrcCtx initialize with dictionary

* bufferSrcCtx initialize with dictionary

* SetHardwareDeviceContext

* SetHardwareDeviceContext

* FilterGraph.NbFilters()
FilterGraph.Filters()
FilterContext.SetHardwareDeviceContext(hdc *HardwareDeviceContext)

* filter_graph_test

* FilterGraph.Dump

* FilterGraph.Dump

* remove FilterGraph.Dump

* Frame.Copy(dst *Frame)

* test fail

* frame.Copy test pass
  • Loading branch information
oldma3095 authored Jan 7, 2025
1 parent a6280c7 commit 2968c4d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,8 @@ func (f *Frame) IsWritable() bool {
func (f *Frame) MakeWritable() error {
return newError(C.av_frame_make_writable(f.c))
}

// https://ffmpeg.org/doxygen/7.0/group__lavu__frame.html#gaec4e92f6e1e75ffaf76e07586fb0c9ed
func (f *Frame) Copy(dst *Frame) error {
return newError(C.av_frame_copy(dst.c, f.c))
}
16 changes: 16 additions & 0 deletions frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,20 @@ func TestFrame(t *testing.T) {
require.False(t, f6.IsWritable())
require.NoError(t, f6.MakeWritable())
require.True(t, f6.IsWritable())

f7 := AllocFrame()
require.NotNil(t, f7)
defer f7.Free()
align = 1
f7.SetHeight(f6.Height())
f7.SetPixelFormat(f6.PixelFormat())
f7.SetWidth(f6.Width())
require.NoError(t, f7.AllocBuffer(align))
require.NoError(t, f7.AllocImage(align))
require.NoError(t, f6.Copy(f7))
f6b, err := f6.Data().Bytes(align)
require.NoError(t, err)
f7b, err := f7.Data().Bytes(align)
require.NoError(t, err)
require.Equal(t, f6b, f7b)
}

0 comments on commit 2968c4d

Please sign in to comment.