feature: Video BufferSize settings for MPV (#314)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
Julien9969 2025-04-17 13:56:36 -04:00 committed by GitHub
parent 3896bb90f5
commit d4380d5f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 56 additions and 8 deletions

View file

@ -22,6 +22,7 @@ class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
@Default(false) bool fillScreen,
@Default(true) bool hardwareAccel,
@Default(false) bool useLibass,
@Default(32) int bufferSize,
PlayerOptions? playerOptions,
@Default(100) double internalVolume,
Set<DeviceOrientation>? allowedOrientations,
@ -42,7 +43,7 @@ class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
PlayerOptions get wantedPlayer => playerOptions ?? PlayerOptions.platformDefaults;
bool playerSame(VideoPlayerSettingsModel other) {
return other.hardwareAccel == hardwareAccel && other.useLibass == useLibass && other.wantedPlayer == wantedPlayer;
return other.hardwareAccel == hardwareAccel && other.useLibass == useLibass && other.bufferSize == bufferSize && other.wantedPlayer == wantedPlayer;
}
@override
@ -55,6 +56,7 @@ class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
other.fillScreen == fillScreen &&
other.hardwareAccel == hardwareAccel &&
other.useLibass == useLibass &&
other.bufferSize == bufferSize &&
other.internalVolume == internalVolume &&
other.playerOptions == playerOptions &&
other.audioDevice == audioDevice;
@ -67,6 +69,7 @@ class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
fillScreen.hashCode ^
hardwareAccel.hashCode ^
useLibass.hashCode ^
bufferSize.hashCode ^
internalVolume.hashCode ^
audioDevice.hashCode;
}

View file

