Ejemplo n.º 1
0
        /// <summary>
        /// Verbindet ein Zugriffsmodul mit einem DVB.NET DirectShow Graphen zur Anzeige
        /// von Bild und Ton.
        /// </summary>
        /// <remarks>
        /// Dabei wird der Thread zur Befüllung des Graphen erzeugt.
        /// </remarks>
        /// <param name="graph">Der DVB.NET DirectShow Graph.</param>
        /// <exception cref="ArgumentNullException">Der Parameter darf nicht <i>null</i> sein.</exception>
        /// <exception cref="NotSupportedException">Die Methode darf nur einmal aufgerufen werden.</exception>
        internal void SetGraph(DisplayGraph graph)
        {
            // Validate
            if (null == graph)
            {
                throw new ArgumentNullException("graph");
            }
            if (null != m_Graph)
            {
                throw new NotSupportedException();
            }

            // Remember
            m_Graph = graph;

            // Create threads
            m_AudioThread = new Thread(AudioFeed)
            {
                Name = "DVB.NET Audio", IsBackground = true
            };
            m_VideoThread = new Thread(VideoFeed)
            {
                Name = "DVB.NET Video", IsBackground = true
            };

            // Set apartment - just in case
            m_AudioThread.SetApartmentState(ApartmentState.MTA);
            m_VideoThread.SetApartmentState(ApartmentState.MTA);

            // Start threads
            m_AudioThread.Start();
            m_VideoThread.Start();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fordert den DirectShow Graphen auf, alle zwischengespeicherten Daten zu
        /// ignorieren.
        /// </summary>
        /// <remarks>
        /// Ein Aufruf erfolgt im Allgemeinen nach einem Senderwechsel.
        /// </remarks>
        public virtual void ClearBuffers()
        {
            // Load graph
            DisplayGraph graph = m_Graph;

            // Forward
            if (graph != null)
            {
                graph.InjectorFilter.ClearBuffers();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Befüllt die Bildspur mit Daten.
        /// </summary>
        private void VideoFeed()
        {
            // Load the graph to use
            DisplayGraph graph = m_Graph;

            // Died early
            if (graph == null)
            {
                return;
            }

            // Process
            for (; ;)
            {
                // Wait for video data
                if (!m_Disposed)
                {
                    // Wait if necessary
                    if (!m_HasVideoData)
                    {
                        lock (m_VideoSync)
                            if (!m_HasVideoData)
                            {
                                if (m_HasExternalFeed)
                                {
                                    Monitor.Wait(m_VideoSync);
                                }
                                else
                                {
                                    Monitor.Wait(m_VideoSync, 1);
                                }
                            }
                    }

                    // Reset
                    m_HasVideoData = false;
                }

                // Done
                if (m_Disposed)
                {
                    break;
                }

                // Skip
                if (!m_Running)
                {
                    continue;
                }

                // Get the next chunk
                byte[] chunk = GetNextChunk(true);

                // Check for data
                if (chunk == null)
                {
                    continue;
                }

                // Read current version - before testing for m_Running!
                int version = graph.InjectorFilter.VideoInjectorVersion;

                // Process
                if (m_Running)
                {
                    graph.InjectorFilter.InjectVideo(version, chunk, 0, chunk.Length);
                }
            }

            // Cleanup
            graph.InjectorFilter.InjectVideo(null, 0, 0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Verbindet ein Zugriffsmodul mit einem DVB.NET DirectShow Graphen zur Anzeige
        /// von Bild und Ton.
        /// </summary>
        /// <remarks>
        /// Dabei wird der Thread zur Befüllung des Graphen erzeugt.
        /// </remarks>
        /// <param name="graph">Der DVB.NET DirectShow Graph.</param>
        /// <exception cref="ArgumentNullException">Der Parameter darf nicht <i>null</i> sein.</exception>
        /// <exception cref="NotSupportedException">Die Methode darf nur einmal aufgerufen werden.</exception>
        internal void SetGraph( DisplayGraph graph )
        {
            // Validate
            if (null == graph)
                throw new ArgumentNullException( "graph" );
            if (null != m_Graph)
                throw new NotSupportedException();

            // Remember
            m_Graph = graph;

            // Create threads
            m_AudioThread = new Thread( AudioFeed ) { Name = "DVB.NET Audio", IsBackground = true };
            m_VideoThread = new Thread( VideoFeed ) { Name = "DVB.NET Video", IsBackground = true };

            // Set apartment - just in case
            m_AudioThread.SetApartmentState( ApartmentState.MTA );
            m_VideoThread.SetApartmentState( ApartmentState.MTA );

            // Start threads
            m_AudioThread.Start();
            m_VideoThread.Start();
        }