revid: adding audio config parameters

This commit is contained in:
Trek H 2019-04-23 19:05:47 +09:30
parent 20c9e6c409
commit c51e0ec168
3 changed files with 36 additions and 31 deletions

View File

@ -255,6 +255,7 @@ func handleFlags() revid.Config {
cfg.Height = *heightPtr cfg.Height = *heightPtr
cfg.Width = *widthPtr cfg.Width = *widthPtr
cfg.FrameRate = *frameRatePtr cfg.FrameRate = *frameRatePtr
cfg.SampleRate = *sampleRatePtr
cfg.HttpAddress = *httpAddressPtr cfg.HttpAddress = *httpAddressPtr
cfg.Quantization = *quantizationPtr cfg.Quantization = *quantizationPtr
cfg.IntraRefreshPeriod = *intraRefreshPeriodPtr cfg.IntraRefreshPeriod = *intraRefreshPeriodPtr

View File

@ -36,46 +36,50 @@ import (
// Config provides parameters relevant to a revid instance. A new config must // Config provides parameters relevant to a revid instance. A new config must
// be passed to the constructor. // be passed to the constructor.
type Config struct { type Config struct {
Logger Logger
LogLevel int8 LogLevel int8
Input uint8 // IO
InputCodec uint8 Input uint8
Outputs []uint8 InputCodec uint8
RtmpMethod uint8 Outputs []uint8
Packetization uint8 RtmpMethod uint8
Packetization uint8
// Quantize specifies whether the input to Quantize bool // Determines whether input to revid will have constant or variable bitrate.
// revid will have constant or variable
// bitrate.
Quantize bool
// FlipHorizonatla and FlipVertical specify
// whether video frames should be flipped.
FlipHorizontal bool
FlipVertical bool
FramesPerClip uint
RtmpUrl string RtmpUrl string
Bitrate uint Bitrate uint
OutputPath string OutputPath string
InputPath string InputPath string
Height uint
Width uint
FrameRate uint
SampleRate uint
Rate float64
HttpAddress string HttpAddress string
Quantization uint Quantization uint
IntraRefreshPeriod uint IntraRefreshPeriod uint
RtpAddress string RtpAddress string
Logger Logger
SendRetry bool SendRetry bool
BurstPeriod uint WriteRate float64 // How many times a second revid encoders will be written to.
Rotation uint
Brightness uint // Video
Saturation int Height uint
Exposure string Width uint
AutoWhiteBalance string FrameRate uint
FramesPerClip uint
BurstPeriod uint
// Transformation
FlipHorizontal bool
FlipVertical bool
Rotation uint
// Color correction
Brightness uint
Saturation int
Exposure string
AutoWhiteBalance string
// Audio
SampleRate uint // Frame rate in Hz.
Period int // How many seconds to record at a time.
Channels int // Number of audio channels, 1 for mono, 2 for stereo.
BitDepth int // Sample bit depth, 16-bit by default.
} }
// Possible modes for raspivid --exposure parameter. // Possible modes for raspivid --exposure parameter.
@ -144,7 +148,7 @@ const (
defaultPacketization = Flv defaultPacketization = Flv
defaultFrameRate = 25 defaultFrameRate = 25
defaultSampleRate = 48000 defaultSampleRate = 48000
defaultRate = 25 defaultWriteRate = 25
defaultWidth = 1280 defaultWidth = 1280
defaultHeight = 720 defaultHeight = 720
defaultIntraRefreshPeriod = 100 defaultIntraRefreshPeriod = 100

View File

@ -676,7 +676,7 @@ func (r *Revid) setupInputForFile() error {
// startAudioInput is used to start capturing audio from an audio device and processing it. // startAudioInput is used to start capturing audio from an audio device and processing it.
func (r *Revid) startAudioInput() error { func (r *Revid) startAudioInput() error {
ai := NewAudioInput(audioParams) ai := NewAudioInput()
go r.processFrom(ai, time.Second/time.Duration(r.config.Rate)) go r.processFrom(ai, time.Second/time.Duration(r.config.Rate))
return nil return nil