mpd

package module
v0.0.0-...-f58c53c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2016 License: MIT Imports: 13 Imported by: 0

README

mpd Circle CI

Parse MPD files.

This is a rewrite of Google's Shaka player MPD parser from JavaScript to Go.

Usage:


// Transforms XML to Go struct
mpd, _ := ParseMpd("http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/manifest.mpd")

// Print parsed mpd
PrintMPD(mpd, 0)

mpdProcessor := NewMpdProcessor()

// Construct manifest from Mpd struct
mpdProcessor.Process(mpd)

// Inspect mpdProcessor.ManifestInfo

The snipet above parse given mpd (which you can watch [here][]) [here]: http://play.streamrail.com/#/vjs

PrintMPD prooduces the following output:


main.Mpd
	Id =
	Type = static
	BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
	main.BaseUrl
		Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
	MediaPresentationDuration = 126
	MinBufferTime = 5
	MinUpdatePeriod = 0
	AvailabilityStartTime = -1
	TimeShiftBufferDepth = 0
	SuggestedPresentationDelay = 1
	Periods = [0xc208064060]
	main.Period
		Id =
		Start = -1
		Duration = -1
		BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
		main.BaseUrl
			Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
		SegmentBase = <nil>
		SegmentList = <nil>
		SegmentTemplate = <nil>
		AdaptationSets = [0xc208066280 0xc2080663c0]
		main.AdaptationSet
			Id =
			Lang = und
			ContentType = audio
			Width = 0
			Height = 0
			MimeType = audio/mp4
			Codecs =
			Main = false
			BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
			main.BaseUrl
				Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
			SegmentBase = <nil>
			SegmentList = <nil>
			SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/audio/und/seg-$Number$.m4f  $RepresentationID$/audio/und/init.mp4 <nil>}
			main.SegmentTemplate
				Timescale = 1000
				PresentationTimeOffset = -1
				SegmentDuration = 1968
				StartNumber = 1
				MediaUrlTemplate = $RepresentationID$/audio/und/seg-$Number$.m4f
				IndexUrlTemplate =
				InitializationUrlTemplate = $RepresentationID$/audio/und/init.mp4
				Timeline = <nil>
			Representations = [0xc208066320]
			main.Representation
				Id = 700k
				Lang = und
				Bandwidth = 114244
				Width = 0
				Height = 0
				MimeType = audio/mp4
				Codecs = mp4a.40.2
				BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
				main.BaseUrl
					Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
				SegmentBase = <nil>
				SegmentList = <nil>
				SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/audio/und/seg-$Number$.m4f  $RepresentationID$/audio/und/init.mp4 <nil>}
				main.SegmentTemplate
					Timescale = 1000
					PresentationTimeOffset = -1
					SegmentDuration = 1968
					StartNumber = 1
					MediaUrlTemplate = $RepresentationID$/audio/und/seg-$Number$.m4f
					IndexUrlTemplate =
					InitializationUrlTemplate = $RepresentationID$/audio/und/init.mp4
					Timeline = <nil>
				ContentProtections = []
				Main = false
		main.AdaptationSet
			Id =
			Lang =
			ContentType = video
			Width = 0
			Height = 0
			MimeType = video/mp4
			Codecs =
			Main = false
			BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
			main.BaseUrl
				Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
			SegmentBase = <nil>
			SegmentList = <nil>
			SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/video/1/seg-$Number$.m4f  $RepresentationID$/video/1/init.mp4 <nil>}
			main.SegmentTemplate
				Timescale = 1000
				PresentationTimeOffset = -1
				SegmentDuration = 1968
				StartNumber = 1
				MediaUrlTemplate = $RepresentationID$/video/1/seg-$Number$.m4f
				IndexUrlTemplate =
				InitializationUrlTemplate = $RepresentationID$/video/1/init.mp4
				Timeline = <nil>
			Representations = [0xc208066460 0xc208066500 0xc2080665a0]
			main.Representation
				Id = 700k
				Lang =
				Bandwidth = 948337
				Width = 1920
				Height = 1080
				MimeType = video/mp4
				Codecs = avc1.42c028
				BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
				main.BaseUrl
					Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
				SegmentBase = <nil>
				SegmentList = <nil>
				SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/video/1/seg-$Number$.m4f  $RepresentationID$/video/1/init.mp4 <nil>}
				main.SegmentTemplate
					Timescale = 1000
					PresentationTimeOffset = -1
					SegmentDuration = 1968
					StartNumber = 1
					MediaUrlTemplate = $RepresentationID$/video/1/seg-$Number$.m4f
					IndexUrlTemplate =
					InitializationUrlTemplate = $RepresentationID$/video/1/init.mp4
					Timeline = <nil>
				ContentProtections = []
				Main = false
			main.Representation
				Id = 1200k
				Lang =
				Bandwidth = 1467491
				Width = 1920
				Height = 1080
				MimeType = video/mp4
				Codecs = avc1.42c028
				BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
				main.BaseUrl
					Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
				SegmentBase = <nil>
				SegmentList = <nil>
				SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/video/1/seg-$Number$.m4f  $RepresentationID$/video/1/init.mp4 <nil>}
				main.SegmentTemplate
					Timescale = 1000
					PresentationTimeOffset = -1
					SegmentDuration = 1968
					StartNumber = 1
					MediaUrlTemplate = $RepresentationID$/video/1/seg-$Number$.m4f
					IndexUrlTemplate =
					InitializationUrlTemplate = $RepresentationID$/video/1/init.mp4
					Timeline = <nil>
				ContentProtections = []
				Main = false
			main.Representation
				Id = 4508k
				Lang =
				Bandwidth = 6963128
				Width = 1920
				Height = 1080
				MimeType = video/mp4
				Codecs = avc1.42c028
				BaseUrl = &{http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/}
				main.BaseUrl
					Url = http://sdk.streamrail.com/pepsi/cdn/0.0.1/601486e52319059b8790c13f7477d2036d042768/dash/
				SegmentBase = <nil>
				SegmentList = <nil>
				SegmentTemplate = &{1000 -1 1968 1 $RepresentationID$/video/1/seg-$Number$.m4f  $RepresentationID$/video/1/init.mp4 <nil>}
				main.SegmentTemplate
					Timescale = 1000
					PresentationTimeOffset = -1
					SegmentDuration = 1968
					StartNumber = 1
					MediaUrlTemplate = $RepresentationID$/video/1/seg-$Number$.m4f
					IndexUrlTemplate =
					InitializationUrlTemplate = $RepresentationID$/video/1/init.mp4
					Timeline = <nil>
				ContentProtections = []
				Main = false

For more examples see mpd_processor_test.go

Documentation

Index

Constants

View Source
const (
	/**
	 * Any gap/overlap within a SegmentTimeline that is greater than or equal to
	 * this value (in seconds) will generate a warning message.
	 * @const {number}
	 */
	GAP_OVERLAP_WARNING_THRESHOLD = 1 / 32

	/**
	 * The maximum span, in seconds, that a SegmentIndex must account for when that
	 * SegmentIndex is being generated via a segment duration.
	 * @const {number}
	 */
	MAX_SEGMENT_INDEX_SPAN = 2 * 60

	/**
	 * The default value, in seconds, for MPD@minBufferTime if this attribute is
	 * missing.
	 * @const {number}
	 */
	DEFAULT_MIN_BUFFER_TIME = 5
)
View Source
const (
	DEFAULT_MIN_BUFFER_TIME_              = 5
	DEFAULT_SUGGESTED_PRESENTATION_DELAY_ = 1
)
View Source
const (

	/**
	 * @expose all TAG_NAME properties so that they do not get stripped during
	 *     advanced compilation.
	 */
	Mpd_TAG_NAME = "MPD"

	Period_TAG_NAME = "Period"

	AdaptationSet_TAG_NAME = "AdaptationSet"

	Role_TAG_NAME = "Role"

	ContentComponent_TAG_NAME = "ContentComponent"

	Representation_TAG_NAME = "Representation"

	ContentProtection_TAG_NAME = "ContentProtection"

	CencPssh_TAG_NAME = "cenc:pssh"

	BaseUrl_TAG_NAME = "BaseURL"

	SegmentBase_TAG_NAME = "SegmentBase"

	RepresentationIndex_TAG_NAME = "RepresentationIndex"

	Initialization_TAG_NAME = "Initialization"

	SegmentList_TAG_NAME = "SegmentList"

	SegmentUrl_TAG_NAME = "SegmentURL"

	SegmentTemplate_TAG_NAME = "SegmentTemplate"

	SegmentTimeline_TAG_NAME = "SegmentTimeline"

	SegmentTimePoint_TAG_NAME = "S"
)

MPD tag names --------------------------------------------------------------

Variables

This section is empty.

Functions

func Abs

func Abs(a int) int

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func PrintMPD

func PrintMPD(root Node, ident int)

Types

type AdaptationSet

type AdaptationSet struct {
	/** @type {?string} */
	Id string

	/**
	 * The language.
	 * @type {?string}
	 * @see IETF RFC 5646
	 * @see ISO 639
	 */
	Lang string

	/**
	 * Should be 'video' or 'audio', not a MIME type.
	 * If not specified, will be inferred from the MIME type.
	 * @type {?string}
	 */
	ContentType mapset.Set

	/** @type {?number} */
	Width int

	/** @type {?number} */
	Height int

	/**
	 * If not specified, will be inferred from the first representation.
	 * @type {?string}
	 */
	MimeType string

	/** @type {?string} */
	Codecs string

	/** @type {!bool}*/
	Main bool

	/** @type {*BaseUrl} */
	BaseUrl *BaseUrl

	/** @type {SegmentBase} */
	SegmentBase *SegmentBase

	/** @type {SegmentList} */
	SegmentList *SegmentList

	/** @type {SegmentTemplate} */
	SegmentTemplate *SegmentTemplate

	/** @type {!Array.<!Representation>} */
	Representations []*Representation
}

func (*AdaptationSet) Parse

func (adaptationSet *AdaptationSet) Parse(parent Node, elem xml.Node)

*

  • Parses an "AdaptationSet" tag.
  • @param {!Period} parent The parent Period.
  • @param {!Node} elem The AdaptationSet XML element.

type BaseUrl

type BaseUrl struct {
	/** @type {?string} */
	Url string
}

func (*BaseUrl) Parse

func (baseUrl *BaseUrl) Parse(parent Node, elem xml.Node)

*

  • Parses a "BaseURL" tag.
  • @param {*} parent The parent object.
  • @param {!Node} elem The BaseURL XML element.

type CencPssh

type CencPssh struct {
	/**
	 * @type {Uint8Array}
	 * @expose
	 */
	PsshBox []uint
}

type Cloneable

type Cloneable interface {
	Clone() Node
}

type ContentComponent

type ContentComponent struct {
	/** @type {?string} */
	Id string

	/**
	 * The language.
	 * @type {?string}
	 * @see IETF RFC 5646
	 * @see ISO 639
	 */
	Lang string

	/**
	 * Should be 'video' or 'audio', not a MIME type.
	 * @type {?string}
	 */
	ContentType string
}

func (*ContentComponent) Parse

func (contentComponent *ContentComponent) Parse(parent Node, elem xml.Node)

*

  • Parses a "ContentComponent" tag.
  • @param {!AdaptationSet} parent The parent AdaptationSet.
  • @param {!Node} elem The ContentComponent XML element.

type ContentProtection

type ContentProtection struct {
	/**
	 * @type {?string}
	 * @expose
	 */
	SchemeIdUri string

	/**
	 * @type {?string}
	 * @expose
	 */
	Value string

	/**
	 * @type {!Array.<!Node>}
	 * @expose
	 */
	Children []Node

	/**
	 * @type {CencPssh}
	 * @expose
	 */
	Pssh CencPssh
}

type FakeNode

type FakeNode struct {
	/** @type {*BaseUrl} */
	BaseUrl *BaseUrl
}

func (FakeNode) Parse

func (fakeNode FakeNode) Parse(parent Node, elem xml.Node)

type Initialization

type Initialization struct {
	/** @type {String} */
	Url string

	/** @type {Range} */
	Range *Range
}

func (*Initialization) Clone

func (initialization *Initialization) Clone() Node

*

  • Creates a deep copy of this Initialization.
  • @return {!Initialization}

func (*Initialization) Parse

func (initialization *Initialization) Parse(parent Node, elem xml.Node)

*

  • Parses an "Initialization" tag.
  • @param {!SegmentBase|!SegmentList} parent
  • The parent SegmentBase or parent SegmentList.
  • @param {!Node} elem The Initialization XML element.

type ManifestInfo

type ManifestInfo struct {
	Live bool

	MinBufferTime int

	PeriodInfos []PeriodInfo
}

