forked from jellyfin/Swiftfin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customizable Device Profiles (jellyfin#1169)
* Rename ExperimentalSettingsView.swift to PlaybackQualitySettingsView.swift Fix Merge * Rename MaximumBitrateSettingsView.swift to PlaybackQualitySettingsView.swift fix merge * Re-implement on Main. Should now have all the Main changed. Added a new change to use the Device Profile as a Transcoding Profile. * Part 1 -> Making VideoPlayerType into a struct (I Hope) correctly * Part 1.1 -> Making VideoPlayerType into a struct (I Hope) correctly * Remove unneeded Files * Missing file + CustomDeviceProfileSelection -> CustomDeviceProfileAction Rename * Change + to Appending * Attempt to add StorageValues+User. Not sure if this is correct? * Move the Array unwrapping to funcitons. Not required but this should help prevent accidently doing this wrong. Add subtitles back into the custom profiles since that somehow got dropped. Added a PlaybackCompatibility enum. This might need to work for more than just video * Complete rewrite to allow multiple profiles, compatibility mode, and directplay. * Hardward -> Hardware * Update CustomDeviceProfileSettingsView.swift Double Licensing * It was actually really easy to implement iOS... Trash cans still look weird and small. * Swipe to Delete instead of the edit button * wip * wip * Linting * tvOS Implementation * wip * wip * cleanup * Create Package.resolved --------- Co-authored-by: Joseph Kribs <[email protected]> Co-authored-by: Ethan Pippin <[email protected]>
- Loading branch information
1 parent
58dfdde
commit f5bd1b8
Showing
58 changed files
with
2,843 additions
and
550 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,45 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Stinsen | ||
import SwiftUI | ||
|
||
final class CustomDeviceProfileCoordinator: NavigationCoordinatable { | ||
|
||
let stack = NavigationStack(initial: \CustomDeviceProfileCoordinator.start) | ||
|
||
@Root | ||
var start = makeStart | ||
|
||
@Route(.push) | ||
var customDeviceProfileSettings = makeCustomDeviceProfileSettings | ||
@Route(.push) | ||
var editCustomDeviceProfile = makeEditCustomDeviceProfile | ||
@Route(.push) | ||
var createCustomDeviceProfile = makeCreateCustomDeviceProfile | ||
|
||
func makeCustomDeviceProfileSettings() -> NavigationViewCoordinator<PlaybackQualitySettingsCoordinator> { | ||
NavigationViewCoordinator( | ||
PlaybackQualitySettingsCoordinator() | ||
) | ||
} | ||
|
||
func makeEditCustomDeviceProfile(profile: Binding<CustomDeviceProfile>) | ||
-> NavigationViewCoordinator<EditCustomDeviceProfileCoordinator> { | ||
NavigationViewCoordinator(EditCustomDeviceProfileCoordinator(profile: profile)) | ||
} | ||
|
||
func makeCreateCustomDeviceProfile() -> NavigationViewCoordinator<EditCustomDeviceProfileCoordinator> { | ||
NavigationViewCoordinator(EditCustomDeviceProfileCoordinator()) | ||
} | ||
|
||
@ViewBuilder | ||
func makeStart() -> some View { | ||
CustomDeviceProfileSettingsView() | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
Shared/Coordinators/EditCustomDeviceProfileCoordinator.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,57 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Stinsen | ||
import SwiftUI | ||
|
||
final class EditCustomDeviceProfileCoordinator: NavigationCoordinatable { | ||
|
||
let stack = NavigationStack(initial: \EditCustomDeviceProfileCoordinator.start) | ||
|
||
@Root | ||
var start = makeStart | ||
|
||
// TODO: fix for tvOS | ||
|
||
@Route(.push) | ||
var customDeviceAudioEditor = makeCustomDeviceAudioEditor | ||
@Route(.push) | ||
var customDeviceVideoEditor = makeCustomDeviceVideoEditor | ||
@Route(.push) | ||
var customDeviceContainerEditor = makeCustomDeviceContainerEditor | ||
|
||
private let profile: Binding<CustomDeviceProfile>? | ||
|
||
init(profile: Binding<CustomDeviceProfile>? = nil) { | ||
self.profile = profile | ||
} | ||
|
||
@ViewBuilder | ||
func makeCustomDeviceAudioEditor(selection: Binding<[AudioCodec]>) -> some View { | ||
OrderedSectionSelectorView(selection: selection, sources: AudioCodec.allCases) | ||
.navigationTitle(L10n.audio) | ||
} | ||
|
||
@ViewBuilder | ||
func makeCustomDeviceVideoEditor(selection: Binding<[VideoCodec]>) -> some View { | ||
OrderedSectionSelectorView(selection: selection, sources: VideoCodec.allCases) | ||
.navigationTitle(L10n.video) | ||
} | ||
|
||
@ViewBuilder | ||
func makeCustomDeviceContainerEditor(selection: Binding<[MediaContainer]>) -> some View { | ||
OrderedSectionSelectorView(selection: selection, sources: MediaContainer.allCases) | ||
.navigationTitle(L10n.containers) | ||
} | ||
|
||
@ViewBuilder | ||
func makeStart() -> some View { | ||
CustomDeviceProfileSettingsView.EditCustomDeviceProfileView(profile: profile) | ||
.navigationTitle(L10n.customProfile) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Shared/Coordinators/PlaybackQualitySettingsCoordinator.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,41 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Stinsen | ||
import SwiftUI | ||
|
||
final class PlaybackQualitySettingsCoordinator: NavigationCoordinatable { | ||
|
||
let stack = NavigationStack(initial: \PlaybackQualitySettingsCoordinator.start) | ||
|
||
@Root | ||
var start = makeStart | ||
|
||
@Route(.push) | ||
var customDeviceProfileSettings = makeCustomDeviceProfileSettings | ||
|
||
func makeCustomDeviceProfileSettings() -> NavigationViewCoordinator<CustomDeviceProfileCoordinator> { | ||
NavigationViewCoordinator( | ||
CustomDeviceProfileCoordinator() | ||
) | ||
} | ||
|
||
func makeEditCustomDeviceProfile(profile: Binding<CustomDeviceProfile>) | ||
-> NavigationViewCoordinator<EditCustomDeviceProfileCoordinator> { | ||
NavigationViewCoordinator(EditCustomDeviceProfileCoordinator(profile: profile)) | ||
} | ||
|
||
func makeCreateCustomDeviceProfile() -> NavigationViewCoordinator<EditCustomDeviceProfileCoordinator> { | ||
NavigationViewCoordinator(EditCustomDeviceProfileCoordinator()) | ||
} | ||
|
||
@ViewBuilder | ||
func makeStart() -> some View { | ||
PlaybackQualitySettingsView() | ||
} | ||
} |
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
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
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
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,32 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import Foundation | ||
import JellyfinAPI | ||
|
||
extension CodecProfile { | ||
|
||
init( | ||
codec: String? = nil, | ||
container: String? = nil, | ||
type: CodecType? = nil, | ||
@ArrayBuilder<ProfileCondition> applyConditions: () -> [ProfileCondition] = { [] }, | ||
@ArrayBuilder<ProfileCondition> conditions: () -> [ProfileCondition] = { [] } | ||
) { | ||
let applyConditions = applyConditions() | ||
let conditions = conditions() | ||
|
||
self.init( | ||
applyConditions: applyConditions.isEmpty ? nil : applyConditions, | ||
codec: codec, | ||
conditions: conditions.isEmpty ? nil : conditions, | ||
container: container, | ||
type: type | ||
) | ||
} | ||
} |
Oops, something went wrong.