feat: Add streaming handlers for live and VOD content using FFmpeg.

This commit is contained in:
Michael committed 2026-01-01 20:05:40 +01:00
1 parent e27fa6fec3
commit 478107f0a4
3 files changed
+227 -66

No files matched your search

@@ -63,6 +63,8 @@ class _SettingsKeys {
static const String showClock = 'show_clock';
static const String preferredAspectRatio = 'aspect_ratio';
static const String playerType = 'player_type';
// Server/GPU Settings
static const String enableNvidiaGpu = 'enable_nvidia_gpu';
}
/// Settings state for IPTV preferences with persistence
@@ -86,6 +88,9 @@ class IptvSettings {
final String preferredAspectRatio;
final PlayerType playerType;
// Server/GPU Settings
final bool enableNvidiaGpu;
const IptvSettings({
// Filters
this.liveTvCategoryFilter = '',
@@ -103,6 +108,8 @@ class IptvSettings {
this.showClock = false,
this.preferredAspectRatio = 'contain',
this.playerType = PlayerType.standard,
// Server/GPU defaults
this.enableNvidiaGpu = false,
});
IptvSettings copyWith({
@@ -119,6 +126,7 @@ class IptvSettings {
bool? showClock,
String? preferredAspectRatio,
PlayerType? playerType,
bool? enableNvidiaGpu,
}) {
return IptvSettings(
liveTvCategoryFilter: liveTvCategoryFilter ?? this.liveTvCategoryFilter,
@@ -134,6 +142,7 @@ class IptvSettings {
showClock: showClock ?? this.showClock,
preferredAspectRatio: preferredAspectRatio ?? this.preferredAspectRatio,
playerType: playerType ?? this.playerType,
enableNvidiaGpu: enableNvidiaGpu ?? this.enableNvidiaGpu,
);
}
@@ -334,6 +343,7 @@ class IptvSettingsNotifier extends StateNotifier<IptvSettings> {
? PlayerType
.values[remoteSettings[_SettingsKeys.playerType] as int]
: null,
enableNvidiaGpu: getValue<bool>(_SettingsKeys.enableNvidiaGpu),
);
}
_initialized = true;
@@ -377,6 +387,7 @@ class IptvSettingsNotifier extends StateNotifier<IptvSettings> {
_SettingsKeys.showClock: state.showClock,
_SettingsKeys.preferredAspectRatio: state.preferredAspectRatio,
_SettingsKeys.playerType: state.playerType.index,
_SettingsKeys.enableNvidiaGpu: state.enableNvidiaGpu,
};
print('[SettingsProvider] _saveToApi: Saving settings...');
@@ -469,6 +480,13 @@ class IptvSettingsNotifier extends StateNotifier<IptvSettings> {
_saveToApi();
}
// ===== Server/GPU Setters =====
void setEnableNvidiaGpu(bool value) {
state = state.copyWith(enableNvidiaGpu: value);
_saveToApi();
}
// Legacy methods
void setCategoryFilter(String filter) => setLiveTvFilter(filter);
void clearCategoryFilter() => clearLiveTvFilter();
@@ -174,6 +174,29 @@ class StreamingSettingsTab extends ConsumerWidget {
),
],
),
const SizedBox(height: 16),
// Server/GPU Section
_buildSectionCard(
context: context,
title: 'Serveur / GPU',
icon: Icons.memory,
children: [
SwitchListTile(
title: Text(
'Accélération NVIDIA GPU',
style: GoogleFonts.roboto(fontSize: 14, color: Colors.white),
),
subtitle: Text(
'Utiliser NVENC/NVDEC pour le transcodage (requiert GPU NVIDIA)',
style: GoogleFonts.roboto(fontSize: 12, color: Colors.white54),
),
value: settings.enableNvidiaGpu,
activeThumbColor: Colors.green,
onChanged: (v) => notifier.setEnableNvidiaGpu(v),
),
],
),
const SizedBox(height: 32),
// Info card