diff --git a/internal/streams/dot.go b/internal/streams/dot.go index aa008c40..96aa4115 100644 --- a/internal/streams/dot.go +++ b/internal/streams/dot.go @@ -67,6 +67,13 @@ type node struct { var codecKeys = []string{"codec_name", "sample_rate", "channels", "profile", "level"} +func (n *node) name() string { + if name, ok := n.Codec["codec_name"].(string); ok { + return name + } + return "unknown" +} + func (n *node) codec() []byte { b := make([]byte, 0, 128) for _, k := range codecKeys { @@ -74,11 +81,14 @@ func (n *node) codec() []byte { b = fmt.Appendf(b, "%s=%v\n", k, v) } } - return b[:len(b)-1] + if l := len(b); l > 0 { + return b[:l-1] + } + return b } func (n *node) appendDOT(dot []byte, group string) []byte { - dot = fmt.Appendf(dot, "%d [group=%s, label=%q, title=%q];\n", n.ID, group, n.Codec["codec_name"], n.codec()) + dot = fmt.Appendf(dot, "%d [group=%s, label=%q, title=%q];\n", n.ID, group, n.name(), n.codec()) //for _, sink := range n.Childs { // dot = fmt.Appendf(dot, "%d -> %d;\n", n.ID, sink) //} diff --git a/pkg/core/codec.go b/pkg/core/codec.go index d07b8b74..9c6c6b79 100644 --- a/pkg/core/codec.go +++ b/pkg/core/codec.go @@ -69,8 +69,14 @@ func FFmpegCodecName(name string) string { return "vp9" case CodecAV1: return "av1" + case CodecELD: + return "aac/eld" + case CodecFLAC: + return "flac" + case CodecMP3: + return "mp3" } - return "" + return name } func (c *Codec) String() (s string) {