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