mirror of https://bitbucket.org/ausocean/av.git
commit
9d6836f585
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
NAME
|
||||
Revid.go
|
||||
revid.go
|
||||
|
||||
DESCRIPTION
|
||||
See Readme.md
|
||||
|
@ -187,7 +187,7 @@ func (r *Revid) reset(config Config) error {
|
|||
// no packetisation - Revid output chan grabs raw data straight from parser
|
||||
r.parser.SetOutputChan(r.outputChan)
|
||||
r.getFrame = r.getFrameNoPacketization
|
||||
goto noPacketizationSetup
|
||||
return nil
|
||||
case Mpegts:
|
||||
r.Log(Info, "Using MPEGTS packetisation!")
|
||||
frameRateAsInt, _ := strconv.Atoi(r.config.FrameRate)
|
||||
|
@ -201,7 +201,6 @@ func (r *Revid) reset(config Config) error {
|
|||
// to perform packetization
|
||||
r.getFrame = r.getFramePacketization
|
||||
r.parser.SetOutputChan(r.generator.GetInputChan())
|
||||
noPacketizationSetup:
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -218,20 +217,21 @@ func (r *Revid) ChangeConfig(c Config) error {
|
|||
return err
|
||||
}
|
||||
r.Start()
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// Log takes a logtype and message and tries to send this information to the
|
||||
// logger provided in the revid config - if there is one, otherwise the message
|
||||
// is sent to stdout
|
||||
func (r *Revid) Log(logType, m string) {
|
||||
if r.config.Verbosity == Yes {
|
||||
if r.config.Verbosity != Yes {
|
||||
return
|
||||
}
|
||||
if r.config.Logger != nil {
|
||||
r.config.Logger.Log("revid", logType, m)
|
||||
return
|
||||
}
|
||||
fmt.Println(logType + ": " + m)
|
||||
}
|
||||
}
|
||||
|
||||
// IsRunning returns true if the revid is currently running and false otherwise
|
||||
|
@ -286,7 +286,6 @@ func (r *Revid) Stop() {
|
|||
if r.cmd != nil && r.cmd.Process != nil {
|
||||
r.cmd.Process.Kill()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// getFrameNoPacketization gets a frame directly from the revid output chan
|
||||
|
@ -298,22 +297,7 @@ func (r *Revid) getFrameNoPacketization() []byte {
|
|||
// getFramePacketization gets a frame from the generators output chan - the
|
||||
// the generator being an mpegts or flv generator depending on the config
|
||||
func (r *Revid) getFramePacketization() []byte {
|
||||
return <-(r.generator.GetOutputChan())
|
||||
}
|
||||
|
||||
// flushDataPacketization removes data from the Revid inst's coutput chan
|
||||
func (r *Revid) flushData() {
|
||||
switch r.config.Packetization {
|
||||
case Flv:
|
||||
for {
|
||||
select {
|
||||
case <-(r.generator.GetOutputChan()):
|
||||
default:
|
||||
goto done
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
return <-r.generator.GetOutputChan()
|
||||
}
|
||||
|
||||
// packClips takes data segments; whether that be tsPackets or mjpeg frames and
|
||||
|
|
Loading…
Reference in New Issue