mirror of https://bitbucket.org/ausocean/av.git
container/mts/encoder.go & revid: adressing PR feedback 1
This commit is contained in:
parent
b077752462
commit
0148c89c7b
|
@ -40,15 +40,6 @@ import (
|
||||||
"bitbucket.org/ausocean/utils/logger"
|
"bitbucket.org/ausocean/utils/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stream IDs as per ITU-T Rec. H.222.0 / ISO/IEC 13818-1 [1], tables 2-22 and 2-34.
|
|
||||||
const (
|
|
||||||
streamIDH264 = 27
|
|
||||||
streamIDH265 = 36
|
|
||||||
streamIDMJPEG = 28
|
|
||||||
streamIDJPEG = 136 // Privately number.
|
|
||||||
streamIDAudio = 0xc0 // ADPCM audio stream ID.
|
|
||||||
)
|
|
||||||
|
|
||||||
// These three constants are used to select between the three different
|
// These three constants are used to select between the three different
|
||||||
// methods of when the PSI is sent.
|
// methods of when the PSI is sent.
|
||||||
const (
|
const (
|
||||||
|
@ -63,7 +54,6 @@ const (
|
||||||
EncodeH265
|
EncodeH265
|
||||||
EncodeJPEG
|
EncodeJPEG
|
||||||
EncodeMJPEG
|
EncodeMJPEG
|
||||||
EncodeAudio
|
|
||||||
EncodePCM
|
EncodePCM
|
||||||
EncodeADPCM
|
EncodeADPCM
|
||||||
)
|
)
|
||||||
|
|
|
@ -206,10 +206,10 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
||||||
r.cfg.Logger.Log(logger.Debug, "using Files output")
|
r.cfg.Logger.Log(logger.Debug, "using Files output")
|
||||||
rb := ring.NewBuffer(int(r.cfg.RBStartElementSize), int(nElements), writeTimeout)
|
rb := ring.NewBuffer(int(r.cfg.RBStartElementSize), int(nElements), writeTimeout)
|
||||||
fs, err := newFileSender(r.cfg.Logger, r.cfg.OutputPath, true)
|
fs, err := newFileSender(r.cfg.Logger, r.cfg.OutputPath, true)
|
||||||
w = newMTSSender(fs, r.cfg.Logger.Log, rb, r.cfg.ClipDuration)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
w = newMTSSender(fs, r.cfg.Logger.Log, rb, r.cfg.ClipDuration)
|
||||||
mtsSenders = append(mtsSenders, w)
|
mtsSenders = append(mtsSenders, w)
|
||||||
case config.OutputRTMP:
|
case config.OutputRTMP:
|
||||||
r.cfg.Logger.Log(logger.Debug, "using RTMP output")
|
r.cfg.Logger.Log(logger.Debug, "using RTMP output")
|
||||||
|
|
|
@ -52,7 +52,7 @@ func TestRaspistill(t *testing.T) {
|
||||||
timelapseInterval = "4"
|
timelapseInterval = "4"
|
||||||
rbStartElementSize = "1000000"
|
rbStartElementSize = "1000000"
|
||||||
input = "Raspistill"
|
input = "Raspistill"
|
||||||
codec = "MJPEG"
|
codec = "JPEG"
|
||||||
output = "Files"
|
output = "Files"
|
||||||
outDir = "out"
|
outDir = "out"
|
||||||
outputPath = outDir + "/"
|
outputPath = outDir + "/"
|
||||||
|
@ -66,8 +66,15 @@ func TestRaspistill(t *testing.T) {
|
||||||
mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}})
|
mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}})
|
||||||
|
|
||||||
// First remove out dir (if exists) to clear contents, then create dir.
|
// First remove out dir (if exists) to clear contents, then create dir.
|
||||||
os.RemoveAll(outDir)
|
err := os.RemoveAll(outDir)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not remove any prior out directory: %v",err)
|
||||||
|
}
|
||||||
|
|
||||||
os.Mkdir(outDir, os.ModePerm)
|
os.Mkdir(outDir, os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not create new out directory: %v",err)
|
||||||
|
}
|
||||||
|
|
||||||
rv, err := New(config.Config{Logger: (*testLogger)(t)}, nil)
|
rv, err := New(config.Config{Logger: (*testLogger)(t)}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -141,4 +148,10 @@ func TestRaspistill(t *testing.T) {
|
||||||
t.Errorf("unexpected image extracted for img: %d", i)
|
t.Errorf("unexpected image extracted for img: %d", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up out directory.
|
||||||
|
err := os.RemoveAll(outDir)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not clean up out directory: %v",err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue