When the publisher or source of a stream is offline, the server can be configured to fill gaps in the stream with a video that is played on repeat until a publisher comes back online. This allows readers to stay connected regardless of the state of the stream. The offline video and any future online stream are concatenated without decoding or re-encoding packets, using the original codec.
39 lines
789 B
Go
39 lines
789 B
Go
package conf
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/conf/jsonwrapper"
|
|
)
|
|
|
|
// RecordFormat is the recordFormat parameter.
|
|
type RecordFormat string
|
|
|
|
// supported values.
|
|
const (
|
|
RecordFormatFMP4 RecordFormat = "fmp4"
|
|
RecordFormatMPEGTS RecordFormat = "mpegts"
|
|
)
|
|
|
|
// UnmarshalJSON implements json.Unmarshaler.
|
|
func (d *RecordFormat) UnmarshalJSON(b []byte) error {
|
|
type alias RecordFormat
|
|
if err := jsonwrapper.Unmarshal(b, (*alias)(d)); err != nil {
|
|
return err
|
|
}
|
|
|
|
switch *d {
|
|
case RecordFormatFMP4, RecordFormatMPEGTS:
|
|
|
|
default:
|
|
return fmt.Errorf("invalid record format '%s'", *d)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// UnmarshalEnv implements env.Unmarshaler.
|
|
func (d *RecordFormat) UnmarshalEnv(_ string, v string) error {
|
|
return d.UnmarshalJSON([]byte(`"` + v + `"`))
|
|
}
|