Beispiel #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();
    }
    // Update is called once per frame
    void Update()
    {
        position = m_Texture.Player.GetPosition() / 1000;
        duration = m_Texture.Player.GetDuration() / 1000;

        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            var p = (position - 5000);
            if (p < 0)
            {
                p = 0;
            }
            m_Texture.Player.Seek(p * 1000);
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            var p = (position + 5000);
            if (p >= duration)
            {
                p = duration;
            }
            m_Texture.Player.Seek(p * 1000);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            m_Texture.Stop();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            m_Texture.Play();
        }
    }
Beispiel #3
0
 public void Resume()
 {
     if (m_Texture != null)
     {
         m_Texture.Play();
     }
 }
Beispiel #4
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;
    }
    // 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();
    }
Beispiel #7
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();
    }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        /*
         * string selectedCamera = CameraManager.GetInstance().GetSelection();
         * if(selectedCamera != actualCamera){
         *      Initialize(selectedCamera);
         *      Debug.Log ("New video...");
         *
         * }
         */

        position = m_Texture.Player.GetPosition() / 1000;
        duration = m_Texture.Player.GetDuration() / 1000;
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            var p = (position - 5000);
            if (p < 0)
            {
                p = 0;
            }
            m_Texture.Player.Seek(p * 1000);
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            var p = (position + 5000);
            if (p >= duration)
            {
                p = duration;
            }
            m_Texture.Player.Seek(p * 1000);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            m_Texture.Stop();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            m_Texture.Play();
        }
    }
 public void StartPlayer()
 {
     m_Texture.SetPipeline(_GetPipeline());
     m_Texture.Play();
 }