Update from io.ReadCloser to codec.ReadCloser

This commit is contained in:
Lukas Herman
2020-03-25 20:50:26 -04:00
committed by Lukas Herman
parent e9ad427815
commit 354f2710b5
14 changed files with 99 additions and 33 deletions
+12 -2
View File
@@ -17,7 +17,7 @@ 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)
BuildAudioEncoder(r audio.Reader, p prop.Media) (ReadCloser, error)
}
// VideoEncoderBuilder is the interface that wraps basic operations that are
@@ -29,7 +29,17 @@ 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)
BuildVideoEncoder(r video.Reader, p prop.Media) (ReadCloser, error)
}
// ReadCloser is an io.ReadCloser with methods for rate limiting: SetBitRate and ForceKeyFrame
type ReadCloser interface {
io.ReadCloser
// SetBitRate sets current target bitrate, lower bitrate means smaller data will be transmitted
// but this also means that the quality will also be lower.
SetBitRate(int) error
// ForceKeyFrame forces the next frame to be a keyframe, aka intra-frame.
ForceKeyFrame() error
}
// BaseParams represents an codec's encoding properties