Documentation
¶
Overview ¶
Package mpd implements complete MPEG-DASH 5'th gen Media Presentation Description (MPD) with DRM support. It has been extended with ContentProtection for PlayReady, Marlin, and DASH-IF ClearKey. There are various helper functions to create MPDs, Periods, AdaptationSets, Representations, and SubRepresentations, and extract properties from an element or its parent.
Index ¶
- Constants
- Variables
- func ParseDuration(str string) (time.Duration, error)
- func Ptr[T any](v T) *T
- type AdaptationSetType
- func (a *AdaptationSetType) AppendRepresentation(r *RepresentationType)
- func (a *AdaptationSetType) Clone() *AdaptationSetType
- func (a *AdaptationSetType) GetCodecs() string
- func (a *AdaptationSetType) GetContentProtections() []*ContentProtectionType
- func (a *AdaptationSetType) GetMimeType() string
- func (a *AdaptationSetType) GetSegmentTemplate() *SegmentTemplateType
- func (a *AdaptationSetType) Parent() *Period
- func (a *AdaptationSetType) SetParent(p *Period)
- func (a *AdaptationSetType) SetParents()
- type AlternativeMPDEventType
- type AlternativeMPDReplaceEventType
- type AnyURI
- type AudioSamplingRateType
- type AuthzURLType
- type BaseURLType
- type CMCDParameterType
- type CerturlType
- type ClientDataReportingType
- type CommonDurationPatternAttributes
- type CommonSegmentSequenceAttributes
- type CommonSegmentSequenceDurationPatternAttributes
- type ContentComponentType
- type ContentEncodingType
- type ContentPopularityRateType
- type ContentProtectionType
- type ContentSteeringType
- type DateTime
- type DescriptorType
- type Duration
- type EventRestrictionsType
- type EventStreamType
- type EventType
- type ExtendedBandwidthType
- type ExtendedUrlInfoType
- type FCS
- type FailoverContentType
- type FloatInf64
- type FrameRateType
- type ImportedMpdType
- type InitializationSetType
- type LaURLType
- type LabelType
- type LatencyType
- type LeapSecondInformationType
- type ListOf4CCType
- type ListOfProfilesType
- type LocationType
- type MPD
- type MPDError
- type MSProType
- type MarlinContentId
- type MarlinContentIds
- type MetricsType
- type ModelPairType
- type MultipleSegmentBaseType
- type OperatingBandwidthType
- type OperatingQualityType
- type PR
- type ParseDurationError
- type PatchLocationType
- type PatternType
- type Period
- func (p *Period) AbsoluteStart(m *MPD) (float64, error)
- func (p *Period) AppendAdaptationSet(a *AdaptationSetType)
- func (p *Period) Clone() *Period
- func (p *Period) GetDuration() (Duration, error)
- func (p *Period) GetIndex() (int, error)
- func (p *Period) GetStart() (Duration, error)
- func (p *Period) GetType() (PeriodType, error)
- func (p *Period) Parent() *MPD
- func (p *Period) SetParent(m *MPD)
- func (p *Period) SetParents()
- type PeriodType
- type PlaybackRateType
- type PlaybackRestrictionsType
- type PreselectionOrderType
- type PreselectionType
- type ProducerReferenceTimeType
- type ProducerReferenceTimeTypeType
- type ProgramInformationType
- type PsshType
- type RFC6838ContentTypeType
- type RandomAccessType
- type RandomAccessTypeType
- type RangeType
- type RatioType
- type RepresentationBaseType
- type RepresentationType
- func NewAudioRepresentation(id, codec, mimeType string, bandwidth, audioSamplingRate int) *RepresentationType
- func NewRepresentation() *RepresentationType
- func NewRepresentationWithID(id, codec, mimeType string, bandwidth int) *RepresentationType
- func NewVideoRepresentation(id, codec, mimeType, frameRate string, bandwidth, width, height int) *RepresentationType
- func (r *RepresentationType) AppendSubRepresentation(sr *SubRepresentationType)
- func (r *RepresentationType) GetCodecs() string
- func (r *RepresentationType) GetContentProtections() []*ContentProtectionType
- func (r *RepresentationType) GetInit() (string, error)
- func (r *RepresentationType) GetMedia() (string, error)
- func (r *RepresentationType) GetMimeType() string
- func (r *RepresentationType) GetSegmentTemplate() *SegmentTemplateType
- func (r *RepresentationType) Parent() *AdaptationSetType
- func (r *RepresentationType) SetParent(p *AdaptationSetType)
- func (r *RepresentationType) SetParents()
- func (r *RepresentationType) SetSegmentBase(initSize, sidxSize uint32, indexRangeExact bool)
- type ResyncType
- type RunLengthType
- type S
- type SegmentBaseType
- type SegmentListType
- type SegmentSequencePropertiesType
- type SegmentTemplateType
- type SegmentTimelineType
- type SegmentURLType
- type SelectionInfoType
- type SelectionType
- type ServiceDescriptionType
- type SingleRFC7233RangeType
- type StringNoWhitespaceType
- type StringNoWhitespaceVectorType
- type StringVectorType
- type SubRepresentationType
- type SubsetType
- type SupVideoInfoType
- type SwitchingType
- type SwitchingTypeType
- type UIntPairsWithIDType
- type UIntVWithIDType
- type UIntVectorType
- type URLType
- type UrlQueryInfoType
- type VideoScanType
Constants ¶
const ( STATIC_TYPE = "static" DYNAMIC_TYPE = "dynamic" LIST_TYPE = "list" )
const ( PROFILE_FULL = "urn:mpeg:dash:profile:full:2011" PROFILE_ONDEMAND = "urn:mpeg:dash:profile:isoff-on-demand:2011" PROFILE_LIVE = "urn:mpeg:dash:profile:isoff-live:2011" PROFILE_MAIN = "urn:mpeg:dash:profile:isoff-main:2011" PROFILE_MPEG_TS_MAIN = "urn:mpeg:dash:profile:mp2t-main:2011" PROFILE_MPEG_TS_SIMPLE = "urn:mpeg:dash:profile:mp2t-simple:2011" PROFILE_EXT_LIVE = "urn:mpeg:dash:profile:isoff-ext-live:2014" PROFILE_EXT_ONDEMAND = "urn:mpeg:dash:profile:isoff-ext-on-demand:2014" PROFILE_COMMON = "urn:mpeg:dash:profile:isoff-common:2014" PROFILE_BROADCAST = "urn:mpeg:dash:profile:isoff-broadcast:2015" PROFILE_CMAF = "urn:mpeg:dash:profile:cmaf:2019" PROFILE_ADVANCED_LINEAR = "urn:mpeg:dash:profile:advanced-linear:2025" PROFILE_LIST = "urn:mpeg:dash:profile:list:2024" PROFILE_SINGLE_PERIOD = "urn:mpeg:dash:profile:sps:2024" )
const ( DASH_NAMESPACE = "urn:mpeg:dash:schema:mpd:2011" AUDIO_CHANNEL_CONFIGURATION_MPEG_DASH = "urn:mpeg:dash:23003:3:audio_channel_configuration:2011" AUDIO_CHANNEL_CONFIGURATION_MPEG_DOLBY = "tag:dolby.com,2014:dash:audio_channel_configuration:2011" MIME_TYPE_VIDEO_MP4 = "video/mp4" MIME_TYPE_AUDIO_MP4 = "audio/mp4" MIME_TYPE_SUBTITLE_VTT = "text/vtt" MIME_TYPE_TTML = "application/ttml+xml" )
const ( DRM_CLEAR_KEY_DASHIF = "urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e" DRM_PLAYREADY = "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" DRM_WIDEVINE = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" DRM_MARLIN = "urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4" // upper case for legacy reasons )
const ( UrlParameterNamespace2014 = "urn:mpeg:dash:schema:urlparam:2014" UrlParameterNamespace2016 = "urn:mpeg:dash:schema:urlparam:2016" UrlParameterNamespace2025 = "urn:mpeg:dash:schema:urlparam:2025" )
const RFC3339MS string = "2006-01-02T15:04:05.999Z07:00"
Variables ¶
var ( ErrASTRequired = errors.New("availabilityStartTime is required for dynamic MPDs") ErrPeriodNotFound = errors.New("period not found in MPD") ErrParentNotSet = errors.New("parent not set") ErrSegmentTemplateNotSet = errors.New("segmentTemplate not set") ErrNoMediaPresentationDuration = errors.New("no MediaPresentationDuration in static MPD") ErrUnknownPeriodDur = errors.New("period duration cannot be derived") ErrUnknownPeriodStart = errors.New("period start cannot be derived") )
Functions ¶
func ParseDuration ¶
ParseDuration parses an xsd Duration string and returns corresponding time.Duration.
Types ¶
type AdaptationSetType ¶
type AdaptationSetType struct {
XlinkHref string `xml:"xlink:href,attr,omitempty"`
XlinkActuate string `xml:"xlink:actuate,attr,omitempty"` // default is "onRequest"
XlinkType string `xml:"xlink:type,attr,omitempty"` // fixed "simple"
XlinkShow string `xml:"xlink:show,attr,omitempty"` // fixed "embed"
Id *uint32 `xml:"id,attr"`
Group uint32 `xml:"group,attr,omitempty"`
Lang string `xml:"lang,attr,omitempty"`
ContentType RFC6838ContentTypeType `xml:"contentType,attr,omitempty"`
Par RatioType `xml:"par,attr,omitempty"`
MinBandwidth uint32 `xml:"minBandwidth,attr,omitempty"`
MaxBandwidth uint32 `xml:"maxBandwidth,attr,omitempty"`
MinWidth uint32 `xml:"minWidth,attr,omitempty"`
MaxWidth uint32 `xml:"maxWidth,attr,omitempty"`
MinHeight uint32 `xml:"minHeight,attr,omitempty"`
MaxHeight uint32 `xml:"maxHeight,attr,omitempty"`
MinFrameRate string `xml:"minFrameRate,attr,omitempty"`
MaxFrameRate string `xml:"maxFrameRate,attr,omitempty"`
SegmentAlignment bool `xml:"segmentAlignment,attr,omitempty"` // default = false
SubsegmentAlignment bool `xml:"subsegmentAlignment,attr,omitempty"` // default = false
SubsegmentStartsWithSAP uint32 `xml:"subsegmentStartsWithSAP,attr,omitempty"` // default = 0
BitstreamSwitching *bool `xml:"bitstreamSwitching,attr"`
InitializationSetRef *UIntVectorType `xml:"initializationSetRef,attr,omitempty"`
InitializationPrincipal AnyURI `xml:"initializationPrincipal,attr,omitempty"`
RepresentationBaseType
Accessibilities []*DescriptorType `xml:"Accessibility"`
Roles []*DescriptorType `xml:"Role"`
Ratings []*DescriptorType `xml:"Rating"`
Viewpoints []*DescriptorType `xml:"Viewpoint"`
ContentComponents []*ContentComponentType `xml:"ContentComponent"`
BaseURLs []*BaseURLType `xml:"BaseURL"`
SegmentBase *SegmentBaseType `xml:"SegmentBase"`
SegmentList *SegmentListType `xml:"SegmentList"`
SegmentTemplate *SegmentTemplateType `xml:"SegmentTemplate"`
Representations []*RepresentationType `xml:"Representation"`
RequestParam []*ExtendedUrlInfoType `xml:"RequestParam"`
// contains filtered or unexported fields
}
AdaptationSetType is AdaptationSet or EmptyAdaptationSet. Note that XMLName is not set, since the same structure is used also for EmptyAdaptationSet.
func NewAdaptationSet ¶ added in v0.6.0
func NewAdaptationSet() *AdaptationSetType
NewAdaptationSet returns a new empty AdaptationSet.
func NewAdaptationSetWithParams ¶ added in v0.10.0
func NewAdaptationSetWithParams(contentType, mimeType string, segmentAlignment bool, startsWithSAP uint32) *AdaptationSetType
func (*AdaptationSetType) AppendRepresentation ¶ added in v0.8.0
func (a *AdaptationSetType) AppendRepresentation(r *RepresentationType)
AppendRepresentation appends a Representation to the AdaptationSet and sets parent pointer.
func (*AdaptationSetType) Clone ¶ added in v0.9.0
func (a *AdaptationSetType) Clone() *AdaptationSetType
Clone returns a deep copy of the AdaptationSet with parent links set.
func (*AdaptationSetType) GetCodecs ¶ added in v0.11.0
func (a *AdaptationSetType) GetCodecs() string
GetCodecs returns codecs string of the adaptation set.
func (*AdaptationSetType) GetContentProtections ¶ added in v0.11.0
func (a *AdaptationSetType) GetContentProtections() []*ContentProtectionType
GetRepresentations returns the ContentProtections of the adaptation set.
func (*AdaptationSetType) GetMimeType ¶ added in v0.11.0
func (a *AdaptationSetType) GetMimeType() string
GetMimeType returns the mime type.
func (*AdaptationSetType) GetSegmentTemplate ¶ added in v0.11.0
func (a *AdaptationSetType) GetSegmentTemplate() *SegmentTemplateType
GetSegmentTemplate returns the segment template of the AdaptationSet or nil if not set.
func (*AdaptationSetType) Parent ¶ added in v0.8.0
func (a *AdaptationSetType) Parent() *Period
func (*AdaptationSetType) SetParent ¶ added in v0.8.0
func (a *AdaptationSetType) SetParent(p *Period)
func (*AdaptationSetType) SetParents ¶ added in v0.9.0
func (a *AdaptationSetType) SetParents()
SetParents sets the parent pointers for all children of a.
type AlternativeMPDEventType ¶ added in v0.13.0
type AlternativeMPDEventType struct {
Uri string `xml:"uri,attr"`
EarliestResolutionTimeOffset float64 `xml:"earliestResolutionTimeOffset,attr,omitempty"`
ServiceDescriptionId uint32 `xml:"serviceDescriptionId,attr,omitempty"`
MaxDuration uint64 `xml:"maxDuration,attr,omitempty"`
ExecuteOnce bool `xml:"executeOnce,attr,omitempty"`
NoJump int32 `xml:"noJump,attr,omitempty"`
SkipAfter Duration `xml:"skipAfter,attr,omitempty"`
SupplementalProperty []*DescriptorType `xml:"SupplementalProperty"`
}
AlternativeMPDEventType is Alternative MPD event
type AlternativeMPDReplaceEventType ¶ added in v0.13.0
type AlternativeMPDReplaceEventType struct {
ReturnOffset uint64 `xml:"returnOffset,attr,omitempty"`
Clip bool `xml:"clip,attr,omitempty"`
StartWithOffset bool `xml:"startWithOffset,attr,omitempty"`
*AlternativeMPDEventType
}
AlternativeMPDReplaceEventType is Alternative MPD Replacement Event
type AnyURI ¶
type AnyURI string
AnyURI is xsd:anyURI http://www.datypic.com/sc/xsd/t-xsd_anyURI.html.
type AudioSamplingRateType ¶
type AudioSamplingRateType *UIntVectorType
AudioSamplingRateType is UIntVectorType with 1 or 2 components.
type AuthzURLType ¶ added in v0.11.1
type AuthzURLType struct {
AuthzType string `xml:"authzType,attr,omitempty"`
Value AnyURI `xml:",chardata"`
}
AuthzURLType is DASH-IF Authzurl according to DASH-IF IOP v5.0.
type BaseURLType ¶
type BaseURLType struct {
ServiceLocation string `xml:"serviceLocation,attr,omitempty"`
ByteRange string `xml:"byteRange,attr,omitempty"`
AvailabilityTimeOffset FloatInf64 `xml:"availabilityTimeOffset,attr,omitempty"`
AvailabilityTimeComplete *bool `xml:"availabilityTimeComplete,attr"`
TimeShiftBufferDepth *Duration `xml:"timeShiftBufferDepth,attr"`
RangeAccess bool `xml:"rangeAccess,attr,omitempty"` // default = false
Value AnyURI `xml:",chardata"`
}
BaseURLType is Base URL.
func NewBaseURL ¶ added in v0.10.0
func NewBaseURL(value string) *BaseURLType
NewBaseURL returns a new BaseURLType with Value set.
type CMCDParameterType ¶ added in v0.13.0
type CMCDParameterType struct {
Version uint32 `xml:"version,attr,omitempty"`
Mode string `xml:"mode,attr,omitempty"`
IncludeInRequests *StringNoWhitespaceVectorType `xml:"includeInRequests,attr,omitempty"`
Keys *StringNoWhitespaceVectorType `xml:"keys,attr"`
ContentID string `xml:"contentID,attr,omitempty"`
SessionID string `xml:"sessionID,attr,omitempty"`
}
CMCDParameterType is CMCD Parameters
type CerturlType ¶ added in v0.14.0
type CerturlType struct {
CertType string `xml:"certType,attr,omitempty"`
Value AnyURI `xml:",chardata"`
}
CerturlType is DASH-IF Certurl defined in Sec 5.4 of DASH-IF IOP v5.1 Part 6.
type ClientDataReportingType ¶ added in v0.13.0
type ClientDataReportingType struct {
SchemeIdUri AnyURI `xml:"schemeIdUri,attr"`
ServiceLocations *StringVectorType `xml:"serviceLocations,attr,omitempty"`
AdaptationSets *UIntVectorType `xml:"adaptationSets,attr,omitempty"`
CMCDParameters []*CMCDParameterType `xml:"CMCDParameters"`
}
ClientDataReportingType is Client Data Reporting
type CommonDurationPatternAttributes ¶ added in v0.13.0
type CommonDurationPatternAttributes struct {
P *uint32 `xml:"p,attr,omitempty"`
PE *uint32 `xml:"pE,attr,omitempty"`
}
CommonDurationPatternAttributes is Common Duration Pattern Attributes (Ed. 6).
type CommonSegmentSequenceAttributes ¶ added in v0.13.0
type CommonSegmentSequenceAttributes struct {
K *uint64 `xml:"k,attr,omitempty"`
KL *uint32 `xml:"kL,attr,omitempty"`
}
CommonSegmentSequenceAttributes is Common Segment Sequence Attributes (Ed. 6).
type CommonSegmentSequenceDurationPatternAttributes ¶ added in v0.13.0
type CommonSegmentSequenceDurationPatternAttributes struct {
Ssp *uint32 `xml:"ssp,attr,omitempty"`
SspL *uint32 `xml:"sspL,attr,omitempty"`
}
CommonSegmentSequenceDurationPatternAttributes is Comm
type ContentComponentType ¶
type ContentComponentType struct {
XMLName xml.Name `xml:"ContentComponent"`
Id *uint32 `xml:"id,attr"`
Lang string `xml:"lang,attr,omitempty"`
ContentType RFC6838ContentTypeType `xml:"contentType,attr,omitempty"`
Par RatioType `xml:"par,attr,omitempty"`
Tag string `xml:"tag,attr,omitempty"`
Accessibilities []*DescriptorType `xml:"Accessibility"`
Roles []*DescriptorType `xml:"Role"`
Ratings []*DescriptorType `xml:"Rating"`
Viewpoints []*DescriptorType `xml:"Viewpoint"`
}
ContentComponentType is Content Component.
type ContentEncodingType ¶
type ContentEncodingType string
ContentEncodingType is an enum with single value "base64".
type ContentPopularityRateType ¶
type ContentPopularityRateType struct {
XMLName xml.Name `xml:"ContentPopularityRate"`
Source string `xml:"source,attr"`
Sourcedescription string `xml:"source_description,attr,omitempty"`
PR []*PR `xml:"PR"`
}
ContentPopularityRateType is Content Popularity Rate.
type ContentProtectionType ¶
type ContentProtectionType struct {
XMLName xml.Name `xml:"ContentProtection"`
Robustness string `xml:"robustness,attr,omitempty"`
RefId string `xml:"refId,attr,omitempty"`
Ref string `xml:"ref,attr,omitempty"`
DefaultKID string `xml:"urn:mpeg:cenc:2013 cenc:default_KID,attr,omitempty"`
// Pssh is PSSH Box with namespace "urn:mpeg:cenc:2013" and prefix "cenc".
Pssh *PsshType `xml:"urn:mpeg:cenc:2013 cenc:pssh,omitempty"`
// MSPro is Microsoft PlayReady provisioning data with namespace "urn:microsoft:playready and "prefix "mspr".
MSPro *MSProType `xml:"urn:microsoft:playready mspr:pro,omitempty"`
// LaURL is DASH-IF License Acquisition URL according to DASH-IF IOp v5.0.
LaURL *LaURLType `xml:"https://dashif.org/CPS dashif:Laurl,omitempty"`
// AuthzURL is DASH-IF clear key authorization URL according to DASH-IF IOp v5.0.
AuthzURL *AuthzURLType `xml:"https://dashif.org/CPS dashif:Authzurl,omitempty"`
// Certurls is an array of DASH-IF Certurl defined in Sec 5.4 of DASH-IF IOP v5.1.
Certurls []CerturlType `xml:"https://dashif.org/CPS dashif:Certurl,omitempty"`
// MarlinContentIds is Marlin Content Ids containing one or more MarlineContentId elements.
MarlinContentIds *MarlinContentIds `xml:"urn:marlin:mas:1-0:services:schemas:mpd mas:MarlinContentIds,omitempty"`
DescriptorType
}
ContentProtectionType is Content Protection.
func NewContentProtection ¶ added in v0.6.0
func NewContentProtection() *ContentProtectionType
NewContentProtection returns a new empty ContentProtection.
type ContentSteeringType ¶ added in v0.13.0
type ContentSteeringType struct {
DefaultServiceLocation string `xml:"defaultServiceLocation,attr,omitempty"`
QueryBeforeStart bool `xml:"queryBeforeStart,attr,omitempty"`
ClientRequirement bool `xml:"clientRequirement,attr,omitempty"`
Value string `xml:",chardata"`
}
ContentSteeringType is Content Steering.
type DateTime ¶
type DateTime string
DateTime is xs:dateTime https://www.w3.org/TR/xmlschema-2/#dateTime (almost ISO 8601).
func ConvertToDateTime ¶
ConvertToDateTime converts a number of seconds to a UTC DateTime by cropping to ms precision.
func ConvertToDateTimeMS ¶ added in v0.7.0
ConvertToDateTime converts an integral number of milliseconds to a UTC DateTime.
func ConvertToDateTimeS ¶
ConvertToDateTime converts an integral number of seconds to a UTC DateTime.
func (DateTime) ConvertToSeconds ¶ added in v0.8.0
ConvertToSeconds converts a DateTime to a number of seconds.
type DescriptorType ¶
type DescriptorType struct {
SchemeIdUri AnyURI `xml:"schemeIdUri,attr,omitempty"`
Value string `xml:"value,attr,omitempty"`
Id string `xml:"id,attr,omitempty"`
UrlQueryInfo *UrlQueryInfoType `xml:"urn:mpeg:dash:schema:urlparam:2014 up:UrlQueryInfo,omitempty"`
ExtUrlQueryInfo *ExtendedUrlInfoType `xml:"urn:mpeg:dash:schema:urlparam:2016 up:ExtUrlQueryInfo,omitempty"`
}
DescriptorType is Descriptor.
func NewDescriptor ¶ added in v0.10.0
func NewDescriptor(schemeIdURI, value, id string) *DescriptorType
NewDescriptor returns a new DescriptorType.
func NewRole ¶ added in v0.10.0
func NewRole(value string) *DescriptorType
type Duration ¶
Duration is an alias of time.Duration and has nano-second precision from Epoch start.
XML marshaling methods need Duration to be included as a pointer in XML.
func Seconds2DurPtr ¶
Seconds2DurPtr returns a pointer to a duration given a time in seconds
func Seconds2DurPtrFloat64 ¶ added in v0.10.0
Seconds2DurPtrFloat64 returns a pointer to a duration given a float64 time in seconds.
func (*Duration) MarshalXMLAttr ¶
func (*Duration) Seconds ¶ added in v0.8.0
Seconds returns the duration as a floating point number of seconds.
type EventRestrictionsType ¶ added in v0.13.0
type EventRestrictionsType struct {
ExecuteOnce bool `xml:"executeOnce,attr,omitempty"`
NoJump bool `xml:"noJump,attr,omitempty"`
}
EventRestrictionsType is Restrictions on event execution
type EventStreamType ¶
type EventStreamType struct {
XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"`
XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest"
XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple"
XlinkShow string `xml:"http://www.w3.org/1999/xlink xlink:show,attr,omitempty"` // fixed = "embed"
SchemeIdUri AnyURI `xml:"schemeIdUri,attr"`
Value string `xml:"value,attr,omitempty"`
Timescale *uint32 `xml:"timescale,attr"` // default = 1
PresentationTimeOffset uint64 `xml:"presentationTimeOffset,attr,omitempty"` // default is 0
Events []*EventType `xml:"Event"`
ServiceDescription []*ServiceDescriptionType `xml:"ServiceDescription"`
EssentialProperty []*DescriptorType `xml:"EssentialProperty"`
SupplementalProperty []*DescriptorType `xml:"SupplementalProperty"`
RequestParam []*ExtendedUrlInfoType `xml:"RequestParam"`
}
EventStreamType is EventStream or InbandEventStream. It therefore has no XMLName.
type EventType ¶
type EventType struct {
XMLName xml.Name `xml:"Event"`
PresentationTime uint64 `xml:"presentationTime,attr"` // default is 0
Duration uint64 `xml:"duration,attr,omitempty"`
Id *uint64 `xml:"id,attr"`
Status string `xml:"status,attr,omitempty"`
ContentEncoding ContentEncodingType `xml:"contentEncoding,attr,omitempty"`
MessageData string `xml:"messageData,attr,omitempty"`
Value string `xml:",chardata"` // Is this still present in Ed. 6?
SelectionInfo *SelectionInfoType `xml:"SelectionInfo"`
ServiceDescription *ServiceDescriptionType `xml:"ServiceDescription"`
InsertPresentation *AlternativeMPDEventType `xml:"InsertPresentation"`
ReplacePresentation *AlternativeMPDReplaceEventType `xml:"ReplacePresentation"`
SupplementalProperty []*DescriptorType `xml:"SupplementalProperty"`
EssentialProperty []*DescriptorType `xml:"EssentialProperty"`
}
EventType is Event. This has settings mixed="true" in the schema, so it can either have charData or child elements or both.
type ExtendedBandwidthType ¶
type ExtendedBandwidthType struct {
XMLName xml.Name `xml:"ExtendedBandwidth"`
Vbr bool `xml:"vbr,attr,omitempty"` // default is false
ModelPairs []*ModelPairType `xml:"ModelPair"`
}
ExtendedBandwidthType is Extended Bandwidth Model
type ExtendedUrlInfoType ¶ added in v0.12.0
type ExtendedUrlInfoType struct {
UrlQueryInfoType
IncludeInRequests string `xml:"includeInRequests,attr,omitempty"` // default = "segment"
HeaderParamSource string `xml:"headerParamSource,attr,omitempty"` // default = "segment"
SameOriginPolicy bool `xml:"sameOriginPolicy,attr,omitempty"` // default = "false"
Header string `xml:"header,attr,omitempty"`
}
ExtendedUrlInfoType is defined in Annex I of ISO/IEC 23009-1. Its namespace is UrlParameterNamespace2016.
type FailoverContentType ¶
type FailoverContentType struct {
Valid *bool `xml:"valid,attr"` // default = true
FCS []*FCS `xml:"FCS"`
}
FailoverContentType is Failover Content.
type FloatInf64 ¶ added in v0.7.0
type FloatInf64 float64
FloatInf64 is a float64 which renders as "INF" for +Inf
func (*FloatInf64) MarshalXMLAttr ¶ added in v0.7.0
func (*FloatInf64) UnmarshalXMLAttr ¶ added in v0.7.0
func (f *FloatInf64) UnmarshalXMLAttr(attr xml.Attr) error
type FrameRateType ¶
type FrameRateType string
FrameRateType is Type for Frame Rate ([0-9]+(/[1-9][0-9]*)?).
type ImportedMpdType ¶ added in v0.13.0
type ImportedMpdType struct {
EarliestResolutionTimeOffset float64 `xml:"earliestResolutionTimeOffset,attr"`
Value AnyURI `xml:",chardata"`
}
ImportedMpdType is Imported MPD
type InitializationSetType ¶
type InitializationSetType struct {
XMLName xml.Name `xml:"InitializationSet"`
XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"`
XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest"
XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple"
Id uint32 `xml:"id,attr"`
InAllPeriods *bool `xml:"inAllPeriods,attr"` // default is true
ContentType RFC6838ContentTypeType `xml:"contentType,attr,omitempty"`
Par RatioType `xml:"par,attr,omitempty"`
MaxWidth uint32 `xml:"maxWidth,attr,omitempty"`
MaxHeight uint32 `xml:"maxHeight,attr,omitempty"`
MaxFrameRate string `xml:"maxFrameRate,attr,omitempty"`
Initialization AnyURI `xml:"initialization,attr,omitempty"`
Accessibilities []*DescriptorType `xml:"Accessibility"`
Roles []*DescriptorType `xml:"Role"`
Ratings []*DescriptorType `xml:"Rating"`
Viewpoints []*DescriptorType `xml:"Viewpoint"`
RepresentationBaseType
}
InitializationSetType is Initialization Set.
func NewInitializationSet ¶ added in v0.6.0
func NewInitializationSet() *InitializationSetType
NewInitializationSet returns a new empty InitializationSet.
type LaURLType ¶ added in v0.11.1
type LaURLType struct {
LicenseType string `xml:"licenseType,attr,omitempty"`
Value AnyURI `xml:",chardata"`
}
LaURLType is License Acquisition URL according to DASH-IF IOP v5.0.
type LabelType ¶
type LabelType struct {
XMLName xml.Name `xml:"Label"`
Id uint32 `xml:"id,attr,omitempty"` // default = 0
Lang string `xml:"lang,attr,omitempty"`
Value string `xml:",chardata"`
}
LabelType is Label and Group Label.
type LatencyType ¶
type LatencyType struct {
XMLName xml.Name `xml:"Latency"`
ReferenceId uint32 `xml:"referenceId,attr"`
Target *uint32 `xml:"target,attr"`
Max *uint32 `xml:"max,attr"`
Min *uint32 `xml:"min,attr"`
QualityLatencies []*UIntPairsWithIDType `xml:"QualityLatency"`
}
LatencyType is Service Description Latency (Annex K.4.2.2).
type LeapSecondInformationType ¶
type LeapSecondInformationType struct {
AvailabilityStartLeapOffset int `xml:"availabilityStartLeapOffset,attr"`
NextAvailabilityStartLeapOffset int `xml:"nextAvailabilityStartLeapOffset,attr,omitempty"`
NextLeapChangeTime DateTime `xml:"nextLeapChangeTime,attr,omitempty"`
}
LeapSecondInformationType is Leap Second Information
type ListOfProfilesType ¶
type ListOfProfilesType string
ListOfProfilesType is comma-separated list of profiles.
func (ListOfProfilesType) AddProfile ¶ added in v0.10.0
func (l ListOfProfilesType) AddProfile(profile string) ListOfProfilesType
AddProfile adds a profile to the comma-separated list of profiles. Duplicates are not added.
type LocationType ¶ added in v0.13.0
type LocationType struct {
ServiceLocation string `xml:"serviceLocation,attr,omitempty"`
Value string `xml:",chardata"`
}
LocationType is Location Type (extension with ServiceLocation in Ed 6)
type MPD ¶
type MPD struct {
XMLName xml.Name `xml:"MPD"`
XMLNs string `xml:"xmlns,attr,omitempty"`
SchemaLocation string `xml:"http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation,attr,omitempty"`
Id string `xml:"id,attr,omitempty"`
Profiles ListOfProfilesType `xml:"profiles,attr"`
Type *string `xml:"type,attr,omitempty"` // Optional with default "static"
AvailabilityStartTime DateTime `xml:"availabilityStartTime,attr,omitempty"`
AvailabilityEndTime DateTime `xml:"availabilityEndTime,attr,omitempty"`
PublishTime DateTime `xml:"publishTime,attr,omitempty"`
MediaPresentationDuration *Duration `xml:"mediaPresentationDuration,attr"`
MinimumUpdatePeriod *Duration `xml:"minimumUpdatePeriod,attr"`
MinBufferTime *Duration `xml:"minBufferTime,attr"`
TimeShiftBufferDepth *Duration `xml:"timeShiftBufferDepth,attr"`
SuggestedPresentationDelay *Duration `xml:"suggestedPresentationDelay,attr"`
MaxSegmentDuration *Duration `xml:"maxSegmentDuration,attr"`
MaxSubsegmentDuration *Duration `xml:"maxSubsegmentDuration,attr"`
ProgramInformation []*ProgramInformationType `xml:"ProgramInformation"`
BaseURL []*BaseURLType `xml:"BaseURL"`
Location []*LocationType `xml:"Location"`
PatchLocation []*PatchLocationType `xml:"PatchLocation"`
ServiceDescription []*ServiceDescriptionType `xml:"ServiceDescription"`
InitializationSet []*InitializationSetType `xml:"InitializationSet"`
InitializationGroup []*UIntVWithIDType `xml:"InitializationGroup"`
InitializationPresentation []*UIntVWithIDType `xml:"InitializationPresentation"`
ContentProtection []*ContentProtectionType `xml:"ContentProtection"`
Periods []*Period `xml:"Period"`
Metrics []*MetricsType `xml:"Metrics"`
EssentialProperties []*DescriptorType `xml:"EssentialProperty"`
SupplementalProperties []*DescriptorType `xml:"SupplementalProperty"`
RequestParam []*ExtendedUrlInfoType `xml:"RequestParam"`
UTCTimings []*DescriptorType `xml:"UTCTiming"`
LeapSecondInformation *LeapSecondInformationType `xml:"LeapSecondInformation"`
}
MPD is MPEG-DASH Media Presentation Description (MPD) as defined in ISO/IEC 23009-1 5'th edition.
The tree of structs is generated from the corresponding XML Schema at https://github.com/MPEGGroup/DASHSchema but fine-tuned manually to handle default cases, listing enumerals, name space for xlink etc.
func MPDFromBytes ¶ added in v0.8.0
MPDFromBytes reads and unmarshals an MPD from a byte slice
func ReadFromFile ¶
ReadFromFile reads and unmarshals an MPD from a file.
func ReadFromString ¶
ReadFromString reads and unmarshals an MPD from a string
func (*MPD) AppendPeriod ¶ added in v0.8.0
AppendPeriod appends a Period to the MPD and sets parent pointer.
func (*MPD) SetParents ¶ added in v0.8.0
func (m *MPD) SetParents()
SetParents sets the parent pointers for all children. Call this after xml.Unmarshal of MPD to set the parent pointers.
type MSProType ¶
type MSProType struct {
Value string `xml:",chardata"`
}
MSProType is Microsoft PlayReady provisioning data.
type MarlinContentId ¶ added in v0.11.0
type MarlinContentId struct {
Value string `xml:",chardata"`
}
MarlinContentId is Marlin Content Id.
type MarlinContentIds ¶ added in v0.11.0
type MarlinContentIds struct {
Cids []*MarlinContentId `xml:"urn:marlin:mas:1-0:services:schemas:mpd mas:MarlinContentId"`
}
MarlinContentIds is Marlin Content Ids containing one or more MarlineContentId elements.
type MetricsType ¶
type MetricsType struct {
Metrics string `xml:"metrics,attr"`
Ranges []*RangeType `xml:"Range"`
Reportings []*DescriptorType `xml:"Reporting"`
}
MetricsType is Metrics.
type ModelPairType ¶
type ModelPairType struct {
XMLName xml.Name `xml:"ModelPair"`
BufferTime *Duration `xml:"bufferTime,attr"`
Bandwidth uint32 `xml:"bandwidth,attr"`
}
ModelPairType is Model Pair
type MultipleSegmentBaseType ¶
type MultipleSegmentBaseType struct {
Duration *uint32 `xml:"duration,attr,omitempty"`
Tolerance *float64 `xml:"tolerance,attr,omitempty"`
StartNumber *uint32 `xml:"startNumber,attr,omitempty"`
EndNumber *uint32 `xml:"endNumber,attr,omitempty"`
EndSubNumber *uint64 `xml:"endSubNumber,attr,omitempty"`
SegmentTimeline *SegmentTimelineType `xml:"SegmentTimeline"`
BitstreamSwitching *URLType `xml:"BitstreamSwitching"`
SegmentBaseType
}
MultipleSegmentBaseType is Multiple Segment information base.
type OperatingBandwidthType ¶
type OperatingBandwidthType struct {
XMLName xml.Name `xml:"OperatingBandwidth"`
MediaType string `xml:"mediaType,attr,omitempty"` // default is "all"
Min uint32 `xml:"min,attr,omitempty"`
Max uint32 `xml:"max,attr,omitempty"`
Target uint32 `xml:"target,attr,omitempty"`
}
OperatingBandwidthType is Service Description Operating Bandwidth.
type OperatingQualityType ¶
type OperatingQualityType struct {
XMLName xml.Name `xml:"OperatingQuality"`
MediaType string `xml:"mediaType,attr,omitempty"` // default is "any"
Min uint32 `xml:"min,attr,omitempty"`
Max uint32 `xml:"max,attr,omitempty"`
Target uint32 `xml:"target,attr,omitempty"`
Type AnyURI `xml:"type,attr,omitempty"`
MaxDifference uint32 `xml:"maxDifference,attr,omitempty"`
}
OperatingQualityType is Service Description Operating Quality.
type PR ¶
type PR struct {
XMLName xml.Name `xml:"PR"`
PopularityRate uint32 `xml:"popularityRate,attr"`
Start *uint64 `xml:"start,attr"`
R int `xml:"r,attr,omitempty"` // default = 0
}
PR is PR element defined in Table 47.
type ParseDurationError ¶ added in v0.6.0
type ParseDurationError struct {
// contains filtered or unexported fields
}
ParseDurationError for parsing xs:Duration string
func (ParseDurationError) Error ¶ added in v0.6.0
func (p ParseDurationError) Error() string
type PatchLocationType ¶
type PatchLocationType struct {
XMLName xml.Name `xml:"PatchLocation"`
ServiceLocation string `xml:"serviceLocation,attr,omitempty"`
Ttl float64 `xml:"ttl,attr,omitempty"`
Value AnyURI `xml:",chardata"`
}
PatchLocationType is Patch Location Type.
type PatternType ¶ added in v0.13.0
type PatternType struct {
Id uint64 `xml:"id,attr"`
P []*RunLengthType `xml:"P"`
}
PatternType is Duration pattern.
type Period ¶ added in v0.8.0
type Period struct {
XMLName xml.Name `xml:"Period"`
XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"`
XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest"
XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple"
XlinkShow string `xml:"http://www.w3.org/1999/xlink xlink:show,attr,omitempty"` // fixed = "embed"
Id string `xml:"id,attr,omitempty"`
Start *Duration `xml:"start,attr"` // Mandatory for dynamic manifests. default = 0
Duration *Duration `xml:"duration,attr"`
BitstreamSwitching *bool `xml:"bitstreamSwitching,attr"`
ImportedMPDs []*ImportedMpdType `xml:"ImportedMPD"`
BaseURLs []*BaseURLType `xml:"BaseURL"`
SegmentBase *SegmentBaseType `xml:"SegmentBase"`
SegmentList *SegmentListType `xml:"SegmentList"`
SegmentTemplate *SegmentTemplateType `xml:"SegmentTemplate"`
AssetIdentifier *DescriptorType `xml:"AssetIdentifier"`
EventStreams []*EventStreamType `xml:"EventStream"`
ServiceDescriptions []*ServiceDescriptionType `xml:"ServiceDescription"`
ContentProtections []*ContentProtectionType `xml:"ContentProtection"`
AdaptationSets []*AdaptationSetType `xml:"AdaptationSet"`
Subsets []*SubsetType `xml:"Subset"`
SupplementalProperties []*DescriptorType `xml:"SupplementalProperty"`
EmptyAdaptationSets []*AdaptationSetType `xml:"EmptyAdaptationSet"`
GroupLabels []*LabelType `xml:"GroupLabel"`
RequestParam []*ExtendedUrlInfoType `xml:"RequestParam"`
Preselections []*PreselectionType `xml:"Preselection"`
// contains filtered or unexported fields
}
func (*Period) AbsoluteStart ¶ added in v0.8.0
AbsoluteStart returns the absolute start time of a Period in seconds. It is meant for dynamic MPDs where each Period has a start time, but it can also be used for the start-over case where a dynamice MPD has just turned into a static MPD and still have availabilityStartTime, with the same value as in the dynamice case.
func (*Period) AppendAdaptationSet ¶ added in v0.8.0
func (p *Period) AppendAdaptationSet(a *AdaptationSetType)
AppendAdaptationSet appends an AdaptationSet to the Period and sets parent pointer.
func (*Period) Clone ¶ added in v0.9.0
Clone returns a deep copy of the Period with parent links set.
func (*Period) GetDuration ¶ added in v0.8.0
GetDuration returns the period's duration if specified or the MPD is single-period static.
func (*Period) GetStart ¶ added in v0.8.0
GetStart returns the period's start time in seconds (relative to availabilityStartTime if present). The algorithm is specified in ISO/IEC 23009-1 Section 5.3.2.1.
func (*Period) GetType ¶ added in v0.8.0
func (p *Period) GetType() (PeriodType, error)
GetType returns the type of period.
func (*Period) SetParents ¶ added in v0.9.0
func (p *Period) SetParents()
SetParents sets the parent pointers for all children of p.
type PeriodType ¶
type PeriodType int
PeriodType is the type of period
const ( PTBad PeriodType = iota PTRegular PTEarlyAvailable PTEarlyTerminated PTRegularOrEarlyTerminated )
func (PeriodType) String ¶ added in v0.8.0
func (p PeriodType) String() string
type PlaybackRateType ¶
type PlaybackRateType struct {
XMLName xml.Name `xml:"PlaybackRate"`
Max float64 `xml:"max,attr,omitempty"`
Min float64 `xml:"min,attr,omitempty"`
}
PlaybackRateType is Service Description Playback Rate.
type PlaybackRestrictionsType ¶ added in v0.13.0
type PlaybackRestrictionsType struct {
SkipAfter Duration `xml:"skipAfter,attr,omitempty"`
}
PlaybackRestrictionsType is Playback restrictions
type PreselectionOrderType ¶
type PreselectionOrderType string
PreselectionOrderType is enumeration "undefined", "time-ordered", "fully-ordered".
type PreselectionType ¶
type PreselectionType struct {
XMLName xml.Name `xml:"Preselection"`
Id string `xml:"id,attr,omitempty"` // default = "1"
PreselectionComponents *StringVectorType `xml:"preselectionComponents,attr"`
Lang string `xml:"lang,attr,omitempty"`
Order PreselectionOrderType `xml:"order,attr,omitempty"`
Accessibilities []*DescriptorType `xml:"Accessibility"`
Roles []*DescriptorType `xml:"Role"`
Ratings []*DescriptorType `xml:"Rating"`
Viewpoints []*DescriptorType `xml:"Viewpoint"`
RepresentationBaseType
}
PreselectionType is Preselection.
func NewPreselection ¶ added in v0.6.0
func NewPreselection() *PreselectionType
NewPreselection returns a new empty Preselection.
type ProducerReferenceTimeType ¶
type ProducerReferenceTimeType struct {
XMLName xml.Name `xml:"ProducerReferenceTime"`
Id uint32 `xml:"id,attr"`
Inband bool `xml:"inband,attr,omitempty"` // default = false
Type ProducerReferenceTimeTypeType `xml:"type,attr,omitempty"` // default = encoder
ApplicationScheme string `xml:"applicationScheme,attr,omitempty"`
WallClockTime string `xml:"wallClockTime,attr"`
PresentationTime uint64 `xml:"presentationTime,attr"`
UTCTiming *DescriptorType `xml:"UTCTiming"`
}
ProducerReferenceTimeType is Producer Reference time.
func NewProducerReferenceTime ¶ added in v0.6.0
func NewProducerReferenceTime() *ProducerReferenceTimeType
NewProducerReferenceTime returns a new empty ProducerReferenceTime.
type ProducerReferenceTimeTypeType ¶
type ProducerReferenceTimeTypeType string
ProducerReferenceTimeTypeType is enumeration "encoder", "captured", "application".
type ProgramInformationType ¶
type ProgramInformationType struct {
Lang string `xml:"lang,attr,omitempty"`
MoreInformationURL AnyURI `xml:"moreInformationURL,attr,omitempty"`
Title string `xml:"Title,omitempty"`
Source string `xml:"Source,omitempty"`
Copyright string `xml:"Copyright,omitempty"`
}
ProgramInformationType is Program Information.
type PsshType ¶
type PsshType struct {
Value string `xml:",chardata"`
}
PsshType is general PSSH box as defined in ISO/IEC 23001-7 (Common Encryption Format).
type RFC6838ContentTypeType ¶
type RFC6838ContentTypeType string
RFC6838ContentTypeType is Type for RFC6838 Content Type.
type RandomAccessType ¶
type RandomAccessType struct {
XMLName xml.Name `xml:"RandomAccess"`
Interval uint32 `xml:"interval,attr"`
Type RandomAccessTypeType `xml:"type,attr,omitempty"` // default = "closed"
MinBufferTime *Duration `xml:"minBufferTime,attr"`
Bandwidth uint32 `xml:"bandwidth,attr,omitempty"`
}
RandomAccessType is Random Access
type RandomAccessTypeType ¶
type RandomAccessTypeType string
RandomAccessTypeType is enumeration "closed", "open", "gradual".
type RangeType ¶
type RangeType struct {
Starttime *Duration `xml:"starttime,attr"`
Duration *Duration `xml:"duration,attr"`
}
RangeType is Metrics Range
type RepresentationBaseType ¶
type RepresentationBaseType struct {
Profiles ListOfProfilesType `xml:"profiles,attr,omitempty"`
Width uint32 `xml:"width,attr,omitempty"`
Height uint32 `xml:"height,attr,omitempty"`
Sar RatioType `xml:"sar,attr,omitempty"`
FrameRate FrameRateType `xml:"frameRate,attr,omitempty"`
AudioSamplingRate *UIntVectorType `xml:"audioSamplingRate,attr,omitempty"`
MimeType string `xml:"mimeType,attr,omitempty"`
SegmentProfiles *ListOf4CCType `xml:"segmentProfiles,attr,omitempty"`
Codecs string `xml:"codecs,attr,omitempty"`
ContainerProfiles *ListOf4CCType `xml:"containerProfiles,attr,omitempty"`
MaximumSAPPeriod float64 `xml:"maximumSAPPeriod,attr,omitempty"`
StartWithSAP uint32 `xml:"startWithSAP,attr,omitempty"`
MaxPlayoutRate float64 `xml:"maxPlayoutRate,attr,omitempty"`
CodingDependency *bool `xml:"codingDependency,attr,omitempty"`
ScanType VideoScanType `xml:"scanType,attr,omitempty"`
SelectionPriority *uint32 `xml:"selectionPriority,attr"` // default = 1
Tag string `xml:"tag,attr,omitempty"`
FramePackings []*DescriptorType `xml:"FramePacking"`
AudioChannelConfigurations []*DescriptorType `xml:"AudioChannelConfiguration"`
ContentProtections []*ContentProtectionType `xml:"ContentProtection"`
OutputProtection *DescriptorType `xml:"OutputProtection"`
EssentialProperties []*DescriptorType `xml:"EssentialProperty"`
SupplementalProperties []*DescriptorType `xml:"SupplementalProperty"`
InbandEventStreams []*EventStreamType `xml:"InbandEventStream"`
Switchings []*SwitchingType `xml:"Switching"`
RandomAccesses []*RandomAccessType `xml:"RandomAccess"`
GroupLabels []*LabelType `xml:"GroupLabel"`
Labels []*LabelType `xml:"Label"`
ProducerReferenceTimes []*ProducerReferenceTimeType `xml:"ProducerReferenceTime"`
ContentPopularityRates []*ContentPopularityRateType `xml:"ContentPopularityRate"`
Resyncs []*ResyncType `xml:"Resync"`
SegmentSequenceProperties *SegmentSequencePropertiesType `xml:"SegmentSequenceProperties"`
RequestParam []*ExtendedUrlInfoType `xml:"RequestParam"`
}
RepresentationBaseType is Representation base (common attributes and elements).
type RepresentationType ¶
type RepresentationType struct {
XMLName xml.Name `xml:"Representation"`
Id string `xml:"id,attr"`
Bandwidth uint32 `xml:"bandwidth,attr"`
QualityRanking *uint32 `xml:"qualityRanking,attr,omitempty"`
DependencyId *StringVectorType `xml:"dependencyId,attr,omitempty"`
AssociationId *StringVectorType `xml:"associationId,attr,omitempty"`
AssociationType *ListOf4CCType `xml:"associationType,attr,omitempty"`
MediaStreamStructureId *StringVectorType `xml:"mediaStreamStructureId,attr,omitempty"`
RepresentationBaseType
BaseURLs []*BaseURLType `xml:"BaseURL"`
ExtendedBandwidths []*ExtendedBandwidthType `xml:"ExtendedBandwidth"`
SubRepresentations []*SubRepresentationType `xml:"SubRepresentation"`
SegmentBase *SegmentBaseType `xml:"SegmentBase"`
SegmentList *SegmentListType `xml:"SegmentList"`
SegmentTemplate *SegmentTemplateType `xml:"SegmentTemplate"`
// contains filtered or unexported fields
}
RepresentationType is Representation.
func NewAudioRepresentation ¶ added in v0.10.0
func NewAudioRepresentation(id, codec, mimeType string, bandwidth, audioSamplingRate int) *RepresentationType
NewAudioRepresentation returns a new audio representation with parameters.
func NewRepresentation ¶ added in v0.6.0
func NewRepresentation() *RepresentationType
NewRepresentation returns a new empty Representation.
func NewRepresentationWithID ¶ added in v0.10.0
func NewRepresentationWithID(id, codec, mimeType string, bandwidth int) *RepresentationType
NewRepresentationWithID returns a new empty Representation with the given ID and parameters.
func NewVideoRepresentation ¶ added in v0.10.0
func NewVideoRepresentation(id, codec, mimeType, frameRate string, bandwidth, width, height int) *RepresentationType
NewVideoRepresentation returns a new video representation with parameters.
func (*RepresentationType) AppendSubRepresentation ¶ added in v0.8.0
func (r *RepresentationType) AppendSubRepresentation(sr *SubRepresentationType)
AppendSubRepresentation appends a SubRepresentation to the Representation and sets parent pointer.
func (*RepresentationType) GetCodecs ¶ added in v0.11.0
func (r *RepresentationType) GetCodecs() string
GetCodecs returns the representation's or its parent's codecs string.
func (*RepresentationType) GetContentProtections ¶ added in v0.11.0
func (r *RepresentationType) GetContentProtections() []*ContentProtectionType
GetContentProtections returns the representation's or its parent's content protections.
func (*RepresentationType) GetInit ¶ added in v0.8.0
func (r *RepresentationType) GetInit() (string, error)
GetInit returns the representation's initialization URI with replaced identifiers.
TODO: Apply BaseURLs
func (*RepresentationType) GetMedia ¶ added in v0.8.0
func (r *RepresentationType) GetMedia() (string, error)
GetRepMedia returns the representation's media path with replaced ID and bandwidth identifiers.
TODO: Apply BaseURLs.
func (*RepresentationType) GetMimeType ¶ added in v0.11.0
func (r *RepresentationType) GetMimeType() string
GetMimeType returns the representation's or its parent's mime type.
func (*RepresentationType) GetSegmentTemplate ¶ added in v0.11.0
func (r *RepresentationType) GetSegmentTemplate() *SegmentTemplateType
func (*RepresentationType) Parent ¶ added in v0.8.0
func (r *RepresentationType) Parent() *AdaptationSetType
func (*RepresentationType) SetParent ¶ added in v0.8.0
func (r *RepresentationType) SetParent(p *AdaptationSetType)
func (*RepresentationType) SetParents ¶ added in v0.9.0
func (r *RepresentationType) SetParents()
SetParents sets the parent pointers for all children of r.
func (*RepresentationType) SetSegmentBase ¶ added in v0.10.0
func (r *RepresentationType) SetSegmentBase(initSize, sidxSize uint32, indexRangeExact bool)
SetSegmentBase sets SegmentBaseType for RepresentationType.
type ResyncType ¶
type ResyncType struct {
XMLName xml.Name `xml:"Resync"`
Type uint32 `xml:"type,attr"` // default = 0
DT *uint32 `xml:"dT,attr"`
DImax *float32 `xml:"dImax,attr"`
DImin float32 `xml:"dImin,attr"` // default = 0
Marker bool `xml:"marker,attr"` // default = false
}
ResyncType is Resynchronization Point.
type RunLengthType ¶ added in v0.13.0
type RunLengthType struct {
D uint64 `xml:"d,attr"`
R uint64 `xml:"r,attr,omitempty"`
CommonSegmentSequenceAttributes
CommonDurationPatternAttributes
}
RunLengthType is Run-length coded sequence of segments or segment sequences.
type S ¶
type S struct {
// T is presentation time of first Segment in sequence relative to presentationTimeOffset.
T *uint64 `xml:"t,attr"`
// N is is first Segment number in Segment sequence relative startNumber
N *uint64 `xml:"n,attr"`
// D is the Segment duration. Optional from Ed. 6, since not present if p (pattern) is used.
D uint64 `xml:"d,attr,omitempty"`
// R is repeat count (how many times to repeat. -1 is unlimited)
R int `xml:"r,attr,omitempty"` // default = 0
// K is the number of Segments that are included in a Segment Sequence.
CommonSegmentSequenceAttributes
CommonDurationPatternAttributes
CommonSegmentSequenceDurationPatternAttributes
}
S is the S element of SegmentTimeline. All time units in media timescale. Defined in ISO/IEC 23009-1 Section 5.3.9.6
type SegmentBaseType ¶
type SegmentBaseType struct {
Timescale *uint32 `xml:"timescale,attr"` // default = 1
EptDelta *int `xml:"eptDelta,attr"`
PdDelta *int `xml:"pdDelta,attr"`
PresentationTimeOffset *uint64 `xml:"presentationTimeOffset,attr,omitempty"`
PresentationDuration *uint64 `xml:"presentationDuration,attr,omitempty"`
TimeShiftBufferDepth Duration `xml:"timeShiftBufferDepth,attr,omitempty"`
IndexRange string `xml:"indexRange,attr,omitempty"`
IndexRangeExact bool `xml:"indexRangeExact,attr,omitempty"`
AvailabilityTimeOffset FloatInf64 `xml:"availabilityTimeOffset,attr,omitempty"`
AvailabilityTimeComplete *bool `xml:"availabilityTimeComplete,attr"`
Initialization *URLType `xml:"Initialization"`
RepresentationIndex *URLType `xml:"RepresentationIndex"`
FailoverContent *FailoverContentType `xml:"FailoverContent"`
}
SegmentBaseType is Segment information base.
func (SegmentBaseType) GetTimescale ¶ added in v0.6.0
func (s SegmentBaseType) GetTimescale() uint32
GetTimescale returns timescale including default value 1 if not set.
func (*SegmentBaseType) SetTimescale ¶ added in v0.6.0
func (s *SegmentBaseType) SetTimescale(timescale uint32)
SetTimescale sets timescale and uses default value 1.
type SegmentListType ¶
type SegmentListType struct {
XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"`
XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest"
XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple"
XlinkShow string `xml:"xlink:show,attr,omitempty"` // fixed "embed"
SegmentURL []*SegmentURLType `xml:"SegmentURL"`
MultipleSegmentBaseType
}
SegmentListType is Segment List.
func NewSegmentList ¶ added in v0.6.0
func NewSegmentList() *SegmentListType
NewSegmentList returns a new empty SegmentList.
type SegmentSequencePropertiesType ¶ added in v0.13.0
type SegmentSequencePropertiesType struct {
SapType uint32 `xml:"sapType,attr"`
Cadence uint32 `xml:"cadence,attr,omitempty"`
Event bool `xml:"event,attr,omitempty"`
Alignment StringNoWhitespaceType `xml:"alignment,attr,omitempty"`
}
SegmentSequencePropertiesType is Segment Sequence properties
type SegmentTemplateType ¶
type SegmentTemplateType struct {
Media string `xml:"media,attr,omitempty"`
Index string `xml:"index,attr,omitempty"`
Initialization string `xml:"initialization,attr,omitempty"`
BitstreamSwitching string `xml:"bitstreamSwitching,attr,omitempty"`
Pattern []*PatternType `xml:"Pattern"`
CommonSegmentSequenceAttributes
CommonDurationPatternAttributes
CommonSegmentSequenceDurationPatternAttributes
MultipleSegmentBaseType
}
SegmentTemplateType is Segment Template
func NewSegmentTemplate ¶ added in v0.6.0
func NewSegmentTemplate() *SegmentTemplateType
NewSegmentTemplate returns a new empty SegmentTemplate.
type SegmentTimelineType ¶
type SegmentTimelineType struct {
Pattern []*PatternType `xml:"Pattern"` // Ed6
S []*S `xml:"S"`
}
SegmentTimelineType is Segment Timeline.
func NewSegmentTimeline ¶ added in v0.6.0
func NewSegmentTimeline() *SegmentTimelineType
NewSegmentTemplate returns a new empty SegmentTimeline.
type SegmentURLType ¶
type SegmentURLType struct {
Media AnyURI `xml:"media,attr,omitempty"`
MediaRange SingleRFC7233RangeType `xml:"mediaRange,attr,omitempty"`
Index AnyURI `xml:"index,attr,omitempty"`
IndexRange SingleRFC7233RangeType `xml:"indexRange,attr,omitempty"`
}
SegmentURLType is Segment URL.
type SelectionInfoType ¶ added in v0.12.0
type SelectionInfoType struct {
SelectionInfo string `xml:"selectionInfo,attr,omitempty"`
ContactURL string `xml:"contactURL,attr"`
Selection []*SelectionType `xml:"Selection"`
}
SelectionInfoType is SelectionInfo
type SelectionType ¶ added in v0.12.0
type SelectionType struct {
DataEncoding string `xml:"dataEncoding,attr,omitempty"`
Parameter string `xml:"parameter,attr"`
Data string `xml:"data,attr,omitempty"`
}
SelectionType is Selection
type ServiceDescriptionType ¶
type ServiceDescriptionType struct {
XMLName xml.Name `xml:"ServiceDescription"`
Id uint32 `xml:"id,attr"`
Scopes []*DescriptorType `xml:"Scope"`
Latencies []*LatencyType `xml:"Latency"`
PlaybackRates []*PlaybackRateType `xml:"PlaybackRate"`
OperatingQualities []*OperatingQualityType `xml:"OperatingQuality"`
OperatingBandwidths []*OperatingBandwidthType `xml:"OperatingBandwidth"`
ContentSteerings []*ContentSteeringType `xml:"ContentSteering"`
ClientDataReporting []*ClientDataReportingType `xml:"ClientDataReporting"`
EventRestrictions []*EventRestrictionsType `xml:"EventRestrictions"`
PlaybackRestrictions []*PlaybackRestrictionsType `xml:"PlaybackRestrictions"`
}
ServiceDescriptionType is Service Description.
type SingleRFC7233RangeType ¶
type SingleRFC7233RangeType string
SingleRFC7233RangeType is range defined in RFC7233 ([0-9]*)(\-([0-9]*))?).
type StringNoWhitespaceType ¶
type StringNoWhitespaceType string
StringNoWhitespaceType is String without white spaces.
type StringNoWhitespaceVectorType ¶ added in v0.13.0
type StringNoWhitespaceVectorType []string
StringNoWhitespaceVectorType is Whitespace-separated list of no-whitespace strings
type StringVectorType ¶
type StringVectorType string
StringVectorType is Whitespace-separated list of strings.
type SubRepresentationType ¶
type SubRepresentationType struct {
XMLName xml.Name `xml:"SubRepresentation"`
Level *uint32 `xml:"level,attr,omitempty"`
DependencyLevel *UIntVectorType `xml:"dependencyLevel,attr,omitempty"`
Bandwidth uint32 `xml:"bandwidth,attr,omitempty"`
ContentComponent *StringVectorType `xml:"contentComponent,attr,omitempty"`
RepresentationBaseType
// contains filtered or unexported fields
}
SubRepresentationType is SubRepresentation
func NewSubRepresentation ¶ added in v0.6.0
func NewSubRepresentation() *SubRepresentationType
NewSubRepresentation returns a new empty SubRepresentation.
func (*SubRepresentationType) Parent ¶ added in v0.8.0
func (s *SubRepresentationType) Parent() *RepresentationType
func (*SubRepresentationType) SetParent ¶ added in v0.8.0
func (s *SubRepresentationType) SetParent(p *RepresentationType)
type SubsetType ¶
type SubsetType struct {
XMLName xml.Name `xml:"Subset"`
Contains *UIntVectorType `xml:"contains,attr"`
Id string `xml:"id,attr,omitempty"`
}
SubsetType is Subset.
type SupVideoInfoType ¶ added in v0.13.0
type SupVideoInfoType struct {
ProcessingInfo string `xml:"processingInfo,attr,omitempty"`
}
SupVideoInfoType is Picture-in-picture information
type SwitchingType ¶
type SwitchingType struct {
XMLName xml.Name `xml:"Switching"`
Interval uint32 `xml:"interval"`
Type SwitchingTypeType `xml:"type,attr,omitempty"` // default = "media"
}
SwitchingType is Switching
type SwitchingTypeType ¶
type SwitchingTypeType string
SwitchingTypeType is enumeration "media", "bitstream".
type UIntPairsWithIDType ¶
type UIntPairsWithIDType struct {
XMLName xml.Name `xml:"UIntPairsWithID"`
Type AnyURI `xml:"type,attr,omitempty"`
*UIntVectorType
}
UIntPairsWithIDType is UInt Pairs With ID.
type UIntVWithIDType ¶
type UIntVWithIDType struct {
XMLName xml.Name `xml:"UIntVWithID"`
Id uint32 `xml:"id,attr"`
Profiles ListOfProfilesType `xml:"profiles,attr,omitempty"`
ContentType RFC6838ContentTypeType `xml:"contentType,attr,omitempty"`
UIntVectorType
}
UIntVWithIDType is UInt Vector With ID
func NewUIntVWithID ¶ added in v0.6.0
func NewUIntVWithID() *UIntVWithIDType
NewUIntVWithID returns a new empty UIntVWithID.
type UIntVectorType ¶
type UIntVectorType string
UIntVectorType is Whitespace-separated list of unsigned integers.
type URLType ¶
type URLType struct {
SourceURL AnyURI `xml:"sourceURL,attr,omitempty"`
Range string `xml:"range,attr,omitempty"`
}
URLType is Segment Info item URL/range.
type UrlQueryInfoType ¶ added in v0.12.0
type UrlQueryInfoType struct {
QueryTemplate string `xml:"queryTemplate,attr,omitempty"`
UseMPDUrlQuery bool `xml:"useMPDUrlQuery,attr,omitempty"`
QueryString string `xml:"queryString,attr,omitempty"`
XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"`
XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest"
XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple"
XlinkShow string `xml:"http://www.w3.org/1999/xlink xlink:show,attr,omitempty"` // fixed = "embed"
}
UrlQueryInfoType is defined in Annex I of ISO/IEC 23009-1. Its namespace is UrlParameterNamespace2014.
type VideoScanType ¶
type VideoScanType string
VideoScanType is enumeration "progressive", "interlaced", "unknown".