mirror of https://bitbucket.org/ausocean/av.git
vidforward: use consistent revid construction function
This commit is contained in:
parent
a4754e5ead
commit
c82d7a8e55
|
@ -39,10 +39,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/cmd/vidforward/global"
|
"bitbucket.org/ausocean/av/cmd/vidforward/global"
|
||||||
"bitbucket.org/ausocean/av/codec/codecutil"
|
|
||||||
"bitbucket.org/ausocean/av/container/mts"
|
"bitbucket.org/ausocean/av/container/mts"
|
||||||
"bitbucket.org/ausocean/av/revid"
|
"bitbucket.org/ausocean/av/revid"
|
||||||
"bitbucket.org/ausocean/av/revid/config"
|
|
||||||
"bitbucket.org/ausocean/utils/logging"
|
"bitbucket.org/ausocean/utils/logging"
|
||||||
"gopkg.in/natefinch/lumberjack.v2"
|
"gopkg.in/natefinch/lumberjack.v2"
|
||||||
)
|
)
|
||||||
|
@ -281,22 +279,8 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
|
|
||||||
var outputs []uint8
|
|
||||||
for _ = range broadcast.urls {
|
|
||||||
outputs = append(outputs, config.OutputRTMP)
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := config.Config{
|
|
||||||
Logger: m.log,
|
|
||||||
Input: config.InputManual,
|
|
||||||
InputCodec: codecutil.H264_AU,
|
|
||||||
Outputs: outputs,
|
|
||||||
RTMPURL: broadcast.urls,
|
|
||||||
LogLevel: logging.Debug,
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
broadcast.rv, err = revid.New(cfg, nil)
|
broadcast.rv, err = newRevid(m.log, broadcast.urls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not initialise revid: %w", err)
|
return fmt.Errorf("could not initialise revid: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,20 @@ import (
|
||||||
var loggingLevel = logging.Info
|
var loggingLevel = logging.Info
|
||||||
|
|
||||||
func newRevid(log logging.Logger, urls []string) (*revid.Revid, error) {
|
func newRevid(log logging.Logger, urls []string) (*revid.Revid, error) {
|
||||||
|
var outputs []uint8
|
||||||
|
for _ = range urls {
|
||||||
|
outputs = append(outputs, config.OutputRTMP)
|
||||||
|
}
|
||||||
|
cfg := config.Config{
|
||||||
|
Logger: log,
|
||||||
|
Input: config.InputManual,
|
||||||
|
InputCodec: codecutil.H264_AU,
|
||||||
|
Outputs: outputs,
|
||||||
|
RTMPURL: urls,
|
||||||
|
LogLevel: logging.Debug,
|
||||||
|
}
|
||||||
return revid.New(
|
return revid.New(
|
||||||
config.Config{
|
cfg, nil)
|
||||||
Logger: log,
|
|
||||||
Input: config.InputManual,
|
|
||||||
InputCodec: codecutil.H264_AU,
|
|
||||||
Outputs: []uint8{config.OutputRTMP},
|
|
||||||
RTMPURL: urls,
|
|
||||||
LogLevel: loggingLevel,
|
|
||||||
}, nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeError logs an error and writes to w in JSON format.
|
// writeError logs an error and writes to w in JSON format.
|
||||||
|
|
Loading…
Reference in New Issue