func NewManifestInfo

func NewManifestInfo() ManifestInfo

type Mpd

type Mpd struct {
	/** @type {?string} */
	Id string

	/** @type {string} */
	Type string

	/** @type {*BaseUrl} */
	BaseUrl *BaseUrl

	/**
	 * The entire stream's duration, in seconds.
	 * @type {?number}
	 */
	MediaPresentationDuration int

	/**
	 * The quantity of media, in terms of seconds, that should be buffered before
	 * playback begins, to ensure uninterrupted playback.
	 * @type {?number}
	 */
	MinBufferTime int

	/**
	 * The interval, in seconds, to poll the media server for an updated
	 * MPD, or null if updates are not required.
	 * @type {?number}
	 */
	MinUpdatePeriod int

	/**
	 * The wall-clock time, in seconds, that the media content specified within
	 * the MPD started/will start to stream.
	 * @type {?number}
	 */
	AvailabilityStartTime int64

	/**
	 * The duration, in seconds, that the media server retains live media
	 * content, excluding the current segment and the previous segment, which are
	 * always available. For example, if this value is 60 then only media content
	 * up to 60 seconds from the beginning of the previous segment may be
	 * requested from the media server.
	 * @type {?number}
	 */
	TimeShiftBufferDepth int

	//DEFAULT_SUGGESTED_PRESENTATION_DELAY_;
	SuggestedPresentationDelay int

	/** @type {!Array.<!Period>} */
	Periods []*Period
}

func ParseMpd

func ParseMpd(url string) (*Mpd, error)

func (*Mpd) Parse

func (mpd *Mpd) Parse(parent Node, elem xml.Node)

*

  • Parses an "MPD" tag.
  • @param {!Object} parent A virtual parent tag containing a BaseURL which
  • refers to the MPD resource itself.
  • @param {!Node} elem The MPD XML element.

type MpdProcessor

type MpdProcessor struct {
	ManifestInfo ManifestInfo
}

func NewMpdProcessor

func NewMpdProcessor() MpdProcessor

func (*MpdProcessor) Process

func (mpdProcessor *MpdProcessor) Process(mpd *Mpd)

*

  • Processes the given MPD. Sets |this.periodInfos|. *
  • @param {Mpd} mpd

type Node

type Node interface {
	Parse(parent Node, elem xml.Node)
}

func NewAdaptationSet

func NewAdaptationSet() Node

func NewBaseUrl

func NewBaseUrl() Node

func NewContentComponent

func NewContentComponent() Node

func NewInitialization

func NewInitialization() Node

func NewMpd

func NewMpd() Node

func NewPeriod

func NewPeriod() Node

func NewRepresentation

func NewRepresentation() Node

func NewRepresentationIndex

func NewRepresentationIndex() Node

func NewRole

func NewRole() Node

func NewSegmentBase

func NewSegmentBase() Node

func NewSegmentList

func NewSegmentList() Node

func NewSegmentTemplate

func NewSegmentTemplate() Node

func NewSegmentTimePoint

func NewSegmentTimePoint() Node

func NewSegmentTimeline

func NewSegmentTimeline() Node

func NewSegmentUrl

func NewSegmentUrl() Node

type Pair

type Pair struct {
	Earliest int
	Current  int
}

func NewPair

func NewPair(earliestSegmentNumber, currentSegmentNumber int) Pair

type Period

type Period struct {
	/** @type {?string} */
	Id string

	/**
	 * The start time of the Period, in seconds, with respect to the media
	 * presentation timeline. Note that the Period becomes/became available at
	 * Mpd.availabilityStartTime + Period.start.
	 * @type {?number}
	 */
	Start int

	/**
	 * The duration in seconds.
	 * @type {?number}
	 */
	Duration int

	/** @type {*BaseUrl} */
	BaseUrl *BaseUrl

	/** @type {SegmentBase} */
	SegmentBase *SegmentBase

	/** @type {SegmentList} */
	SegmentList *SegmentList

	/** @type {SegmentTemplate} */
	SegmentTemplate *SegmentTemplate

	/** @type {!Array.<!AdaptationSet>} */
	AdaptationSets []*AdaptationSet
}

func (*Period) Parse

func (period *Period) Parse(parent Node, elem xml.Node)

