Skip to content

Commit

Permalink
feat: GetContentProtection methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Nov 21, 2023
1 parent f7748ed commit 334630d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet
### Added

- GetContentProtections methods to AdaptationSet and Representation

## [0.10.0] - 2023-05-26

Expand Down
13 changes: 13 additions & 0 deletions mpd/mpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ func (a *AdaptationSetType) Clone() *AdaptationSetType {
return ac
}

// GetRepresentations returns the ContentProtections of the adaptation set.
func (a *AdaptationSetType) GetContentProtections() []*ContentProtectionType {
return a.ContentProtections
}

// ContentComponentType is Content Component.
type ContentComponentType struct {
XMLName xml.Name `xml:"ContentComponent"`
Expand Down Expand Up @@ -452,6 +457,14 @@ func (r *RepresentationType) GetMedia() (string, error) {
return media, nil
}

// GetContentProtections returns the representation's or its parent's content protections.
func (r *RepresentationType) GetContentProtections() []*ContentProtectionType {
if len(r.ContentProtections) == 0 {
return r.parent.GetContentProtections()
}
return r.ContentProtections
}

// ContentProtectionType is Content Protection.
type ContentProtectionType struct {
XMLName xml.Name `xml:"ContentProtection"`
Expand Down

0 comments on commit 334630d

Please sign in to comment.