Aufnahme-Feature entfernt - libVLC sout-duplicate Hall-Problem nicht loesbar
This commit is contained in:
parent
282e5c3f5a
commit
84203db798
3 changed files with 1 additions and 115 deletions
|
|
@ -381,9 +381,6 @@
|
|||
<Slider x:Name="SldVolume" Width="100" Minimum="0" Maximum="100" Value="80"
|
||||
VerticalAlignment="Center" Margin="8,0"
|
||||
ValueChanged="SldVolume_ValueChanged"/>
|
||||
<Button x:Name="BtnRecord" Content="⏺" FontSize="16" Width="40" Height="40"
|
||||
Background="Transparent" Foreground="#888" BorderThickness="0"
|
||||
Click="BtnRecord_Click" Cursor="Hand" ToolTip="Aufnahme starten"/>
|
||||
<Button x:Name="BtnFullscreen" Content="⛶" FontSize="16" Width="40" Height="40"
|
||||
Background="Transparent" Foreground="White" BorderThickness="0"
|
||||
Click="BtnFullscreen_Click" Cursor="Hand" ToolTip="Vollbild (F11)"/>
|
||||
|
|
|
|||
|
|
@ -42,10 +42,6 @@ public partial class MainWindow : Window
|
|||
// WebView2 für Web-Sender (YouTube, Netflix etc.)
|
||||
private bool _webViewReady = false;
|
||||
|
||||
// Aufnahme
|
||||
private string? _recordingFilePath;
|
||||
private bool _isRecording = false;
|
||||
|
||||
// WndProc-Hook für globale Tastatureingaben (auch wenn WebView2 Fokus hat)
|
||||
private System.Windows.Interop.HwndSource? _hwndSource;
|
||||
|
||||
|
|
@ -210,7 +206,6 @@ public partial class MainWindow : Window
|
|||
try
|
||||
{
|
||||
_hwndSource?.RemoveHook(WndProc);
|
||||
if (_isRecording) StopRecording();
|
||||
_epgTimer.Stop();
|
||||
_zapTimer.Stop();
|
||||
_epgRefreshTimer.Stop();
|
||||
|
|
@ -398,7 +393,7 @@ public partial class MainWindow : Window
|
|||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0x00, 0x78, 0xD4))
|
||||
: new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0x66, 0xBB, 0x6A));
|
||||
// Aufnahme stoppen wenn Sender wechselt
|
||||
if (_isRecording) StopRecording();
|
||||
// if (_isRecording) StopRecording();
|
||||
TxtNoChannel.Visibility = Visibility.Collapsed;
|
||||
UpdateFavButton();
|
||||
|
||||
|
|
@ -694,108 +689,6 @@ public partial class MainWindow : Window
|
|||
|
||||
private void BtnFullscreen_Click(object sender, RoutedEventArgs e) => ToggleFullscreen();
|
||||
|
||||
private void BtnRecord_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isRecording) StopRecording();
|
||||
else StartRecording();
|
||||
}
|
||||
|
||||
private void StartRecording()
|
||||
{
|
||||
if (_currentChannel == null || _currentChannel.Kind == ChannelKind.Web)
|
||||
{
|
||||
MessageBox.Show("Aufnahme nur für TV- und Radio-Sender möglich.",
|
||||
"HomeStream", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
if (_player == null || _currentMedia == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var dir = _settings.RecordingPath;
|
||||
Directory.CreateDirectory(dir);
|
||||
var safeName = string.Join("_", _currentChannel.Name.Split(Path.GetInvalidFileNameChars()));
|
||||
var fileName = $"{safeName}_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.ts";
|
||||
var filePath = Path.Combine(dir, fileName);
|
||||
|
||||
// Laufenden Player stoppen, neue Media mit sout-duplicate starten
|
||||
// #duplicate: gleichzeitig Display (Abspielen) UND File (Aufnahme)
|
||||
_player.Stop();
|
||||
|
||||
// sout-duplicate: display nur Video (kein Audio via sout-Pfad!), file bekommt alles
|
||||
// Audio laeuft separat ueber den normalen Decoder-Pfad -> kein Hall
|
||||
var sout = $":sout=#duplicate{{dst=display{{select=noaudio}},dst=std{{access=file,mux=ts,dst={filePath}}}}}";
|
||||
var media = new Media(_libVLC!, new Uri(_currentChannel.Url),
|
||||
sout,
|
||||
":sout-keep",
|
||||
"--network-caching=1000",
|
||||
"--no-video-title-show",
|
||||
"--no-osd",
|
||||
"--rtsp-tcp");
|
||||
|
||||
media.MetaChanged += OnMediaMetaChanged;
|
||||
|
||||
var oldMedia = _currentMedia;
|
||||
_currentMedia = media;
|
||||
_player.Media = media;
|
||||
_player.Play();
|
||||
|
||||
try { oldMedia?.Dispose(); } catch { }
|
||||
|
||||
_isRecording = true;
|
||||
_recordingFilePath = filePath;
|
||||
BtnRecord.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Colors.Red);
|
||||
BtnRecord.ToolTip = $"Aufnahme läuft: {fileName} — Klicken zum Stoppen";
|
||||
TxtChannelSource.Text = (_currentChannel.Source == ChannelSource.Online
|
||||
? "● Online" : "● FritzBox") + " 🔴 REC";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Aufnahme-Fehler:\n{ex.Message}",
|
||||
"HomeStream", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void StopRecording()
|
||||
{
|
||||
if (!_isRecording) return;
|
||||
try
|
||||
{
|
||||
// Player mit normalem Stream neu starten (ohne sout)
|
||||
if (_currentChannel != null && _player != null && _libVLC != null)
|
||||
{
|
||||
_player.Stop();
|
||||
var media = new Media(_libVLC, new Uri(_currentChannel.Url));
|
||||
media.MetaChanged += OnMediaMetaChanged;
|
||||
var oldMedia = _currentMedia;
|
||||
_currentMedia = media;
|
||||
_player.Media = media;
|
||||
_player.Play();
|
||||
try { oldMedia?.Dispose(); } catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
_isRecording = false;
|
||||
_recordingFilePath = null;
|
||||
BtnRecord.Foreground = new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(0x88, 0x88, 0x88));
|
||||
BtnRecord.ToolTip = "Aufnahme starten";
|
||||
if (_currentChannel != null)
|
||||
{
|
||||
TxtChannelSource.Text = _currentChannel.Source == ChannelSource.Online
|
||||
? "● Online" : "● FritzBox";
|
||||
TxtChannelSource.Foreground = _currentChannel.Source == ChannelSource.Online
|
||||
? new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(0x00, 0x78, 0xD4))
|
||||
: new System.Windows.Media.SolidColorBrush(
|
||||
System.Windows.Media.Color.FromRgb(0x66, 0xBB, 0x6A));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleFullscreen()
|
||||
{
|
||||
if (!_isFullscreen)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@ public class AppSettings
|
|||
/// <summary>Startkategorie beim App-Start (default: Favoriten)</summary>
|
||||
public string StartCategory { get; set; } = "fav";
|
||||
|
||||
/// <summary>Ordner fuer Aufnahmen (default: Videos\HomeStream)</summary>
|
||||
public string RecordingPath { get; set; } = System.IO.Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), "HomeStream");
|
||||
|
||||
private static readonly string ConfigPath = AppPaths.Settings;
|
||||
|
||||
public static AppSettings Load()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue