From 3d80d92e2a8747c342c3f461e213159c40ed5919 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Thu, 23 May 2019 09:27:44 -0700 Subject: [PATCH] Add SegmentMap and Duration processing --- mpls.go | 3 ++- parse.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mpls.go b/mpls.go index be604e4..95defda 100644 --- a/mpls.go +++ b/mpls.go @@ -143,6 +143,8 @@ type MPLS struct { AppInfoPlaylist AppInfoPlaylist Playlist Playlist MarkPlaylist PlaylistMark + SegmentMap []string + Duration int64 } // AppInfoPlaylist sucks @@ -154,7 +156,6 @@ type AppInfoPlaylist struct { UOMask uint64 } -// Playlist sucks type Playlist struct { Len int PlayItemCount uint16 diff --git a/parse.go b/parse.go index 3ffe783..1bb6c93 100644 --- a/parse.go +++ b/parse.go @@ -106,7 +106,12 @@ func (mpls *MPLS) Parse(file []byte) error { } // _ = mpls.MarkPlaylist.parse(reader) - + mpls.SegmentMap = make([]string, 0, len(mpls.Playlist.PlayItems)) + for _, playitem := range mpls.Playlist.PlayItems { + mpls.SegmentMap = append(mpls.SegmentMap, playitem.Clpi.ClipFile) + mpls.Duration += int64(playitem.OutTime - playitem.InTime) + } + mpls.Duration = mpls.Duration / 4500 return reader.err }