Exemplo n.º 1
0
        protected void AddAdditionalGraphTargetsToGraph(MVGraphAPI.ManualGraphBuilder graphBuilder)
        {
            if (additionalTargets == null)
            {
                return;
            }

            foreach (MvxTarget additionalTarget in additionalTargets)
            {
                graphBuilder = graphBuilder + additionalTarget.GetGraphNode();
            }
        }
Exemplo n.º 2
0
        protected override bool OpenReader()
        {
            lastReceivedFrame = null;
            m_paused          = false;
            if (m_audioSource)
            {
                m_audioSource.enabled = true;
            }
            lock (m_audioPlayer)
                m_audioPlayer.Reset();

            try
            {
                m_frameAccess = new MVGraphAPI.FrameAccessGraphNode();

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

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

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

                Debug.Log("Mvx2: The stream is open and playing");

                m_stopReadingFrames   = false;
                m_framesReadingThread = new Thread(new ThreadStart(ReadFrames));
                m_framesReadingThread.Start();

                return(true);
            }
            catch (System.Exception exception)
            {
                Debug.LogErrorFormat("Failed to create the graph: {0}", exception.Message);
                m_mvxRunner = null;
                return(false);
            }
        }
Exemplo n.º 3
0
        protected override bool OpenReader()
        {
            lastReceivedFrame = null;

            try
            {
                m_frameAccess = new MVGraphAPI.FrameAccessGraphNode();

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

                m_mvxRunner = new MVGraphAPI.RandomAccessGraphRunner(graphBuilder.CompileGraphAndReset());
                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);
            }
        }
Exemplo n.º 4
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);
            }
        }