*

  • Parses a "Period" tag.
  • @param {!Mpd} parent The parent Mpd.
  • @param {!Node} elem The Period XML element.

type PeriodInfo

type PeriodInfo struct {
	Id string

	Start int

	/**
	 * The period's duration, in seconds.
	 */
	Duration int

	StreamSetInfos []StreamSetInfo
}

func NewPeriodInfo

func NewPeriodInfo() PeriodInfo

type Range

type Range struct {
	/** @const {number} */
	Begin int
	/** @const {number} */
	End int
}

*

  • A Range.
  • @param {number} begin The beginning of the range.
  • @param {number} end The end of the range.

func (Range) Clone

func (r Range) Clone() *Range

*

  • Creates a deep copy of this Range.
  • @return {Range}

type Representation

type Representation struct {
	/** @type {?string} */
	Id string

	/**
	 * Never seen on the Representation itself, but inherited from AdapationSet
	 * for convenience.
	 * @see AdaptationSet.lang
	 * @type {?string}
	 */
	Lang string

	/**
	 * Bandwidth required, in bits per second, to assure uninterrupted playback,
	 * assuming that |minBufferTime| seconds of video are in buffer before
	 * playback begins.
	 * @type {?number}
	 */
	Bandwidth uint32

	/** @type {?number} */
	Width int

	/** @type {?number} */
	Height int

	/** @type {?string} */
	MimeType string

	/** @type {?string} */
	Codecs string

	/** @type {*BaseUrl} */
	BaseUrl *BaseUrl

	/** @type {SegmentBase} */
	SegmentBase *SegmentBase

	/** @type {SegmentList} */
	SegmentList *SegmentList

	/** @type {SegmentTemplate} */
	SegmentTemplate *SegmentTemplate

	/** @type {!Array.<ContentProtection>} */
	ContentProtections []*ContentProtection

	/** @type {boolean} */
	Main bool
}

func (*Representation) Parse

func (representation *Representation) Parse(parent Node, elem xml.Node)

*

  • Parses a "Representation" tag.
  • @param {!AdaptationSet} parent The parent AdaptationSet.
  • @param {!Node} elem The Representation XML element.

type RepresentationIndex

type RepresentationIndex struct {
	/** @type {string} */
	Url string

	/**
	 * Inherits the value of SegmentBase.indexRange if not specified.
	 * @type {Range}
	 */
	Range *Range
}

func (*RepresentationIndex) Clone

func (representationIndex *RepresentationIndex) Clone() Node

*

  • Creates a deep copy of this RepresentationIndex.
  • @return {!RepresentationIndex}

func (*RepresentationIndex) Parse

func (representationIndex *RepresentationIndex) Parse(parent Node, elem xml.Node)

*

  • Parses a "RepresentationIndex" tag.
  • @param {!SegmentBase} parent The parent SegmentBase.
  • @param {!Node} elem The RepresentationIndex XML element.

type Role

type Role struct {
	/** @type {?string} */
	Value string
}

func (*Role) Parse

func (role *Role) Parse(parent Node, elem xml.Node)

*

  • Parses a "Role" tag.
  • @param {!AdaptationSet} parent The parent AdaptationSet.
  • @param {!Node} elem The Role XML element.

type SegmentBase

type SegmentBase struct {
	/**
	 * This not an actual XML attribute of SegmentBase. It is inherited from the
	 * SegmentBase's parent Representation.
	 * @type {*BaseUrl}
	 */
	BaseUrl *BaseUrl

	/** @type {?number} */
	Timescale int

	/** @type {?number} */
	PresentationTimeOffset int

	/** @type {Range} */
	IndexRange *Range

	/** @type {RepresentationIndex} */
	RepresentationIndex *RepresentationIndex

	/** @type {Initialization} */
	Initialization *Initialization
}

func (SegmentBase) Clone

func (segmentBase SegmentBase) Clone() Node

*

  • Creates a deep copy of this SegmentBase.
  • @return {!SegmentBase}

func (*SegmentBase) Parse

func (segmentBase *SegmentBase) Parse(parent Node, elem xml.Node)

*

  • Parses a "SegmentBase" tag.
  • @param {*} parent The parent object.
  • @param {!Node} elem The SegmentBase XML element.

type SegmentIndex

type SegmentIndex struct {
	References          []*SegmentReference
	TimestampCorrection int
}

func NewSegmentIndex

