Beispiel #1
0
    private IEnumerator SdiInputCoroutine()
    {
        yield return(new WaitForEndOfFrame());

        UtyGLNvSdi.SdiInputSetBufferSize(options.inputRingBufferSize);
        UtyGLNvSdi.SdiInputSetCaptureFields(false);

        // Issue a plugin event with an integer identifier.
        // The plugin can distinguish between different based on this ID.
        GL.IssuePluginEvent(UtyGLNvSdi.GetSdiInputRenderEventFunc(), (int)SdiRenderEvent.Initialize);
        yield return(new WaitForEndOfFrame());

        SetupTextures();

        GL.IssuePluginEvent(UtyGLNvSdi.GetSdiInputRenderEventFunc(), (int)SdiRenderEvent.Setup);
        GL.IssuePluginEvent(UtyGLNvSdi.GetSdiInputRenderEventFunc(), (int)SdiRenderEvent.StartCapture);
        yield return(new WaitForEndOfFrame());

        sdiEnabled = true;

        while (UtyGLNvSdi.SdiInputIsCapturing())
        {
            // Wait until all frame rendering is done
            yield return(new WaitForEndOfFrame());

            // Get status of the capture (GL_SUCCESS_NV, GL_FAILURE_NV, GL_PARTIAL_SUCCESS_NV)
            //Debug.Log(UtyGLNvSdi.SdiInputCaptureStatus().ToString());

            // Capture frame from device
            GL.IssuePluginEvent(UtyGLNvSdi.GetSdiInputRenderEventFunc(), (int)SdiRenderEvent.CaptureFrame);
        }
    }