コード例 #1
0
        /// <summary>
        /// Aktiviert die Verbraucherkontrolle für diese Quelle.
        /// </summary>
        /// <param name="source">Eine volle Referenz zur Quelle.</param>
        public void EnableOptimizer( SourceSelection source )
        {
            // Just register
            Manager.BeforeRecreateStream += manager =>
            {
                // Create a brand new optimizer
                var localOpt = new StreamSelectionOptimizer();

                // Add the one stream
                localOpt.Add( source, RequestedStreams );

                // Run the optimization
                if (localOpt.Optimize() == 1)
                    return localOpt.GetStreams( 0 );

                // Failed - activation is not possible
                return null;
            };
        }
コード例 #2
0
        /// <summary>
        /// Ermittelt eine möglicherweise eingeschränkte Datenstromauswahl.
        /// </summary>
        /// <param name="manager">Die Quelle, um die es geht.</param>
        /// <returns>Eine geeignete Auswahl.</returns>
        private StreamSelection GetOptimizedStreams( SourceStreamsManager manager )
        {
            // Not possible
            if (null == CurrentSelection)
                return null;

            // What we want to record
            StreamSelection selection = new StreamSelection();

            // Put it on
            selection.AC3Tracks.LanguageMode = LanguageModes.All;
            selection.MP2Tracks.LanguageMode = LanguageModes.All;
            selection.SubTitles.LanguageMode = LanguageModes.All;
            selection.ProgramGuide = true;
            selection.Videotext = true;

            // See if we are working on a limited device
            if (!Device.HasConsumerRestriction)
                return selection;

            // Stop picture for a moment
            Device.SetConsumerState( VideoId, false );
            Device.SetConsumerState( AudioId, false );
            Device.SetConsumerState( TextId, false );

            // Require restart
            m_NeedRestart = true;

            // Create a brand new optimizer
            StreamSelectionOptimizer localOpt = new StreamSelectionOptimizer();

            // Add the one stream
            localOpt.Add( CurrentSelection, selection );

            // Run the optimization
            localOpt.Optimize();

            // Report result
            return localOpt.GetStreams( 0 );
        }