diff --git a/DVB.NET Viewer/Application/DVBNETViewer.csproj b/DVB.NET Viewer/Application/DVBNETViewer.csproj index 75863bc..b1ad8e1 100644 --- a/DVB.NET Viewer/Application/DVBNETViewer.csproj +++ b/DVB.NET Viewer/Application/DVBNETViewer.csproj @@ -9,7 +9,7 @@ WinExe Properties DVBNETViewer - DVBNETViewer + DVBNETViewer5 DVBNETViewer.ico @@ -68,22 +68,26 @@ - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\GAC\JMS.DVB.Common.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\GAC\JMS.DVB.Common.dll - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DeviceAccess.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DeviceAccess.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.HardwareAbstraction.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.HardwareAbstraction.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DirectShow.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DirectShow.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SITables.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SITables.dll + False + + + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.TS.dll False @@ -92,7 +96,7 @@ False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.FavoriteManager.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.FavoriteManager.dll False diff --git a/DVB.NET Viewer/Application/Program.cs b/DVB.NET Viewer/Application/Program.cs index f1ed5c8..f074d96 100644 --- a/DVB.NET Viewer/Application/Program.cs +++ b/DVB.NET Viewer/Application/Program.cs @@ -11,7 +11,7 @@ using JMS.DVB.DirectShow.UI; using JMS.DVB.DirectShow.RawDevices; using System.Reflection; - +using JMS.DVB.TS; namespace DVBNETViewer { @@ -26,8 +26,8 @@ public static class Program /// Die Art der Abmeldung. /// Optional ein Grund, falls der Rechner heruntergefahren wird. /// Gesetzt, wenn die Operation erfolgreich war. - [DllImport( "user32.dll" )] - private static extern bool ExitWindowsEx( UInt32 flags, UInt32 reason ); + [DllImport("user32.dll")] + private static extern bool ExitWindowsEx(UInt32 flags, UInt32 reason); /// /// Installiert die Laufzeitumgebung. @@ -39,14 +39,17 @@ static Program() } [STAThread] - static void Main( string[] args ) + static void Main(string[] args) { + // Allow video PES to use length field as well. + VideoStream.DefaultAcceptAnyLength = true; + // Be safe try { // Check settings var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - if (!version.Equals( Properties.Settings.Default.Version )) + if (!version.Equals(Properties.Settings.Default.Version)) { // Upgrade Properties.Settings.Default.Upgrade(); @@ -56,7 +59,7 @@ static void Main( string[] args ) // Prepare Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault( false ); + Application.SetCompatibleTextRenderingDefault(false); // Force priority Process.GetCurrentProcess().PriorityClass = Properties.Settings.Default.Priority; @@ -68,19 +71,19 @@ static void Main( string[] args ) UserProfile.ApplyLanguage(); // See how we should work - if (Equals( startMode, "/Reset" )) + if (Equals(startMode, "/Reset")) { // Ask user - if (DialogResult.Yes != MessageBox.Show( Properties.Resources.ResetSettings, Properties.Resources.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2 )) return; + if (DialogResult.Yes != MessageBox.Show(Properties.Resources.ResetSettings, Properties.Resources.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2)) return; // Process Properties.Settings.Default.Reset(); Properties.Settings.Default.Save(); } - if (Equals( startMode, "/LearnRC" )) + if (Equals(startMode, "/LearnRC")) { // Run RC configuration - RCSettings.Edit( RCSettings.ConfigurationFile ).Dispose(); + RCSettings.Edit(RCSettings.ConfigurationFile).Dispose(); } else { @@ -92,19 +95,19 @@ static void Main( string[] args ) ViewerMain form = null; // Test parameter - if (!string.IsNullOrEmpty( startMode )) - if (Equals( startMode, "/VCR" )) + if (!string.IsNullOrEmpty(startMode)) + if (Equals(startMode, "/VCR")) { // Create in VCR LIVE / CURRENT mode - form = new ViewerMain( StartupModes.RemoteVCR ); + form = new ViewerMain(StartupModes.RemoteVCR); } - else if (startMode.ToLower().StartsWith( "dvbnet://" )) + else if (startMode.ToLower().StartsWith("dvbnet5://")) { // Start with the server part - startMode = startMode.Substring( 9 ); + startMode = startMode.Substring(10); // See if this is a regular start using the URL protocol - bool startedByProtocol = !startMode.StartsWith( "*" ); + bool startedByProtocol = !startMode.StartsWith("*"); // Must be the control center if (startedByProtocol) @@ -113,59 +116,59 @@ static void Main( string[] args ) byte[] tmp = new byte[startMode.Length]; // Copy by byte - for (int i = tmp.Length; i-- > 0; ) - tmp[i] = (byte) startMode[i]; + for (int i = tmp.Length; i-- > 0;) + tmp[i] = (byte)startMode[i]; // Retrieve - startMode = Encoding.UTF8.GetString( tmp ); + startMode = Encoding.UTF8.GetString(tmp); } else { // Just cut off the control character - startMode = startMode.Substring( 1 ); + startMode = startMode.Substring(1); } // Just correct for URL stuff - startMode = Uri.UnescapeDataString( startMode.Replace( '+', ' ' ) ); + startMode = Uri.UnescapeDataString(startMode.Replace('+', ' ')); // See if this is a file replay - int file = startMode.ToLower().IndexOf( "/play=" ); + int file = startMode.ToLower().IndexOf("/play="); if (file < 0) { // Create in VCR CURRENT mode - form = new ViewerMain( StartupModes.WatchOrTimeshift, startMode ); + form = new ViewerMain(StartupModes.WatchOrTimeshift, startMode); } else { // Get server and file name - string server = startMode.Substring( 0, file ); - string path = startMode.Substring( file + 6 ); + string server = startMode.Substring(0, file); + string path = startMode.Substring(file + 6); // Replay - form = new ViewerMain( StartupModes.PlayRemoteFile, path, server ); + form = new ViewerMain(StartupModes.PlayRemoteFile, path, server); } } - else if (startMode.StartsWith( "/VCR=" )) + else if (startMode.StartsWith("/VCR=")) { // Create in VCR REPLY mode - form = new ViewerMain( StartupModes.PlayRemoteFile, startMode.Substring( 5 ), null ); + form = new ViewerMain(StartupModes.PlayRemoteFile, startMode.Substring(5), null); } - else if (startMode.StartsWith( "/TCP=" )) + else if (startMode.StartsWith("/TCP=")) { // Create in STREAMING SLAVE mode - form = new ViewerMain( StartupModes.ConnectTCP, startMode.Substring( 5 ) ); + form = new ViewerMain(StartupModes.ConnectTCP, startMode.Substring(5)); } - else if (startMode.StartsWith( "/FILE=" )) + else if (startMode.StartsWith("/FILE=")) { // Create in LOCAL REPLAY mode - form = new ViewerMain( StartupModes.PlayLocalFile, startMode.Substring( 6 ) ); + form = new ViewerMain(StartupModes.PlayLocalFile, startMode.Substring(6)); } // Local mode if (form != null) { // Run the application - Application.Run( form ); + Application.Run(form); } else { @@ -173,47 +176,47 @@ static void Main( string[] args ) var profile = UserProfile.Profile; if (profile != null) using (HardwareManager.Open()) - Application.Run( new ViewerMain( profile ) ); + Application.Run(new ViewerMain(profile)); } } } catch (Exception e) { // Report as is - MessageBox.Show( e.ToString() ); + MessageBox.Show(e.ToString()); // Terminate - Environment.Exit( 1 ); + Environment.Exit(1); } // If we are running as the users shell log off - using (var key = Registry.CurrentUser.OpenSubKey( @"Software\Microsoft\Windows NT\CurrentVersion\Winlogon" )) + using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\Winlogon")) if (key != null) try { // Load shell - var shell = key.GetValue( "Shell" ) as string; + var shell = key.GetValue("Shell") as string; if (shell != null) { // Remove quotes if (shell.Length >= 2) - if (shell.StartsWith( "\"" )) - if (shell.EndsWith( "\"" )) - shell = shell.Substring( 1, shell.Length - 2 ).Replace( "\"\"", "\"" ); + if (shell.StartsWith("\"")) + if (shell.EndsWith("\"")) + shell = shell.Substring(1, shell.Length - 2).Replace("\"\"", "\""); // Clip shell = shell.Trim(); // See what's left - if (!string.IsNullOrEmpty( shell )) + if (!string.IsNullOrEmpty(shell)) { // Attach to file - var file1 = new FileInfo( shell ); - var file2 = new FileInfo( Application.ExecutablePath ); + var file1 = new FileInfo(shell); + var file2 = new FileInfo(Application.ExecutablePath); // Check - if (string.Equals( file1.FullName, file2.FullName, StringComparison.InvariantCultureIgnoreCase )) - ExitWindowsEx( 0x10, 0 ); + if (string.Equals(file1.FullName, file2.FullName, StringComparison.InvariantCultureIgnoreCase)) + ExitWindowsEx(0x10, 0); } } } diff --git a/DVB.NET Viewer/Application/Properties/AssemblyInfo.cs b/DVB.NET Viewer/Application/Properties/AssemblyInfo.cs index 99c149f..c632b4e 100644 --- a/DVB.NET Viewer/Application/Properties/AssemblyInfo.cs +++ b/DVB.NET Viewer/Application/Properties/AssemblyInfo.cs @@ -5,22 +5,22 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle( "DVB.NET / VCR.NET Stream Viewer" )] -[assembly: AssemblyDescription( "User Interface to DVB.NET / VCR.NET Transport Streams" )] -[assembly: AssemblyConfiguration( "" )] -[assembly: AssemblyCompany( "JMS" )] -[assembly: AssemblyProduct( "DVB.NET" )] -[assembly: AssemblyCopyright( "Copyright © 2003-15" )] -[assembly: AssemblyTrademark( "" )] -[assembly: AssemblyCulture( "" )] +[assembly: AssemblyTitle("DVB.NET / VCR.NET Stream Viewer")] +[assembly: AssemblyDescription("User Interface to DVB.NET / VCR.NET Transport Streams")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("JMS")] +[assembly: AssemblyProduct("DVB.NET")] +[assembly: AssemblyCopyright("Copyright © 2003-24")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible( false )] +[assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid( "66acf330-6e4e-4f8a-bd73-de8de987fcda" )] +[assembly: Guid("66acf330-6e4e-4f8a-bd73-de8de987fcda")] // Version information for an assembly consists of the following four values: // @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion( "4.3.0.0" )] -[assembly: AssemblyFileVersion( "4.3.0.0" )] +[assembly: AssemblyVersion("5.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/DVB.NET Viewer/Application/ViewerMain.cs b/DVB.NET Viewer/Application/ViewerMain.cs index 67dabed..d8f602b 100644 --- a/DVB.NET Viewer/Application/ViewerMain.cs +++ b/DVB.NET Viewer/Application/ViewerMain.cs @@ -78,8 +78,8 @@ public void Dispose() /// /// Operationsmodus der Anwendung. /// Parameter zum Operationsmodus der Anwendung. - public ViewerMain( StartupModes mode, params string[] args ) - : this( null, mode, args ) + public ViewerMain(StartupModes mode, params string[] args) + : this(null, mode, args) { } @@ -88,8 +88,8 @@ public ViewerMain( StartupModes mode, params string[] args ) /// eine lokale Hardware. /// /// Die zu verwendene lokale DVB.NET Hardware. - public ViewerMain( Profile profile ) - : this( profile, StartupModes.LocalDVB ) + public ViewerMain(Profile profile) + : this(profile, StartupModes.LocalDVB) { } @@ -99,7 +99,7 @@ public ViewerMain( Profile profile ) /// Die zu verwendene lokale DVB.NET Hardware. /// Operationsmodus der Anwendung. /// Parameter zum Operationsmodus der Anwendung. - public ViewerMain( Profile profile, StartupModes mode, params string[] args ) + public ViewerMain(Profile profile, StartupModes mode, params string[] args) { // Remember m_Arguments = args; @@ -110,14 +110,14 @@ public ViewerMain( Profile profile, StartupModes mode, params string[] args ) InitializeComponent(); // Attach to viewer - IViewerSite viewer = (IViewerSite) theViewer; + IViewerSite viewer = theViewer; // Register additional keys - to be kept we must do this before SetSite fixes the map - viewer.SetKeyHandler( Keys.J, ProcessFullScreen ); - viewer.SetKeyHandler( Keys.End, Close ); + viewer.SetKeyHandler(Keys.J, ProcessFullScreen); + viewer.SetKeyHandler(Keys.End, Close); // Connect viewer control to configuration - theViewer.SetSite( this ); + theViewer.SetSite(this); // Prepare to show SetBounds(); @@ -145,7 +145,7 @@ private void SetBounds() // Full screen simulation FormBorderStyle = FormBorderStyle.None; - Bounds = Screen.PrimaryScreen.Bounds; + Bounds = Screen.FromControl(this).Bounds; ControlBox = false; TopMost = true; } @@ -186,14 +186,14 @@ private void ProcessFullScreen() Properties.Settings.Default.FullScreen = !Properties.Settings.Default.FullScreen; Properties.Settings.Default.Save(); - // Attach to viewer - IOSDSite osd = (IOSDSite) theViewer; - // Hide any overlay - osd.Hide(); + theViewer.Hide(); // Put us in position SetBounds(); + + // Restart + Application.Restart(); } /// @@ -202,7 +202,7 @@ private void ProcessFullScreen() /// /// Wird ignoriert. /// Wird ignoriert. - private void ViewerMain_Load( object sender, EventArgs e ) + private void ViewerMain_Load(object sender, EventArgs e) { // Finish if (Properties.Settings.Default.HideCursor) @@ -212,7 +212,7 @@ private void ViewerMain_Load( object sender, EventArgs e ) if (Properties.Settings.Default.FirstStart) { // Show configuration - if (!ShowGlobalOptions( null )) + if (!ShowGlobalOptions(null)) { // Done Close(); @@ -239,7 +239,7 @@ private void ViewerMain_Load( object sender, EventArgs e ) /// /// Wird ignoriert. /// Wird ignoriert. - private void tickStart_Tick( object sender, EventArgs e ) + private void tickStart_Tick(object sender, EventArgs e) { // Once only tickStart.Enabled = false; @@ -259,23 +259,23 @@ private void tickStart_Tick( object sender, EventArgs e ) // Check mode switch (m_Mode) { - case StartupModes.LocalDVB: adaptor = new DeviceAdpator( Profile, theViewer ); break; - case StartupModes.RemoteVCR: adaptor = new VCRAdaptor( theViewer ); break; - case StartupModes.ConnectTCP: adaptor = new SlaveAdaptor( theViewer, m_Arguments[0] ); break; - case StartupModes.PlayLocalFile: adaptor = new FileAdaptor( theViewer, m_Arguments[0] ); break; - case StartupModes.PlayRemoteFile: m_FixedServer = m_Arguments[1]; adaptor = new VCRAdaptor( theViewer, m_Arguments[0] ); break; - case StartupModes.WatchOrTimeshift: adaptor = CreateWatch( m_Arguments[0].Split( '/' ) ); break; - default: throw new ArgumentException( m_Mode.ToString(), "m_Mode" ); + case StartupModes.LocalDVB: adaptor = new DeviceAdpator(Profile, theViewer); break; + case StartupModes.RemoteVCR: adaptor = new VCRAdaptor(theViewer); break; + case StartupModes.ConnectTCP: adaptor = new SlaveAdaptor(theViewer, m_Arguments[0]); break; + case StartupModes.PlayLocalFile: adaptor = new FileAdaptor(theViewer, m_Arguments[0]); break; + case StartupModes.PlayRemoteFile: m_FixedServer = m_Arguments[1]; adaptor = new VCRAdaptor(theViewer, m_Arguments[0]); break; + case StartupModes.WatchOrTimeshift: adaptor = CreateWatch(m_Arguments[0].Split('/')); break; + default: throw new ArgumentException(m_Mode.ToString(), "m_Mode"); } // Startup control - theViewer.Initialize( adaptor ); + theViewer.Initialize(adaptor); // Create configuration list ResetOptions(); // Reset title - if (Equals( Text, newText )) + if (Equals(Text, newText)) Text = oldText; // Up and running @@ -284,18 +284,18 @@ private void tickStart_Tick( object sender, EventArgs e ) /// /// Erzeugt einen Adaptor zum Betrachten einer aktuellen Aufzeichnung - dieser - /// Aufruf wird über das dvbnet:// Protokoll angestossen. + /// Aufruf wird über das dvbnet5:// Protokoll angestossen. /// /// URL Teile nach dem Protokollnamen. /// Ein geeignet konfigurierter Adaptor. - private Adaptor CreateWatch( string[] parts ) + private Adaptor CreateWatch(string[] parts) { // Remember m_FixedServer = parts[0]; m_Profile = parts[1]; // Create - return new VCRAdaptor( theViewer, int.Parse( parts[2] ), 0 == string.Compare( parts[3], "TimeShift", true ) ); + return new VCRAdaptor(theViewer, int.Parse(parts[2]), 0 == string.Compare(parts[3], "TimeShift", true)); } /// @@ -308,10 +308,10 @@ private void ShowFavoriteSettings() using (ShowCursor()) { // Attach to viewer - IViewerSite viewer = (IViewerSite) theViewer; + IViewerSite viewer = (IViewerSite)theViewer; // Show configuration dialog - viewer.FavoriteManager.ShowConfiguration( this ); + viewer.FavoriteManager.ShowConfiguration(this); } } @@ -321,14 +321,14 @@ private void ShowFavoriteSettings() public void ResetOptions() { // Attach to viewer - IViewerSite viewer = (IViewerSite) theViewer; + IViewerSite viewer = (IViewerSite)theViewer; // Wipe out viewer.ResetOptions(); // Fill configuration - viewer.AddOption( new OptionDisplay( Properties.Resources.OptionGlobalSettings, () => ShowGlobalOptions( viewer ) ) ); - viewer.AddOption( new OptionDisplay( Properties.Resources.OptionFavorites, ShowFavoriteSettings ) ); + viewer.AddOption(new OptionDisplay(Properties.Resources.OptionGlobalSettings, () => ShowGlobalOptions(viewer))); + viewer.AddOption(new OptionDisplay(Properties.Resources.OptionFavorites, ShowFavoriteSettings)); // Be safe try @@ -339,7 +339,7 @@ public void ResetOptions() catch (Exception ex) { // Report - viewer.ShowMessage( ex.Message, Properties.Resources.ErrorTitle, false ); + viewer.ShowMessage(ex.Message, Properties.Resources.ErrorTitle, false); } } @@ -349,7 +349,7 @@ public void ResetOptions() /// /// Wird ignoriert. /// Wird ignoriert. - private void ViewerMain_SizeChanged( object sender, EventArgs e ) + private void ViewerMain_SizeChanged(object sender, EventArgs e) { // Do not update while starting if (m_Starting) return; @@ -361,8 +361,8 @@ private void ViewerMain_SizeChanged( object sender, EventArgs e ) Rectangle rect = DesktopBounds; // Correct - if (rect.Left < 0) rect.Offset( -rect.Left, 0 ); - if (rect.Top < 0) rect.Offset( 0, -rect.Top ); + if (rect.Left < 0) rect.Offset(-rect.Left, 0); + if (rect.Top < 0) rect.Offset(0, -rect.Top); // Remember all Properties.Settings.Default.Location = rect; @@ -373,12 +373,12 @@ private void ViewerMain_SizeChanged( object sender, EventArgs e ) /// Zeigt die Einstellungen der Anwendung an. /// /// Die zugehörige Darstellungsinstanz. - private bool ShowGlobalOptions( IViewerSite viewer ) + private bool ShowGlobalOptions(IViewerSite viewer) { // Show configuration dialog using (ShowCursor()) - using (ProgramSettings dialog = new ProgramSettings( viewer )) - if (DialogResult.OK == dialog.ShowDialog( this )) + using (ProgramSettings dialog = new ProgramSettings(viewer)) + if (DialogResult.OK == dialog.ShowDialog(this)) { // Update Properties.Settings.Default.Save(); @@ -403,7 +403,7 @@ private bool ShowGlobalOptions( IViewerSite viewer ) case ProgramSettings.ChangeTypes.Application: { // Report to user - MessageBox.Show( this, Properties.Resources.RequireRestart, Properties.Resources.OptionGlobalSettings ); + MessageBox.Show(this, Properties.Resources.RequireRestart, Properties.Resources.OptionGlobalSettings); // We can do no more break; @@ -411,7 +411,7 @@ private bool ShowGlobalOptions( IViewerSite viewer ) case ProgramSettings.ChangeTypes.Picture: { // Switch off OSD - IOSDSite osd = (IOSDSite) theViewer; + IOSDSite osd = (IOSDSite)theViewer; osd.Hide(); // Restart picture @@ -626,10 +626,10 @@ Uri IRemoteInfo.ServerUri get { // Override is active - if (null != m_FixedServer) return new Uri( string.Format( "http://{0}/VCR.NET/VCRServer.asmx", m_FixedServer ) ); + if (null != m_FixedServer) return new Uri(string.Format("http://{0}/api/info", m_FixedServer)); // Forward - return new Uri( Properties.Settings.Default.DVBNETViewer_FullServer_VCR30Server ); + return new Uri(Properties.Settings.Default.DVBNETViewer_FullServer_VCR30Server); } } @@ -679,14 +679,7 @@ ushort IStreamInfo.BroadcastPort /// /// Meldet die maximal erlaubte Anzeigezeit für ein OSD in Sekunden. /// - int IGeneralInfo.OSDLifeTime - { - get - { - // Report - return Properties.Settings.Default.OSDLifeTime; - } - } + int IGeneralInfo.OSDLifeTime => Properties.Settings.Default.OSDLifeTime; /// /// Liest oder setzt die aktuelle Lautstärke in % von 0.0 bis 1.0. @@ -706,68 +699,43 @@ double IGeneralInfo.Volume } } - /// - /// Deaktiviert den Vollbildmodus. - /// - void IGeneralInfo.LeaveFullScreen() - { - // Forward - LeaveFullScreen(); - } - - /// - /// Deaktiviert den Vollbildmodus. - /// - private void LeaveFullScreen() - { - // Nothing to do - if (!Properties.Settings.Default.FullScreen) return; - - // Leave fullscreen mode - ProcessFullScreen(); - - // Wait a bit - Application.DoEvents(); - } - - /// /// Meldet, ob der Cyberlink / PowerDVD Codec für H.264 aktiviert werden soll. /// - bool IGeneralInfo.UseCyberlinkCodec { get { return Properties.Settings.Default.UseCyberlinkCodec; } } + bool IGeneralInfo.UseCyberlinkCodec => Properties.Settings.Default.UseCyberlinkCodec; - bool IGeneralInfo.UseRemoteControl { get { return Properties.Settings.Default.UseRemote; } } + bool IGeneralInfo.UseRemoteControl => Properties.Settings.Default.UseRemote; - string IGeneralInfo.H264Decoder { get { return Properties.Settings.Default.H264Decoder; } } + string IGeneralInfo.H264Decoder => Properties.Settings.Default.H264Decoder; - string IGeneralInfo.MPEG2Decoder { get { return Properties.Settings.Default.MPEG2Decoder; } } + string IGeneralInfo.MPEG2Decoder => Properties.Settings.Default.MPEG2Decoder; - string IGeneralInfo.AC3Decoder { get { return Properties.Settings.Default.AC3Decoder; } } + string IGeneralInfo.AC3Decoder => Properties.Settings.Default.AC3Decoder; - string IGeneralInfo.MP2Decoder { get { return Properties.Settings.Default.MP2Decoder; } } + string IGeneralInfo.MP2Decoder => Properties.Settings.Default.MP2Decoder; - int IGeneralInfo.AVDelay { get { return Properties.Settings.Default.AVDelay; } } + int IGeneralInfo.AVDelay => Properties.Settings.Default.AVDelay; - void IGeneralInfo.SetPictureParameters( PictureParameters parameters ) + void IGeneralInfo.SetPictureParameters(PictureParameters parameters) { // Copy over if necessary if (Properties.Settings.Default.OverwriteVideoSettings) { // Set all - SetVideoParameter( parameters.Brightness, Properties.Settings.Default.VideoBrightness ); - SetVideoParameter( parameters.Saturation, Properties.Settings.Default.VideoSaturation ); - SetVideoParameter( parameters.Hue, Properties.Settings.Default.VideoHue ); - SetVideoParameter( parameters.Contrast, Properties.Settings.Default.VideoContrast ); + SetVideoParameter(parameters.Brightness, Properties.Settings.Default.VideoBrightness); + SetVideoParameter(parameters.Saturation, Properties.Settings.Default.VideoSaturation); + SetVideoParameter(parameters.Hue, Properties.Settings.Default.VideoHue); + SetVideoParameter(parameters.Contrast, Properties.Settings.Default.VideoContrast); } } - private void SetVideoParameter( PictureParameters.ParameterSet parameter, float value ) + private void SetVideoParameter(PictureParameters.ParameterSet parameter, float value) { // Store but keep in range - parameter.Value = Math.Max( parameter.Minimum, Math.Min( parameter.Maximum, value ) ); + parameter.Value = Math.Max(parameter.Minimum, Math.Min(parameter.Maximum, value)); } - void IGeneralInfo.SetWindowTitle( string title ) + void IGeneralInfo.SetWindowTitle(string title) { // Do as requested Text = title; diff --git a/DVB.NET Viewer/Setups/Viewer/Deutsch.wxl b/DVB.NET Viewer/Setups/Viewer/Deutsch.wxl index 10b771a..1a9055a 100644 --- a/DVB.NET Viewer/Setups/Viewer/Deutsch.wxl +++ b/DVB.NET Viewer/Setups/Viewer/Deutsch.wxl @@ -1,23 +1,19 @@ - DVB.NET / VCR.NET Viewer + DVB.NET / VCR.NET Viewer 5.0 Quellcode Intellisense Dateien - Vor der Installation muss die existierende Version des DVB.NET / VCR.NET Viewers deinstalliert werden. - Der DVB.NET / VCR.NET Viewer setzt eine Installation des Microsoft .NET Frameworks in der Version 4.5.1 voraus. - Zur Installation des DVB.NET / VCR.NET Viewers muss DVB.NET bereits installiert sein. Die aktuelle Version kann hier heruntergeladen werden: + Vor der Installation muss die existierende Version des DVB.NET / VCR.NET Viewers 5.0 deinstalliert werden. + Der DVB.NET / VCR.NET Viewer 5.0 setzt eine Installation des Microsoft .NET Frameworks in der Version 4.5.1 voraus. + Zur Installation des DVB.NET / VCR.NET Viewers 5.0 muss DVB.NET bereits installiert sein. Die aktuelle Version kann hier heruntergeladen werden: http://www.psimarron.net/DVBNET/html/download.html - DVB.NET Viewer (lokal) + DVB.NET Viewer 5.0 (lokal) Lokales DVB Gerät verwenden. - DVB.NET Viewer (VCR.NET) - Verbindung zu einem VCR.NET Recording Service. - DVB.NET Viewer (Fernbedienung anlernen) - Anlernen einer Fernbedienung. - DVB.NET Viewer (Einstellungen zurücksetzen) + DVB.NET Viewer 5.0 (Einstellungen zurücksetzen) Alle Einstellungen auf die Voreinstellung zurück setzen. \ No newline at end of file diff --git a/DVB.NET Viewer/Setups/Viewer/DirectoryTree.wxs b/DVB.NET Viewer/Setups/Viewer/DirectoryTree.wxs index 84297ac..1868ced 100644 --- a/DVB.NET Viewer/Setups/Viewer/DirectoryTree.wxs +++ b/DVB.NET Viewer/Setups/Viewer/DirectoryTree.wxs @@ -12,7 +12,7 @@ - + diff --git a/DVB.NET Viewer/Setups/Viewer/Menu.wxs b/DVB.NET Viewer/Setups/Viewer/Menu.wxs index 96b6ffe..069f301 100644 --- a/DVB.NET Viewer/Setups/Viewer/Menu.wxs +++ b/DVB.NET Viewer/Setups/Viewer/Menu.wxs @@ -8,7 +8,7 @@ - + - - - - - + @@ -47,7 +47,7 @@ - + diff --git a/DVB.NET Viewer/Setups/Viewer/Registry.wxs b/DVB.NET Viewer/Setups/Viewer/Registry.wxs index c4423c2..10c4551 100644 --- a/DVB.NET Viewer/Setups/Viewer/Registry.wxs +++ b/DVB.NET Viewer/Setups/Viewer/Registry.wxs @@ -6,11 +6,11 @@ - - - - - + + + + + diff --git a/DVB.NET Viewer/Setups/Viewer/Viewer.wixproj b/DVB.NET Viewer/Setups/Viewer/Viewer.wixproj index 88a6dc0..a2e21df 100644 --- a/DVB.NET Viewer/Setups/Viewer/Viewer.wixproj +++ b/DVB.NET Viewer/Setups/Viewer/Viewer.wixproj @@ -6,7 +6,7 @@ 3.7 ac44fac9-4952-4572-81c4-76b9525fe4bc 2.0 - DVBNETViewer + DVBNETViewer5 Package $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets @@ -17,7 +17,7 @@ ..\..\..\msi\ obj\$(Configuration)\ Debug - SETUPVERSION=4.3.13 + SETUPVERSION=5.0.3 de-de True ICE57 @@ -25,7 +25,7 @@ ..\..\..\msi\ obj\$(Configuration)\ - SETUPVERSION=4.3.13 + SETUPVERSION=5.0.3 de-de True ICE57 diff --git a/DVB.NET Viewer/ViewerControl/CurrentConnector.cs b/DVB.NET Viewer/ViewerControl/CurrentConnector.cs index 44be84c..77d6e16 100644 --- a/DVB.NET Viewer/ViewerControl/CurrentConnector.cs +++ b/DVB.NET Viewer/ViewerControl/CurrentConnector.cs @@ -26,7 +26,7 @@ private class JobScheduleInfo /// Erstellt eine neue Beschreibung. /// /// Die zugehörige Aktivität. - public JobScheduleInfo( VCRNETRestProxy.Current info ) + public JobScheduleInfo(VCRNETRestProxy.Current info) { // Remember Activity = info; @@ -35,7 +35,7 @@ public JobScheduleInfo( VCRNETRestProxy.Current info ) /// /// Die Position innerhalb der Mehrkanalaufzeichnung. /// - public int StreamIndex { get { return Activity.streamIndex; } } + public int StreamIndex { get { return Activity.index; } } /// /// Meldet den Namen der Aktivität. @@ -63,10 +63,10 @@ public override string ToString() /// /// Der zugehörige VCR.NET Recording Service. /// Die Zieladresse des Netzwerkversands. - public void StreamTo( string endPoint, string target ) + public void StreamTo(string endPoint, string target) { // Forward - VCRNETRestProxy.SetStreamTargetSync( endPoint, Activity.device, Activity.source, Activity.referenceId.Value, target ); + VCRNETRestProxy.SetStreamTargetSync(endPoint, Activity.profileName, Activity.source, Activity.planIdentifier.Value, target); } } @@ -100,8 +100,8 @@ public void StreamTo( string endPoint, string target ) /// /// Verbindung zur aktuellen Anwendung. /// Vorgabe für die Auswahl der ersten Teilaufzeichnung. - public CurrentConnector( VCRAdaptor adaptor, string startWith ) - : base( adaptor ) + public CurrentConnector(VCRAdaptor adaptor, string startWith) + : base(adaptor) { // Remember m_StartupStation = startWith; @@ -111,7 +111,7 @@ public CurrentConnector( VCRAdaptor adaptor, string startWith ) /// Aktualisiert die Daten der aktuellen Aufzeichnung. /// /// Die aktuellen Daten. - private void ReceiveCurrentRecording( VCRNETRestProxy.Current[] current ) + private void ReceiveCurrentRecording(VCRNETRestProxy.Current[] current) { // Remember if valid m_allActivities = current; @@ -127,7 +127,7 @@ public override void FillOptions() base.FillOptions(); // Register - Adaptor.Parent.SetKeyHandler( Keys.Multiply, StartTimeshift ); + Adaptor.Parent.SetKeyHandler(Keys.Multiply, StartTimeshift); } /// @@ -136,10 +136,10 @@ public override void FillOptions() private void StartTimeshift() { // Check mode - if (!string.IsNullOrEmpty( Adaptor.StreamInfo.BroadcastIP )) + if (!string.IsNullOrEmpty(Adaptor.StreamInfo.BroadcastIP)) { // Report - ShowMessage( Properties.Resources.NoMulticastTimeShift, Properties.Resources.Warning_NotAvailable, true ); + ShowMessage(Properties.Resources.NoMulticastTimeShift, Properties.Resources.Warning_NotAvailable, true); // Done return; @@ -150,11 +150,11 @@ private void StartTimeshift() if (current == null) return; var path = current.PrimaryPath; - if (string.IsNullOrEmpty( path )) + if (string.IsNullOrEmpty(path)) return; // Start it - Adaptor.StartReplay( path, current.Name, current.Activity ); + Adaptor.StartReplay(path, current.Name, current.Activity); } /// @@ -167,10 +167,10 @@ public override void LoadStations() // Special if (m_StartupStation != null) - if (m_StartupStation.StartsWith( "dvbnet:" )) + if (m_StartupStation.StartsWith("dvbnet5:")) { // Get the index - startupIndex = int.Parse( m_StartupStation.Substring( 7 ) ); + startupIndex = int.Parse(m_StartupStation.Substring(8)); // No direct default m_StartupStation = null; @@ -187,16 +187,16 @@ public override void LoadStations() var duplicates = new Dictionary(); // Find all current activities - foreach (var activity in VCRNETRestProxy.GetActivitiesForProfile( Adaptor.EndPoint, Profile )) + foreach (var activity in VCRNETRestProxy.GetActivitiesForProfile(Adaptor.EndPoint, Profile)) { // Create the information record - var item = new JobScheduleInfo( activity ); + var item = new JobScheduleInfo(activity); var name = activity.name; // Read counter int cnt; - if (duplicates.TryGetValue( name, out cnt )) - name = string.Format( "{0} ({1})", name, cnt ); + if (duplicates.TryGetValue(name, out cnt)) + name = string.Format("{0} ({1})", name, cnt); else cnt = 0; @@ -204,11 +204,11 @@ public override void LoadStations() duplicates[name] = ++cnt; // Add to list - Favorites.AddChannel( name, item ); + Favorites.AddChannel(name, item); // Remember if (m_DefaultStation == null) - if ((startupIndex < 0) || (startupIndex == activity.streamIndex)) + if ((startupIndex < 0) || (startupIndex == activity.index)) m_DefaultStation = name; } @@ -231,7 +231,7 @@ public override void LoadStations() /// /// Name des gewünschten NVOD Dienstes. /// Wirft immer eine . - public override string SetService( ServiceItem service ) + public override string SetService(ServiceItem service) { // Not supported return null; @@ -242,22 +242,22 @@ public override string SetService( ServiceItem service ) /// /// Die gewünschte Aufzeichnung. /// Aktuelle Aufzeichnung samt aktiver Tonspur oder null. - public override string SetStation( object context ) + public override string SetStation(object context) { // Stop sending data Accessor.Stop(); // Restart videotext caching from scratch - Adaptor.VideoText.Deactivate( true ); + Adaptor.VideoText.Deactivate(true); // Reset Disconnect(); // Attach to the item - var item = (JobScheduleInfo) context; + var item = (JobScheduleInfo)context; // Get the signal - item.StreamTo( Adaptor.EndPoint, Adaptor.Target ); + item.StreamTo(Adaptor.EndPoint, Adaptor.Target); // Remember m_CurrentSource = item; @@ -277,7 +277,7 @@ private void Disconnect() try { // Process - current.StreamTo( Adaptor.EndPoint, null ); + current.StreamTo(Adaptor.EndPoint, null); } catch { @@ -315,21 +315,21 @@ public override void OnProfileChanging() /// Prüft die Liste der aktiven Aufzeichnungen. /// /// Eine nicht leere Liste von aktiven Auzeichnungen. - private void ValidateActiveRecording( VCRNETRestProxy.Current[] activities ) + private void ValidateActiveRecording(VCRNETRestProxy.Current[] activities) { // Check for special operations var first = activities[0]; var current = m_CurrentSource; // See if there is a task running - if (first.streamIndex < 0) - ShowMessage( Properties.Resources.CurrentUntil, Properties.Resources.Warning_NotAvailable, false, first.source, first.EndsAt.ToLocalTime() ); + if (first.index < 0) + ShowMessage(Properties.Resources.CurrentUntil, Properties.Resources.Warning_NotAvailable, false, first.source, first.EndsAt.ToLocalTime()); // See if we have no current source else if (current == null) { // Start watching - Adaptor.StartWatch( null ); + Adaptor.StartWatch(null); // Done return; @@ -339,12 +339,12 @@ private void ValidateActiveRecording( VCRNETRestProxy.Current[] activities ) else { // Set if we are connected - var newCurrent = activities.First( activity => activity.referenceId.Value == current.Activity.referenceId.Value ); + var newCurrent = activities.First(activity => activity.planIdentifier.Value == current.Activity.planIdentifier.Value); if (newCurrent != null) - if (string.IsNullOrEmpty( newCurrent.streamTarget )) + if (string.IsNullOrEmpty(newCurrent.streamTarget)) { // Start watching - Adaptor.StartWatch( null ); + Adaptor.StartWatch(null); // Done return; @@ -352,27 +352,27 @@ private void ValidateActiveRecording( VCRNETRestProxy.Current[] activities ) } // Restart request - VCRNETRestProxy.GetActivities( Adaptor.EndPoint, ReceiveCurrentRecording, null ); + VCRNETRestProxy.GetActivities(Adaptor.EndPoint, ReceiveCurrentRecording, null); } /// /// Prüft, ob in den LIVE Modus gewechselt werden kann. /// /// Die als nächstens anstehende Aktivität. - private void ValidateIdle( VCRNETRestProxy.Current next ) + private void ValidateIdle(VCRNETRestProxy.Current next) { // Get the next recording - if (next.start.HasValue) + if (next.Start.HasValue) { // When will it start - var delta = next.start.Value - DateTime.UtcNow; + var delta = next.Start.Value - DateTime.UtcNow; if (delta.TotalMinutes <= 3) { // Report - ShowMessage( Properties.Resources.NextRecording, Properties.Resources.Warning_NotAvailable, false, (int) delta.TotalSeconds ); + ShowMessage(Properties.Resources.NextRecording, Properties.Resources.Warning_NotAvailable, false, (int)delta.TotalSeconds); // Restart request - VCRNETRestProxy.GetActivities( Adaptor.EndPoint, ReceiveCurrentRecording, null ); + VCRNETRestProxy.GetActivities(Adaptor.EndPoint, ReceiveCurrentRecording, null); // Done return; @@ -389,8 +389,8 @@ private void ValidateIdle( VCRNETRestProxy.Current next ) public override void KeepAlive() { // Read results - var activities = (m_allActivities ?? Enumerable.Empty()).Where( activity => ProfileManager.ProfileNameComparer.Equals( activity.device, Profile ) ).ToArray(); - var running = activities.Where( activity => activity.IsActive ).ToArray(); + var activities = (m_allActivities ?? Enumerable.Empty()).Where(activity => ProfileManager.ProfileNameComparer.Equals(activity.profileName, Profile)).ToArray(); + var running = activities.Where(activity => activity.IsActive).ToArray(); var gotResult = m_allActivitiesValid; // Prepare for next call @@ -400,13 +400,13 @@ public override void KeepAlive() // See if result is available if (gotResult) if (running.Length > 0) - ValidateActiveRecording( running ); + ValidateActiveRecording(running); else if (activities.Length > 0) - ValidateIdle( activities[0] ); + ValidateIdle(activities[0]); else Adaptor.StartLIVE(); else - VCRNETRestProxy.GetActivities( Adaptor.EndPoint, ReceiveCurrentRecording, null ); + VCRNETRestProxy.GetActivities(Adaptor.EndPoint, ReceiveCurrentRecording, null); } /// diff --git a/DVB.NET Viewer/ViewerControl/IGeneralInfo.cs b/DVB.NET Viewer/ViewerControl/IGeneralInfo.cs index c9896b1..791189b 100644 --- a/DVB.NET Viewer/ViewerControl/IGeneralInfo.cs +++ b/DVB.NET Viewer/ViewerControl/IGeneralInfo.cs @@ -20,11 +20,6 @@ public interface IGeneralInfo /// double Volume { get; set; } - /// - /// Vollbildmodus verlassen. - /// - void LeaveFullScreen(); - /// /// Gesetzt, wenn der spezielle Formatcode für Cyberlink / PowerDVD verwendet werden soll. /// @@ -54,13 +49,13 @@ public interface IGeneralInfo /// Überträgt die Einstellungen für die Bildparameter. /// /// - void SetPictureParameters( PictureParameters parameters ); + void SetPictureParameters(PictureParameters parameters); /// /// Legt die Fensterüberschrift fest. /// /// Die neue Überschrift des Huaptfensters. - void SetWindowTitle( string title ); + void SetWindowTitle(string title); /// /// Zeigt die Maus an. diff --git a/DVB.NET Viewer/ViewerControl/JMS.DVB.Viewer.csproj b/DVB.NET Viewer/ViewerControl/JMS.DVB.Viewer.csproj index 018d6f3..95a8b0e 100644 --- a/DVB.NET Viewer/ViewerControl/JMS.DVB.Viewer.csproj +++ b/DVB.NET Viewer/ViewerControl/JMS.DVB.Viewer.csproj @@ -67,39 +67,39 @@ - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.Algorithms.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.Algorithms.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DirectShow.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.DirectShow.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.EPG.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.EPG.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.HardwareAbstraction.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.HardwareAbstraction.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SITables.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SITables.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SourceManagement.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.SourceManagement.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.DVB.TS.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.DVB.TS.dll False - ..\..\..\..\..\..\..\Program Files\JMS\DVB.NET 4.3\RunTime\JMS.FavoriteManager.dll + ..\..\..\..\..\..\..\Program Files (x86)\JMS\DVB.NET 4.3\RunTime\JMS.FavoriteManager.dll False - ..\..\..\..\..\..\..\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll + ..\..\..\..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll diff --git a/DVB.NET Viewer/ViewerControl/LiveConnector.cs b/DVB.NET Viewer/ViewerControl/LiveConnector.cs index 63bab0a..8553c98 100644 --- a/DVB.NET Viewer/ViewerControl/LiveConnector.cs +++ b/DVB.NET Viewer/ViewerControl/LiveConnector.cs @@ -143,7 +143,7 @@ public override void LoadStations() } // Check encryption - if (source.encrypted) + if (source.isEncrypted) { // Only if encrypted is allowed if (free && !pay) @@ -157,7 +157,7 @@ public override void LoadStations() } // Process - Favorites.AddChannel( source.nameWithProvider, source ); + Favorites.AddChannel( source.name, source ); } // Finished @@ -198,7 +198,7 @@ public override string SetStation( object context ) CurrentService = null; // Store to settings - return (Adaptor.RemoteInfo.VCRStation = source.nameWithProvider); + return (Adaptor.RemoteInfo.VCRStation = source.name); } /// @@ -212,7 +212,7 @@ private static string GetStationName( VCRNETRestProxy.Source channel ) if (null == channel) return null; else - return channel.nameWithProvider; + return channel.name; } /// @@ -280,7 +280,7 @@ public override string SetService( ServiceItem service ) CurrentService = null; // Done - return source.nameWithProvider; + return source.name; } // Got a real service @@ -393,13 +393,13 @@ private void StartRecording( int duration ) // Configure the new job var job = new VCRNETRestProxy.Job { - sourceName = CurrentSource.nameWithProvider, + source = CurrentSource.name, name = "Manuelle Aufzeichnung", - withSubtitles = true, - withVideotext = true, - includeDolby = true, + dvbSubtitles = true, + videotext = true, + dolbyDigital = true, allLanguages = true, - device = Profile, + profile = Profile, }; // Send it diff --git a/DVB.NET Viewer/ViewerControl/Properties/AssemblyInfo.cs b/DVB.NET Viewer/ViewerControl/Properties/AssemblyInfo.cs index 9cbb88c..5db0b5f 100644 --- a/DVB.NET Viewer/ViewerControl/Properties/AssemblyInfo.cs +++ b/DVB.NET Viewer/ViewerControl/Properties/AssemblyInfo.cs @@ -5,22 +5,22 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle( "DVB.NET / VCR.NET Viewer Contol" )] -[assembly: AssemblyDescription( ".NET Control to View DVB.NET / VCR.NET Transport Streams" )] -[assembly: AssemblyConfiguration( "" )] -[assembly: AssemblyCompany( "JMS" )] -[assembly: AssemblyProduct( "DVB.NET" )] -[assembly: AssemblyCopyright( "Copyright © 2003-15" )] -[assembly: AssemblyTrademark( "" )] -[assembly: AssemblyCulture( "" )] +[assembly: AssemblyTitle("DVB.NET / VCR.NET Viewer Contol")] +[assembly: AssemblyDescription(".NET Control to View DVB.NET / VCR.NET Transport Streams")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("JMS")] +[assembly: AssemblyProduct("DVB.NET")] +[assembly: AssemblyCopyright("Copyright © 2003-24")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible( false )] +[assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid( "601e27c3-4509-4ef2-a7d7-07846049702d" )] +[assembly: Guid("601e27c3-4509-4ef2-a7d7-07846049702d")] // Version information for an assembly consists of the following four values: // @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion( "4.3.0.0" )] +[assembly: AssemblyVersion("5.0.0.0")] diff --git a/DVB.NET Viewer/ViewerControl/VCRAdaptor.cs b/DVB.NET Viewer/ViewerControl/VCRAdaptor.cs index ad5b28a..9dbfaaf 100644 --- a/DVB.NET Viewer/ViewerControl/VCRAdaptor.cs +++ b/DVB.NET Viewer/ViewerControl/VCRAdaptor.cs @@ -43,7 +43,7 @@ public string EndPoint var uri = RemoteInfo.ServerUri.AbsoluteUri; // Create endpoint - return uri.Substring( 0, uri.LastIndexOf( '/' ) ); + return uri.Substring(0, uri.LastIndexOf('/')); } } @@ -51,8 +51,8 @@ public string EndPoint /// Erzeugt eine neue Zugriffsinstanz. /// /// Die zugehörige Anwendung. - public VCRAdaptor( IViewerSite main ) - : this( main, default( string ) ) + public VCRAdaptor(IViewerSite main) + : this(main, default(string)) { } @@ -62,40 +62,40 @@ public VCRAdaptor( IViewerSite main ) /// Die zugehörige Anwendung. /// Teilaufzeichnung, die betrachtet werden soll. /// Gesetzt, wenn der Timeshift Modus aktiviert werden soll. - public VCRAdaptor( IViewerSite main, int streamIndex, bool timeshift ) - : base( main ) + public VCRAdaptor(IViewerSite main, int streamIndex, bool timeshift) + : base(main) { // Connect to alternate interfaces - ChannelInfo = (IChannelInfo) main; - StreamInfo = (IStreamInfo) main; + ChannelInfo = (IChannelInfo)main; + StreamInfo = (IStreamInfo)main; // Remember m_Profile = RemoteInfo.VCRProfile; // Use default - if (string.IsNullOrEmpty( m_Profile )) + if (string.IsNullOrEmpty(m_Profile)) m_Profile = "*"; // Construct Url var uri = RemoteInfo.ServerUri; // Connect to stream - Connect( StreamInfo.BroadcastIP, StreamInfo.BroadcastPort, uri.Host ); + Connect(StreamInfo.BroadcastIP, StreamInfo.BroadcastPort, uri.Host); // Find all current activities - var activities = VCRNETRestProxy.GetActivitiesForProfile( EndPoint, Profile ); + var activities = VCRNETRestProxy.GetActivitiesForProfile(EndPoint, Profile); if (activities.Count < 1) - StartLIVE( true ); + StartLIVE(true); else { // Find the activity - var current = activities.FirstOrDefault( activity => activity.streamIndex == streamIndex ); + var current = activities.FirstOrDefault(activity => activity.index == streamIndex); if (current == null) - StartWatch( null, true ); - else if (timeshift && string.IsNullOrEmpty( StreamInfo.BroadcastIP ) && (current.files.Length > 0)) - StartReplay( current.files[0], current.name, current, true ); + StartWatch(null, true); + else if (timeshift && string.IsNullOrEmpty(StreamInfo.BroadcastIP) && (current.files.Length > 0)) + StartReplay(current.files[0], current.name, current, true); else - StartWatch( string.Format( "dvbnet:{0}", streamIndex ), true ); + StartWatch(string.Format("dvbnet5:{0}", streamIndex), true); } } @@ -104,47 +104,47 @@ public VCRAdaptor( IViewerSite main, int streamIndex, bool timeshift ) /// /// Die zugehörige Anwendung. /// Pfad zu einer VCR.NET Aufzeichnungsdatei. - public VCRAdaptor( IViewerSite main, string replayPath ) - : base( main ) + public VCRAdaptor(IViewerSite main, string replayPath) + : base(main) { // Connect to alternate interfaces - ChannelInfo = (IChannelInfo) main; - StreamInfo = (IStreamInfo) main; + ChannelInfo = (IChannelInfo)main; + StreamInfo = (IStreamInfo)main; // Remember m_Profile = RemoteInfo.VCRProfile; // Use default - if (string.IsNullOrEmpty( m_Profile )) + if (string.IsNullOrEmpty(m_Profile)) m_Profile = "*"; // Construct Url Uri uri = RemoteInfo.ServerUri; // Connect to stream - Connect( StreamInfo.BroadcastIP, StreamInfo.BroadcastPort, uri.Host ); + Connect(StreamInfo.BroadcastIP, StreamInfo.BroadcastPort, uri.Host); // Check startup mode - if (string.IsNullOrEmpty( replayPath )) + if (string.IsNullOrEmpty(replayPath)) { // Special if LIVE is active - var current = VCRNETRestProxy.GetFirstActivityForProfile( EndPoint, Profile ); + var current = VCRNETRestProxy.GetFirstActivityForProfile(EndPoint, Profile); if (current != null) if (!current.IsActive) current = null; - else if ("LIVE".Equals( current.name )) + else if ("LIVE".Equals(current.name)) current = null; // Start correct access module if (current == null) - StartLIVE( true ); + StartLIVE(true); else - StartWatch( null, true ); + StartWatch(null, true); } else { // Start remote file replay - StartReplay( replayPath, null, null, true ); + StartReplay(replayPath, null, null, true); } } @@ -161,7 +161,7 @@ public override void LoadStations() /// Entfernt das aktuelle Zugriffsmodul. /// /// Für den ersten Aufruf gesetzt. - private void DestroyConnector( bool startup ) + private void DestroyConnector(bool startup) { // Stop all if (!startup) @@ -179,7 +179,7 @@ private void DestroyConnector( bool startup ) } // Restart videotext caching from scratch - VideoText.Deactivate( true ); + VideoText.Deactivate(true); } catch { @@ -197,7 +197,7 @@ private void DestroyConnector( bool startup ) protected override void OnDispose() { // Check connector - DestroyConnector( false ); + DestroyConnector(false); } /// @@ -205,24 +205,24 @@ protected override void OnDispose() /// /// Senderbeschreibung abhängig vom Zugriffsmodul. /// Sendername mit ausgewählter Tonspur oder null. - public override string SetStation( object context ) + public override string SetStation(object context) { // Forward - if (m_CurrentConnector.SetStation( context ) == null) + if (m_CurrentConnector.SetStation(context) == null) return null; // Reset EPG display ShowCurrentEntry(); // Restart videotext caching from scratch - VideoText.Deactivate( true ); + VideoText.Deactivate(true); // Forget EPG data collected so far CurrentEntry = null; NextEntry = null; // Reset audio selection - return RestartAudio( false ); + return RestartAudio(false); } /// @@ -231,10 +231,10 @@ public override string SetStation( object context ) /// Voller Name der Tonspur oder null für die /// bevorzugte Tonspur. /// Sendername mit ausgewählter Tonspur oder null. - public override string SetAudio( string audio ) + public override string SetAudio(string audio) { // Forward - return SetAudio( audio, m_CurrentConnector.UpdateSettings ); + return SetAudio(audio, m_CurrentConnector.UpdateSettings); } /// @@ -257,13 +257,13 @@ public override string SetAudio( string audio ) /// /// Name des Dienstes. /// Name des Dienstes mit aktueller Tonspur oder null. - public override string SetService( ServiceItem service ) + public override string SetService(ServiceItem service) { // Forward - if (m_CurrentConnector.SetService( service ) == null) + if (m_CurrentConnector.SetService(service) == null) return null; else - return RestartAudio( false ); + return RestartAudio(false); } /// @@ -271,7 +271,7 @@ public override string SetService( ServiceItem service ) /// Form aufrecht gehalten werden kann. /// /// Gesetzt für den Aufruf im Sekundenrythmus. - public override void KeepAlive( bool fine ) + public override void KeepAlive(bool fine) { // Forward if (!fine) @@ -284,7 +284,7 @@ public override void KeepAlive( bool fine ) public override void FillOptions() { // Request all - var profiles = VCRNETRestProxy.GetProfilesSync( EndPoint ).Select( profile => profile.name ).ToArray(); + var profiles = VCRNETRestProxy.GetProfilesSync(EndPoint).Select(profile => profile.name).ToArray(); // Process all foreach (var profile in profiles) @@ -293,15 +293,15 @@ public override void FillOptions() string format = Properties.Resources.OptionProfile; // See if this is active - if (string.IsNullOrEmpty( Profile ) && ProfileManager.ProfileNameComparer.Equals( profiles[0], profile )) + if (string.IsNullOrEmpty(Profile) && ProfileManager.ProfileNameComparer.Equals(profiles[0], profile)) format = Properties.Resources.OptionProfileActive; - else if (ProfileManager.ProfileNameComparer.Equals( Profile, profile )) + else if (ProfileManager.ProfileNameComparer.Equals(Profile, profile)) format = Properties.Resources.OptionProfileActive; else format = Properties.Resources.OptionProfile; // Register - Clone() is important since anonymous delegate would bind profile to the last iteration value for ALL items - Parent.AddOption( new OptionDisplay( string.Format( format, profile ), () => ChangeProfile( profile ) ) ); + Parent.AddOption(new OptionDisplay(string.Format(format, profile), () => ChangeProfile(profile))); } // Forward @@ -326,7 +326,7 @@ public override void FillOptions() /// VCR.NET erneut aufgebaut. /// /// Das zu verwendende Profil. - private void ChangeProfile( string profile ) + private void ChangeProfile(string profile) { // Fire m_CurrentConnector.OnProfileChanging(); @@ -367,7 +367,7 @@ public void ChannelListChanged() public void StartLIVE() { // Forward - StartLIVE( false ); + StartLIVE(false); } /// @@ -375,10 +375,10 @@ public void StartLIVE() /// /// Voller Pfad einer VCR.NET Aufzeichnungsdatei. /// Name der Teilaufzeichnung. - public void StartReplay( string path, string name ) + public void StartReplay(string path, string name) { // Forward - StartReplay( path, name, null ); + StartReplay(path, name, null); } /// @@ -387,10 +387,10 @@ public void StartReplay( string path, string name ) /// Voller Pfad einer VCR.NET Aufzeichnungsdatei. /// Name der Teilaufzeichnung. /// Detailinformationen zur aktuellen Aufzeichnung. - public void StartReplay( string path, string name, VCRNETRestProxy.Current recording ) + public void StartReplay(string path, string name, VCRNETRestProxy.Current recording) { // Forward - StartReplay( path, name, recording, false ); + StartReplay(path, name, recording, false); } /// @@ -400,38 +400,38 @@ public void StartReplay( string path, string name, VCRNETRestProxy.Current recor /// Name der Teilaufzeichnung. /// Detailinformationen zur aktuellen Aufzeichnung. /// Während des Starts der Anwendung gesetzt. - private void StartReplay( string path, string name, VCRNETRestProxy.Current recording, bool startup ) + private void StartReplay(string path, string name, VCRNETRestProxy.Current recording, bool startup) { // Shut down - DestroyConnector( startup ); + DestroyConnector(startup); // All files var files = new List(); // Try to count number of files - if (!string.IsNullOrEmpty( path )) + if (!string.IsNullOrEmpty(path)) { // Add self - files.Add( path ); + files.Add(path); // See if there are more if (recording != null) if (recording.files != null) - if (path.ToLower().EndsWith( ".ts" )) + if (path.ToLower().EndsWith(".ts")) { // Get prefix - var prefix = path.Substring( 0, path.Length - 3 ) + " - "; + var prefix = path.Substring(0, path.Length - 3) + " - "; // Search all foreach (var test in recording.files) - if (test.ToLower().EndsWith( ".ts" )) - if (string.Compare( test, 0, prefix, 0, prefix.Length, true ) == 0) - files.Add( test ); + if (test.ToLower().EndsWith(".ts")) + if (string.Compare(test, 0, prefix, 0, prefix.Length, true) == 0) + files.Add(test); } } // Restart - m_CurrentConnector = new FileConnector( this, path, name, files.ToArray() ); + m_CurrentConnector = new FileConnector(this, path, name, files.ToArray()); // Done on first call if (startup) @@ -441,20 +441,20 @@ private void StartReplay( string path, string name, VCRNETRestProxy.Current reco ChannelListChanged(); // Reload all - ShowMessage( RestartAudio( false ), Properties.Resources.NameTitle, true ); + ShowMessage(RestartAudio(false), Properties.Resources.NameTitle, true); } /// /// Aktiviert eine Verbindung zum VCR.NET Recording Service. /// /// Während des Starts der Anwendung gesetzt. - private void StartLIVE( bool startup ) + private void StartLIVE(bool startup) { // Shut down - DestroyConnector( startup ); + DestroyConnector(startup); // Restart - m_CurrentConnector = new LiveConnector( this ); + m_CurrentConnector = new LiveConnector(this); // Reload all if (!startup) @@ -465,10 +465,10 @@ private void StartLIVE( bool startup ) /// Verbindet sich mit der laufenden Aufzeichnung im VCR.NET Recording Service. /// /// Auszuwählende Aufzeichnung. - public void StartWatch( string startWith ) + public void StartWatch(string startWith) { // Forward - StartWatch( startWith, false ); + StartWatch(startWith, false); } /// @@ -476,13 +476,13 @@ public void StartWatch( string startWith ) /// /// Während des Starts der Anwendung gesetzt. /// Auszuwählende Aufzeichnung. - private void StartWatch( string startWith, bool startup ) + private void StartWatch(string startWith, bool startup) { // Shut down - DestroyConnector( startup ); + DestroyConnector(startup); // Restart - m_CurrentConnector = new CurrentConnector( this, startWith ); + m_CurrentConnector = new CurrentConnector(this, startWith); // Reload all if (!startup) @@ -502,7 +502,7 @@ public override void StartRecording() /// Wird aufgerufen, wenn das Zugriffsmodul Daten anfordert. /// /// Das anfordernde Zugriffsmodul. - protected override void OnWaitData( TransportStreamReceiver endPoint ) + protected override void OnWaitData(TransportStreamReceiver endPoint) { // Load connector var connector = m_CurrentConnector; diff --git a/DVB.NET Viewer/ViewerControl/VCRNETRestProxy.cs b/DVB.NET Viewer/ViewerControl/VCRNETRestProxy.cs index 3ac6a9e..0f7b22a 100644 --- a/DVB.NET Viewer/ViewerControl/VCRNETRestProxy.cs +++ b/DVB.NET Viewer/ViewerControl/VCRNETRestProxy.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -59,12 +60,12 @@ public class Source /// /// Der Anzeigename der Quelle. /// - public string nameWithProvider { get; set; } + public string name { get; set; } /// /// Gesetzt, wenn die Quelle verschlüsselt ist. /// - public bool encrypted { get; set; } + public bool isEncrypted { get; set; } /// /// Die eindeutige Kennung der Quelle. @@ -80,7 +81,7 @@ public class Current /// /// Das zugehörige Geräteprofil. /// - public string device { get; set; } + public string profileName { get; set; } /// /// Der Name der Aktivität. @@ -90,17 +91,17 @@ public class Current /// /// Die laufende Nummer des zugehörigen Datenstroms. /// - public int streamIndex { get; set; } + public int index { get; set; } /// /// Für gerade aktive Aufzeichnungen gesetzt. /// - public Guid? referenceId { get; set; } + public Guid? planIdentifier { get; set; } /// /// Gesetzt, wenn es sich um eine aktive Aufzeichnung oder Aufgabe handelt. /// - public bool IsActive { get { return referenceId.HasValue; } } + public bool IsActive => planIdentifier.HasValue; /// /// Die zugehörige Quelle, sofern bekannt. @@ -115,17 +116,22 @@ public class Current /// /// Der Startzeitpunkt der Aufzeichnung. /// - public DateTime? start { get; set; } + public string startTimeISO { get; set; } = null; + + /// + /// Der Startzeitpunkt der Aufzeichnung. + /// + public DateTime? Start => string.IsNullOrEmpty(startTimeISO) ? (DateTime?)null : DateTime.Parse(startTimeISO, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); /// /// Die Laufzeit der Aufzeichnung in Sekunden. /// - public int duration { get; set; } + public int durationInSeconds { get; set; } /// /// Meldet den Endzeitpunkt der Aufzeichnung. /// - public DateTime EndsAt { get { return start.Value.AddSeconds( duration ); } } + public DateTime EndsAt => Start.Value.AddSeconds(durationInSeconds); /// /// Die Netzwerkadresse, an die gerade die Aufzeichnungsdaten versendet werden. @@ -157,12 +163,12 @@ public class Job /// /// Das für die Auswahl der Quelle verwendete Gerät. /// - public string device { get; set; } + public string profile { get; set; } /// /// Die Quelle, von der aufgezeichnet werden soll. /// - public string sourceName { get; set; } + public string source { get; set; } /// /// Gesetzt, wenn alle Tonspuren aufgezeichnet werden sollen. @@ -172,17 +178,17 @@ public class Job /// /// Gesetzt, wenn auch die Dolby Digital Tonspur aufgezeichnet werden soll. /// - public bool includeDolby { get; set; } + public bool dolbyDigital { get; set; } /// /// Gesetzt, wenn auch der Videotext aufgezeichnet werden soll. /// - public bool withVideotext { get; set; } + public bool videotext { get; set; } /// /// Gesetzt, wenn auch alle DVB Untertitel aufgezeichnet werden sollen. /// - public bool withSubtitles { get; set; } + public bool dvbSubtitles { get; set; } } /// @@ -198,12 +204,30 @@ public class Schedule /// /// Der Zeitpunkt, an dem die erste Aufzeichnung stattfinden soll. /// - public DateTime firstStart { get; set; } + public string firstStartISO { get; set; } + + /// + /// Der Zeitpunkt, an dem die erste Aufzeichnung stattfinden soll. + /// + public DateTime firstStart + { + get { return DateTime.Parse(firstStartISO, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); } + set { firstStartISO = value.ToString("o"); } + } /// /// Das Datum der letzten Ausführung. /// - public DateTime lastDay { get; set; } + public string lastDayISO { get; set; } + + /// + /// Das Datum der letzten Ausführung. + /// + public DateTime lastDay + { + get { return DateTime.Parse(lastDayISO, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); } + set { lastDayISO = value.ToString("o"); } + } /// /// Die Dauer der Aufzeichnung. @@ -237,17 +261,20 @@ private class JobScheduleData /// /// Die gewünschte Art des Ergebnisses. /// Der laufende Zugriff. + /// Gesetzt, wenn es sich bei der Antwort um eine JSON Serialisierung handler. /// Das Ergebnis. - private static TResult Deserialize( IAsyncResult result ) + private static TResult Deserialize(IAsyncResult result, bool json = true) { // Attach to the request - var request = (WebRequest) result.AsyncState; + var request = (WebRequest)result.AsyncState; // Load the response - using (var response = request.EndGetResponse( result )) + using (var response = request.EndGetResponse(result)) using (var status = response.GetResponseStream()) - using (var reader = new StreamReader( status )) - return (TResult) s_Converter.Deserialize( reader, typeof( TResult ) ); + using (var reader = new StreamReader(status)) + return json + ? (TResult)s_Converter.Deserialize(reader, typeof(TResult)) + : (TResult)(object)reader.ReadToEnd(); } /// @@ -256,24 +283,24 @@ private static TResult Deserialize( IAsyncResult result ) /// Die Art des Ergebnisses. /// Die Anfrage. /// Das gewünschte Ergebnis. - private static TResult BeginRequestAndWait( Action, Action> request ) + private static TResult BeginRequestAndWait(Action, Action> request) { // Result - var result = default( TResult ); + var result = default(TResult); Exception exception = null; // Create synchronizer var sync = new object(); // Protect - Monitor.Enter( sync ); + Monitor.Enter(sync); // Start - request( data => { result = data; lock (sync) Monitor.Pulse( sync ); }, error => { exception = error; lock (sync) Monitor.Pulse( sync ); } ); + request(data => { result = data; lock (sync) Monitor.Pulse(sync); }, error => { exception = error; lock (sync) Monitor.Pulse(sync); }); // Wait if not failed in preparation if (exception == null) - Monitor.Wait( sync ); + Monitor.Wait(sync); // Fire error if (exception != null) @@ -292,7 +319,8 @@ private static TResult BeginRequestAndWait( Action, Act /// Wird im Erfolgsfall aufgerufen. /// Wird im Fehlerfall aufgerufen. /// An den Server zu übertragende Daten. - private static void BeginRequest( Func uriFactory, string method, Action success, Action failure, object data = null ) + /// Nicht gesetzt wenn es sich bei der Antwort nicht um eine JSON Serialisierung handelt. + private static void BeginRequest(Func uriFactory, string method, Action success, Action failure, object data = null, bool json = true) { // Default if (failure == null) @@ -302,8 +330,8 @@ private static void BeginRequest( Func uriFactory, string metho try { // Create request - var uri = new Uri( uriFactory() ); - var request = WebRequest.Create( uri ); + var uri = new Uri(uriFactory()); + var request = WebRequest.Create(uri); // Configure request.UseDefaultCredentials = true; @@ -316,17 +344,12 @@ private static void BeginRequest( Func uriFactory, string metho // Process try { - // Generate response - var status = Deserialize( args ); - - // Report - if (success != null) - success( status ); + success?.Invoke(Deserialize(args, json)); } catch (Exception e) { // Forward - failure( e ); + failure(e); } }; @@ -337,7 +360,7 @@ private static void BeginRequest( Func uriFactory, string metho request.ContentLength = 0; // Direct processing - request.BeginGetResponse( responseProcessor, request ); + request.BeginGetResponse(responseProcessor, request); } else { @@ -352,25 +375,25 @@ private static void BeginRequest( Func uriFactory, string metho try { // Fill - using (var stream = request.EndGetRequestStream( args )) - using (var writer = new StreamWriter( stream )) - s_Converter.Serialize( writer, data ); + using (var stream = request.EndGetRequestStream(args)) + using (var writer = new StreamWriter(stream)) + s_Converter.Serialize(writer, data); // Forward - request.BeginGetResponse( responseProcessor, request ); + request.BeginGetResponse(responseProcessor, request); } catch (Exception e) { // Forward - failure( e ); + failure(e); } - }, request ); + }, request); } } catch (Exception e) { // Fire - failure( e ); + failure(e); } } @@ -380,11 +403,8 @@ private static void BeginRequest( Func uriFactory, string metho /// Der zu verwendende VCR.NET Recording Service. /// Das zu verwendende Geräteprofil. /// Die Adresse, an die alle Daten gesendet werden sollen. - public static Status ConnectSync( string endPoint, string profileName, string target ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => Connect( endPoint, profileName, target, success, failure ) ); - } + public static Status ConnectSync(string endPoint, string profileName, string target) + => BeginRequestAndWait((success, failure) => Connect(endPoint, profileName, target, success, failure)); /// /// Aktiviert das Versenden von Daten. @@ -394,11 +414,8 @@ public static Status ConnectSync( string endPoint, string profileName, string ta /// Die Adresse, an die alle Daten gesendet werden sollen. /// Wird im Erfolgsfall aufgerufen. /// Wird im Fehlerfall aufgerufen. - private static void Connect( string endPoint, string profileName, string target, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}{1}?target={2}", endPoint, profileName, target ), "POST", success, failure ); - } + private static void Connect(string endPoint, string profileName, string target, Action success, Action failure) + => BeginRequest(() => string.Format("{0}live/{1}?target={2}", endPoint, profileName, target), "POST", success, failure); /// /// Beginnt einen neuen Zugriff zum Auslesen der Quellen. @@ -409,11 +426,8 @@ private static void Connect( string endPoint, string profileName, string target, /// Gesetzt, um alle Radiosender einzuschliessen. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void ReadSources( string endPoint, string profileName, bool includeTV, bool includeRadio, Action success, Action failure ) - { - // Forward - BeginRequest( () => string.Format( "{0}{1}?tv={2}&radio={3}", endPoint, profileName, includeTV, includeRadio ), "GET", success, failure ); - } + private static void ReadSources(string endPoint, string profileName, bool includeTV, bool includeRadio, Action success, Action failure) + => BeginRequest(() => string.Format("{0}source/{1}?tv={2}&radio={3}", endPoint, profileName, includeTV, includeRadio), "GET", success, failure); /// /// Ermittelt alle Quellen. @@ -423,11 +437,8 @@ private static void ReadSources( string endPoint, string profileName, bool inclu /// Gesetzt, um alle Fernsehsender einzuschliessen. /// Gesetzt, um alle Radiosender einzuschliessen. /// Die Liste der Quellen. - public static Source[] ReadSourcesSync( string endPoint, string profileName, bool includeTV, bool includeRadio ) - { - // Forward - return BeginRequestAndWait( ( success, failure ) => ReadSources( endPoint, profileName, includeTV, includeRadio, success, failure ) ); - } + public static Source[] ReadSourcesSync(string endPoint, string profileName, bool includeTV, bool includeRadio) + => BeginRequestAndWait((success, failure) => ReadSources(endPoint, profileName, includeTV, includeRadio, success, failure)); /// /// Ermittelt einen aktuellen Zustand. @@ -436,11 +447,8 @@ public static Source[] ReadSourcesSync( string endPoint, string profileName, boo /// Der Name des Geräteprofils. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - public static void GetStatus( string endPoint, string profileName, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}{1}", endPoint, profileName ), "GET", success, failure ); - } + public static void GetStatus(string endPoint, string profileName, Action success, Action failure) + => BeginRequest(() => string.Format("{0}status/{1}", endPoint, profileName), "GET", success, failure); /// /// Ermittelt einen aktuellen Zustand. @@ -448,11 +456,8 @@ public static void GetStatus( string endPoint, string profileName, ActionDer zu verwendende VCR.NET Recording Service. /// Der Name des Geräteprofils. /// Der aktuelle Zustand. - public static Status GetStatusSync( string endPoint, string profileName ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => GetStatus( endPoint, profileName, success, failure ) ); - } + public static Status GetStatusSync(string endPoint, string profileName) + => BeginRequestAndWait((success, failure) => GetStatus(endPoint, profileName, success, failure)); /// /// Beendet die Sitzung. @@ -461,11 +466,8 @@ public static Status GetStatusSync( string endPoint, string profileName ) /// Der Name des Geräteprofils. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void Disconnect( string endPoint, string profileName, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}{1}", endPoint, profileName ), "DELETE", success, failure ); - } + private static void Disconnect(string endPoint, string profileName, Action success, Action failure) + => BeginRequest(() => string.Format("{0}live/{1}", endPoint, profileName), "DELETE", success, failure); /// /// Beendet die Sitzung. @@ -473,11 +475,8 @@ private static void Disconnect( string endPoint, string profileName, ActionDer zu verwendende VCR.NET Recording Service. /// Der Name des Geräteprofils. /// Der neue Zustand. - public static Status DisconnectSync( string endPoint, string profileName ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => Disconnect( endPoint, profileName, success, failure ) ); - } + public static Status DisconnectSync(string endPoint, string profileName) + => BeginRequestAndWait((success, failure) => Disconnect(endPoint, profileName, success, failure)); /// /// Wählt einen neuen Sender aus. @@ -487,11 +486,8 @@ public static Status DisconnectSync( string endPoint, string profileName ) /// Die eindeutige Kennung des Senders. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void Tune( string endPoint, string profileName, string source, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}{1}?source={2}", endPoint, profileName, source ), "PUT", success, failure ); - } + private static void Tune(string endPoint, string profileName, string source, Action success, Action failure) + => BeginRequest(() => string.Format("{0}tune/{1}?source={2}", endPoint, profileName, source), "PUT", success, failure); /// /// Wählt einen neuen Sender aus. @@ -500,11 +496,8 @@ private static void Tune( string endPoint, string profileName, string source, Ac /// Der Name des Geräteprofils. /// Die eindeutige Kennung des Senders. /// Der neue Zustand. - public static Status TuneSync( string endPoint, string profileName, string source ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => Tune( endPoint, profileName, source, success, failure ) ); - } + public static Status TuneSync(string endPoint, string profileName, string source) + => BeginRequestAndWait((success, failure) => Tune(endPoint, profileName, source, success, failure)); /// /// Ändert den Netzwerkversand. @@ -516,11 +509,8 @@ public static Status TuneSync( string endPoint, string profileName, string sourc /// Die neue Zieladresse für den Netzwerkversand. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void SetStreamTarget( string endPoint, string profileName, string source, Guid scheduleIdentifier, string target, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}/plan/{1}?source={2}&scheduleIdentifier={3:N}&target={4}", endPoint, profileName, source, scheduleIdentifier, target ), "POST", success, failure ); - } + private static void SetStreamTarget(string endPoint, string profileName, string source, Guid scheduleIdentifier, string target, Action success, Action failure) + => BeginRequest(() => string.Format("{0}/plan/target/{1}?source={2}&scheduleIdentifier={3:N}&target={4}", endPoint, profileName, source, scheduleIdentifier, target), "POST", success, failure); /// /// Ändert den Netzwerkversand. @@ -530,11 +520,8 @@ private static void SetStreamTarget( string endPoint, string profileName, string /// Die Quelle. /// Die eindeutige Kennung der Aufzeichnung. /// Die neue Zieladresse für den Netzwerkversand. - public static void SetStreamTargetSync( string endPoint, string profileName, string source, Guid scheduleIdentifier, string target ) - { - // Use helper - BeginRequestAndWait( ( success, failure ) => SetStreamTarget( endPoint, profileName, source, scheduleIdentifier, target, success, failure ) ); - } + public static void SetStreamTargetSync(string endPoint, string profileName, string source, Guid scheduleIdentifier, string target) + => BeginRequestAndWait((success, failure) => SetStreamTarget(endPoint, profileName, source, scheduleIdentifier, target, success, failure)); /// /// Ermittelt alle Geräteprofile. @@ -542,22 +529,16 @@ public static void SetStreamTargetSync( string endPoint, string profileName, str /// Die Verbindung zum VCR.NET Recording Service. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void GetProfiles( string endPoint, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}/profile", endPoint ), "GET", success, failure ); - } + private static void GetProfiles(string endPoint, Action success, Action failure) + => BeginRequest(() => string.Format("{0}/profile/profiles", endPoint), "GET", success, failure); /// /// Ermittelt alle Geräteprofile. /// /// Die Verbindung zum VCR.NET Recording Service. /// Die gewünschte Liste. - public static ProfileInfo[] GetProfilesSync( string endPoint ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => GetProfiles( endPoint, success, failure ) ); - } + public static ProfileInfo[] GetProfilesSync(string endPoint) + => BeginRequestAndWait((success, failure) => GetProfiles(endPoint, success, failure)); /// /// Ermittelt die aktuellen und anstehenden Aktivitäten aller Geräteprofile. @@ -565,22 +546,16 @@ public static ProfileInfo[] GetProfilesSync( string endPoint ) /// Die Verbindung zum VCR.NET Recording Service. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - public static void GetActivities( string endPoint, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}/plan", endPoint ), "GET", success, failure ); - } + public static void GetActivities(string endPoint, Action success, Action failure) + => BeginRequest(() => string.Format("{0}/plan/current", endPoint), "GET", success, failure); /// /// Ermittelt die aktuellen und anstehenden Aktivitäten aller Geräteprofile. /// /// Die Verbindung zum VCR.NET Recording Service. /// Die gewünschte Liste. - public static Current[] GetActivitiesSync( string endPoint ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => GetActivities( endPoint, success, failure ) ); - } + public static Current[] GetActivitiesSync(string endPoint) + => BeginRequestAndWait((success, failure) => GetActivities(endPoint, success, failure)); /// /// Meldet alle Aktivitäten eines bestimmten Geräteprofils. @@ -588,16 +563,12 @@ public static Current[] GetActivitiesSync( string endPoint ) /// Die Verbindung zum VCR.NET Recording Service. /// Der Name des Profils. /// Die gewünschte Liste - public static List GetActivitiesForProfile( string endPoint, string profileName ) - { - // Forward - return - GetActivitiesSync( endPoint ) - .Where( activity => activity.IsActive ) - .Where( activity => activity.streamIndex >= 0 ) - .Where( activity => ProfileManager.ProfileNameComparer.Equals( activity.device, profileName ) ) + public static List GetActivitiesForProfile(string endPoint, string profileName) + => GetActivitiesSync(endPoint) + .Where(activity => activity.IsActive) + .Where(activity => activity.index >= 0) + .Where(activity => ProfileManager.ProfileNameComparer.Equals(activity.profileName, profileName)) .ToList(); - } /// /// Ermittelt die erste Aktivität zu einem Geräteprofil. @@ -605,13 +576,9 @@ public static List GetActivitiesForProfile( string endPoint, string pro /// Die Verbindung zum VCR.NET Recording Service. /// Der Name des Profils. /// Die erste Aktivität, sofern eine solche existiert. - public static Current GetFirstActivityForProfile( string endPoint, string profileName ) - { - // Forward - return - GetActivitiesSync( endPoint ) - .FirstOrDefault( activity => ProfileManager.ProfileNameComparer.Equals( activity.device, profileName ) ); - } + public static Current GetFirstActivityForProfile(string endPoint, string profileName) + => GetActivitiesSync(endPoint) + .FirstOrDefault(activity => ProfileManager.ProfileNameComparer.Equals(activity.profileName, profileName)); /// /// Legt eine neue Aufzeichnung an. @@ -621,11 +588,8 @@ public static Current GetFirstActivityForProfile( string endPoint, string profil /// Die Daten zur Aufzeichnung. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - private static void CreateNew( string endPoint, Job job, Schedule schedule, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}/edit", endPoint ), "POST", success, failure, new JobScheduleData { job = job, schedule = schedule } ); - } + private static void CreateNew(string endPoint, Job job, Schedule schedule, Action success, Action failure) + => BeginRequest(() => string.Format("{0}/edit/job", endPoint), "POST", success, failure, new JobScheduleData { job = job, schedule = schedule }, false); /// /// Legt eine neue Aufzeichnung an. @@ -634,11 +598,8 @@ private static void CreateNew( string endPoint, Job job, Schedule schedule, Acti /// Die Daten zum Auftrag. /// Die Daten zur Aufzeichnung. /// Die eindeutige Kennung der neuen Aufzeichnung. - public static string CreateNewSync( string endPoint, Job job, Schedule schedule ) - { - // Use helper - return BeginRequestAndWait( ( success, failure ) => CreateNew( endPoint, job, schedule, success, failure ) ); - } + public static string CreateNewSync(string endPoint, Job job, Schedule schedule) + => BeginRequestAndWait((success, failure) => CreateNew(endPoint, job, schedule, success, failure)); /// /// Fordert ein Stück einer Datei an. @@ -651,10 +612,7 @@ public static string CreateNewSync( string endPoint, Job job, Schedule schedule /// Der Port, an dem die Daten empfangen werden sollen. /// Wird im Erfolgsfall aufgerufen. /// Wird bei Fehlern aufgerufen. - public static void RequestFilePart( string endPoint, string path, long offset, int length, string target, ushort port, Action success, Action failure ) - { - // Use helper - BeginRequest( () => string.Format( "{0}/file?path={1}&offset={2}&length={3}&target={4}&port={5}", endPoint, path, offset, length, target, port ), "GET", success, failure ); - } + public static void RequestFilePart(string endPoint, string path, long offset, int length, string target, ushort port, Action success, Action failure) + => BeginRequest(() => string.Format("{0}/file?path={1}&offset={2}&length={3}&target={4}&port={5}", endPoint, path, offset, length, target, port), "GET", success, failure); } } diff --git a/DVB.NET Viewer/ViewerControl/ViewerControl.cs b/DVB.NET Viewer/ViewerControl/ViewerControl.cs index 00631de..623d8a4 100644 --- a/DVB.NET Viewer/ViewerControl/ViewerControl.cs +++ b/DVB.NET Viewer/ViewerControl/ViewerControl.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Drawing; using System.Security; using System.Windows.Forms; @@ -49,7 +48,7 @@ private class _OSDText : IDisposable /// Die zugehörige Anzeigeeinheit. /// Die Konstruktionseinheit. /// Die Art des Inhalts. - public _OSDText( ViewerControl viewer, OSDText builder, OSDShowMode mode ) + public _OSDText(ViewerControl viewer, OSDText builder, OSDShowMode mode) { // Remember Builder = builder; @@ -73,7 +72,7 @@ public void Dispose() Builder = null; // Update - m_Viewer.OSDShown( m_Mode ); + m_Viewer.OSDShown(m_Mode); } #endregion @@ -87,16 +86,16 @@ public void Dispose() /// /// Zeigt an, dass der Videotext aktiv ist. /// - private static readonly DateTime TTXOnTime = DateTime.MaxValue.AddSeconds( -1 ); + private static readonly DateTime TTXOnTime = DateTime.MaxValue.AddSeconds(-1); /// /// Prüft, ob eine bestimmte Taste gedrückt ist. /// /// Zu prüfende Taste. /// Ergebnis der Prüfung. - [DllImport( "user32.dll" )] + [DllImport("user32.dll")] [SuppressUnmanagedCodeSecurity] - private static extern short GetAsyncKeyState( int virtualKey ); + private static extern short GetAsyncKeyState(int virtualKey); /// /// Die Senderverwaltung mit Favoritenfähigkeit. @@ -248,7 +247,7 @@ public ViewerControl() InitializeComponent(); // Create favorite manager - m_FavoriteManager = new ChannelSelector( true ); + m_FavoriteManager = new ChannelSelector(true); // Connect to events m_FavoriteManager.ChannelSelected += ChannelSelected; @@ -267,32 +266,32 @@ public ViewerControl() /// /// Ignoriert. /// Informationen zur Veränderung. - private void MouseWheelChanged( object sender, MouseEventArgs e ) + private void MouseWheelChanged(object sender, MouseEventArgs e) { // See if we should control the volume if (m_LastOSDWasList) { // Check for change if (e.Delta > 0) - ListUp( Keys.Up ); + ListUp(Keys.Up); else if (e.Delta < 0) - ListDown( Keys.Down ); + ListDown(Keys.Down); } else if (m_LastProgressWasFile) { // Check for change if (e.Delta > 0) - ExecuteKey( Keys.Add ); + ExecuteKey(Keys.Add); else if (e.Delta < 0) - ExecuteKey( Keys.Subtract ); + ExecuteKey(Keys.Subtract); } else { // Check for change if (e.Delta > 0) - VolumeUp( Keys.Right ); + VolumeUp(Keys.Right); else if (e.Delta < 0) - VolumeDown( Keys.Left ); + VolumeDown(Keys.Left); } } @@ -300,7 +299,7 @@ private void MouseWheelChanged( object sender, MouseEventArgs e ) /// Verbindet das Control mit dem Zugriff auf die Konfiguration. /// /// Ermöglicht den Zugriff auf die Einstellungen. - public void SetSite( object settings ) + public void SetSite(object settings) { // Attach to all interfaces provided m_GeneralInfo = settings as IGeneralInfo; @@ -310,14 +309,14 @@ public void SetSite( object settings ) m_LocalInfo = settings as ILocalInfo; // Load initial settings - m_Handlers = new Dictionary( directShow.KeyProcessors ); + m_Handlers = new Dictionary(directShow.KeyProcessors); } /// /// Verbindet die Anzeige mit einem Adaptor. /// /// Die zu verwendende Quelle. - public void Initialize( Adaptor adaptor ) + public void Initialize(Adaptor adaptor) { // Remember m_CurrentAdaptor = adaptor; @@ -333,7 +332,7 @@ public void Initialize( Adaptor adaptor ) directShow.AC3Decoder = GeneralInfo.AC3Decoder; // Initialize DirectShow window - directShow.SetAccessor( m_CurrentAdaptor.Accessor ); + directShow.SetAccessor(m_CurrentAdaptor.Accessor); // Set the volume directShow.Volume = GeneralInfo.Volume; @@ -345,7 +344,7 @@ public void Initialize( Adaptor adaptor ) if (null != parameters) { // Update - GeneralInfo.SetPictureParameters( parameters ); + GeneralInfo.SetPictureParameters(parameters); // Send to window directShow.PictureParameters = parameters; @@ -355,14 +354,14 @@ public void Initialize( Adaptor adaptor ) signalTest.Enabled = true; // Finish initialisation - Restart( true ); + Restart(true); } /// /// Mit dem Drücken der rechten Maustaste wird das Kontextmenü geöffnet. /// /// Taste, die der Anwender betätigt hat. - private void RightClick( Keys key ) + private void RightClick(Keys key) { // Must have adaptor if (null == m_CurrentAdaptor) return; @@ -371,46 +370,44 @@ private void RightClick( Keys key ) selScratch.Items.Clear(); // Funktionen, die in jedem Operationsmodus zur Verfügung stehen - selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Fullscreen, () => ExecuteKey( Keys.J ) ) ); - selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Volume, () => VolumeChange( 0 ) ) ); - selScratch.Items.Add( " " ); - selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_EPG, () => ExecuteKey( Keys.F1 ) ) ); - if (m_CurrentAdaptor.TTXAvailable) selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_VideoText, () => ExecuteKey( Keys.F2 ) ) ); + selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Fullscreen, () => ExecuteKey(Keys.J))); + selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Volume, () => VolumeChange(0))); + selScratch.Items.Add(" "); + selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_EPG, () => ExecuteKey(Keys.F1))); + if (m_CurrentAdaptor.TTXAvailable) selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_VideoText, () => ExecuteKey(Keys.F2))); // Optionale Listen Keys? station = m_CurrentAdaptor.StationListKey, audio = m_CurrentAdaptor.TrackListKey, nvod = m_CurrentAdaptor.ServiceListKey, rec = m_CurrentAdaptor.RecordingKey, tshift = m_CurrentAdaptor.TimeShiftKey; string recText = m_CurrentAdaptor.RecordingText; // Alle Listen - if (station.HasValue) selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Channels, () => ExecuteKey( station.Value ) ) ); - if (audio.HasValue) selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Audio, () => ExecuteKey( audio.Value ) ) ); - if (nvod.HasValue) selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Service, () => ExecuteKey( nvod.Value ) ) ); + if (station.HasValue) selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Channels, () => ExecuteKey(station.Value))); + if (audio.HasValue) selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Audio, () => ExecuteKey(audio.Value))); + if (nvod.HasValue) selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Service, () => ExecuteKey(nvod.Value))); // Trenner - selScratch.Items.Add( " " ); + selScratch.Items.Add(" "); // Aufzeichnung - if (rec.HasValue) selScratch.Items.Add( new OptionDisplay( recText, () => ExecuteKey( rec.Value ) ) ); - if (tshift.HasValue) selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_TimeShift, () => ExecuteKey( tshift.Value ) ) ); + if (rec.HasValue) selScratch.Items.Add(new OptionDisplay(recText, () => ExecuteKey(rec.Value))); + if (tshift.HasValue) selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_TimeShift, () => ExecuteKey(tshift.Value))); // Funktionen, die in jedem Operationsmodus zur Verfügung stehen - selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Options, () => ExecuteKey( (Keys) 219 ) ) ); - selScratch.Items.Add( " " ); - selScratch.Items.Add( new OptionDisplay( Properties.Resources.Context_Quit, () => ExecuteKey( Keys.End ) ) ); + selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Options, () => ExecuteKey((Keys)219))); + selScratch.Items.Add(" "); + selScratch.Items.Add(new OptionDisplay(Properties.Resources.Context_Quit, () => ExecuteKey(Keys.End))); // Anzeigen - ShowList( Properties.Resources.ContextTitle, selScratch, 0, OSDShowMode.ContextMenu ); + ShowList(Properties.Resources.ContextTitle, selScratch, 0, OSDShowMode.ContextMenu); } /// /// Führt die Aktion zu einer Taste aus. /// /// Die gwünschte Taste. - private void ExecuteKey( Keys key ) + private void ExecuteKey(Keys key) { - // Load - BDAWindow.KeyProcessor processor; - if (directShow.KeyProcessors.TryGetValue( key, out processor )) processor( key ); + if (directShow.KeyProcessors.TryGetValue(key, out var processor)) processor(key); } /// @@ -419,18 +416,18 @@ private void ExecuteKey( Keys key ) /// Die Senderverwaltung. /// Der Name des neuen NVOD Dienstes. /// Das zum NVOD Dienst. - private void ServiceSelected( ChannelSelector selector, string serviceName, object context ) + private void ServiceSelected(ChannelSelector selector, string serviceName, object context) { // Be safe try { // Forward - ShowName( m_CurrentAdaptor.SetService( (ServiceItem) context ) ); + ShowName(m_CurrentAdaptor.SetService((ServiceItem)context)); } catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -439,18 +436,18 @@ private void ServiceSelected( ChannelSelector selector, string serviceName, obje /// /// Die Senderverwaltung. /// Der Name der gewünschten Tonspur. - private void TrackSelected( ChannelSelector selector, string audioName ) + private void TrackSelected(ChannelSelector selector, string audioName) { // Be safe try { // Forward - ShowName( m_CurrentAdaptor.SetAudio( audioName ) ); + ShowName(m_CurrentAdaptor.SetAudio(audioName)); } catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -460,10 +457,10 @@ private void TrackSelected( ChannelSelector selector, string audioName ) /// /// Anzuzeigender Name oder null, wenn keine Anzeige /// erfolgen soll. - private void ShowName( string fullName ) + private void ShowName(string fullName) { // Nothing to show - if (!string.IsNullOrEmpty( fullName )) ShowMessage( fullName, Properties.Resources.NameTitle, true ); + if (!string.IsNullOrEmpty(fullName)) ShowMessage(fullName, Properties.Resources.NameTitle, true); } /// @@ -473,18 +470,18 @@ private void ShowName( string fullName ) /// Der Anzeigename des Sender. /// Eine beliebige Instanz zu einem Sender, wie sie im aktuellen /// verstanden wird. - private void ChannelSelected( ChannelSelector selector, string channelName, object context ) + private void ChannelSelected(ChannelSelector selector, string channelName, object context) { // Be safe try { // Process - ShowName( m_CurrentAdaptor.SetStation( context ) ); + ShowName(m_CurrentAdaptor.SetStation(context)); } catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -501,8 +498,8 @@ private void LoadKeys() // Keys mapped to core implementation directShow.KeyProcessors[Keys.Subtract] = PreviousChannel; directShow.KeyProcessors[Keys.PageDown] = ListPageDown; - directShow.KeyProcessors[(Keys) 189] = PreviousChannel; - directShow.KeyProcessors[(Keys) 191] = StartRecording; + directShow.KeyProcessors[(Keys)189] = PreviousChannel; + directShow.KeyProcessors[(Keys)191] = StartRecording; directShow.KeyProcessors[Keys.RButton] = RightClick; directShow.KeyProcessors[Keys.LButton] = LeftClick; directShow.KeyProcessors[Keys.K] = ShowChannelList; @@ -518,8 +515,8 @@ private void LoadKeys() directShow.KeyProcessors[Keys.NumPad7] = ProcessAs; directShow.KeyProcessors[Keys.NumPad8] = ProcessAs; directShow.KeyProcessors[Keys.NumPad9] = ProcessAs; - directShow.KeyProcessors[(Keys) 187] = NextChannel; - directShow.KeyProcessors[(Keys) 219] = ShowOptions; + directShow.KeyProcessors[(Keys)187] = NextChannel; + directShow.KeyProcessors[(Keys)219] = ShowOptions; directShow.KeyProcessors[Keys.Escape] = EscapeKey; directShow.KeyProcessors[Keys.D0] = ForwardTTXKey; directShow.KeyProcessors[Keys.D1] = ForwardTTXKey; @@ -536,6 +533,8 @@ private void LoadKeys() directShow.KeyProcessors[Keys.L] = ShowAudioList; directShow.KeyProcessors[Keys.Left] = VolumeDown; directShow.KeyProcessors[Keys.Right] = VolumeUp; + directShow.KeyProcessors[Keys.F5] = ToggleMute; + directShow.KeyProcessors[Keys.F6] = Synchronize; directShow.KeyProcessors[Keys.Down] = ListDown; directShow.KeyProcessors[Keys.Return] = Select; directShow.KeyProcessors[Keys.Enter] = Select; @@ -569,7 +568,7 @@ private void LoadKeys() /// Interpretiert eine Taste um. /// /// Die tatsächlich gedrückte Taste. - private void ProcessAs( Keys key ) + private void ProcessAs(Keys key) { // Remap switch (key) @@ -592,26 +591,26 @@ private void ProcessAs( Keys key ) // Run if (processor != null) - processor( key ); + processor(key); } /// /// Die linke Masutaste wurde gedrückt, was als Auswahl in der aktuellen Liste interpretiert wird. /// /// Die vom Anwender betätigte Taste. - private void LeftClick( Keys key ) + private void LeftClick(Keys key) { // Check for consistency and process if (OSDActive) if (m_LastOSDWasList) { // Select the entry - Select( Keys.Enter ); + Select(Keys.Enter); } else if (m_LastProgressWasFile) { // File movements are triggered using the record key - ExecuteKey( (Keys) 191 ); + ExecuteKey((Keys)191); } else if (IsVideoTextActive) { @@ -627,7 +626,7 @@ private void LeftClick( Keys key ) return; // Find the page - int? page = m_TTXDigits.GetPageAt( ttxHit.Value ); + int? page = m_TTXDigits.GetPageAt(ttxHit.Value); // Use if if (page.HasValue) @@ -646,7 +645,7 @@ private void LeftClick( Keys key ) /// Zeigt EPG Informationen an, falls vorhanden. /// /// Vom Anwender gedrückte Taste. - private void ShowEPG( Keys key ) + private void ShowEPG(Keys key) { // End display HideOSD(); @@ -660,7 +659,7 @@ private void ShowEPG( Keys key ) /// Zeigt die Videotext Seite 100 an. /// /// Vom Anwender gedrückte Taste. - private void ShowTTX( Keys key ) + private void ShowTTX(Keys key) { // Check cuurent state var showingText = (m_OSDShowMode == OSDShowMode.Videotext); @@ -700,10 +699,10 @@ public bool IsVideoTextActive /// /// /// Die Taste, die der Anwender gedrückt hat. - private void ForwardTTXKey( Keys key ) + private void ForwardTTXKey(Keys key) { // Forward if not eaten up by TTX - if (!PreprocessKey( key )) ForwardKey( key ); + if (!PreprocessKey(key)) ForwardKey(key); } /// @@ -711,7 +710,7 @@ private void ForwardTTXKey( Keys key ) /// /// Die gedrückte Taste. /// Gesetzt, wenn die Taste verarbeitet wurde. - public bool PreprocessKey( Keys key ) + public bool PreprocessKey(Keys key) { // See if this is the END key if (Keys.End == key) return IsRecording; @@ -726,12 +725,12 @@ public bool PreprocessKey( Keys key ) int page; // Move down or up - if ((Keys.Subtract == key) || ((Keys) 189 == key)) + if ((Keys.Subtract == key) || ((Keys)189 == key)) { // Down page = -1; } - else if ((Keys.Add == key) || ((Keys) 187 == key)) + else if ((Keys.Add == key) || ((Keys)187 == key)) { // Up page = +1; @@ -770,13 +769,13 @@ public bool PreprocessKey( Keys key ) // Create a string from the page if ((m_TTXPageBuilder > 0) && (m_TTXPageBuilder < 100)) - m_PendingTTXPage = string.Format( "{0}??", m_TTXPageBuilder ).Substring( 0, 3 ); + m_PendingTTXPage = string.Format("{0}??", m_TTXPageBuilder).Substring(0, 3); else m_PendingTTXPage = null; // Refresh if (m_CurrentTTXPage != null) - ShowTTXPage( m_CurrentTTXPage ); + ShowTTXPage(m_CurrentTTXPage); // Check mode if ((m_TTXPageBuilder < 100) || (m_TTXPageBuilder > 899)) @@ -804,27 +803,50 @@ public bool PreprocessKey( Keys key ) /// Increase volume. /// /// Ignored. - private void VolumeUp( Keys key ) + private void VolumeUp(Keys key) { // Forward - VolumeChange( +0.01 ); + VolumeChange(+0.01); } /// /// Decrease volume. /// /// Ignored. - private void VolumeDown( Keys key ) + private void VolumeDown(Keys key) { // Forward - VolumeChange( -0.01 ); + VolumeChange(-0.01); + } + + /// + /// Toggle volume mute. + /// + /// Ignored. + private void ToggleMute(Keys key) + { + // Not possible + if (m_GeneralInfo == null) return; + + // Get new volume. + var volume = directShow.Volume <= 0.01 ? Math.Min(1, Math.Max(0, m_GeneralInfo.Volume)) : 0; + + // Send + directShow.Volume = volume; + + // Report + using (var osd = CreateTextOverlay(1, string.Format(Properties.Resources.VolumeTitle, (int)(volume * 100)), OSDShowMode.Volume)) + osd.Builder.ShowProgress(volume, true); + + // Remember what we are doing + m_LastProgressWasFile = false; } /// /// Beginnt oder beendet eine Aufzeichnung. /// /// - private void StartRecording( Keys key ) + private void StartRecording(Keys key) { // Be safe try @@ -835,7 +857,7 @@ private void StartRecording( Keys key ) catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -854,7 +876,7 @@ private bool IsRecording if (!m_CurrentAdaptor.IsRecording) return false; // Report - ShowMessage( string.Format( Properties.Resources.RecordingActive, m_CurrentAdaptor.RecordedBytes / 1024 ), Properties.Resources.RecordingTitle, true ); + ShowMessage(string.Format(Properties.Resources.RecordingActive, m_CurrentAdaptor.RecordedBytes / 1024), Properties.Resources.RecordingTitle, true); // Yes return true; @@ -866,7 +888,7 @@ private bool IsRecording /// aktiv ist. /// /// Aktuelle Eingabe. - private void ForwardKey( Keys key ) + private void ForwardKey(Keys key) { // Not while recording if (IsRecording) return; @@ -875,7 +897,7 @@ private void ForwardKey( Keys key ) HideOSD(); // Send - m_FavoriteManager.AnalyseStandardKey( key ); + m_FavoriteManager.AnalyseStandardKey(key); } /// @@ -883,10 +905,10 @@ private void ForwardKey( Keys key ) /// Aufzeichnung aktiv ist. /// /// Aktuelle Eingabe. - private void NextChannel( Keys key ) + private void NextChannel(Keys key) { // Check for videotext - if (PreprocessKey( key )) return; + if (PreprocessKey(key)) return; // Not while recording if (IsRecording) return; @@ -895,7 +917,7 @@ private void NextChannel( Keys key ) HideOSD(); // Forward - m_FavoriteManager.AnalyseStandardKey( '+' ); + m_FavoriteManager.AnalyseStandardKey('+'); } /// @@ -903,10 +925,10 @@ private void NextChannel( Keys key ) /// Aufzeichnung aktiv ist. /// /// Aktuelle Eingabe. - private void PreviousChannel( Keys key ) + private void PreviousChannel(Keys key) { // Check for videotext - if (PreprocessKey( key )) return; + if (PreprocessKey(key)) return; // Not while recording if (IsRecording) return; @@ -915,14 +937,14 @@ private void PreviousChannel( Keys key ) HideOSD(); // Forward - m_FavoriteManager.AnalyseStandardKey( '-' ); + m_FavoriteManager.AnalyseStandardKey('-'); } /// /// Deaktiviert das OSD. /// /// Aktuelle Eingabe. - private void EscapeKey( Keys key ) + private void EscapeKey(Keys key) { // Hide HideOSD(); @@ -936,7 +958,7 @@ private void EscapeKey( Keys key ) /// Im Allgemeinen erfolgt eine Weitergabe an die Senderverwaltung. /// /// Aktuelle Eingabe. - private void Select( Keys key ) + private void Select(Keys key) { // Not while recording if (IsRecording) return; @@ -984,12 +1006,12 @@ private void Select( Keys key ) Application.DoEvents(); // Process - m_FavoriteManager.FinishSelection( m_CurrentList ); + m_FavoriteManager.FinishSelection(m_CurrentList); } catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -997,7 +1019,7 @@ private void Select( Keys key ) /// Verschiebt den aktiven Eintrag der aktuellen Auswahlliste im OSD. /// /// Gibt an, wie die Verschiebung durchzuführen ist. - private void MoveListIndex( int delta ) + private void MoveListIndex(int delta) { // Do nothing if (m_CurrentList == null) @@ -1009,10 +1031,10 @@ private void MoveListIndex( int delta ) try { // Update - m_CurrentList.SelectedIndex = Math.Max( 0, Math.Min( m_CurrentList.Items.Count - 1, m_CurrentList.SelectedIndex + delta ) ); + m_CurrentList.SelectedIndex = Math.Max(0, Math.Min(m_CurrentList.Items.Count - 1, m_CurrentList.SelectedIndex + delta)); // Show up - ShowList( 0, m_OSDShowMode ); + ShowList(0, m_OSDShowMode); } catch { @@ -1025,13 +1047,13 @@ private void MoveListIndex( int delta ) /// wenn keine Aufzeichnung aktiv ist. /// /// Aktuelle Eingabe - private void ListUp( Keys key ) + private void ListUp(Keys key) { // Not while recording if (IsRecording) return; // Process - MoveListIndex( -1 ); + MoveListIndex(-1); } /// @@ -1039,13 +1061,13 @@ private void ListUp( Keys key ) /// wenn keine Aufzeichnung aktiv ist. /// /// Aktuelle Eingabe - private void ListDown( Keys key ) + private void ListDown(Keys key) { // Not while recording if (IsRecording) return; // Process - MoveListIndex( +1 ); + MoveListIndex(+1); } /// @@ -1057,13 +1079,13 @@ private void ListDown( Keys key ) /// zum Anfang der Auswahlliste hin verschoben. /// /// Aktuelle Eingabe - private void ListPageUp( Keys key ) + private void ListPageUp(Keys key) { // Not while recording if (IsRecording) return; // Process - MoveListIndex( -m_Overlay.MaximumNumberOfLines ); + MoveListIndex(-m_Overlay.MaximumNumberOfLines); } /// @@ -1075,13 +1097,13 @@ private void ListPageUp( Keys key ) /// zum Ende der Auswahlliste hin verschoben. /// /// Aktuelle Eingabe - private void ListPageDown( Keys key ) + private void ListPageDown(Keys key) { // Not while recording if (IsRecording) return; // Process - MoveListIndex( +m_Overlay.MaximumNumberOfLines ); + MoveListIndex(+m_Overlay.MaximumNumberOfLines); } /// @@ -1090,7 +1112,7 @@ private void ListPageDown( Keys key ) /// Enthält die Liste weniger Einträge als diese /// Zahl, so wird das OSD nicht angezeigt. /// Die Art der angezeigten Daten. - private void ShowList( int minShow, OSDShowMode mode ) + private void ShowList(int minShow, OSDShowMode mode) { // Too few items in list if (m_CurrentList.Items.Count < minShow) @@ -1104,19 +1126,19 @@ private void ShowList( int minShow, OSDShowMode mode ) } // Get the minimum to show - int lowIndex = Math.Max( 0, m_CurrentList.SelectedIndex - m_Overlay.MaximumNumberOfLines / 2 ); - int highIndex = Math.Min( m_CurrentList.Items.Count, lowIndex + m_Overlay.MaximumNumberOfLines ); + int lowIndex = Math.Max(0, m_CurrentList.SelectedIndex - m_Overlay.MaximumNumberOfLines / 2); + int highIndex = Math.Min(m_CurrentList.Items.Count, lowIndex + m_Overlay.MaximumNumberOfLines); // Start OSD - using (var osd = CreateTextOverlay( m_Overlay.MaximumNumberOfLines, m_CurrentHead, mode )) + using (var osd = CreateTextOverlay(m_Overlay.MaximumNumberOfLines, m_CurrentHead, mode)) { // Normal lines for (int i = lowIndex; i < highIndex; ++i) - osd.Builder.WriteLine( i == m_CurrentList.SelectedIndex, m_CurrentList.Items[i].ToString() ); + osd.Builder.WriteLine(i == m_CurrentList.SelectedIndex, m_CurrentList.Items[i].ToString()); // Bug to feature to use empty line if (highIndex < m_CurrentList.Items.Count) - osd.Builder.WriteLine( "..." ); + osd.Builder.WriteLine("..."); } // Set @@ -1133,7 +1155,7 @@ private void ShowList( int minShow, OSDShowMode mode ) /// Enthält die Liste weniger als diese Anzahl von /// Einträgen, so wird sie nicht angezeigt. /// Die Art der angezeigten Daten. - public void ShowList( string headline, ComboBox selection, int minShow, OSDShowMode mode ) + public void ShowList(string headline, ComboBox selection, int minShow, OSDShowMode mode) { // Double means off if (m_OSDShowMode == mode) @@ -1148,7 +1170,7 @@ public void ShowList( string headline, ComboBox selection, int minShow, OSDShowM m_CurrentHead = headline; // Forward - ShowList( minShow, mode ); + ShowList(minShow, mode); } } @@ -1157,13 +1179,13 @@ public void ShowList( string headline, ComboBox selection, int minShow, OSDShowM /// zur aktuellen Auswahlliste im OSD und diese anzeigt. /// /// Aktuelle Eingabe. - private void ShowOptions( Keys key ) + private void ShowOptions(Keys key) { // Not while recording if (IsRecording) return; // Process - ShowList( Properties.Resources.OptionListHeadLine, selOptions, 1, OSDShowMode.ContextMenu ); + ShowList(Properties.Resources.OptionListHeadLine, selOptions, 1, OSDShowMode.ContextMenu); } /// @@ -1171,26 +1193,26 @@ private void ShowOptions( Keys key ) /// zur aktuellen Auswahlliste im OSD und diese anzeigt. /// /// Aktuelle Eingabe. - private void ShowChannelList( Keys key ) + private void ShowChannelList(Keys key) { // Not while recording if (IsRecording) return; // Process - ShowList( Properties.Resources.ChannelListHeadLine, m_FavoriteManager.ChannelList, 1, OSDShowMode.SourceList ); + ShowList(Properties.Resources.ChannelListHeadLine, m_FavoriteManager.ChannelList, 1, OSDShowMode.SourceList); } /// /// Wählt einen NVOD Dienst über sein Kürzel aus, wenn keine Aufzeichnung aktiv ist. /// /// Aktuelle Eingabe. - private void ServiceKey( Keys key ) + private void ServiceKey(Keys key) { // Not while recording if (IsRecording) return; // Load list - if (LoadServiceList()) m_FavoriteManager.AnalyseStandardKey( key ); + if (LoadServiceList()) m_FavoriteManager.AnalyseStandardKey(key); } /// @@ -1198,13 +1220,13 @@ private void ServiceKey( Keys key ) /// NVOD Dienste erzeugt und diese angezeigt. /// /// Aktuelle Eingabe. - private void ShowServiceList( Keys key ) + private void ShowServiceList(Keys key) { // Not while recording if (IsRecording) return; // Load list - if (LoadServiceList()) ShowList( Properties.Resources.ServiceListHeadLine, m_FavoriteManager.ServiceList, 2, OSDShowMode.Services ); + if (LoadServiceList()) ShowList(Properties.Resources.ServiceListHeadLine, m_FavoriteManager.ServiceList, 2, OSDShowMode.Services); } /// @@ -1224,7 +1246,7 @@ private bool LoadServiceList() foreach (ServiceItem service in m_CurrentAdaptor.Services) { // Add to list - m_FavoriteManager.AddService( service.ToString(), service ); + m_FavoriteManager.AddService(service.ToString(), service); } // Finished @@ -1236,7 +1258,7 @@ private bool LoadServiceList() catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); // Do not proceed return false; @@ -1248,7 +1270,7 @@ private bool LoadServiceList() /// zur aktuellen Auswahlliste im OSD und diese anzeigt. /// /// Aktuelle Eingabe. - private void ShowAudioList( Keys key ) + private void ShowAudioList(Keys key) { // Not while recording if (IsRecording) return; @@ -1257,14 +1279,14 @@ private void ShowAudioList( Keys key ) if (null != m_CurrentAdaptor) m_CurrentAdaptor.LoadTracks(); // Process - ShowList( Properties.Resources.AudioListHeadLine, m_FavoriteManager.AudioList, 2, OSDShowMode.AudioTracks ); + ShowList(Properties.Resources.AudioListHeadLine, m_FavoriteManager.AudioList, 2, OSDShowMode.AudioTracks); } /// /// Zeigt die aktuelle zeitliche Position. /// /// Aktuelle Eingabe. - private void ShowPosition( Keys key ) + private void ShowPosition(Keys key) { // Turn off display HideOSD(); @@ -1291,7 +1313,7 @@ private void ShowPosition( Keys key ) if (pos > current.Duration) pos = current.Duration; // Get the relative position - ShowPosition( pos.TotalMilliseconds / current.Duration.TotalMilliseconds, string.Format( Properties.Resources.EPGPosition, (int) (pos.TotalMinutes + 0.5), (int) (current.Duration.TotalMinutes + 0.5) ) ); + ShowPosition(pos.TotalMilliseconds / current.Duration.TotalMilliseconds, string.Format(Properties.Resources.EPGPosition, (int)(pos.TotalMinutes + 0.5), (int)(current.Duration.TotalMinutes + 0.5))); } /// @@ -1300,7 +1322,7 @@ private void ShowPosition( Keys key ) /// Reinitialisert. /// /// Gesetzt, wenn die Anwendung in der Initialisierungsphase ist. - private void Restart( bool applicationStart ) + private void Restart(bool applicationStart) { // Configure graph directShow.UseCyberlink = GeneralInfo.UseCyberlinkCodec; @@ -1323,12 +1345,12 @@ private void Restart( bool applicationStart ) m_CurrentAdaptor.LoadStations(); // Load defaults - ShowName( m_CurrentAdaptor.LoadDefaults( applicationStart ) ); + ShowName(m_CurrentAdaptor.LoadDefaults(applicationStart)); } catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -1338,7 +1360,7 @@ private void Restart( bool applicationStart ) /// /// Wird ignoriert. /// Wird ignoriert. - private void osdOff_Tick( object sender, EventArgs e ) + private void osdOff_Tick(object sender, EventArgs e) { // Not yet if (DateTime.UtcNow < m_OSDOff) return; @@ -1365,16 +1387,16 @@ public bool OSDActive /// /// Wird ignoriert. /// Wird ignoriert. - private void signalTest_Tick( object sender, EventArgs e ) + private void signalTest_Tick(object sender, EventArgs e) { // Be safe try { // Load current tick counter - int tick = ((int?) signalTest.Tag) ?? 10; + int tick = ((int?)signalTest.Tag) ?? 10; // Run the keep alive test - m_CurrentAdaptor.KeepAlive( --tick > 0 ); + m_CurrentAdaptor.KeepAlive(--tick > 0); // Store back signalTest.Tag = (0 == tick) ? 10 : tick; @@ -1397,7 +1419,7 @@ private void signalTest_Tick( object sender, EventArgs e ) catch (Exception ex) { // Report - ShowError( ex ); + ShowError(ex); } } @@ -1406,13 +1428,13 @@ private void signalTest_Tick( object sender, EventArgs e ) /// Es erfolgt eine entsprechende Visualisierung im OSD. /// /// Change of volume. - private void VolumeChange( double delta ) + private void VolumeChange(double delta) { // Not possible - if (null == m_GeneralInfo) return; + if (m_GeneralInfo == null) return; // Process - double volume = Math.Min( 1, Math.Max( 0, m_GeneralInfo.Volume + delta ) ); + var volume = Math.Min(1, Math.Max(0, m_GeneralInfo.Volume + delta)); // No change at all if (volume == m_GeneralInfo.Volume) @@ -1426,11 +1448,8 @@ private void VolumeChange( double delta ) directShow.Volume = volume; // Report - using (var osd = CreateTextOverlay( 1, string.Format( Properties.Resources.VolumeTitle, (int) (volume * 100) ), OSDShowMode.Volume )) - { - // Fill - osd.Builder.ShowProgress( volume, true ); - } + using (var osd = CreateTextOverlay(1, string.Format(Properties.Resources.VolumeTitle, (int)(volume * 100)), OSDShowMode.Volume)) + osd.Builder.ShowProgress(volume, true); // Remember what we are doing m_LastProgressWasFile = false; @@ -1440,23 +1459,23 @@ private void VolumeChange( double delta ) /// Zeigt eine Fehlermeldung im OSD an. /// /// Der aufgetretene Fehler. - public void ShowError( Exception e ) + public void ShowError(Exception e) { // Show message - ShowMessage( e.Message, Properties.Resources.ErrorTitle, false ); + ShowMessage(e.Message, Properties.Resources.ErrorTitle, false); } /// /// Zeigt eine Videotext Seite an. /// /// - private void ShowTTXPage( TTXPage page ) + private void ShowTTXPage(TTXPage page) { // Sychnronize if (InvokeRequired) { // Execute - BeginInvoke( new TTXParser.PageHandler( ShowTTXPage ), page ); + BeginInvoke(new TTXParser.PageHandler(ShowTTXPage), page); // Done return; @@ -1469,7 +1488,7 @@ private void ShowTTXPage( TTXPage page ) page.Feedback = m_PendingTTXPage; // Create it - if (!m_Overlay.ShowPage( page, out m_TTXDigits )) + if (!m_Overlay.ShowPage(page, out m_TTXDigits)) { // Ups - failed HideOSD(); @@ -1480,7 +1499,7 @@ private void ShowTTXPage( TTXPage page ) m_CurrentTTXPage = page; // Report - OSDShown( OSDShowMode.Videotext ); + OSDShown(OSDShowMode.Videotext); // Nearly (no) automatic termination of OSD m_OSDOff = TTXOnTime; @@ -1489,7 +1508,7 @@ private void ShowTTXPage( TTXPage page ) catch (Exception e) { // Report error - ShowError( e ); + ShowError(e); // Done return; @@ -1513,20 +1532,20 @@ private void ShowTTXPage( TTXPage page ) /// Vollbildmodus, wird dieser Parameter ignoriert und das OSD ist undurchsichtig. /// Optional durchsichtige Farbe. /// Die Art der angezeigten Daten. - private void ShowOSD( Bitmap bitmap, double left, double top, double right, double bottom, double? alpha, Color? transparent, OSDShowMode mode ) + private void ShowOSD(Bitmap bitmap, double left, double top, double right, double bottom, double? alpha, Color? transparent, OSDShowMode mode) { // Update - m_Overlay.ShowOverlay( bitmap, left, top, right, bottom, alpha, transparent ); + m_Overlay.ShowOverlay(bitmap, left, top, right, bottom, alpha, transparent); // Report - OSDShown( mode ); + OSDShown(mode); } /// /// Bestätigt die Anzeige einer Überblendung. /// /// Die Art der angezeigten Daten. - private void OSDShown( OSDShowMode mode ) + private void OSDShown(OSDShowMode mode) { // Reset m_OSDShowMode = (mode == OSDShowMode.Nothing) ? OSDShowMode.Other : mode; @@ -1541,7 +1560,7 @@ private void OSDShown( OSDShowMode mode ) m_CanSelect = true; // Start the OSD timer - m_OSDOff = DateTime.UtcNow.AddSeconds( GeneralInfo.OSDLifeTime ); + m_OSDOff = DateTime.UtcNow.AddSeconds(GeneralInfo.OSDLifeTime); } /// @@ -1551,10 +1570,10 @@ private void OSDShown( OSDShowMode mode ) /// Die gewünschte Überschrift. /// Die Art der angezeigten Daten. /// Die Steuerungseinheit. - private _OSDText CreateTextOverlay( int lines, string headline, OSDShowMode mode ) + private _OSDText CreateTextOverlay(int lines, string headline, OSDShowMode mode) { // Forward - return new _OSDText( this, m_Overlay.CreateTextOverlay( lines, headline, true ), mode ); + return new _OSDText(this, m_Overlay.CreateTextOverlay(lines, headline, true), mode); } /// @@ -1572,10 +1591,10 @@ private _OSDText CreateTextOverlay( int lines, string headline, OSDShowMode mode /// Vollbildmodus, wird dieser Parameter ignoriert und das OSD ist undurchsichtig. /// Optional durchsichtige Farbe. /// Die Art der angezeigten Daten. - void IOSDSite.Show( Bitmap bitmap, double left, double top, double right, double bottom, double? alpha, Color? transparent, OSDShowMode mode ) + void IOSDSite.Show(Bitmap bitmap, double left, double top, double right, double bottom, double? alpha, Color? transparent, OSDShowMode mode) { // Forward - ShowOSD( bitmap, left, top, right, bottom, alpha, transparent, mode ); + ShowOSD(bitmap, left, top, right, bottom, alpha, transparent, mode); } /// @@ -1586,7 +1605,7 @@ public bool UsesOverlay get { // Report - return ((GetAsyncKeyState( 16 ) >= 0) && (directShow.VideoBytesReceived > 0)); + return ((GetAsyncKeyState(16) >= 0) && (directShow.VideoBytesReceived > 0)); } } @@ -1611,14 +1630,14 @@ private void HideOSD() m_CurrentAdaptor.VideoText.CurrentPage = null; // Forward - HideOSD( true ); + HideOSD(true); } /// /// Entfernt das OSD. /// /// Gesetzt, wenn all visuellen OSD Element ausgeblendet werden sollen. - private void HideOSD( bool hideControls ) + private void HideOSD(bool hideControls) { // Clear reset timer m_OSDOff = OSDOffTime; @@ -1669,21 +1688,21 @@ ChannelSelector IViewerSite.FavoriteManager /// Die Nachricht. /// Überschrift für das Nachrichtenfeld. /// Gesetzt, wenn das echte OSD verwendet werden soll. - private void ShowMessage( string message, string headline, bool realOSD ) + private void ShowMessage(string message, string headline, bool realOSD) { // Report - using (var osd = CreateTextOverlay( 1, headline, OSDShowMode.Other )) + using (var osd = CreateTextOverlay(1, headline, OSDShowMode.Other)) { // Set mode if (!realOSD) osd.Builder.DisableOverlay(); // Fill - osd.Builder.WriteLine( message ); + osd.Builder.WriteLine(message); } // Forward to title - if (Equals( headline, Properties.Resources.NameTitle )) GeneralInfo.SetWindowTitle( message ); + if (Equals(headline, Properties.Resources.NameTitle)) GeneralInfo.SetWindowTitle(message); } /// @@ -1692,16 +1711,16 @@ private void ShowMessage( string message, string headline, bool realOSD ) /// Die Nachricht. /// Überschrift für das Nachrichtenfeld. /// Gesetzt, wenn das echte OSD verwendet werden soll. - void IViewerSite.ShowMessage( string message, string headline, bool realOSD ) + void IViewerSite.ShowMessage(string message, string headline, bool realOSD) { // Forward - ShowMessage( message, headline, realOSD ); + ShowMessage(message, headline, realOSD); } - object IViewerSite.Invoke( Delegate method, params object[] args ) + object IViewerSite.Invoke(Delegate method, params object[] args) { // Forward to .NET - return Invoke( method, args ); + return Invoke(method, args); } /// @@ -1729,10 +1748,10 @@ ComboBox IViewerSite.ScratchComboBox } } - void IViewerSite.ShowList( string headline, int minShow, OSDShowMode mode ) + void IViewerSite.ShowList(string headline, int minShow, OSDShowMode mode) { // Forward - ShowList( headline, selScratch, minShow, mode ); + ShowList(headline, selScratch, minShow, mode); } void IViewerSite.ResetOptions() @@ -1741,7 +1760,7 @@ void IViewerSite.ResetOptions() selOptions.Items.Clear(); // Load all the global ones - foreach (OptionDisplay option in m_GlobalOptions) selOptions.Items.Add( option ); + foreach (OptionDisplay option in m_GlobalOptions) selOptions.Items.Add(option); } /// @@ -1767,7 +1786,7 @@ void IViewerSite.FillOptions() m_GlobalOptions.Clear(); // Load to global options - foreach (OptionDisplay option in selOptions.Items) m_GlobalOptions.Add( option ); + foreach (OptionDisplay option in selOptions.Items) m_GlobalOptions.Add(option); // Forward m_CurrentAdaptor.FillOptions(); @@ -1786,10 +1805,10 @@ bool IViewerSite.CanRestartGraph } } - void IViewerSite.AddOption( OptionDisplay option ) + void IViewerSite.AddOption(OptionDisplay option) { // Store to list - selOptions.Items.Add( option ); + selOptions.Items.Add(option); } Adaptor IViewerSite.CurrentAdaptor @@ -1814,7 +1833,7 @@ public IDisposable ShowCursor() void IViewerSite.Restart() { // Forward - Restart( false ); + Restart(false); } /// @@ -1822,13 +1841,13 @@ void IViewerSite.Restart() /// /// Die relative Position zwischen 0 und 1. /// Überschreift zur Anzeige. - private void ShowPosition( double percentage, string headline ) + private void ShowPosition(double percentage, string headline) { // Report - using (var osd = CreateTextOverlay( 1, string.Format( headline, (int) (100 * percentage) ), OSDShowMode.Position )) + using (var osd = CreateTextOverlay(1, string.Format(headline, (int)(100 * percentage)), OSDShowMode.Position)) { // Fill - osd.Builder.ShowProgress( percentage, false ); + osd.Builder.ShowProgress(percentage, false); } } @@ -1836,10 +1855,10 @@ private void ShowPosition( double percentage, string headline ) /// Zeigt die aktuelle Position in einer Datei an. /// /// Die relative Position zwischen 0 und 1. - void IViewerSite.ShowPositionInFile( double percentage ) + void IViewerSite.ShowPositionInFile(double percentage) { // Display - ShowPosition( percentage, Properties.Resources.FileTitle ); + ShowPosition(percentage, Properties.Resources.FileTitle); // Remember what we are doing m_LastProgressWasFile = true; @@ -1850,62 +1869,34 @@ void IViewerSite.ShowPositionInFile( double percentage ) /// /// Gewünschte Taste. /// Zugehörige Bearbeitungsroutine. - void IViewerSite.SetKeyHandler( Keys key, ViewerKeyStrokeCallback handler ) + void IViewerSite.SetKeyHandler(Keys key, ViewerKeyStrokeCallback handler) { // Check mode - if (null == handler) - directShow.KeyProcessors.Remove( key ); + if (handler == null) + directShow.KeyProcessors.Remove(key); else - directShow.KeyProcessors[key] = test => { if (!PreprocessKey( test )) handler(); }; + directShow.KeyProcessors[key] = test => { if (!PreprocessKey(test)) handler(); }; } /// /// Meldet, ob Radiosender in der Senderliste erscheinen sollen. /// - bool IChannelInfo.UseRadio - { - get - { - // Forward - return (null == m_ChannelInfo) ? true : m_ChannelInfo.UseRadio; - } - } + bool IChannelInfo.UseRadio => m_ChannelInfo?.UseRadio == true; /// /// Meldet, ob verschlüsselte Sender in der Senderliste erscheinen sollen. /// - bool IChannelInfo.PayTV - { - get - { - // Forward - return (null == m_ChannelInfo) ? true : m_ChannelInfo.PayTV; - } - } + bool IChannelInfo.PayTV => m_ChannelInfo?.PayTV == true; /// /// Meldet, ob unverschlüsselte Sender in der Senderliste erscheinen sollen. /// - bool IChannelInfo.FreeTV - { - get - { - // Forward - return (null == m_ChannelInfo) ? true : m_ChannelInfo.FreeTV; - } - } + bool IChannelInfo.FreeTV => m_ChannelInfo?.FreeTV == true; /// /// Meldet, ob Fernsehsender in der Senderliste erscheinen sollen. /// - bool IChannelInfo.UseTV - { - get - { - // Forward - return (null == m_ChannelInfo) ? true : m_ChannelInfo.UseTV; - } - } + bool IChannelInfo.UseTV => m_ChannelInfo?.UseTV == true; string ILocalInfo.LocalStation { @@ -2005,7 +1996,7 @@ ushort IStreamInfo.BroadcastPort get { // Forward - return (null == m_StreamInfo) ? (ushort) 0 : m_StreamInfo.BroadcastPort; + return (null == m_StreamInfo) ? (ushort)0 : m_StreamInfo.BroadcastPort; } } @@ -2022,23 +2013,9 @@ Uri IRemoteInfo.ServerUri #region IGeneralInfo Members - private IGeneralInfo GeneralInfo - { - get - { - // Report - return (IGeneralInfo) this; - } - } + private IGeneralInfo GeneralInfo => this; - int IGeneralInfo.OSDLifeTime - { - get - { - // Forward - return (null == m_GeneralInfo) ? 5 : m_GeneralInfo.OSDLifeTime; - } - } + int IGeneralInfo.OSDLifeTime => m_GeneralInfo?.OSDLifeTime ?? 5; double IGeneralInfo.Volume { @@ -2054,69 +2031,58 @@ double IGeneralInfo.Volume } } - void IGeneralInfo.LeaveFullScreen() - { - // Forward - if (null != m_GeneralInfo) m_GeneralInfo.LeaveFullScreen(); - } - - - bool IGeneralInfo.UseCyberlinkCodec { get { return ((null == m_GeneralInfo) || m_GeneralInfo.UseCyberlinkCodec); } } + bool IGeneralInfo.UseCyberlinkCodec => m_GeneralInfo?.UseCyberlinkCodec == true; /// /// Gesetzt, wenn die Fernsteuerung verwendet werden soll. /// - public bool UseRemoteControl { get { return ((null == m_GeneralInfo) || m_GeneralInfo.UseRemoteControl); } } + public bool UseRemoteControl => m_GeneralInfo?.UseRemoteControl == true; - int IGeneralInfo.AVDelay { get { return (null == m_GeneralInfo) ? 500 : m_GeneralInfo.AVDelay; } } + int IGeneralInfo.AVDelay => m_GeneralInfo?.AVDelay ?? 500; - string IGeneralInfo.H264Decoder { get { return (null == m_GeneralInfo) ? null : m_GeneralInfo.H264Decoder; } } + string IGeneralInfo.H264Decoder => m_GeneralInfo?.H264Decoder; - string IGeneralInfo.MPEG2Decoder { get { return (null == m_GeneralInfo) ? null : m_GeneralInfo.MPEG2Decoder; } } + string IGeneralInfo.MPEG2Decoder => m_GeneralInfo?.MPEG2Decoder; - string IGeneralInfo.AC3Decoder { get { return (null == m_GeneralInfo) ? null : m_GeneralInfo.AC3Decoder; } } + string IGeneralInfo.AC3Decoder => m_GeneralInfo?.AC3Decoder; - string IGeneralInfo.MP2Decoder { get { return (null == m_GeneralInfo) ? null : m_GeneralInfo.MP2Decoder; } } + string IGeneralInfo.MP2Decoder => m_GeneralInfo?.MP2Decoder; + void IGeneralInfo.SetPictureParameters(PictureParameters parameters) => m_GeneralInfo?.SetPictureParameters(parameters); - void IGeneralInfo.SetPictureParameters( PictureParameters parameters ) - { - // Forward - if (null != m_GeneralInfo) m_GeneralInfo.SetPictureParameters( parameters ); - } + void IGeneralInfo.SetWindowTitle(string title) => m_GeneralInfo?.SetWindowTitle(title); + #endregion - void IGeneralInfo.SetWindowTitle( string title ) + private void CreateOverlay() { - // Forward - if (null != m_GeneralInfo) m_GeneralInfo.SetWindowTitle( title ); - } + // Install overlay + m_Overlay = new OverlayWindow(this) { Owner = FindForm() }; - #endregion + // Connect message sink + m_Overlay.OnGotMessage += ForwardOSDMessage; + m_Overlay.MouseWheel += MouseWheelChanged; + } /// /// Wird beim Starten ausgelöst. /// /// Wird ignoriert. /// Wird ignoriert. - private void ViewerControl_Load( object sender, EventArgs e ) + private void ViewerControl_Load(object sender, EventArgs e) { // Install overlay - m_Overlay = new OverlayWindow( this ) { Owner = FindForm() }; - - // Connect message sink - m_Overlay.OnGotMessage += ForwardOSDMessage; - m_Overlay.MouseWheel += MouseWheelChanged; + CreateOverlay(); // See if we should remote control if (UseRemoteControl) if (m_RCSettings.Mappings.Length > 0) { // Install remote control - m_RCReceiver = RawInputSink.Create( Handle ); + m_RCReceiver = RawInputSink.Create(Handle); // Connect - m_RCReceiver.SetReceiver( ForwardRCMessage ); + m_RCReceiver.SetReceiver(ForwardRCMessage); } } @@ -2124,22 +2090,22 @@ private void ViewerControl_Load( object sender, EventArgs e ) /// Bearbeitet eine Windows Meldung über eine Benutzereingabe. /// /// Die zu bearbeitende Meldung - protected override void WndProc( ref System.Windows.Forms.Message m ) + protected override void WndProc(ref Message m) { // Pre process if (m_RCReceiver != null) - if (m_RCReceiver.ProcessMessage( ref m )) + if (m_RCReceiver.ProcessMessage(ref m)) return; // Forward - base.WndProc( ref m ); + base.WndProc(ref m); } /// /// Nimmt einen Befehl von der Fernsteuerung entgegen. /// /// Der empfangene Code. - private void ForwardRCMessage( MappingItem item ) + private void ForwardRCMessage(MappingItem item) { // Be safe try @@ -2157,7 +2123,7 @@ private void ForwardRCMessage( MappingItem item ) } // Collect - m_CurrentRC.Add( item ); + m_CurrentRC.Add(item); // Load mapping var command = m_RCSettings[m_CurrentRC.ToArray()]; @@ -2167,33 +2133,33 @@ private void ForwardRCMessage( MappingItem item ) // Remap to keys switch (command.Value) { - case InputKey.SourceDown: directShow.ProcessKey( Keys.Subtract ); break; - case InputKey.PageDown: directShow.ProcessKey( Keys.PageDown ); break; - case InputKey.VolumeDown: directShow.ProcessKey( Keys.Left ); break; - case InputKey.VolumeUp: directShow.ProcessKey( Keys.Right ); break; - case InputKey.Information: directShow.ProcessKey( Keys.L ); break; - case InputKey.PageUp: directShow.ProcessKey( Keys.PageUp ); break; - case InputKey.ListDown: directShow.ProcessKey( Keys.Down ); break; - case InputKey.Menu: directShow.ProcessKey( Keys.RButton ); break; - case InputKey.SourceUp: directShow.ProcessKey( Keys.Add ); break; - case InputKey.Enter: directShow.ProcessKey( Keys.Enter ); break; - case InputKey.Pause: directShow.ProcessKey( (Keys) 191 ); break; - case InputKey.ListUp: directShow.ProcessKey( Keys.Up ); break; - case InputKey.Digit0: directShow.ProcessKey( Keys.D0 ); break; - case InputKey.Digit1: directShow.ProcessKey( Keys.D1 ); break; - case InputKey.Digit2: directShow.ProcessKey( Keys.D2 ); break; - case InputKey.Digit3: directShow.ProcessKey( Keys.D3 ); break; - case InputKey.Digit4: directShow.ProcessKey( Keys.D4 ); break; - case InputKey.Digit5: directShow.ProcessKey( Keys.D5 ); break; - case InputKey.Digit6: directShow.ProcessKey( Keys.D6 ); break; - case InputKey.Digit7: directShow.ProcessKey( Keys.D7 ); break; - case InputKey.Digit8: directShow.ProcessKey( Keys.D8 ); break; - case InputKey.Digit9: directShow.ProcessKey( Keys.D9 ); break; - case InputKey.Guide: directShow.ProcessKey( Keys.F1 ); break; - case InputKey.Text: directShow.ProcessKey( Keys.F2 ); break; - case InputKey.Off: directShow.ProcessKey( Keys.End ); break; - case InputKey.Mute: directShow.ProcessKey( Keys.F3 ); break; - case InputKey.List: directShow.ProcessKey( Keys.K ); break; + case InputKey.SourceDown: directShow.ProcessKey(Keys.Subtract); break; + case InputKey.PageDown: directShow.ProcessKey(Keys.PageDown); break; + case InputKey.VolumeDown: directShow.ProcessKey(Keys.Left); break; + case InputKey.VolumeUp: directShow.ProcessKey(Keys.Right); break; + case InputKey.Information: directShow.ProcessKey(Keys.L); break; + case InputKey.PageUp: directShow.ProcessKey(Keys.PageUp); break; + case InputKey.ListDown: directShow.ProcessKey(Keys.Down); break; + case InputKey.Menu: directShow.ProcessKey(Keys.RButton); break; + case InputKey.SourceUp: directShow.ProcessKey(Keys.Add); break; + case InputKey.Enter: directShow.ProcessKey(Keys.Enter); break; + case InputKey.Pause: directShow.ProcessKey((Keys)191); break; + case InputKey.ListUp: directShow.ProcessKey(Keys.Up); break; + case InputKey.Digit0: directShow.ProcessKey(Keys.D0); break; + case InputKey.Digit1: directShow.ProcessKey(Keys.D1); break; + case InputKey.Digit2: directShow.ProcessKey(Keys.D2); break; + case InputKey.Digit3: directShow.ProcessKey(Keys.D3); break; + case InputKey.Digit4: directShow.ProcessKey(Keys.D4); break; + case InputKey.Digit5: directShow.ProcessKey(Keys.D5); break; + case InputKey.Digit6: directShow.ProcessKey(Keys.D6); break; + case InputKey.Digit7: directShow.ProcessKey(Keys.D7); break; + case InputKey.Digit8: directShow.ProcessKey(Keys.D8); break; + case InputKey.Digit9: directShow.ProcessKey(Keys.D9); break; + case InputKey.Guide: directShow.ProcessKey(Keys.F1); break; + case InputKey.Text: directShow.ProcessKey(Keys.F2); break; + case InputKey.Off: directShow.ProcessKey(Keys.End); break; + case InputKey.Mute: directShow.ProcessKey(Keys.F3); break; + case InputKey.List: directShow.ProcessKey(Keys.K); break; } } catch @@ -2202,18 +2168,30 @@ private void ForwardRCMessage( MappingItem item ) } } + /// + /// Erzwingt eine Synchronisation der Anzeige. + /// + public void Synchronize() + { + directShow.ProcessKey(Keys.K); + directShow.ProcessKey(Keys.Enter); + } + + private void Synchronize(Keys key) => Synchronize(); + /// /// Leitet Eingaben weiter. /// /// Die Daten zur aktuellen Benutzereingabe. - private void ForwardOSDMessage( ref Message m ) + private void ForwardOSDMessage(ref Message m) { // Check operation switch (m.Msg) { - case 0x0101: directShow.ProcessKey( (Keys) m.WParam ); break; - case 0x0202: directShow.ProcessKey( Keys.LButton ); break; - case 0x0205: directShow.ProcessKey( Keys.RButton ); break; + case 0x0101: directShow.ProcessKey((Keys)m.WParam); break; + case 0x0202: directShow.ProcessKey(Keys.LButton); break; + case 0x0205: directShow.ProcessKey(Keys.RButton); break; + case 0x007e: Synchronize(); break; } } } diff --git a/DVB.NET/Setups/Core/CoreSetup.wixproj b/DVB.NET/Setups/Core/CoreSetup.wixproj index dfeeb22..2ae8728 100644 --- a/DVB.NET/Setups/Core/CoreSetup.wixproj +++ b/DVB.NET/Setups/Core/CoreSetup.wixproj @@ -17,7 +17,7 @@ obj\$(Configuration)\ Debug True - SETUPVERSION=4.3.19 + SETUPVERSION=4.3.20 de-de ICE57 @@ -25,7 +25,7 @@ ..\..\..\msi\ obj\$(Configuration)\ True - SETUPVERSION=4.3.19 + SETUPVERSION=4.3.20 de-de ICE57 diff --git a/DVB.NET/SourceManagement/ScanLocations/BuiltIn.dss b/DVB.NET/SourceManagement/ScanLocations/BuiltIn.dss index c939592..d3649d2 100644 Binary files a/DVB.NET/SourceManagement/ScanLocations/BuiltIn.dss and b/DVB.NET/SourceManagement/ScanLocations/BuiltIn.dss differ diff --git a/DVB.NET/TS/VideoStream.cs b/DVB.NET/TS/VideoStream.cs index 863eb81..3fc3508 100644 --- a/DVB.NET/TS/VideoStream.cs +++ b/DVB.NET/TS/VideoStream.cs @@ -2,90 +2,95 @@ namespace JMS.DVB.TS { - /// - /// Represents a single video stream. - /// - public class VideoStream: StreamBase - { - /// - /// Get or set if any PES length is accepted. - /// - public bool AcceptAnyLength = false; + /// + /// Represents a single video stream. + /// + public class VideoStream : StreamBase + { + /// + /// Default value to accept any PES length. + /// + public static bool DefaultAcceptAnyLength = false; - /// - /// Create a new instance. - /// - /// Related transport stream. - /// Transport stream identifier for this video stream. - /// Set if this stream supplies the PCR. - public VideoStream(IStreamConsumer consumer, short pid, bool isPCR) - : base(consumer, pid, isPCR) - { - } + /// + /// Get or set if any PES length is accepted. + /// + public bool AcceptAnyLength = DefaultAcceptAnyLength; - /// - /// Valid PES start codes for video streams range from 0x000001e0 - /// to 0x000001ef. - /// - /// The last byte of a start code. - /// Set if the start code represents a video stream. - protected override bool IsValidStartCode(byte code) - { - // Must be video - return ((code >= 0xe0) && (code < 0xf0)); - } + /// + /// Create a new instance. + /// + /// Related transport stream. + /// Transport stream identifier for this video stream. + /// Set if this stream supplies the PCR. + public VideoStream(IStreamConsumer consumer, short pid, bool isPCR) + : base(consumer, pid, isPCR) + { + } - /// - /// The only valid length for a DVB-S PES packet is 0. - /// - /// Length of the current PES packet. - /// Set if the parameter is 0. - protected override bool IsValidLength(int length) - { - // Always accepted - if (0 == length) return true; + /// + /// Valid PES start codes for video streams range from 0x000001e0 + /// to 0x000001ef. + /// + /// The last byte of a start code. + /// Set if the start code represents a video stream. + protected override bool IsValidStartCode(byte code) + { + // Must be video + return ((code >= 0xe0) && (code < 0xf0)); + } - // See if other length is allowed - if so, do not check! - return AcceptAnyLength; - } + /// + /// The only valid length for a DVB-S PES packet is 0. + /// + /// Length of the current PES packet. + /// Set if the parameter is 0. + protected override bool IsValidLength(int length) + { + // Always accepted + if (0 == length) return true; - /// - /// See, if the indicated position in the buffer is a keyframe. Prior to - /// calling this method the caller checks that it really starts with - /// a PES header. - /// - /// Some buffer. - /// First byte of the packet. - /// Number of bytes in the packet. - /// Set if this packet starts a key frame. - protected override bool IsKeyFrame(byte[] buffer, int start, int length) - { - // Size in header respecting the extension block - int header = 9 + buffer[start + 8]; + // See if other length is allowed - if so, do not check! + return AcceptAnyLength; + } - // Correct - length -= header; + /// + /// See, if the indicated position in the buffer is a keyframe. Prior to + /// calling this method the caller checks that it really starts with + /// a PES header. + /// + /// Some buffer. + /// First byte of the packet. + /// Number of bytes in the packet. + /// Set if this packet starts a key frame. + protected override bool IsKeyFrame(byte[] buffer, int start, int length) + { + // Size in header respecting the extension block + int header = 9 + buffer[start + 8]; - // See if there is enough data to test - if (length < 4) return false; + // Correct + length -= header; - // Calculate packet start - start += header; + // See if there is enough data to test + if (length < 4) return false; - // Check for GOP start - return (((0 == buffer[start++]) && (0 == buffer[start++]) && (1 == buffer[start++]) && (0xb3 == buffer[start++]))); - } + // Calculate packet start + start += header; - /// - /// Video streams must use the largest buffer available. - /// - protected override bool IsVideo - { - get - { - // Report - return true; - } - } - } + // Check for GOP start + return (((0 == buffer[start++]) && (0 == buffer[start++]) && (1 == buffer[start++]) && (0xb3 == buffer[start++]))); + } + + /// + /// Video streams must use the largest buffer available. + /// + protected override bool IsVideo + { + get + { + // Report + return true; + } + } + } }