mpd

package
v0.0.0-...-b330db7 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  Duration = 1
	Microsecond          = 1000 * Nanosecond
	Millisecond          = 1000 * Microsecond
	Second               = 1000 * Millisecond
	Minute               = 60 * Second
	Hour                 = 60 * Minute
)
View Source
const (
	DASH_MIME_TYPE_VIDEO_MP4     string = "video/mp4"
	DASH_MIME_TYPE_AUDIO_MP4     string = "audio/mp4"
	DASH_MIME_TYPE_SUBTITLE_VTT  string = "text/vtt"
	DASH_MIME_TYPE_SUBTITLE_TTML string = "application/ttaf+xml"
	DASH_MIME_TYPE_SUBTITLE_SRT  string = "application/x-subrip"
	DASH_MIME_TYPE_SUBTITLE_DFXP string = "application/ttaf+xml"
)

Constants for some known MIME types, this is a limited list and others can be used.

View Source
const (
	CONTENT_PROTECTION_ROOT_SCHEME_ID_URI       = "urn:mpeg:dash:mp4protection:2011"
	CONTENT_PROTECTION_ROOT_VALUE               = "cenc"
	CENC_XMLNS                                  = "urn:mpeg:cenc:2013"
	CONTENT_PROTECTION_WIDEVINE_SCHEME_ID       = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
	CONTENT_PROTECTION_WIDEVINE_SCHEME_HEX      = "edef8ba979d64acea3c827dcd51d21ed"
	CONTENT_PROTECTION_PLAYREADY_SCHEME_ID      = "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"
	CONTENT_PROTECTION_PLAYREADY_SCHEME_HEX     = "9a04f07998404286ab92e65be0885f95"
	CONTENT_PROTECTION_PLAYREADY_SCHEME_V10_ID  = "urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95"
	CONTENT_PROTECTION_PLAYREADY_SCHEME_V10_HEX = "79f0049a40988642ab92e65be0885f95"
	CONTENT_PROTECTION_PLAYREADY_XMLNS          = "urn:microsoft:playready"
)

Constants for DRM / ContentProtection

Variables

View Source
var (
	ErrNoDASHProfileSet               error = errors.New("No DASH profile set")
	ErrAdaptationSetNil                     = errors.New("Adaptation Set nil")
	ErrSegmentTemplateLiveProfileOnly       = errors.New("Segment template can only be used with Live Profile")
	ErrSegmentTemplateNil                   = errors.New("Segment Template nil ")
	ErrRepresentationNil                    = errors.New("Representation nil")
	ErrBaseURLEmpty                         = errors.New("Base URL empty")
	ErrSegmentBaseOnDemandProfileOnly       = errors.New("Segment Base can only be used with On-Demand Profile")
	ErrSegmentBaseNil                       = errors.New("Segment Base nil")
	ErrAudioChannelConfigurationNil         = errors.New("Audio Channel Configuration nil")
	ErrInvalidDefaultKID                    = errors.New("Invalid Default KID string, should be 32 characters")
	ErrPROEmpty                             = errors.New("PlayReady PRO empty")
	ErrContentProtectionNil                 = errors.New("Content Protection nil")
)

Known error variables

Functions

This section is empty.

Types

type AdaptationSet

type AdaptationSet struct {
	CommonAttributesAndElements
	XMLName           xml.Name             `xml:"AdaptationSet"`
	ID                *string              `xml:"id,attr" datastore:",noindex"`
	SegmentAlignment  *bool                `xml:"segmentAlignment,attr" datastore:",noindex"`
	Lang              *string              `xml:"lang,attr" datastore:",noindex"`
	Group             *string              `xml:"group,attr" datastore:",noindex"`
	PAR               *string              `xml:"par,attr" datastore:",noindex"`
	MinBandwidth      *string              `xml:"minBandwidth,attr" datastore:",noindex"`
	MaxBandwidth      *string              `xml:"maxBandwidth,attr" datastore:",noindex"`
	MinWidth          *string              `xml:"minWidth,attr" datastore:",noindex"`
	MaxWidth          *string              `xml:"maxWidth,attr" datastore:",noindex"`
	ContentProtection []*ContentProtection `xml:"ContentProtection,omitempty"` // Common attribute, can be deprecated here
	Roles             []*Role              `xml:"Role,omitempty" datastore:",noindex"`
	SegmentBase       *SegmentBase         `xml:"SegmentBase,omitempty" datastore:",noindex"`
	SegmentList       *SegmentList         `xml:"SegmentList,omitempty" datastore:",noindex"`
	SegmentTemplate   *SegmentTemplate     `xml:"SegmentTemplate,omitempty" datastore:",noindex"` // Live Profile Only
	Representations   []*Representation    `xml:"Representation,omitempty" datastore:",noindex"`
}

