-
Notifications
You must be signed in to change notification settings - Fork 41
Add missing multivariant playlist tags and attributes from draft 15 #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
theRealRobG
merged 19 commits into
develop_1.x
from
missing-multivariant-playlist-tags-from-draft-15
Sep 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9f03dc7
Adding multivariant playlist tags defined in draft 15 and still missi…
theRealRobG 84b3a0b
Add attributes missing from EXT-X-MEDIA as of draft 15
theRealRobG 63aaabc
Updated test comment with up-to-date docs for EXT-X-MEDIA
theRealRobG 28d401a
Add attributes missing from EXT-X-STREAM-INF as of draft 15
theRealRobG 064b48d
Add attributes missing from EXT-X-I-FRAME-STREAM-INF as of draft 15
theRealRobG 9390aed
Updated encryption method enum with new type
theRealRobG a46b9e4
Added parsing for CHANNELS attribute
theRealRobG 2441804
Added parsing for HDCP-LEVEL
theRealRobG 492bc60
Added parsing for VIDEO-RANGE
theRealRobG 4fd3f9d
Added parsing for REQ-VIDEO-LAYOUT
theRealRobG 32d0ec8
Added parsing for FORMAT in EXT-X-SESSION-DATA
theRealRobG cdd2694
Corrected location for EXT-X-SESSION-DATA playlist validation
theRealRobG 2f1eb23
Merge branch 'develop_1.x' into missing-multivariant-playlist-tags-fr…
theRealRobG c871de1
Favor structs over classes
theRealRobG f23275d
Favor not double declaring the issue variable
theRealRobG 440593f
Clarified enum naming and favored more terse function syntax
theRealRobG 34de4a9
Favor enums rather than structs holding enums
theRealRobG 02d2cb9
Introduce unrecognized cases to keep parsing forward compatible
theRealRobG 2d21125
Explicitly indicate class is final
theRealRobG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
... Playlist Parsing/Pantos-Generic Tag Validators/EXT_X_SESSION_DATAPlaylistValidator.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // | ||
| // EXT_X_SESSION_DATAPlaylistValidator.swift | ||
| // mamba | ||
| // | ||
| // Created by Robert Galluccio on 8/31/24. | ||
| // Copyright © 2024 Comcast Corporation. | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| class EXT_X_SESSION_DATAPlaylistValidator: HLSPlaylistValidator { | ||
| static func validate(hlsPlaylist: any HLSPlaylistInterface) -> [HLSValidationIssue]? { | ||
| var issues = [HLSValidationIssue]() | ||
|
|
||
| let issue = duplicateIssue(tags: hlsPlaylist.tags.filter { $0.tagDescriptor == PantosTag.EXT_X_SESSION_DATA }) | ||
| if let issue { | ||
rmigneco marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| issues.append(issue) | ||
| } | ||
|
|
||
| return issues.isEmpty ? nil : issues | ||
| } | ||
|
|
||
| // A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same DATA-ID attribute. A Playlist MUST NOT | ||
| // contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute. | ||
| private static func duplicateIssue(tags: [HLSTag]) -> HLSValidationIssue? { | ||
| var dataIdToLanguagesMap = [String: [String?]]() | ||
| for tag in tags { | ||
| guard let dataId = tag.value(forValueIdentifier: PantosValue.dataId) else { continue } | ||
| var existingLanguages = dataIdToLanguagesMap[dataId] ?? [] | ||
| existingLanguages.append(tag.value(forValueIdentifier: PantosValue.language)) | ||
| dataIdToLanguagesMap[dataId] = existingLanguages | ||
| } | ||
| for languages in dataIdToLanguagesMap.values { | ||
| if languages.count != Set(languages).count { | ||
| return HLSValidationIssue(description: .EXT_X_SESSION_DATAPlaylistValidator, severity: .error) | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
| } | ||
71 changes: 71 additions & 0 deletions
71
...c HLS Playlist Parsing/Pantos-Generic Tag Validators/EXT_X_SESSION_DATATagValidator.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // | ||
| // EXT_X_SESSION_DATATagValidator.swift | ||
| // mamba | ||
| // | ||
| // Created by Robert Galluccio on 8/31/24. | ||
| // Copyright © 2024 Comcast Corporation. | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| class EXT_X_SESSION_DATATagValidator: HLSTagValidator { | ||
| private var genericValidator: GenericDictionaryTagValidator | ||
|
|
||
| init() { | ||
| genericValidator = GenericDictionaryTagValidator( | ||
| tag: PantosTag.EXT_X_SESSION_DATA, | ||
| dictionaryValueIdentifiers: [ | ||
| HLSDictionaryTagValueIdentifierImpl( | ||
| valueId: PantosValue.dataId, | ||
| optional: false, | ||
| expectedType: String.self | ||
| ), | ||
| HLSDictionaryTagValueIdentifierImpl( | ||
| valueId: PantosValue.value, | ||
| optional: true, | ||
| expectedType: String.self | ||
| ), | ||
| HLSDictionaryTagValueIdentifierImpl( | ||
| valueId: PantosValue.uri, | ||
| optional: true, | ||
| expectedType: String.self | ||
| ), | ||
| HLSDictionaryTagValueIdentifierImpl( | ||
| valueId: PantosValue.format, | ||
| optional: true, | ||
| expectedType: String.self | ||
| ), | ||
| HLSDictionaryTagValueIdentifierImpl( | ||
| valueId: PantosValue.language, | ||
| optional: true, | ||
| expectedType: String.self | ||
| ), | ||
| ] | ||
| ) | ||
| } | ||
|
|
||
| func validate(tag: HLSTag) -> [HLSValidationIssue]? { | ||
| var issueList = genericValidator.validate(tag: tag) ?? [] | ||
|
|
||
| // Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI attribute, but not both. | ||
| switch (tag.value(forValueIdentifier: PantosValue.value), tag.value(forValueIdentifier: PantosValue.uri)) { | ||
| case (.none, .some), (.some, .none): | ||
| break | ||
| case (.some, .some), (.none, .none): | ||
| issueList.append(HLSValidationIssue(description: .EXT_X_SESSION_DATATagValidator, severity: .error)) | ||
| } | ||
|
|
||
| return issueList.isEmpty ? nil : issueList | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...neric HLS Playlist Parsing/Pantos-Generic Tag Validators/EXT_X_SESSION_KEYValidator.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // | ||
| // EXT_X_SESSION_KEYValidator.swift | ||
| // mamba | ||
| // | ||
| // Created by Robert Galluccio on 8/31/24. | ||
| // Copyright © 2024 Comcast Corporation. | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| // All attributes defined for the EXT-X-KEY tag (Section 4.4.4.4) are also defined for the | ||
| // EXT-X-SESSION-KEY, except that the value of the METHOD attribute MUST NOT be NONE. | ||
| class EXT_X_SESSION_KEYValidator: EXT_X_KEYValidator { | ||
rmigneco marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| override public func validate(tag: HLSTag) -> [HLSValidationIssue]? { | ||
| var issueList = super.validate(tag: tag) ?? [] | ||
|
|
||
| if let method = tag.value(forValueIdentifier: PantosValue.method) { | ||
| if method == HLSEncryptionMethodType.EncryptionMethod.None.rawValue { | ||
| issueList.append( | ||
| HLSValidationIssue( | ||
| description: IssueDescription.EXT_X_SESSION_KEYValidator, | ||
| severity: IssueSeverity.error | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| return issueList.isEmpty ? nil : issueList | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.