Exemple #1
0
    // Use this for initialization
    protected override void Start()
    {
        _Processor = new OffscreenProcessor();
        m_Texture  = gameObject.GetComponent <GstCustomTexture>();

        material = gameObject.GetComponent <MeshRenderer> ().material;
        // Check to make sure we have an instance.
        if (m_Texture == null)
        {
            DestroyImmediate(this);
        }

        m_Texture.Initialize();
        //		pipeline = "filesrc location=\""+VideoPath+"\" ! decodebin ! videoconvert ! video/x-raw,format=I420 ! appsink name=videoSink sync=true";
        //		pipeline = "filesrc location=~/Documents/Projects/BeyondAR/Equirectangular_projection_SW.jpg ! jpegdec ! videoconvert ! imagefreeze ! videoconvert ! imagefreeze ! videoconvert ! video/x-raw,format=I420 ! appsink name=videoSink sync=true";
        //		pipeline = "videotestsrc ! videoconvert ! video/x-raw,width=3280,height=2048,format=I420 ! appsink name=videoSink sync=true";
        m_Texture.SetPipeline(_GetPipeline());
        m_Texture.Play();


        if (Debugger != null)
        {
            Debugger.AddDebugElement(new DebugCameraCaptureElement(m_Texture));
        }

        m_Texture.OnFrameGrabbed += OnFrameGrabbed;

        _Processor.ShaderName = "Image/I420ToRGB";

        Debug.Log("Starting Base");
        base.Start();
    }
Exemple #2
0
    public void Init(RobotInfo ifo)
    {
        GStreamerCore.Ref();
        m_Texture = TargetNode.AddComponent <GstCustomTexture> ();
        m_Texture.Initialize();

        FileName = ifo.URL;

        _Processor            = new OffscreenProcessor();
        _Processor.ShaderName = "Image/I420ToRGB";
        _needProcessing       = false;

        string path = Application.dataPath + "/" + FileName;

        m_Texture.SetPipeline("filesrc location=\"" + path + "\" ! qtdemux name=demux " +
                              "demux.video_0 ! queue ! avdec_h264 ! videoconvert ! video/x-raw,format=I420 ! appsink name=videoSink " +
                              "demux.audio_0 ! queue ! decodebin ! audioconvert ! volume volume=5 ! appsink name=audioSink");
        m_Texture.OnFrameGrabbed += OnFrameGrabbed;
        m_Texture.Play();


        GameObject audioObj = new GameObject("AudioObject_" + TargetNode.name);

        audioObj.transform.parent   = TargetNode.transform;
        audioObj.transform.position = Vector3.zero;
        AudioObject       = audioObj.AddComponent <AudioSource> ();
        AudioObject.loop  = true;
        _player           = audioObj.AddComponent <GstAudioPlayer> ();
        _player.Player    = m_Texture.Player.AudioWrapper;
        _player.TargetSrc = AudioObject;
    }
    void OnEnable()
    {
        CameraPorts cameraports  = CameraPanel.Load();
        List <int>  portSettings = new List <int>();

        portSettings.Add(cameraports.camera1);
        portSettings.Add(cameraports.camera2);
        portSettings.Add(cameraports.camera3);
        portSettings.Add(cameraports.camera4);
        portSettings.Add(cameraports.idMiniROV);
        //Debug.Log("El id está en la posicion: "+portSettings.Count);
        GameObject parent = GameObject.Find("CameraManager");

        for (int i = 0; i < parent.transform.childCount; i++)
        {
            if (this.gameObject.name == ("VideoStream" + (i + 1)))
            {
                port = portSettings[i].ToString();
                int mjpegCamera = portSettings[portSettings.Count - 1];
                if (i == mjpegCamera)
                {
                    pipeline = "udpsrc port=" + port + " ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! appsink name=videoSink";
                }
                else
                {
                    pipeline = "udpsrc port=" + port + " ! application/x-rtp ! rtph264depay ! avdec_h264 ! videoconvert ! appsink name=videoSink";
                }
            }
        }

        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        //pipeline = "udpsrc port="+port+" ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink name=videoSink";
        m_Texture.SetPipeline(pipeline);          //        pipeline+" ! video/x-raw,format=I420 ! videoconvert ! appsink name=videoSink"
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        m_Texture.Player.CreateStream();
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img = new GstImageInfo();
        _img.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        BlittedImage            = new Texture2D(1, 1);
        BlittedImage.filterMode = FilterMode.Bilinear;
        BlittedImage.anisoLevel = 0;
        BlittedImage.wrapMode   = TextureWrapMode.Clamp;

        if (TargetMaterial != null)
        {
            TargetMaterial.mainTexture = BlittedImage;
        }
    }
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent<GstCustomTexture>();

        // Check to make sure we have an instance.
        if (m_Texture == null)
        {
            DestroyImmediate(this);
        }

        m_Texture.Initialize ();

        m_Texture.SetPipeline (Pipeline);
        m_Texture.Play ();
    }
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent <GstCustomTexture>();

        // Check to make sure we have an instance.
        if (m_Texture == null)
        {
            DestroyImmediate(this);
        }

        m_Texture.Initialize();

        m_Texture.SetPipeline(Pipeline);
        m_Texture.Play();
    }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        GStreamerCore.Ref();

        _Processor            = new OffscreenProcessor();
        _Processor.ShaderName = "Image/I420ToRGB";
        _needProcessing       = false;

        _texture = gameObject.AddComponent <GstCustomTexture> ();
        _texture.Initialize();

        string path = Application.dataPath + "/" + FileName;

        _texture.SetPipeline("filesrc location=\"" + path + "\" ! qtdemux name=demux demux.video_0 ! avdec_h264 ! videorate ! videoconvert ! video/x-raw,format=I420,framerate=30/1 ");

        _texture.OnFrameGrabbed += _OnFrameGrabbed;
        _texture.Play();
    }
