diff --git a/models/media.go b/models/media.go index d760059..f9ac2f7 100644 --- a/models/media.go +++ b/models/media.go @@ -41,9 +41,11 @@ type Mediafile struct { outputFormat string copyTs bool nativeFramerateInput bool + inputInitialOffset string rtmpLive string hlsPlaylistType string hlsSegmentDuration int + streamIds map[int]string metadata Metadata } @@ -189,6 +191,14 @@ func (m *Mediafile) SetHlsPlaylistType(val string) { m.hlsPlaylistType = val } +func (m *Mediafile) SetInputInitialOffset(val string) { + m.inputInitialOffset = val +} + +func (m *Mediafile) SetStreamIds(val map[int]string) { + m.streamIds = val +} + func (m *Mediafile) SetMetadata(v Metadata) { m.metadata = v } @@ -339,6 +349,14 @@ func (m *Mediafile) HlsPlaylistType() string { return m.hlsPlaylistType } +func (m *Mediafile) InputInitialOffset() string { + return m.inputInitialOffset +} + +func (m *Mediafile) StreamIds() map[int]string { + return m.streamIds +} + func (m *Mediafile) Metadata() Metadata { return m.metadata } @@ -353,6 +371,7 @@ func (m *Mediafile) ToStrCommand() string { "NativeFramerateInput", "DurationInput", "RtmpLive", + "InputInitialOffset", "InputPath", "Aspect", @@ -379,6 +398,7 @@ func (m *Mediafile) ToStrCommand() string { "SeekTime", "Duration", "CopyTs", + "StreamIds", "OutputFormat", "HlsSegmentDuration", "HlsPlaylistType", @@ -638,6 +658,14 @@ func (m *Mediafile) ObtainHlsPlaylistType() string { } } +func (m *Mediafile) ObtainInputInitialOffset() string { + if m.inputInitialOffset != "" { + return fmt.Sprintf("-itsoffset %s", m.inputInitialOffset) + } else { + return "" + } +} + func (m *Mediafile) ObtainHlsSegmentDuration() string { if m.hlsSegmentDuration != 0 { return fmt.Sprintf("-hls_time %d", m.hlsSegmentDuration) @@ -645,3 +673,14 @@ func (m *Mediafile) ObtainHlsSegmentDuration() string { return "" } } + +func (m *Mediafile) ObtainStreamIds() string { + if m.streamIds != nil && len(m.streamIds) != 0 { + result := []string{} + for i, val := range m.streamIds { + result = append(result, fmt.Sprintf("-streamid %d:%s", i, val)) + } + return strings.Join(result, " ") + } + return "" +} diff --git a/models/models.go b/models/models.go index 9c72682..a157bf3 100644 --- a/models/models.go +++ b/models/models.go @@ -12,6 +12,7 @@ type Metadata struct { type Streams struct { Index int + Id string `json:"id"` CodecName string `json:"codec_name"` CodecLongName string `json:"codec_long_name"` Profile string `json:"profile"`