Files
mediamtx/internal/conf/record_format.go
T
Alessandro RosandGitHub a56408db19 add always available streams (#5335)
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.
2026-01-31 14:44:58 +01:00

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 + `"`))
}