Exemple #7
0
    // Use this for initialization

    private void OnEnable()
    {
        GameObject parent = GameObject.Find("CameraManager");;

        for (int i = 0; i < parent.transform.childCount; i++)
        {
            if (this.gameObject.name == ("VideoStream" + (i + 1)))
            {
                port = this.GetComponentInParent <CameraManager>().GetPorts()[i];
            }
        }

        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        //pipeline = "udpsrc port="+port+" ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink name=videoSink";
        pipeline = "udpsrc port=" + port + " ! application/x-rtp ! rtph264depay ! avdec_h264 ! videoconvert ! appsink name=videoSink";
        m_Texture.SetPipeline(pipeline);          //        pipeline+" ! video/x-raw,format=I420 ! videoconvert ! appsink name=videoSink"
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        m_Texture.Player.CreateStream();
        //StartCoroutine(Dalay());
        System.Threading.Thread.Sleep(100);
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img = new GstImageInfo();
        _img.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        BlittedImage            = new Texture2D(1, 1);
        BlittedImage.filterMode = FilterMode.Bilinear;
        BlittedImage.anisoLevel = 0;
        BlittedImage.wrapMode   = TextureWrapMode.Clamp;

        if (TargetMaterial != null)
        {
            TargetMaterial.mainTexture = BlittedImage;
        }
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();
        m_Texture.SetPipeline(pipeline + " ! video/x-raw,format=I420 ! videoconvert ! appsink name=videoSink");
        m_Texture.Player.CreateStream();
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img = new GstImageInfo();
        _img.Create(3840, 2160, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        BlittedImage            = new Texture2D(7680, 2160);
        BlittedImage.filterMode = FilterMode.Bilinear;
        BlittedImage.anisoLevel = 0;
        BlittedImage.wrapMode   = TextureWrapMode.Clamp;

        if (TargetMaterial != null)
        {
            TargetMaterial.mainTexture = BlittedImage;
        }
    }
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();

        m_Texture.SetPipeline(pipeline);
        m_Texture.Player.CreateStream();
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img = new GstImageInfo();
        _img.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        BlittedImage            = new Texture2D(1, 1);
        BlittedImage.filterMode = FilterMode.Bilinear;
        BlittedImage.anisoLevel = 0;
        BlittedImage.wrapMode   = TextureWrapMode.Clamp;

        if (TargetMaterial != null)
        {
            TargetMaterial.mainTexture = BlittedImage;
        }
    }
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();
        string pipeline = "udpsrc port=" + Port.ToString() + " ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! avdec_h264";

        m_Texture.SetPipeline(pipeline + " ! video/x-raw,format=I420 ! videoconvert ! appsink name=videoSink");
        m_Texture.Player.CreateStream();
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img_left = new GstImageInfo();
        _img_left.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        _img_right = new GstImageInfo();
        _img_right.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        blittedImageLeft            = new Texture2D(1, 1);
        blittedImageLeft.filterMode = FilterMode.Bilinear;
        blittedImageLeft.anisoLevel = 0;
        blittedImageLeft.wrapMode   = TextureWrapMode.Clamp;

        blittedImageRight            = new Texture2D(1, 1);
        blittedImageRight.filterMode = FilterMode.Bilinear;
        blittedImageRight.anisoLevel = 0;
        blittedImageRight.wrapMode   = TextureWrapMode.Clamp;

        if (leftUIImage != null)
        {
            leftUIImage.texture = blittedImageLeft;
        }

        if (rightUIImage != null)
        {
            rightUIImage.texture = blittedImageRight;
        }
    }