@ -26,6 +26,7 @@ mixin _$VideoPlayerSettingsModel {
bool get fillScreen => throw _privateConstructorUsedError;
bool get hardwareAccel => throw _privateConstructorUsedError;
bool get useLibass => throw _privateConstructorUsedError;
int get bufferSize => throw _privateConstructorUsedError;
PlayerOptions? get playerOptions => throw _privateConstructorUsedError;
double get internalVolume => throw _privateConstructorUsedError;
Set<DeviceOrientation>? get allowedOrientations =>
@ -59,6 +60,7 @@ abstract class $VideoPlayerSettingsModelCopyWith<$Res> {
bool fillScreen,
bool hardwareAccel,
bool useLibass,
int bufferSize,
PlayerOptions? playerOptions,
double internalVolume,
Set<DeviceOrientation>? allowedOrientations,
@ -90,6 +92,7 @@ class _$VideoPlayerSettingsModelCopyWithImpl<$Res,
Object? fillScreen = null,
Object? hardwareAccel = null,
Object? useLibass = null,
Object? bufferSize = null,
Object? playerOptions = freezed,
Object? internalVolume = null,
Object? allowedOrientations = freezed,
@ -120,6 +123,10 @@ class _$VideoPlayerSettingsModelCopyWithImpl<$Res,
? _value.useLibass
: useLibass // ignore: cast_nullable_to_non_nullable
as bool,
bufferSize: null == bufferSize
? _value.bufferSize
: bufferSize // ignore: cast_nullable_to_non_nullable
as int,
playerOptions: freezed == playerOptions
? _value.playerOptions
: playerOptions // ignore: cast_nullable_to_non_nullable
@ -171,6 +178,7 @@ abstract class _$$VideoPlayerSettingsModelImplCopyWith<$Res>
bool fillScreen,
bool hardwareAccel,
bool useLibass,
int bufferSize,
PlayerOptions? playerOptions,
double internalVolume,
Set<DeviceOrientation>? allowedOrientations,
@ -201,6 +209,7 @@ class __$$VideoPlayerSettingsModelImplCopyWithImpl<$Res>
Object? fillScreen = null,
Object? hardwareAccel = null,
Object? useLibass = null,
Object? bufferSize = null,
Object? playerOptions = freezed,
Object? internalVolume = null,
Object? allowedOrientations = freezed,
@ -231,6 +240,10 @@ class __$$VideoPlayerSettingsModelImplCopyWithImpl<$Res>
? _value.useLibass
: useLibass // ignore: cast_nullable_to_non_nullable
as bool,
bufferSize: null == bufferSize
? _value.bufferSize
: bufferSize // ignore: cast_nullable_to_non_nullable
as int,
playerOptions: freezed == playerOptions
? _value.playerOptions
: playerOptions // ignore: cast_nullable_to_non_nullable
@ -277,6 +290,7 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
this.fillScreen = false,
this.hardwareAccel = true,
this.useLibass = false,
this.bufferSize = 32,
this.playerOptions,
this.internalVolume = 100,
final Set<DeviceOrientation>? allowedOrientations,
@ -308,6 +322,9 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
@JsonKey()
final bool useLibass;
@override
@JsonKey()
final int bufferSize;
@override
final PlayerOptions? playerOptions;
@override
@JsonKey()
@ -346,7 +363,7 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'VideoPlayerSettingsModel(screenBrightness: $screenBrightness, videoFit: $videoFit, fillScreen: $fillScreen, hardwareAccel: $hardwareAccel, useLibass: $useLibass, playerOptions: $playerOptions, internalVolume: $internalVolume, allowedOrientations: $allowedOrientations, nextVideoType: $nextVideoType, maxHomeBitrate: $maxHomeBitrate, maxInternetBitrate: $maxInternetBitrate, audioDevice: $audioDevice, segmentSkipSettings: $segmentSkipSettings)';
return 'VideoPlayerSettingsModel(screenBrightness: $screenBrightness, videoFit: $videoFit, fillScreen: $fillScreen, hardwareAccel: $hardwareAccel, useLibass: $useLibass, bufferSize: $bufferSize, playerOptions: $playerOptions, internalVolume: $internalVolume, allowedOrientations: $allowedOrientations, nextVideoType: $nextVideoType, maxHomeBitrate: $maxHomeBitrate, maxInternetBitrate: $maxInternetBitrate, audioDevice: $audioDevice, segmentSkipSettings: $segmentSkipSettings)';
}
@override
@ -359,6 +376,7 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
..add(DiagnosticsProperty('fillScreen', fillScreen))
..add(DiagnosticsProperty('hardwareAccel', hardwareAccel))
..add(DiagnosticsProperty('useLibass', useLibass))
..add(DiagnosticsProperty('bufferSize', bufferSize))
..add(DiagnosticsProperty('playerOptions', playerOptions))
..add(DiagnosticsProperty('internalVolume', internalVolume))
..add(DiagnosticsProperty('allowedOrientations', allowedOrientations))
@ -393,6 +411,7 @@ abstract class _VideoPlayerSettingsModel extends VideoPlayerSettingsModel {
final bool fillScreen,
final bool hardwareAccel,
final bool useLibass,
final int bufferSize,
final PlayerOptions? playerOptions,
final double internalVolume,
final Set<DeviceOrientation>? allowedOrientations,
@ -418,6 +437,8 @@ abstract class _VideoPlayerSettingsModel extends VideoPlayerSettingsModel {
@override
bool get useLibass;
@override
int get bufferSize;
@override
PlayerOptions? get playerOptions;
@override
double get internalVolume;

View file

@ -15,6 +15,7 @@ _$VideoPlayerSettingsModelImpl _$$VideoPlayerSettingsModelImplFromJson(
fillScreen: json['fillScreen'] as bool? ?? false,
hardwareAccel: json['hardwareAccel'] as bool? ?? true,
useLibass: json['useLibass'] as bool? ?? false,
bufferSize: (json['bufferSize'] as num?)?.toInt() ?? 32,
playerOptions:
$enumDecodeNullable(_$PlayerOptionsEnumMap, json['playerOptions']),
internalVolume: (json['internalVolume'] as num?)?.toDouble() ?? 100,
@ -47,6 +48,7 @@ Map<String, dynamic> _$$VideoPlayerSettingsModelImplToJson(
'fillScreen': instance.fillScreen,
'hardwareAccel': instance.hardwareAccel,
'useLibass': instance.useLibass,
'bufferSize': instance.bufferSize,
'playerOptions': _$PlayerOptionsEnumMap[instance.playerOptions],
'internalVolume': instance.internalVolume,
'allowedOrientations': instance.allowedOrientations