mirror of https://bitbucket.org/ausocean/av.git
Merged in revid/waiturl (pull request #24)
revid: wait for URL from netreceiver Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
commit
576815a10f
|
@ -44,27 +44,29 @@ import (
|
||||||
|
|
||||||
// Indexes for configFlags
|
// Indexes for configFlags
|
||||||
const (
|
const (
|
||||||
inputPtr = 0
|
inputPtr = iota
|
||||||
inputCodecPtr = 1
|
inputCodecPtr
|
||||||
outputPtr = 2
|
outputPtr
|
||||||
rtmpMethodPtr = 3
|
rtmpMethodPtr
|
||||||
packetizationPtr = 4
|
packetizationPtr
|
||||||
quantizationModePtr = 5
|
quantizationModePtr
|
||||||
verbosityPtr = 6
|
verbosityPtr
|
||||||
framesPerClipPtr = 7
|
framesPerClipPtr
|
||||||
rtmpUrlPtr = 8
|
rtmpUrlPtr
|
||||||
bitratePtr = 9
|
bitratePtr
|
||||||
outputFileNamePtr = 10
|
outputFileNamePtr
|
||||||
inputFileNamePtr = 11
|
inputFileNamePtr
|
||||||
heightPtr = 12
|
heightPtr
|
||||||
widthPtr = 13
|
widthPtr
|
||||||
frameRatePtr = 14
|
frameRatePtr
|
||||||
httpAddressPtr = 15
|
httpAddressPtr
|
||||||
quantizationPtr = 16
|
quantizationPtr
|
||||||
timeoutPtr = 17
|
timeoutPtr
|
||||||
intraRefreshPeriodPtr = 18
|
intraRefreshPeriodPtr
|
||||||
verticalFlipPtr = 19
|
verticalFlipPtr
|
||||||
horizontalFlipPtr = 20
|
horizontalFlipPtr
|
||||||
|
|
||||||
|
noOfConfigFlags
|
||||||
)
|
)
|
||||||
|
|
||||||
// Other misc consts
|
// Other misc consts
|
||||||
|
@ -73,7 +75,6 @@ const (
|
||||||
netSendRetryTime = 5
|
netSendRetryTime = 5
|
||||||
sleepTime = 2 * 43200
|
sleepTime = 2 * 43200
|
||||||
defaultRunDuration = 2 * 43200
|
defaultRunDuration = 2 * 43200
|
||||||
noOfConfigFlags = 21
|
|
||||||
revidStopTime = 5
|
revidStopTime = 5
|
||||||
prepTime = 20
|
prepTime = 20
|
||||||
loggerVerbosity = 3
|
loggerVerbosity = 3
|
||||||
|
@ -93,7 +94,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flagNames := [noOfConfigFlags][2]string{
|
flagNames := [noOfConfigFlags]struct{ name, description string }{
|
||||||
{"Input", "The input type"},
|
{"Input", "The input type"},
|
||||||
{"InputCodec", "The codec of the input"},
|
{"InputCodec", "The codec of the input"},
|
||||||
{"Output", "The output type"},
|
{"Output", "The output type"},
|
||||||
|
@ -119,8 +120,8 @@ func main() {
|
||||||
|
|
||||||
// Create the configFlags based on the flagNames array
|
// Create the configFlags based on the flagNames array
|
||||||
configFlags := make([](*string), noOfConfigFlags)
|
configFlags := make([](*string), noOfConfigFlags)
|
||||||
for i := 0; i < noOfConfigFlags; i++ {
|
for i, f := range &flagNames {
|
||||||
configFlags[i] = flag.String(flagNames[i][0], "", flagNames[i][1])
|
configFlags[i] = flag.String(f.name, "", f.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we want a netsender session
|
// Do we want a netsender session
|
||||||
|
@ -265,7 +266,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if vs != ns.GetVarSum() {
|
if vs != ns.GetVarSum() {
|
||||||
// vars changed
|
// vars changed
|
||||||
vars, err := ns.GetVars()
|
vars, err := ns.GetVars()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
config.Logger.Log(progName, "Error", err.Error())
|
config.Logger.Log(progName, "Error", err.Error())
|
||||||
|
@ -326,6 +327,9 @@ func startRevid() {
|
||||||
|
|
||||||
func stopRevid() {
|
func stopRevid() {
|
||||||
revidInst.Stop()
|
revidInst.Stop()
|
||||||
|
|
||||||
|
// FIXME(kortschak): Is this waiting on completion of work?
|
||||||
|
// Use a wait group and Wait method if it is.
|
||||||
time.Sleep(time.Duration(revidStopTime) * time.Second)
|
time.Sleep(time.Duration(revidStopTime) * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
# This script launches revid-cli at boot time
|
# This script launches revid-cli at boot time
|
||||||
|
|
||||||
REVIDPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/revid-cli
|
REVIDPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/revid-cli
|
||||||
RTMPURL=rtmp://a.rtmp.youtube.com/live2/vq8y-wzxh-731t-7rtb
|
|
||||||
|
|
||||||
# kernel settings to improve performance on Raspberry Pi
|
# kernel settings to improve performance on Raspberry Pi
|
||||||
# tell Linux to fork optimistically
|
# tell Linux to fork optimistically
|
||||||
|
@ -27,6 +26,6 @@ exec 1>&2
|
||||||
|
|
||||||
# set working dir and run revid-cli
|
# set working dir and run revid-cli
|
||||||
cd $REVIDPATH
|
cd $REVIDPATH
|
||||||
sudo "PATH=$PATH:$REVIDPATH" ./revid-cli -Verbosity=Yes -Input=Raspivid -Output=NativeRtmp -QuantizationMode=QuantizationOff -RtmpUrl=$RTMPURL -Bitrate=500000 -Packetization=Flv -NetSender &
|
sudo "PATH=$PATH:$REVIDPATH" ./revid-cli -Verbosity=Yes -Input=Raspivid -Output=NativeRtmp -QuantizationMode=QuantizationOff -Bitrate=500000 -Packetization=Flv -NetSender &
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -6,10 +6,10 @@ DESCRIPTION
|
||||||
See Readme.md
|
See Readme.md
|
||||||
|
|
||||||
AUTHORS
|
AUTHORS
|
||||||
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
Config.go is Copyright (C) 2017 the Australian Ocean Lab (AusOcean)
|
Config.go is Copyright (C) 2017-2018 the Australian Ocean Lab (AusOcean)
|
||||||
|
|
||||||
It is free software: you can redistribute it and/or modify them
|
It is free software: you can redistribute it and/or modify them
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
|
@ -22,7 +22,7 @@ LICENSE
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses).
|
along with revid in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package revid
|
package revid
|
||||||
|
@ -63,33 +63,32 @@ type Config struct {
|
||||||
|
|
||||||
// Enums for config struct
|
// Enums for config struct
|
||||||
const (
|
const (
|
||||||
NothingDefined = 0
|
NothingDefined = iota
|
||||||
Raspivid = 1
|
Raspivid
|
||||||
Rtp = 2
|
Rtp
|
||||||
H264Codec = 3
|
H264Codec
|
||||||
File = 4
|
File
|
||||||
Http = 5
|
Http
|
||||||
H264 = 6
|
H264
|
||||||
Mjpeg = 7
|
Mjpeg
|
||||||
None = 8
|
None
|
||||||
Mpegts = 9
|
Mpegts
|
||||||
Ffmpeg = 11
|
Ffmpeg
|
||||||
Flv = 13
|
Flv
|
||||||
LibRtmp = 14
|
LibRtmp
|
||||||
QuantizationOn = 15
|
QuantizationOn
|
||||||
QuantizationOff = 16
|
QuantizationOff
|
||||||
Yes = 17
|
Yes
|
||||||
No = 18
|
No
|
||||||
NativeRtmp = 19
|
NativeRtmp
|
||||||
FfmpegRtmp = 20
|
FfmpegRtmp
|
||||||
)
|
)
|
||||||
|
|
||||||
// Default config settings
|
// Default config settings
|
||||||
const (
|
const (
|
||||||
defaultInput = Raspivid
|
defaultInput = Raspivid
|
||||||
defaultOutput = NativeRtmp
|
defaultOutput = Http
|
||||||
defaultPacketization = Flv
|
defaultPacketization = Flv
|
||||||
defaultRtmpUrl = "rtmp://a.rtmp.youtube.com/live2/vq8y-wzxh-731t-7rtb"
|
|
||||||
defaultFrameRate = "25"
|
defaultFrameRate = "25"
|
||||||
defaultWidth = "1280"
|
defaultWidth = "1280"
|
||||||
defaultHeight = "720"
|
defaultHeight = "720"
|
||||||
|
@ -174,15 +173,11 @@ func (config *Config) Validate(r *revid) error {
|
||||||
switch config.Output {
|
switch config.Output {
|
||||||
case Http:
|
case Http:
|
||||||
case File:
|
case File:
|
||||||
case NativeRtmp:
|
case NativeRtmp, FfmpegRtmp:
|
||||||
if config.RtmpUrl == "" {
|
if config.RtmpUrl == "" {
|
||||||
return errors.New("Bad RTMP URL")
|
r.Log(Info, "No RTMP URL: falling back to HTTP")
|
||||||
}
|
config.Output = Http
|
||||||
r.Log(Info, "Defaulting frames per clip to 1 for rtmp output!")
|
break
|
||||||
config.FramesPerClip = "1"
|
|
||||||
case FfmpegRtmp:
|
|
||||||
if config.RtmpUrl == "" {
|
|
||||||
return errors.New("Bad RTMP URL")
|
|
||||||
}
|
}
|
||||||
r.Log(Info, "Defaulting frames per clip to 1 for rtmp output!")
|
r.Log(Info, "Defaulting frames per clip to 1 for rtmp output!")
|
||||||
config.FramesPerClip = "1"
|
config.FramesPerClip = "1"
|
||||||
|
|
|
@ -6,11 +6,11 @@ DESCRIPTION
|
||||||
See Readme.md
|
See Readme.md
|
||||||
|
|
||||||
AUTHORS
|
AUTHORS
|
||||||
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
||||||
Alan Noble <alan@ausocean.org>
|
Alan Noble <alan@ausocean.org>
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
revid is Copyright (C) 2017 the Australian Ocean Lab (AusOcean)
|
revid is Copyright (C) 2017-2018 the Australian Ocean Lab (AusOcean)
|
||||||
|
|
||||||
It is free software: you can redistribute it and/or modify them
|
It is free software: you can redistribute it and/or modify them
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
|
@ -23,7 +23,7 @@ LICENSE
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses).
|
along with revid in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// revid is a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols.
|
// revid is a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols.
|
||||||
|
@ -216,6 +216,10 @@ noPacketizationSetup:
|
||||||
|
|
||||||
// ChangeConfig changes the current configuration of the revid instance.
|
// ChangeConfig changes the current configuration of the revid instance.
|
||||||
func (r *revid) ChangeConfig(config Config) (err error) {
|
func (r *revid) ChangeConfig(config Config) (err error) {
|
||||||
|
// FIXME(kortschak): This is reimplemented in cmd/revid-cli/main.go.
|
||||||
|
// The implementation in the command is used and this is not.
|
||||||
|
// Decide on one or the other.
|
||||||
|
|
||||||
r.Stop()
|
r.Stop()
|
||||||
r, err = NewRevid(config)
|
r, err = NewRevid(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue