mirror of
https://github.com/pion/mediadevices.git
synced 2025-10-18 14:40:38 +08:00
Unify codec params type/func naming
This commit is contained in:
@@ -58,7 +58,7 @@ func main() {
|
||||
c.FrameRate = 30
|
||||
|
||||
// Load default parameters.
|
||||
cp, err := vaapi.NewVP8Param()
|
||||
cp, err := vaapi.NewVP8Params()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/pion/webrtc/v2"
|
||||
)
|
||||
|
||||
// ParamVP8 stores VP8 encoding parameters.
|
||||
type ParamVP8 struct {
|
||||
// ParamsVP8 stores VP8 encoding parameters.
|
||||
type ParamsVP8 struct {
|
||||
codec.BaseParams
|
||||
Sequence SequenceParamVP8
|
||||
RateControlMode RateControlMode
|
||||
@@ -24,9 +24,9 @@ type SequenceParamVP8 struct {
|
||||
ClampQindexLow uint
|
||||
}
|
||||
|
||||
// NewVP8Param returns default parameters of VP8 codec.
|
||||
func NewVP8Param() (ParamVP8, error) {
|
||||
return ParamVP8{
|
||||
// NewVP8Params returns default parameters of VP8 codec.
|
||||
func NewVP8Params() (ParamsVP8, error) {
|
||||
return ParamsVP8{
|
||||
BaseParams: codec.BaseParams{
|
||||
BitRate: 320000,
|
||||
KeyFrameInterval: 30,
|
||||
@@ -47,17 +47,17 @@ func NewVP8Param() (ParamVP8, error) {
|
||||
}
|
||||
|
||||
// Name represents the codec name
|
||||
func (p *ParamVP8) Name() string {
|
||||
func (p *ParamsVP8) Name() string {
|
||||
return webrtc.VP8
|
||||
}
|
||||
|
||||
// BuildVideoEncoder builds VP8 encoder with given params
|
||||
func (p *ParamVP8) BuildVideoEncoder(r video.Reader, property prop.Media) (io.ReadCloser, error) {
|
||||
func (p *ParamsVP8) BuildVideoEncoder(r video.Reader, property prop.Media) (io.ReadCloser, error) {
|
||||
return newVP8Encoder(r, property, *p)
|
||||
}
|
||||
|
||||
// ParamVP9 represents VAEncSequenceParameterBufferVP9 and other parameter buffers.
|
||||
type ParamVP9 struct {
|
||||
// ParamsVP9 represents VAEncSequenceParameterBufferVP9 and other parameter buffers.
|
||||
type ParamsVP9 struct {
|
||||
codec.BaseParams
|
||||
RateControlMode RateControlMode
|
||||
RateControl RateControlParam
|
||||
@@ -97,9 +97,9 @@ const (
|
||||
RateControlAVBR RateControlMode = 0x00000800
|
||||
)
|
||||
|
||||
// NewVP9Param returns default parameters of VP9 codec.
|
||||
func NewVP9Param() (ParamVP9, error) {
|
||||
return ParamVP9{
|
||||
// NewVP9Params returns default parameters of VP9 codec.
|
||||
func NewVP9Params() (ParamsVP9, error) {
|
||||
return ParamsVP9{
|
||||
BaseParams: codec.BaseParams{
|
||||
BitRate: 320000,
|
||||
KeyFrameInterval: 30,
|
||||
@@ -116,11 +116,11 @@ func NewVP9Param() (ParamVP9, error) {
|
||||
}
|
||||
|
||||
// Name represents the codec name
|
||||
func (p *ParamVP9) Name() string {
|
||||
func (p *ParamsVP9) Name() string {
|
||||
return webrtc.VP9
|
||||
}
|
||||
|
||||
// BuildVideoEncoder builds VP9 encoder with given params
|
||||
func (p *ParamVP9) BuildVideoEncoder(r video.Reader, property prop.Media) (io.ReadCloser, error) {
|
||||
func (p *ParamsVP9) BuildVideoEncoder(r video.Reader, property prop.Media) (io.ReadCloser, error) {
|
||||
return newVP9Encoder(r, property, *p)
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ type encoderVP8 struct {
|
||||
|
||||
frameCnt int
|
||||
prop prop.Media
|
||||
params ParamVP8
|
||||
params ParamsVP8
|
||||
|
||||
rate *framerateDetector
|
||||
|
||||
@@ -92,7 +92,7 @@ type encoderVP8 struct {
|
||||
}
|
||||
|
||||
// newVP8Encoder creates new VP8 encoder
|
||||
func newVP8Encoder(r video.Reader, p prop.Media, params ParamVP8) (io.ReadCloser, error) {
|
||||
func newVP8Encoder(r video.Reader, p prop.Media, params ParamsVP8) (io.ReadCloser, error) {
|
||||
if p.Width%16 != 0 || p.Width == 0 {
|
||||
return nil, errors.New("width must be 16*n")
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ type encoderVP9 struct {
|
||||
|
||||
frameCnt int
|
||||
prop prop.Media
|
||||
params ParamVP9
|
||||
params ParamsVP9
|
||||
|
||||
rate *framerateDetector
|
||||
|
||||
@@ -96,7 +96,7 @@ type encoderVP9 struct {
|
||||
}
|
||||
|
||||
// newVP9Encoder creates new VP9 encoder
|
||||
func newVP9Encoder(r video.Reader, p prop.Media, params ParamVP9) (io.ReadCloser, error) {
|
||||
func newVP9Encoder(r video.Reader, p prop.Media, params ParamsVP9) (io.ReadCloser, error) {
|
||||
if p.Width%16 != 0 || p.Width == 0 {
|
||||
return nil, errors.New("width must be 16*n")
|
||||
}
|
||||
|
Reference in New Issue
Block a user