stream-poc2/model/metadata.go
2025-10-09 22:21:38 +02:00

45 lines
1.5 KiB
Go

package model
import "fmt"
type Chunk struct {
FName string `json:"fname"` // just the basename
Length float64 `json:"length"`
}
type AudioStream struct {
Index int `json:"index"`
Lang string `json:"lang"` // there can be multiple instances of the same language! (Frédi és Béni is one example)
Title string `json:"title"`
Default bool `json:"default"`
Codec string `json:"codec"`
SampleRate int `json:"sample_rate"`
Bitrate int `json:"bitrate"` // !!! <- This is before transcoding (if used!)
Channels int `json:"channels"`
AudioChunks []Chunk `json:"audio_chunks"`
}
type Resolution struct {
Width int `json:"width"`
Height int `json:"height"`
}
func (r Resolution) String() string {
return fmt.Sprintf("%dx%d", r.Width, r.Height)
}
type VideoStream struct {
Resolution Resolution `json:"resolution"`
HLSCodecsString string `json:"hls_codecs_string"` // i.e.: avc1.42E01E
PeakBitrate int `json:"peak_bitrate"` // for BANDWIDTH - bits per second
AvgBitrate int `json:"avg_bitrate"` // for AVERAGE-BANDWIDTH - bits per second
FrameRate float64 `json:"frame_rate"`
VideoChunks []Chunk `json:"video_chunks"`
}
type MediaMetadata struct {
FriendlyName string `json:"friendly_name"`
TargetDuration float64 `json:"target_duration"`
VideoStream VideoStream `json:"video_stream"`
AudioStreams []AudioStream `json:"audio_streams"`
}