func (*AdaptationSet) AddContentProtection

func (as *AdaptationSet) AddContentProtection(cp ContentProtectioner) error

Internal helper method for adding a ContentProtection to an AdaptationSet.

func (*AdaptationSet) AddNewContentProtectionRoot

func (as *AdaptationSet) AddNewContentProtectionRoot(defaultKIDHex string) (*CENCContentProtection, error)

Adds a ContentProtection tag at the root level of an AdaptationSet. This ContentProtection tag does not include signaling for any particular DRM scheme. defaultKIDHex - Default Key ID as a Hex String.

func (*AdaptationSet) AddNewContentProtectionRootLegacyUUID

func (as *AdaptationSet) AddNewContentProtectionRootLegacyUUID(defaultKIDHex string) (*CENCContentProtection, error)

Adds a ContentProtection tag at the root level of an AdaptationSet. This ContentProtection tag does not include signaling for any particular DRM scheme. defaultKIDHex - Default Key ID as a Hex String.

NOTE: this is only here for Legacy purposes. This will create an invalid UUID.

func (*AdaptationSet) AddNewContentProtectionSchemePlayready

func (as *AdaptationSet) AddNewContentProtectionSchemePlayready(pro string) (*PlayreadyContentProtection, error)

AddNewContentProtectionSchemePlayready adds a new content protection scheme for PlayReady DRM. pro - PlayReady Object Header, as a Base64 encoded string.

func (*AdaptationSet) AddNewContentProtectionSchemePlayreadyV10

func (as *AdaptationSet) AddNewContentProtectionSchemePlayreadyV10(pro string) (*PlayreadyContentProtection, error)

AddNewContentProtectionSchemePlayreadyV10 adds a new content protection scheme for PlayReady v1.0 DRM. pro - PlayReady Object Header, as a Base64 encoded string.

func (*AdaptationSet) AddNewContentProtectionSchemePlayreadyV10WithPSSH

func (as *AdaptationSet) AddNewContentProtectionSchemePlayreadyV10WithPSSH(pro string) (*PlayreadyContentProtection, error)

AddNewContentProtectionSchemePlayreadyV10WithPSSH adds a new content protection scheme for PlayReady v1.0 DRM. The scheme will include both ms:pro and cenc:pssh subelements pro - PlayReady Object Header, as a Base64 encoded string.

func (*AdaptationSet) AddNewContentProtectionSchemePlayreadyWithPSSH

func (as *AdaptationSet) AddNewContentProtectionSchemePlayreadyWithPSSH(pro string) (*PlayreadyContentProtection, error)

AddNewContentProtectionSchemePlayreadyWithPSSH adds a new content protection scheme for PlayReady DRM. The scheme will include both ms:pro and cenc:pssh subelements pro - PlayReady Object Header, as a Base64 encoded string.

func (*AdaptationSet) AddNewContentProtectionSchemeWidevine

func (as *AdaptationSet) AddNewContentProtectionSchemeWidevine() (*WidevineContentProtection, error)

AddNewContentProtectionSchemeWidevine adds a new content protection scheme for Widevine DRM to the adaptation set.

func (*AdaptationSet) AddNewContentProtectionSchemeWidevineWithPSSH

func (as *AdaptationSet) AddNewContentProtectionSchemeWidevineWithPSSH(wvHeader []byte) (*WidevineContentProtection, error)

AddNewContentProtectionSchemeWidevine adds a new content protection scheme for Widevine DRM to the adaptation set. With a <cenc:pssh> element that contains a Base64 encoded PSSH box wvHeader - binary representation of Widevine Header !!! Note: this function will accept any byte slice as a wvHeader value !!!

func (*AdaptationSet) AddNewRepresentationAudio

func (as *AdaptationSet) AddNewRepresentationAudio(samplingRate int64, bandwidth int64, codecs string, id string) (*Representation, error)

Adds a new Audio representation to an AdaptationSet. samplingRate - in Hz (i.e. 44100). bandwidth - in Bits/s (i.e. 67095). codecs - codec string for Audio Only (in RFC6381, https://tools.ietf.org/html/rfc6381) (i.e. mp4a.40.2). id - ID for this representation, will get used as $RepresentationID$ in template strings.

func (*AdaptationSet) AddNewRepresentationSubtitle

func (as *AdaptationSet) AddNewRepresentationSubtitle(bandwidth int64, id string) (*Representation, error)

Adds a new Subtitle representation to an AdaptationSet. bandwidth - in Bits/s (i.e. 256). id - ID for this representation, will get used as $RepresentationID$ in template strings.

func (*AdaptationSet) AddNewRepresentationVideo

func (as *AdaptationSet) AddNewRepresentationVideo(bandwidth int64, codecs string, id string, frameRate string, width int64, height int64) (*Representation, error)

Adds a new Video representation to an AdaptationSet. bandwidth - in Bits/s (i.e. 1518664). codecs - codec string for Audio Only (in RFC6381, https://tools.ietf.org/html/rfc6381) (i.e. avc1.4d401f). id - ID for this representation, will get used as $RepresentationID$ in template strings. frameRate - video frame rate (as a fraction) (i.e. 30000/1001). width - width of the video (i.e. 1280). height - height of the video (i.e 720).

func (*AdaptationSet) AddNewRole

func (as *AdaptationSet) AddNewRole(schemeIDURI string, value string) (*Role, error)

Adds a new Role to an AdaptationSet schemeIdUri - Scheme ID URI string (i.e. urn:mpeg:dash:role:2011) value - Value for this role, (i.e. caption, subtitle, main, alternate, supplementary, commentary, dub)

func (*AdaptationSet) SetNewSegmentTemplate

func (as *AdaptationSet) SetNewSegmentTemplate(duration int64, init string, media string, startNumber int64, timescale int64) (*SegmentTemplate, error)

Sets up a new SegmentTemplate for an AdaptationSet. duration - relative to timescale (i.e. 2000). init - template string for init segment (i.e. $RepresentationID$/audio/en/init.mp4). media - template string for media segments. startNumber - the number to start segments from ($Number$) (i.e. 0). timescale - sets the timescale for duration (i.e. 1000, represents milliseconds).

type AttrMPD

type AttrMPD interface {
	GetStrptr() *string
}

func AttrAvailabilityStartTime

func AttrAvailabilityStartTime(value string) AttrMPD

AttrAvailabilityStartTime returns AttrMPD object for NewMPD

func AttrMediaPresentationDuration

func AttrMediaPresentationDuration(value string) AttrMPD

AttrMediaPresentationDuration returns AttrMPD object for NewMPD

func AttrMinimumUpdatePeriod

func AttrMinimumUpdatePeriod(value string) AttrMPD

AttrMinimumUpdatePeriod returns AttrMPD object for NewMPD

type AudioChannelConfiguration

type AudioChannelConfiguration struct {
	SchemeIDURI *string `xml:"schemeIdUri,attr"`
	// Value will be an int for non-Dolby Schemes, and a hexstring for Dolby Schemes, hence we make it a string
	Value *string `xml:"value,attr"`
}

type AudioChannelConfigurationScheme

type AudioChannelConfigurationScheme string
const (
	// Scheme for non-Dolby Audio
	AUDIO_CHANNEL_CONFIGURATION_MPEG_DASH AudioChannelConfigurationScheme = "urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
	// Scheme for Dolby Audio
	AUDIO_CHANNEL_CONFIGURATION_MPEG_DOLBY AudioChannelConfigurationScheme = "tag:dolby.com,2014:dash:audio_channel_configuration:2011"
)

type CENCContentProtection

type CENCContentProtection struct {
	ContentProtection
	DefaultKID *string `xml:"default_KID,attr" datastore:",noindex" `
	Value      *string `xml:"value,attr" datastore:",noindex"` // Default: cenc
}

func (CENCContentProtection) MarshalXML

func (s CENCContentProtection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type CENCContentProtectionMarshal

type CENCContentProtectionMarshal struct {
	ContentProtectionMarshal
	DefaultKID *string `xml:"cenc:default_KID,attr"`
	Value      *string `xml:"value,attr"` // Default: cenc
}

type CommonAttributesAndElements

type CommonAttributesAndElements struct {
	Profiles                  *string              `xml:"profiles,attr"`
	Width                     *string              `xml:"width,attr"`
	Height                    *string              `xml:"height,attr"`
	Sar                       *string              `xml:"sar,attr"`
	FrameRate                 *string              `xml:"frameRate,attr"`
	AudioSamplingRate         *string              `xml:"audioSamplingRate,attr"`
	MimeType                  *string              `xml:"mimeType,attr"`
	SegmentProfiles           *string              `xml:"segmentProfiles,attr"`
	Codecs                    *string              `xml:"codecs,attr"`
	MaximumSAPPeriod          *string              `xml:"maximumSAPPeriod,attr"`
	StartWithSAP              *int64               `xml:"startWithSAP,attr"`
	MaxPlayoutRate            *string              `xml:"maxPlayoutRate,attr"`
	ScanType                  *string              `xml:"scanType,attr"`
	FramePacking              *DescriptorType      `xml:"framePacking,attr"`
	AudioChannelConfiguration *DescriptorType      `xml:"audioChannelConfiguration,attr"`
	ContentProtection         []*ContentProtection `xml:"ContentProtection,omitempty"`
	EssentialProperty         *DescriptorType      `xml:"essentialProperty,attr"`
	SupplementalProperty      *DescriptorType      `xml:"supplmentalProperty,attr"`
	InbandEventStream         *DescriptorType      `xml:"inbandEventStream,attr"`
}

ISO 23009-1-2014 5.3.7

type ContentProtection

type ContentProtection struct {
	AdaptationSet  *AdaptationSet `xml:"-"`
	XMLName        xml.Name       `xml:"ContentProtection" datastore:",noindex"`
	SchemeIDURI    *string        `xml:"schemeIdUri,attr" datastore:",noindex"` // Default: urn:mpeg:dash:mp4protection:2011
	XMLNS          *string        `xml:"cenc,attr" datastore:",noindex"`        // Default: urn:mpeg:cenc:2013
	DefaultKID     *string        `xml:"default_KID,attr,omitempty" datastore:",noindex" `
	PlayreadyXMLNS *string        `xml:"mspr,attr,omitempty" datastore:",noindex"`
	PRO            *string        `xml:"pro,omitempty" datastore:",noindex"`
	Value          *string        `xml:"value,attr,omitempty" datastore:",noindex"` // Default: cenc
	PSSH           *Pssh          `xml:"pssh,omitempty" datastore:",noindex"`
}

func (ContentProtection) ContentProtected

func (s ContentProtection) ContentProtected()

func (ContentProtection) MarshalXML

func (s ContentProtection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ContentProtectionMarshal

type ContentProtectionMarshal struct {
	AdaptationSet  *AdaptationSet `xml:"-"`
	XMLName        xml.Name       `xml:"ContentProtection"`
	SchemeIDURI    *string        `xml:"schemeIdUri,attr"` // Default: urn:mpeg:dash:mp4protection:2011
	XMLNS          *string        `xml:"xmlns:cenc,attr"`  // Default: urn:mpeg:cenc:2013
	DefaultKID     *string        `xml:"cenc:default_KID,attr"`
	PlayreadyXMLNS *string        `xml:"xmlns:mspr,attr,omitempty"`
	PRO            *string        `xml:"mspr:pro,omitempty"`
	Value          *string        `xml:"value,attr"` // Default: cenc
	PSSH           *PsshMarshal   `xml:"cenc:pssh,omitempty"`
}

type ContentProtectioner

type ContentProtectioner interface {
	ContentProtected()
}

type DashProfile

type DashProfile string

Type definition for DASH profiles

const (
	// Live Profile
	DASH_PROFILE_LIVE DashProfile = "urn:mpeg:dash:profile:isoff-live:2011"
	// On Demand Profile
	DASH_PROFILE_ONDEMAND DashProfile = "urn:mpeg:dash:profile:isoff-on-demand:2011"
	// HbbTV Profile
	DASH_PROFILE_HBBTV_1_5_LIVE DashProfile = "urn:hbbtv:dash:profile:isoff-live:2012,urn:mpeg:dash:profile:isoff-live:2011"
)

Constants for supported DASH profiles

type DescriptorType

type DescriptorType struct {
	SchemeIDURI *string `xml:"schemeIDURI,attr"`
	Value       *string `xml:"value,attr"`
	ID          *string `xml:"id,attr"`
}

type Duration

type Duration time.Duration

func (Duration) Hours

func (d Duration) Hours() float64

Hours returns the duration as a floating point number of hours.

func (Duration) MarshalXMLAttr

func (d Duration) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

func (Duration) Minutes

func (d Duration) Minutes() float64

Minutes returns the duration as a floating point number of minutes.

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() int64

Nanoseconds returns the duration as an integer nanosecond count.

func (Duration) Seconds

func (d Duration) Seconds() float64

Seconds returns the duration as a floating point number of seconds.

func (*Duration) String

func (d *Duration) String() string

String renders a Duration in XML Duration Data Type format

func (Duration) Truncate

func (d Duration) Truncate(m Duration) Duration

Truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged.

func (*Duration) UnmarshalXMLAttr

func (d *Duration) UnmarshalXMLAttr(attr xml.Attr) error

type Event

type Event struct {
	PresentationTime *string `xml:"presentationTime,attr" datastore:",noindex"`
	Duration         *int64  `xml:"duration,attr" datastore:",noindex"`
	ID               *string `xml:"id,attr" datastore:",noindex"`
	Signal           *Signal `xml:"Signal,omitempty" datastore:",noindex"`
}

type EventStream

type EventStream struct {
	SchemeIDURI *string  `xml:"schemeIdUri,attr" datastore:",noindex"`
	Value       *string  `xml:"value,attr" datastore:",noindex"`
	Timescale   *int64   `xml:"timescale,attr" datastore:",noindex"`
	Event       []*Event `xml:"Event,omitempty" datastore:",noindex"`
}

type MPD

type MPD struct {
	XMLNs                     *string `xml:"xmlns,attr" datastore:",noindex"`
	Profiles                  *string `xml:"profiles,attr" datastore:",noindex"`
	Type                      *string `xml:"type,attr" datastore:",noindex"`
	MediaPresentationDuration *string `xml:"mediaPresentationDuration,attr" datastore:",noindex"`
	MinBufferTime             *string `xml:"minBufferTime,attr" datastore:",noindex"`
	AvailabilityStartTime     *string `xml:"availabilityStartTime,attr,omitempty" datastore:",noindex"`
	PublishTime               *string `xml:"publishTime,attr,omitempty" datastore:",noindex"`
	MinimumUpdatePeriod       *string `xml:"minimumUpdatePeriod,attr" datastore:",noindex"`
	BaseURL                   string  `xml:"BaseURL,omitempty" datastore:",noindex"`

	Periods []*Period `xml:"Period,omitempty" datastore:",noindex"`
	// contains filtered or unexported fields
}

func NewDynamicMPD

func NewDynamicMPD(profile DashProfile, availabilityStartTime, minBufferTime string, attributes ...AttrMPD) *MPD

Creates a new dynamic MPD object. profile - DASH Profile (Live or OnDemand). availabilityStartTime - anchor for the computation of the earliest availability time (in UTC). minBufferTime - Min Buffer Time (i.e. PT1.97S). attributes - Other attributes (optional).

func NewMPD

func NewMPD(profile DashProfile, mediaPresentationDuration, minBufferTime string, attributes ...AttrMPD) *MPD

Creates a new static MPD object. profile - DASH Profile (Live or OnDemand). mediaPresentationDuration - Media Presentation Duration (i.e. PT6M16S). minBufferTime - Min Buffer Time (i.e. PT1.97S). attributes - Other attributes (optional).

func Read

func Read(r io.Reader) (*MPD, error)

Reads from an io.Reader interface into an MPD object. r - Must implement the io.Reader interface.

func ReadFromFile

func ReadFromFile(path string) (*MPD, error)

Reads an MPD XML file from disk into a MPD object. path - File path to an MPD on disk

func ReadFromString

func ReadFromString(xmlStr string) (*MPD, error)

Reads a string into a MPD object. xmlStr - MPD manifest data as a string.

func (*MPD) AddNewAdaptationSetAudio

func (m *MPD) AddNewAdaptationSetAudio(mimeType string, segmentAlignment bool, startWithSAP int64, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Audio Assets. mimeType - MIME Type (i.e. audio/mp4). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1). lang - Language (i.e. en).

func (*MPD) AddNewAdaptationSetAudioWithID

func (m *MPD) AddNewAdaptationSetAudioWithID(id string, mimeType string, segmentAlignment bool, startWithSAP int64, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Audio Assets. mimeType - MIME Type (i.e. audio/mp4). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1). lang - Language (i.e. en).

func (*MPD) AddNewAdaptationSetSubtitle

func (m *MPD) AddNewAdaptationSetSubtitle(mimeType string, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Subtitle Assets. mimeType - MIME Type (i.e. text/vtt). lang - Language (i.e. en).

func (*MPD) AddNewAdaptationSetSubtitleWithID

func (m *MPD) AddNewAdaptationSetSubtitleWithID(id string, mimeType string, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Subtitle Assets. mimeType - MIME Type (i.e. text/vtt). lang - Language (i.e. en).

func (*MPD) AddNewAdaptationSetVideo

func (m *MPD) AddNewAdaptationSetVideo(mimeType string, scanType string, segmentAlignment bool, startWithSAP int64) (*AdaptationSet, error)

Create a new Adaptation Set for Video Assets. mimeType - MIME Type (i.e. video/mp4). scanType - Scan Type (i.e.progressive). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1).

func (*MPD) AddNewAdaptationSetVideoWithID

func (m *MPD) AddNewAdaptationSetVideoWithID(id string, mimeType string, scanType string, segmentAlignment bool, startWithSAP int64) (*AdaptationSet, error)

Create a new Adaptation Set for Video Assets. mimeType - MIME Type (i.e. video/mp4). scanType - Scan Type (i.e.progressive). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1).

func (*MPD) AddNewPeriod

func (m *MPD) AddNewPeriod() *Period

AddNewPeriod creates a new Period and make it the currently active one.

func (*MPD) GetCurrentPeriod

func (m *MPD) GetCurrentPeriod() *Period

GetCurrentPeriod returns the current Period.

func (*MPD) Validate

func (m *MPD) Validate() error

Validate checks for incomplete MPD object

func (*MPD) Write

func (m *MPD) Write(w io.Writer) error

Writes an MPD object to an io.Writer interface w - Must implement the io.Writer interface.

func (*MPD) WriteToFile

func (m *MPD) WriteToFile(path string) error

Writes an MPD object to a file on disk. path - Output path to write the manifest to.

func (*MPD) WriteToString

func (m *MPD) WriteToString() (string, error)

Writes an MPD object to a string.

type MultipleSegmentBase

type MultipleSegmentBase struct {
	SegmentBase
	SegmentTimeline    *SegmentTimeline `xml:"SegmentTimeline,omitempty"`
	BitstreamSwitching *URL             `xml:"BitstreamSwitching,omitempty"`
	Duration           *int32           `xml:"duration,attr,omitempty"`
	StartNumber        *int32           `xml:"startNumber,attr,omitempty"`
}

type Period

type Period struct {
	ID                 string           `xml:"id,attr,omitempty" datastore:",noindex"`
	Duration           Duration         `xml:"duration,attr,omitempty" datastore:",noindex"`
	Start              Duration         `xml:"start,attr,omitempty" datastore:",noindex"`
	BitStreamSwitching string           `xml:"bitstreamSwitching,attr,omitempty" datastore:",noindex"`
	BaseURL            string           `xml:"BaseURL,omitempty" datastore:",noindex"`
	EventStream        *EventStream     `xml:"EventStream,omitempty" datastore:",noindex"`
	SegmentBase        *SegmentBase     `xml:"SegmentBase,omitempty" datastore:",noindex"`
	SegmentList        *SegmentList     `xml:"SegmentList,omitempty" datastore:",noindex"`
	SegmentTemplate    *SegmentTemplate `xml:"SegmentTemplate,omitempty" datastore:",noindex"`
	AdaptationSets     []*AdaptationSet `xml:"AdaptationSet,omitempty" datastore:",noindex"`
}

func (*Period) AddNewAdaptationSetAudio

func (period *Period) AddNewAdaptationSetAudio(mimeType string, segmentAlignment bool, startWithSAP int64, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Audio Assets. mimeType - MIME Type (i.e. audio/mp4). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1). lang - Language (i.e. en).

func (*Period) AddNewAdaptationSetAudioWithID

func (period *Period) AddNewAdaptationSetAudioWithID(id string, mimeType string, segmentAlignment bool, startWithSAP int64, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Audio Assets. mimeType - MIME Type (i.e. audio/mp4). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1). lang - Language (i.e. en).

func (*Period) AddNewAdaptationSetSubtitle

func (period *Period) AddNewAdaptationSetSubtitle(mimeType string, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Subtitle Assets. mimeType - MIME Type (i.e. text/vtt). lang - Language (i.e. en).

func (*Period) AddNewAdaptationSetSubtitleWithID

func (period *Period) AddNewAdaptationSetSubtitleWithID(id string, mimeType string, lang string) (*AdaptationSet, error)

Create a new Adaptation Set for Subtitle Assets. mimeType - MIME Type (i.e. text/vtt). lang - Language (i.e. en).

func (*Period) AddNewAdaptationSetVideo

func (period *Period) AddNewAdaptationSetVideo(mimeType string, scanType string, segmentAlignment bool, startWithSAP int64) (*AdaptationSet, error)

Create a new Adaptation Set for Video Assets. mimeType - MIME Type (i.e. video/mp4). scanType - Scan Type (i.e.progressive). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1).

func (*Period) AddNewAdaptationSetVideoWithID

func (period *Period) AddNewAdaptationSetVideoWithID(id string, mimeType string, scanType string, segmentAlignment bool, startWithSAP int64) (*AdaptationSet, error)

Create a new Adaptation Set for Video Assets. mimeType - MIME Type (i.e. video/mp4). scanType - Scan Type (i.e.progressive). segmentAlignment - Segment Alignment(i.e. true). startWithSAP - Starts With SAP (i.e. 1).

func (*Period) SetDuration

func (period *Period) SetDuration(d time.Duration)

type PlayreadyContentProtection

type PlayreadyContentProtection struct {
	ContentProtection
	PlayreadyXMLNS *string `xml:"mspr,attr,omitempty" datastore:",noindex"`
	PRO            *string `xml:"pro,omitempty" datastore:",noindex"`
	PSSH           *Pssh   `xml:"pssh,omitempty" datastore:",noindex"`
}

func (PlayreadyContentProtection) MarshalXML

func (s PlayreadyContentProtection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PlayreadyContentProtectionMarshal

type PlayreadyContentProtectionMarshal struct {
	ContentProtectionMarshal
	PlayreadyXMLNS *string      `xml:"xmlns:mspr,attr,omitempty"`
	PRO            *string      `xml:"mspr:pro,omitempty"`
	PSSH           *PsshMarshal `xml:"cenc:pssh,omitempty"`
}

type Pssh

type Pssh struct {
	Cenc  *string `xml:"cenc,attr" datastore:",noindex"` // Default: urn:mpeg:cenc:2013
	Value *string `xml:",chardata" datastore:",noindex"`
}

type PsshMarshal

type PsshMarshal struct {
	Cenc  *string `xml:"xmlns:cenc,attr"` // Default: urn:mpeg:cenc:2013
	Value *string `xml:",chardata"`
}

type Representation

type Representation struct {
	CommonAttributesAndElements
	AdaptationSet             *AdaptationSet             `xml:"-"`
	AudioChannelConfiguration *AudioChannelConfiguration `xml:"AudioChannelConfiguration,omitempty" datastore:",noindex"`
	AudioSamplingRate         *int64                     `xml:"audioSamplingRate,attr" datastore:",noindex"`   // Audio
	Bandwidth                 *int64                     `xml:"bandwidth,attr" datastore:",noindex"`           // Audio + Video
	Codecs                    *string                    `xml:"codecs,attr" datastore:",noindex"`              // Audio + Video
	FrameRate                 *string                    `xml:"frameRate,attr,omitempty" datastore:",noindex"` // Video
	Height                    *int64                     `xml:"height,attr" datastore:",noindex"`              // Video
	ID                        *string                    `xml:"id,attr" datastore:",noindex"`                  // Audio + Video
	Width                     *int64                     `xml:"width,attr" datastore:",noindex"`               // Video
	BaseURL                   *string                    `xml:"BaseURL,omitempty" datastore:",noindex"`        // On-Demand Profile
	SegmentBase               *SegmentBase               `xml:"SegmentBase,omitempty" datastore:",noindex"`    // On-Demand Profile
	SegmentList               *SegmentList               `xml:"SegmentList,omitempty" datastore:",noindex"`
	SegmentTemplate           *SegmentTemplate           `xml:"SegmentTemplate,omitempty" datastore:",noindex"`
}

func (*Representation) AddNewAudioChannelConfiguration

func (r *Representation) AddNewAudioChannelConfiguration(scheme AudioChannelConfigurationScheme, channelConfiguration string) (*AudioChannelConfiguration, error)

Sets a new AudioChannelConfiguration on a Representation. This is required for the HbbTV profile. scheme - One of the two AudioConfigurationSchemes. channelConfiguration - string that represents the channel configuration.

func (*Representation) AddNewSegmentBase

func (r *Representation) AddNewSegmentBase(indexRange string, initRange string) (*SegmentBase, error)

Sets a new SegmentBase on a Representation. This is for On Demand profile. indexRange - Byte range to the index (sidx)atom. init - Byte range to the init atoms (ftyp+moov).

func (*Representation) SetNewBaseURL

func (r *Representation) SetNewBaseURL(baseURL string) error

Sets the BaseURL for a Representation. baseURL - Base URL as a string (i.e. 800k/output-audio-und.mp4)

type Role

type Role struct {
	AdaptationSet *AdaptationSet `xml:"-"`
	SchemeIDURI   *string        `xml:"schemeIdUri,attr"`
	Value         *string        `xml:"value,attr"`
}

type SegmentBase

type SegmentBase struct {
	Initialization           *URL     `xml:"Initialization,omitempty"`
	RepresentationIndex      *URL     `xml:"RepresentationIndex,omitempty"`
	Timescale                *int32   `xml:"timescale,attr,omitempty"`
	PresentationTimeOffset   *int64   `xml:"presentationTimeOffset,attr,omitempty"`
	IndexRange               *string  `xml:"indexRange,attr,omitempty"`
	IndexRangeExact          *bool    `xml:"indexRangeExact,attr,omitempty"`
	AvailabilityTimeOffset   *float32 `xml:"availabilityTimeOffset,attr,omitempty"`
	AvailabilityTimeComplete *bool    `xml:"availabilityTimeComplete,attr,omitempty"`
}

type SegmentList

type SegmentList struct {
	MultipleSegmentBase
	SegmentURLs []*SegmentURL `xml:"SegmentURL,omitempty"`
}

type SegmentTemplate

type SegmentTemplate struct {
	AdaptationSet          *AdaptationSet   `xml:"-"`
	SegmentTimeline        *SegmentTimeline `xml:"SegmentTimeline,omitempty" datastore:"-"`
	PresentationTimeOffset *int64           `xml:"presentationTimeOffset,attr,omitempty" datastore:",noindex"`
	Duration               *int64           `xml:"duration,attr" datastore:",noindex"`
	Initialization         *string          `xml:"initialization,attr" datastore:",noindex"`
	Media                  *string          `xml:"media,attr" datastore:",noindex"`
	StartNumber            *int64           `xml:"startNumber,attr" datastore:",noindex"`
	Timescale              *int64           `xml:"timescale,attr" datastore:",noindex"`
}

Segment Template is for Live Profile Only

type SegmentTimeline

type SegmentTimeline struct {
	Segments []*SegmentTimelineSegment `xml:"S,omitempty"`
}

type SegmentTimelineSegment

type SegmentTimelineSegment struct {
	StartTime   *int64 `xml:"t,attr,omitempty" datastore:",noindex"`
	Duration    int64  `xml:"d,attr" datastore:",noindex"`
	RepeatCount *int   `xml:"r,attr,omitempty" datastore:",noindex,omitempty"`
}

type SegmentURL

type SegmentURL struct {
	Media      *string `xml:"media,attr,omitempty"`
	MediaRange *string `xml:"mediaRange,attr,omitempty"`
	Index      *string `xml:"index,attr,omitempty"`
	IndexRange *string `xml:"indexRange,attr,omitempty"`
}

type Signal

type Signal struct {
	XMLNS  *string `xml:"xmlns,attr" datastore:",noindex"`
	Binary *string `xml:"Binary,omitempty" datastore:",noindex"`
}

type URL

type URL struct {
	SourceURL *string `xml:"sourceURL,attr,omitempty"`
	Range     *string `xml:"range,attr,omitempty"`
}

type WidevineContentProtection

type WidevineContentProtection struct {
	ContentProtection
	PSSH *Pssh `xml:"pssh,omitempty" datastore:",noindex"`
}

func NewWidevineContentProtection

func NewWidevineContentProtection(wvHeader []byte) (*WidevineContentProtection, error)

func (WidevineContentProtection) MarshalXML

func (s WidevineContentProtection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type WidevineContentProtectionMarshal

type WidevineContentProtectionMarshal struct {
	ContentProtectionMarshal
	PSSH *PsshMarshal `xml:"cenc:pssh,omitempty"`
}

Jump to

Keyboard shortcuts

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