Ejemplo n.º 1
0
        public override MVGraphAPI.GraphNode GetGraphNode()
        {
            if (m_asyncFrameAccessGraphTarget == null)
            {
                m_asyncFrameAccessGraphTarget = new MVGraphAPI.AsyncFrameAccessGraphNode(new MVGraphAPI.DelegatedFrameListener(OnMvxFrame));
            }

            return(m_asyncFrameAccessGraphTarget);
        }
Ejemplo n.º 2
0
        protected override void DisposeReader()
        {
            if (m_frameAccess != null)
            {
                m_frameAccess.Dispose();
                m_frameAccess = null;
            }

            if (m_mvxRunner == null)
            {
                return;
            }

            m_mvxRunner.Stop();
            m_mvxRunner.Dispose();
            m_mvxRunner = null;
        }
Ejemplo n.º 3
0
        protected override bool OpenReader()
        {
            lastReceivedFrame = null;
            m_paused          = false;

            try
            {
                m_frameAccess = new MVGraphAPI.AsyncFrameAccessGraphNode(new MVGraphAPI.DelegatedFrameListener(HandleNextFrame));
                m_fpsBlocker  = new MVGraphAPI.BlockFPSGraphNode(3, m_followStreamFPS ? MVGraphAPI.BlockFPSGraphNode.FPS_FROM_SOURCE : MVGraphAPI.BlockFPSGraphNode.FPS_MAX, MVGraphAPI.BlockGraphNode.FullBehaviour.FB_BLOCK_FRAMES);

                MVGraphAPI.ManualGraphBuilder graphBuilder = new MVGraphAPI.ManualGraphBuilder();
                graphBuilder = graphBuilder
                               + dataStreamDefinition.GetSourceGraphNode()
                               + new MVGraphAPI.AutoDecompressorGraphNode()
                               + m_fpsBlocker
                               + m_frameAccess;
                AddAdditionalGraphTargetsToGraph(graphBuilder);

                m_mvxRunner = new MVGraphAPI.AutoSequentialGraphRunner(graphBuilder.CompileGraphAndReset());

                if (!m_mvxRunner.Play(m_playbackMode))
                {
                    Debug.LogError("Mvx2: Failed to play source");
                    return(false);
                }

                Debug.Log("Mvx2: The stream is open and playing");
                return(true);
            }
            catch (System.Exception exception)
            {
                Debug.LogErrorFormat("Failed to create the graph: {0}", exception.Message);
                m_mvxRunner = null;
                return(false);
            }
        }