From eb4cba6e74551fb74198953128fd8d2ce4747e97 Mon Sep 17 00:00:00 2001 From: ma3315865 Date: Thu, 19 Dec 2024 09:34:42 +0800 Subject: [PATCH] rename rate control methods --- codec_context.go | 12 ++++++------ codec_context_test.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codec_context.go b/codec_context.go index 4edf11a..0ff2ae5 100644 --- a/codec_context.go +++ b/codec_context.go @@ -467,31 +467,31 @@ func (cc *CodecContext) SetMaxBFrames(n int) { } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#aa2b5582f1a360534310b686cc3f7c668 -func (cc *CodecContext) RcMaxRate() int64 { +func (cc *CodecContext) RateControlMaxRate() int64 { return int64(cc.c.rc_max_rate) } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#aa2b5582f1a360534310b686cc3f7c668 -func (cc *CodecContext) SetRcMaxRate(n int64) { +func (cc *CodecContext) SetRateControlMaxRate(n int64) { cc.c.rc_max_rate = C.int64_t(n) } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#ac265c70b89e87455ec05eb2978def81b -func (cc *CodecContext) RcMinRate() int64 { +func (cc *CodecContext) RateControlMinRate() int64 { return int64(cc.c.rc_min_rate) } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#ac265c70b89e87455ec05eb2978def81b -func (cc *CodecContext) SetRcMinRate(n int64) { +func (cc *CodecContext) SetRateControlMinRate(n int64) { cc.c.rc_min_rate = C.int64_t(n) } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#a15000607a7e2371162348bb35b0184c1 -func (cc *CodecContext) RcBufferSize() int { +func (cc *CodecContext) RateControlBufferSize() int { return int(cc.c.rc_buffer_size) } // https://ffmpeg.org/doxygen/7.0/structAVCodecContext.html#a15000607a7e2371162348bb35b0184c1 -func (cc *CodecContext) SetRcBufferSize(n int) { +func (cc *CodecContext) SetRateControlBufferSize(n int) { cc.c.rc_buffer_size = C.int(n) } diff --git a/codec_context_test.go b/codec_context_test.go index 57fef52..69ab042 100644 --- a/codec_context_test.go +++ b/codec_context_test.go @@ -102,9 +102,9 @@ func TestCodecContext(t *testing.T) { cc4.SetWidth(16) cc4.SetExtraHardwareFrames(4) cc4.SetMaxBFrames(1) - cc4.SetRcMaxRate(1_5000_000) - cc4.SetRcMinRate(1_5000_000) - cc4.SetRcBufferSize(1_5000_000) + cc4.SetRateControlMaxRate(int64(1_5000_000)) + cc4.SetRateControlMinRate(int64(1_5000_000)) + cc4.SetRateControlBufferSize(1_5000_000) require.Equal(t, int64(1), cc4.BitRate()) require.True(t, cc4.ChannelLayout().Equal(ChannelLayout21)) require.Equal(t, NewCodecContextFlags(4), cc4.Flags()) @@ -126,9 +126,9 @@ func TestCodecContext(t *testing.T) { require.Equal(t, 16, cc4.Width()) require.Equal(t, 4, cc4.ExtraHardwareFrames()) require.Equal(t, 1, cc4.MaxBFrames()) - require.Equal(t, 1_5000_000, cc4.RcMaxRate()) - require.Equal(t, 1_5000_000, cc4.RcMinRate()) - require.Equal(t, 1_5000_000, cc4.RcBufferSize()) + require.Equal(t, 1_5000_000, cc4.RateControlMaxRate()) + require.Equal(t, 1_5000_000, cc4.RateControlMinRate()) + require.Equal(t, 1_5000_000, cc4.RateControlBufferSize()) cc5 := AllocCodecContext(nil) require.NotNil(t, cc5)