Ejemplo n.º 1
0
    void OpenVideoFromRTSP(string url)
    {
        ffmpeg = new SharpFFmpeg.SharpFFmpeg();
        bool ret = ffmpeg.OpenStream(url, out width, out heigth);

        if (ret == false)
        {
            return;
        }
        hit.SetActive(false);
        tmpTex = new Texture2D(width, heigth, TextureFormat.RGB24, false);
        ShowTex.mainTexture = tmpTex;
        ShowTex.shader      = Shader.Find("Unlit/Masked Colored");
        samples             = new byte[width * heigth * 3];
        buffer = IntPtr.Zero;
        StartCoroutine("UpdateVideo");
    }
Ejemplo n.º 2
0
    void OnDestroy()
    {
        readData = false;
        StopCoroutine("readMemUpdate");
        if (ffmpeg != null)
        {
            //StopCoroutine("UpdateVideo");
            ffmpeg.CloseStream();
            ffmpeg = null;
        }

        if (txt2dtest != null)
        {
            Destroy(txt2dtest);
        }
        if (tmpTex != null)
        {
            Destroy(tmpTex);
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 向控制器提交关闭操作
 /// </summary>
 public void Close()
 {
     ParentHandle.SendMessage("StopVideo", CamaraRef);
     readData = false;
     StopCoroutine("readMemUpdate");
     if (ffmpeg != null)
     {
         //StopCoroutine("UpdateVideo");
         ffmpeg.CloseStream();
         ffmpeg = null;
     }
     if (txt2dtest != null)
     {
         Destroy(txt2dtest);
     }
     if (tmpTex != null)
     {
         Destroy(tmpTex);
         tmpTex = null;
     }
 }