Exemplo n.º 1
0
    void OnGUI()
    {
        if (mDebugGuiScale <= 0 || mMovie == null)
        {
            return;
        }

        //	draw in the bottom left and move along
        int  wh        = (int)Mathf.Min(Screen.height * mDebugGuiScale, Screen.width * mDebugGuiScale);
        Rect debugRect = new Rect(0, Screen.height - wh, wh, wh);

        //	draw graphs on the row below
        if (mPerformanceTextures.Count > 0)
        {
            debugRect.y -= debugRect.height;
        }

        for (int t = 0; t < mStreamTextures.Count; t++)
        {
            var texture = mStreamTextures[t];
            if (texture == null)
            {
                continue;
            }

            GUI.DrawTexture(debugRect, texture);
            debugRect.x += debugRect.width;
        }

        //	draw graphs on the row below
        if (mPerformanceTextures.Count > 0)
        {
            debugRect.y += debugRect.height;
            debugRect.x  = 0;
        }

        for (int t = 0; t < mPerformanceTextures.Count; t++)
        {
            var texture = mPerformanceTextures[t];
            if (texture == null)
            {
                continue;
            }

            GUI.DrawTexture(debugRect, texture);
            debugRect.x += debugRect.width;
        }

        //	draw some other debug
        String Text = "";

        Text += "Codec: " + mMovie.GetCodec() + "\n";
        Text += "Error: " + mMovie.GetFatalError() + "\n";
        Text += "Last Frame Requested: " + mMovie.GetTimeMs() + "\n";
        Text += "Last Frame Copied: " + mMovie.GetLastFrameCopiedMs() + "\n";
        Text += "OutOfSync: " + ((long)mMovie.GetLastFrameCopiedMs() - (long)mMovie.GetTimeMs()) + "\n";
        GUI.Label(new Rect(0, Screen.height - (wh * 3), wh * 2, wh), Text);
    }
Exemplo n.º 2
0
    void Update()
    {
        UpdateMovie();

        for (int s = 0; s < mStreamTextures.Count; s++)
        {
            var texture = mStreamTextures [s];
            if (texture == null)
            {
                continue;
            }

            //	gr: the updateTexture() can cause mMovie to be deleted. mono seems to miss throwing exceptions if mMovie is null so it will take down unity
            if (mMovie != null)
            {
                mMovie.UpdateTexture(texture, s);
            }
        }

        for (int s = 0; s < mPerformanceTextures.Count && mEnableDebugTextures; s++)
        {
            var texture = mPerformanceTextures [s];
            if (texture == null)
            {
                continue;
            }

            //	gr: the updateTexture() can cause mMovie to be deleted. mono seems to miss throwing exceptions if mMovie is null so it will take down unity
            if (mMovie != null)
            {
                mMovie.UpdatePerformanceGraphTexture(texture, s, mLocalisedPerformanceGraph);
            }
        }

        for (int s = 0; s < mAudioTextures.Count && mEnableDebugTextures; s++)
        {
            var texture = mAudioTextures [s];
            if (texture == null)
            {
                continue;
            }

            //	gr: the updateTexture() can cause mMovie to be deleted. mono seems to miss throwing exceptions if mMovie is null so it will take down unity
            if (mMovie != null)
            {
                mMovie.UpdateAudioTexture(texture, s);
            }
        }

        //	waiting for first frame
        if (!mStarted && mMovie != null)
        {
            var LastFrameCopied = mMovie.GetLastFrameCopiedMs();
            if (LastFrameCopied != 0)
            {
                OnMovieFrameReady();
            }
        }
    }