func NewSegmentIndex(references []*SegmentReference) SegmentIndex

*

  • Creates a SegmentIndex. *
  • @param {!Array.<!SegmentReference>} references Sorted by time in
  • ascending order with no gaps.

func (SegmentIndex) Last

func (segmentIndex SegmentIndex) Last() *SegmentReference

*

  • Gets the last SegmentReference. *
  • @return {!SegmentReference} The last SegmentReference.
  • @throws {RangeError} when there are no SegmentReferences.

func (SegmentIndex) Length

func (segmentIndex SegmentIndex) Length() int

*

  • Gets the number of SegmentReferences. *
  • @return {number}

type SegmentList

type SegmentList struct {
	/**
	 * This not an actual XML attribute of SegmentList. It is inherited from the
	 * SegmentList's parent Representation.
	 * @type {BaseUrl}
	 */
	BaseUrl *BaseUrl

	/** @type {?number} */
	Timescale uint32 // xs:unsignedInt

	/** @type {?number} */
	PresentationTimeOffset uint64 // xs:unsignedLong

	/**
	 * Each segment's duration. This value is never zero.
	 * @type {?number}
	 */
	SegmentDuration int // xs:duration

	/**
	 * The segment number origin. This value is never zero.
	 * @type {?number}
	 */
	StartNumber uint32 // xs:unsignedInt

	/** @type {Initialization} */
	Initialization *Initialization

	/** @type {!Array.<SegmentUrl>} */
	SegmentUrls []*SegmentUrl
}

func (SegmentList) Clone

func (segmentList SegmentList) Clone() Node

*

  • Creates a deep copy of this SegmentList.
  • @return {!SegmentList}

func (*SegmentList) Parse

func (segmentList *SegmentList) Parse(parent Node, elem xml.Node)

*

  • Parses a "SegmentList" tag.
  • @param {*} parent The parent object.
  • @param {!Node} elem The SegmentList XML element.

type SegmentMetadataInfo

type SegmentMetadataInfo struct {
	Url string

	StartByte int

	EndByte int
}

func NewSegmentMetadataInfo

func NewSegmentMetadataInfo() SegmentMetadataInfo

type SegmentReference

type SegmentReference struct {

	/**
	 * The segment's ID.
	 * @const {number}
	 */
	Id uint64

	/**
	 * The time, in seconds, that the segment begins.
	 * @const {number}
	 */
	StartTime uint64

	/**
	 * The time, in seconds, that the segment ends. The segment ends immediately
	 * before this time. A null value indicates that the segment continues to the
	 * end of the stream.
	 * @const {?number}
	 */
	EndTime uint64

	/**
	 * The position of the segment's first byte.
	 * @const {number}
	 */
	StartByte int

	/**
	 * The position of the segment's last byte, inclusive. A null value indicates
	 * that the segment continues to the end of the file located at |url|.
	 * @const {?number}
	 */
	EndByte int

	/**
	 * The segment's location.
	 * @const {!string}
	 */
	Url string
}

func NewSegmentReference

func NewSegmentReference(id, startTime, endTime uint64, startByte, endByte int, url string) SegmentReference

type SegmentTemplate

type SegmentTemplate struct {
	/** @type {?number} */
	Timescale uint32 // xs:unsignedInt

	/** @type {?number} */
	PresentationTimeOffset int // xs:unsignedLong

	/**
	 * Each segment's duration. This value is never zero.
	 * @type {?number}
	 */
	SegmentDuration int // xs:duration

	/**
	 * The segment number origin. This value is never zero.
	 * @type {?number}
	 */
	StartNumber int // xs:unsignedInt

	/** @type {?string} */
	MediaUrlTemplate string

	/** @type {?string} */
	IndexUrlTemplate string

	/** @type {?string} */
	InitializationUrlTemplate string

	/** @type {SegmentTimeline} */
	Timeline *SegmentTimeline
}

func (SegmentTemplate) Clone

func (segmentTemplate SegmentTemplate) Clone() Node

func (*SegmentTemplate) Parse

func (segmentTemplate *SegmentTemplate) Parse(parent Node, elem xml.Node)

*

  • Parses a "SegmentTemplate" tag.
  • @param {*} parent The parent object.
  • @param {!Node} elem The SegmentTemplate XML element.

type SegmentTimePoint