Exemple #11
0
    // Use this for initialization
    void Start()
    {
        m_Texture = gameObject.GetComponent <GstCustomTexture>();
        m_Texture.Initialize();
        m_Texture.SetPipeline(pipeline + " ! video/x-raw,format=I420 ! videoconvert ! appsink name=videoSink");
        m_Texture.Player.CreateStream();
        m_Texture.Player.Play();

        m_Texture.OnFrameBlitted += OnFrameBlitted;
        _img_left = new GstImageInfo();
        _img_left.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        _img_right = new GstImageInfo();
        _img_right.Create(1, 1, GstImageInfo.EPixelFormat.EPixel_R8G8B8);

        blittedImageLeft            = new Texture2D(1, 1);
        blittedImageLeft.filterMode = FilterMode.Bilinear;
        blittedImageLeft.anisoLevel = 0;
        blittedImageLeft.wrapMode   = TextureWrapMode.Clamp;

        blittedImageRight            = new Texture2D(1, 1);
        blittedImageRight.filterMode = FilterMode.Bilinear;
        blittedImageRight.anisoLevel = 0;
        blittedImageRight.wrapMode   = TextureWrapMode.Clamp;

        if (leftUIImage != null)
        {
            leftUIImage.material.mainTexture    = blittedImageLeft;
            leftUIImage.rectTransform.sizeDelta = new Vector2(frameWidth, frameHeight);
        }

        if (rightUIImage != null)
        {
            rightUIImage.material.mainTexture    = blittedImageRight;
            rightUIImage.rectTransform.sizeDelta = new Vector2(frameWidth, frameHeight);
        }
    }
    // Use this for initialization
    protected override void Start()
    {
        _Processor = new OffscreenProcessor();
        m_Texture  = gameObject.GetComponent <GstCustomTexture>();

        //material=gameObject.GetComponent<MeshRenderer> ().material;
        // Check to make sure we have an instance.
        if (m_Texture == null)
        {
            DestroyImmediate(this);
        }


        m_Texture.Initialize();
        if (Debugger != null)
        {
            Debugger.AddDebugElement(new DebugCameraCaptureElement(m_Texture));
        }
        m_Texture.OnFrameGrabbed += OnFrameGrabbed;

        _Processor.ShaderName = "Image/I420ToRGB";
        Debug.Log("Starting Base");
        base.Start();
    }