void OnEnable()
 {
     if (mCast == null) {
         mCast = new PopCast (mOutputTarget, new PopCastParams ());
         mCast.AddDebugCallback (Debug.Log);
     }
 }
Exemple #2
0
 void OnDisable()
 {
     if (mCast != null)
     {
         mCast.Free();
         mCast = null;
     }
 }
 void OnEnable()
 {
     if (mCast == null)
     {
         mCast = new PopCast(mOutputTarget, new PopCastParams());
         mCast.AddDebugCallback(Debug.Log);
     }
 }
Exemple #4
0
 void OnEnable()
 {
     if (mCast == null)
     {
         mCast = new PopCast(mOutputTarget, CastParams);
         if (EnableDebug)
         {
             PopCast.EnableDebugLog = EnableDebug;
         }
     }
 }
    static public void ApplyInspector(PopCast Instance, Object target, Editor ThisEditor)
    {
        GUILayout.Label("PopCast Version " + PopCast.GetVersion());
        PopCast.mAllowBackgroundProcessing = GUILayout.Toggle(PopCast.mAllowBackgroundProcessing, "Allow background jobs");

        string MetaString = (Instance != null) ? Instance.GetMetaJson() : null;

        if (MetaString == null)
        {
            if (Instance != null)
            {
                MetaString = "<no meta>";
            }
            else if (Instance == null)
            {
                MetaString = "<no instance>";
            }
        }


        //	pop cast has some GPU processing to do, and if the editor is paused or stopped,
        //	we'll be waiting for renderthread events, so we need to force them to finish encodings
        var BackgroundJobs = PopCast.GetBackgroundGpuJobCount();

        if (BackgroundJobs > 0)
        {
            string Message = "" + BackgroundJobs + " background jobs";

            if (!EditorApplication.isUpdating)
            {
                ThisEditor.Repaint();
                if (PopCast.mAllowBackgroundProcessing)
                {
                    Message += " (forcing GPU update)";
                    PopCast.Update();
                }
            }

            Message += "\n" + MetaString;

            EditorGUILayout.HelpBox(Message, MessageType.Warning, true);
        }
        else
        {
            string Message = "Idle (no background jobs)";
            Message += "\n" + MetaString;
            EditorGUILayout.HelpBox(Message, MessageType.Info, true);
        }

        if (Instance != null)
        {
            ThisEditor.Repaint();
        }
    }
    void StartRecording()
    {
        if (RecordCamera == null)
        {
            RecordCamera = Camera.allCameras[0];
            Debug.Log(Camera.allCameras);
        }

        //	if no texture provided, make one
        if (RecordToTexture == null)
        {
            RecordToTexture = new RenderTexture(RecordCamera.pixelWidth, RecordCamera.pixelHeight, 16);
        }

        mPopCast = new PopCast(Filename, Parameters);
        PopCast.EnableDebugLog = true;
    }
    static public void ApplyInspector(PopCast Instance, Object target, Editor ThisEditor)
    {
        GUILayout.Label("PopCast Version " + PopCast.GetVersion());
        PopCast.mAllowBackgroundProcessing = GUILayout.Toggle(PopCast.mAllowBackgroundProcessing, "Allow background jobs");

        string MetaString = "";
        var    Meta       = (Instance != null) ? Instance.GetMeta() : null;

        if (Meta != null)
        {
            MetaString += "BackgroundGpuJobCount: " + Meta.BackgroundGpuJobCount + "\n";
            MetaString += "InstanceCount: " + Meta.InstanceCount + "\n";
            MetaString += "MuxerInputQueueCount: " + Meta.MuxerInputQueueCount + "\n";
            MetaString += "MuxerDefferedQueueCount: " + Meta.MuxerDefferedQueueCount + "\n";
            MetaString += "MB's Written: " + (Meta.BytesWritten / (1024.0f * 1024.0f)) + "\n";
            MetaString += "PendingWrites: " + Meta.PendingWrites + "\n";
            MetaString += "PendingEncodedFrames: " + Meta.PendingEncodedFrames + "\n";
            MetaString += "PushedFrameCount: " + Meta.PushedFrameCount + "\n";
            MetaString += "PendingFrameCount: " + Meta.PendingFrameCount + "\n";
        }
        else if (Instance != null)
        {
            MetaString = "<no meta>";
        }
        else
        {
            MetaString = "<no instance>";
        }


        //	pop cast has some GPU processing to do, and if the editor is paused or stopped,
        //	we'll be waiting for renderthread events, so we need to force them to finish encodings
        var BackgroundJobs = PopCast.GetBackgroundGpuJobCount();

        if (BackgroundJobs > 0)
        {
            string Message = "" + BackgroundJobs + " background jobs";

            if (!EditorApplication.isUpdating)
            {
                ThisEditor.Repaint();
                if (PopCast.mAllowBackgroundProcessing)
                {
                    Message += " (forcing GPU update)";
                    PopCast.Update();
                }
            }

            Message += "\n" + MetaString;

            EditorGUILayout.HelpBox(Message, MessageType.Warning, true);
        }
        else
        {
            string Message = "Idle (no background jobs)";
            Message += "\n" + MetaString;
            EditorGUILayout.HelpBox(Message, MessageType.Info, true);
        }

        if (Instance != null)
        {
            ThisEditor.Repaint();
        }
    }
 void StopRecording()
 {
     mPopCast = null;
     System.GC.Collect();
 }