type SegmentTimePoint struct {
	/**
	 * The start time of the media segment, in seconds, relative to the beginning
	 * of the Period.
	 * @type {?number}
	 */
	StartTime uint64

	/** @type {?number} */
	Duration uint64

	/** @type {?number} */
	Repeat int
}

func (*SegmentTimePoint) Clone

func (segmentTimePoint *SegmentTimePoint) Clone() Node

*

  • Creates a deep copy of this SegmentTimePoint.
  • @return {!SegmentTimePoint}

func (*SegmentTimePoint) Parse

func (segmentTimePoint *SegmentTimePoint) Parse(parent Node, elem xml.Node)

*

  • Parses an "S" tag.
  • @param {!SegmentTimeline} parent The parent SegmentTimeline.
  • @param {!Node} elem The SegmentTimePoint XML element.

type SegmentTimeline

type SegmentTimeline struct {
	/** @type {!Array.<!SegmentTimePoint>} */
	TimePoints []*SegmentTimePoint
}

func (*SegmentTimeline) Clone

func (segmentTimeline *SegmentTimeline) Clone() Node

*

  • Creates a deep copy of this SegmentTimeline.
  • @return {!SegmentTimeline}

func (*SegmentTimeline) Parse

func (segmentTimeline *SegmentTimeline) Parse(parent Node, elem xml.Node)

*

  • Parses a "SegmentTimeline" tag.
  • @param {!SegmentTemplate} parent The parent SegmentTemplate.
  • @param {!Node} elem The SegmentTimeline XML element.

type SegmentUrl

type SegmentUrl struct {
	/** @type {string} */
	MediaUrl string

	/** @type {Range} */
	MediaRange *Range
}

func (*SegmentUrl) Clone

func (segmentUrl *SegmentUrl) Clone() Node

*

  • Creates a deep copy of this SegmentUrl.
  • @return {!SegmentUrl}

func (*SegmentUrl) Parse

func (segmentUrl *SegmentUrl) Parse(parent Node, elem xml.Node)

*

  • Parses a "SegmentUrl" tag.
  • @param {!SegmentList} parent The parent SegmentList.
  • @param {!Node} elem The SegmentUrl XML element.

type StreamInfo

type StreamInfo struct {
	UniqueId int

	Id string

	/**
	 * An offset, in seconds, to apply to each timestamp within each media
	 * segment that's put in buffer.
	 */
	TimestampOffset int

	/**
	 * Indicates the stream's current segment's start time, i.e., its live-edge.
	 * This value is non-null if the stream is both live and available;
	 * otherwise, this value is null.
	 */
	CurrentSegmentStartTime uint64

	/**
	 * Bandwidth required, in bits per second, to assure uninterrupted playback,
	 * assuming that |minBufferTime| seconds of video are in buffer before
	 * playback begins.
	 */
	Bandwidth uint32

	Width int

	Height int

	MimeType string

	Codecs string

	MediaUrl string

	Enabled bool

	/**
	 * The stream's SegmentIndex metadata.
	 * @see {StreamInfo.isAvailable}
	 */
	SegmentIndexInfo *SegmentMetadataInfo

	/**
	 * The stream's segment initialization metadata.
	 * @type {SegmentMetadataInfo}
	 */
	SegmentInitializationInfo *SegmentMetadataInfo

	/**
	 * The stream's SegmentIndex.
	 * @see {StreamInfo.isAvailable}
	 * @type {SegmentIndex}
	 */
	SegmentIndex *SegmentIndex

	/** @type {ArrayBuffer} */
	SegmentInitializationData []byte

	/** @private {ArrayBuffer} */
	SegmentIndexData []byte
}

func NewStreamInfo

func NewStreamInfo() StreamInfo

type StreamSetInfo

type StreamSetInfo struct {
	/** @type {number} */
	UniqueId int

	/** @type {?string} */
	Id string

	/** @type {string} */
	ContentType mapset.Set

	/** @type {!Array.<!StreamInfo>} */
	StreamInfos []*StreamInfo

	/** @type {string} */
	Lang string

	/** @type {boolean} */
	Main bool
}

func NewStreamSetInfo

func NewStreamSetInfo() StreamSetInfo

type TimeLine

type TimeLine struct {
	Start uint64
	End   uint64
}

func NewTimeLine

func NewTimeLine(start, end uint64) TimeLine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL