mirror of https://bitbucket.org/ausocean/av.git
revid: audio input meta addition moved to Revid.setupPipeline()
This commit is contained in:
parent
79ddea32c0
commit
fa5585271e
|
@ -19,12 +19,8 @@ LICENSE
|
||||||
package revid
|
package revid
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/codec/codecutil"
|
|
||||||
"bitbucket.org/ausocean/av/container/mts"
|
|
||||||
"bitbucket.org/ausocean/av/input/audio"
|
"bitbucket.org/ausocean/av/input/audio"
|
||||||
"bitbucket.org/ausocean/utils/logger"
|
"bitbucket.org/ausocean/utils/logger"
|
||||||
)
|
)
|
||||||
|
@ -40,18 +36,6 @@ func (r *Revid) startAudioDevice() (func() error, error) {
|
||||||
BitDepth: r.cfg.BitDepth,
|
BitDepth: r.cfg.BitDepth,
|
||||||
Codec: r.cfg.InputCodec,
|
Codec: r.cfg.InputCodec,
|
||||||
}
|
}
|
||||||
mts.Meta.Add("sampleRate", strconv.Itoa(r.cfg.SampleRate))
|
|
||||||
mts.Meta.Add("channels", strconv.Itoa(r.cfg.Channels))
|
|
||||||
mts.Meta.Add("period", fmt.Sprintf("%.6f", r.cfg.RecPeriod))
|
|
||||||
mts.Meta.Add("bitDepth", strconv.Itoa(r.cfg.BitDepth))
|
|
||||||
switch r.cfg.InputCodec {
|
|
||||||
case codecutil.PCM:
|
|
||||||
mts.Meta.Add("codec", "pcm")
|
|
||||||
case codecutil.ADPCM:
|
|
||||||
mts.Meta.Add("codec", "adpcm")
|
|
||||||
default:
|
|
||||||
r.cfg.Logger.Log(logger.Fatal, pkg+"no audio codec set in config")
|
|
||||||
}
|
|
||||||
|
|
||||||
ai, err := audio.NewDevice(ac, r.cfg.Logger)
|
ai, err := audio.NewDevice(ac, r.cfg.Logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -337,6 +337,18 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
||||||
panic("not implemented")
|
panic("not implemented")
|
||||||
}
|
}
|
||||||
case config.InputAudio:
|
case config.InputAudio:
|
||||||
|
mts.Meta.Add("sampleRate", strconv.Itoa(r.cfg.SampleRate))
|
||||||
|
mts.Meta.Add("channels", strconv.Itoa(r.cfg.Channels))
|
||||||
|
mts.Meta.Add("period", fmt.Sprintf("%.6f", r.cfg.RecPeriod))
|
||||||
|
mts.Meta.Add("bitDepth", strconv.Itoa(r.cfg.BitDepth))
|
||||||
|
switch r.cfg.InputCodec {
|
||||||
|
case codecutil.PCM:
|
||||||
|
mts.Meta.Add("codec", "pcm")
|
||||||
|
case codecutil.ADPCM:
|
||||||
|
mts.Meta.Add("codec", "adpcm")
|
||||||
|
default:
|
||||||
|
r.cfg.Logger.Log(logger.Fatal, pkg+"no audio codec set in config")
|
||||||
|
}
|
||||||
r.setupInput = r.startAudioDevice
|
r.setupInput = r.startAudioDevice
|
||||||
r.lexTo = codecutil.NewByteLexer(&r.cfg.ChunkSize).Lex
|
r.lexTo = codecutil.NewByteLexer(&r.cfg.ChunkSize).Lex
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue