-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/2.2.2_xcode16' of https://github.com/kimbely032…
…0/mamba into release/2.2.2_xcode16
- Loading branch information
Showing
18 changed files
with
1,889 additions
and
201 deletions.
There are no files selected for viewing
This file contains 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,52 @@ | ||
name: Build and test | ||
|
||
on: | ||
pull_request: | ||
branches: [ "develop", "develop_1.x", "main", "main_1.x" ] | ||
|
||
jobs: | ||
define-ios-device: | ||
name: Get iOS simulator device to run iOS tests on | ||
runs-on: macos-latest | ||
outputs: | ||
device: ${{ steps.ios.outputs.device }} | ||
steps: | ||
- id: ios | ||
run: echo "device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`" >> "$GITHUB_OUTPUT" | ||
|
||
build: | ||
name: Build and Test mamba and mambaTVOS | ||
runs-on: macos-latest | ||
needs: define-ios-device | ||
strategy: | ||
matrix: | ||
target: | ||
- scheme: mamba | ||
platform: iOS Simulator | ||
device: ${{ needs.define-ios-device.outputs.device }} | ||
- scheme: mambaTVOS | ||
platform: tvOS Simulator | ||
device: Apple TV | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build | ||
env: | ||
scheme: ${{ matrix.target.scheme }} | ||
platform: ${{ matrix.target.platform }} | ||
device: ${{ matrix.target.device }} | ||
run: | | ||
echo "scheme = $scheme" | ||
echo "platform = $platform" | ||
echo "device = $device" | ||
xcodebuild build-for-testing -scheme "$scheme" -"workspace" "mamba.xcworkspace" -destination "platform=$platform,name=$device" | ||
- name: Test | ||
env: | ||
scheme: ${{ matrix.target.scheme }} | ||
platform: ${{ matrix.target.platform }} | ||
device: ${{ matrix.target.device }} | ||
run: | | ||
echo "scheme = $scheme" | ||
echo "platform = $platform" | ||
echo "device = $device" | ||
xcodebuild test-without-building -scheme "$scheme" -"workspace" "mamba.xcworkspace" -destination "platform=$platform,name=$device" |
This file contains 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
52 changes: 52 additions & 0 deletions
52
... Playlist Parsing/Pantos-Generic Tag Validators/EXT_X_SESSION_DATAPlaylistValidator.swift
This file contains 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,52 @@ | ||
// | ||
// 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 | ||
|
||
final class EXT_X_SESSION_DATAPlaylistValidator: MasterPlaylistValidator { | ||
static func validate(masterPlaylist: any MasterPlaylistInterface) -> [PlaylistValidationIssue] { | ||
var issues = [PlaylistValidationIssue]() | ||
|
||
if let issue = duplicateIssue( | ||
tags: masterPlaylist.tags.filter { $0.tagDescriptor == PantosTag.EXT_X_SESSION_DATA } | ||
) { | ||
issues.append(issue) | ||
} | ||
|
||
return 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: [PlaylistTag]) -> PlaylistValidationIssue? { | ||
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 PlaylistValidationIssue(description: .EXT_X_SESSION_DATAPlaylistValidator, severity: .error) | ||
} | ||
} | ||
return nil | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...neric Playlist Parsing/Pantos-Generic Tag Validators/EXT_X_SESSION_DATATagValidator.swift
This file contains 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 | ||
|
||
struct EXT_X_SESSION_DATATagValidator: PlaylistTagValidator { | ||
private var genericValidator: GenericDictionaryTagValidator | ||
|
||
init() { | ||
genericValidator = GenericDictionaryTagValidator( | ||
tag: PantosTag.EXT_X_SESSION_DATA, | ||
dictionaryValueIdentifiers: [ | ||
DictionaryTagValueIdentifierImpl( | ||
valueId: PantosValue.dataId, | ||
optional: false, | ||
expectedType: String.self | ||
), | ||
DictionaryTagValueIdentifierImpl( | ||
valueId: PantosValue.value, | ||
optional: true, | ||
expectedType: String.self | ||
), | ||
DictionaryTagValueIdentifierImpl( | ||
valueId: PantosValue.uri, | ||
optional: true, | ||
expectedType: String.self | ||
), | ||
DictionaryTagValueIdentifierImpl( | ||
valueId: PantosValue.format, | ||
optional: true, | ||
expectedType: SessionDataFormat.self | ||
), | ||
DictionaryTagValueIdentifierImpl( | ||
valueId: PantosValue.language, | ||
optional: true, | ||
expectedType: String.self | ||
), | ||
] | ||
) | ||
} | ||
|
||
func validate(tag: PlaylistTag) -> [PlaylistValidationIssue]? { | ||
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(PlaylistValidationIssue(description: .EXT_X_SESSION_DATATagValidator, severity: .error)) | ||
} | ||
|
||
return issueList.isEmpty ? nil : issueList | ||
} | ||
} |
Oops, something went wrong.