mirror of
https://github.com/pion/mediadevices.git
synced 2025-10-04 00:06:32 +08:00
Redesign codec
Resolves https://github.com/pion/mediadevices/issues/114 * Remove codec registrar * Completely redesign how codec is being discovered, tuned, and built * Update examples * Update unit tests
This commit is contained in:
@@ -8,5 +8,35 @@ import (
|
||||
"github.com/pion/mediadevices/pkg/prop"
|
||||
)
|
||||
|
||||
type VideoEncoderBuilder func(r video.Reader, p prop.Media) (io.ReadCloser, error)
|
||||
type AudioEncoderBuilder func(r audio.Reader, p prop.Media) (io.ReadCloser, error)
|
||||
// AudioEncoderBuilder is the interface that wraps basic operations that are
|
||||
// necessary to build the audio encoder.
|
||||
//
|
||||
// This interface is for codec implementors to provide codec specific params,
|
||||
// but still giving generality for the users.
|
||||
type AudioEncoderBuilder interface {
|
||||
// Name represents the codec name
|
||||
Name() string
|
||||
// BuildAudioEncoder builds audio encoder by given media params and audio input
|
||||
BuildAudioEncoder(r audio.Reader, p prop.Media) (io.ReadCloser, error)
|
||||
}
|
||||
|
||||
// VideoEncoderBuilder is the interface that wraps basic operations that are
|
||||
// necessary to build the video encoder.
|
||||
//
|
||||
// This interface is for codec implementors to provide codec specific params,
|
||||
// but still giving generality for the users.
|
||||
type VideoEncoderBuilder interface {
|
||||
// Name represents the codec name
|
||||
Name() string
|
||||
// BuildVideoEncoder builds video encoder by given media params and video input
|
||||
BuildVideoEncoder(r video.Reader, p prop.Media) (io.ReadCloser, error)
|
||||
}
|
||||
|
||||
// BaseParams represents an codec's encoding properties
|
||||
type BaseParams struct {
|
||||
// Target bitrate in bps.
|
||||
BitRate int
|
||||
|
||||
// Expected interval of the keyframes in frames.
|
||||
KeyFrameInterval int
|
||||
}
|
||||
|
Reference in New Issue
Block a user