Пример #1
0
 public void Destroy()
 {
     if (m_Pipeline != null)
     {
         m_Pipeline.Destroy();
         m_Pipeline = null;
         GStreamer.Unref();
     }
     m_instanceHandle.Free();
 }
Пример #2
0
 public void Destroy()
 {
     if (m_Pipeline != null)
     {
         m_Pipeline.Destroy();
         m_Pipeline = null;
     }
     m_instanceHandle.Free();
     Debug.Log("[GUB] Destroy");
 }
Пример #3
0
    void Initialize()
    {
        GStreamer.GUBUnityDebugLogPFN log_handler = null;
        if (Application.isEditor)
        {
            log_handler = (int level, string message) => Debug.logger.Log((LogType)level, "GUB", message);
        }

        GStreamer.Ref("2", log_handler);
        m_instanceHandle = GCHandle.Alloc(this);
        m_Pipeline       = new GstUnityBridgePipeline(name + GetInstanceID(), OnFinish, null, null, (System.IntPtr)m_instanceHandle);
    }
Пример #4
0
    void Initialize()
    {
        GStreamer.GUBUnityDebugLogPFN log_handler = null;
        if (Application.isEditor)
        {
            log_handler = (int level, string message) => Debug.logger.Log((LogType)level, "GUB", message);
        }

        GStreamer.Ref("2", log_handler);
        m_instanceHandle = GCHandle.Alloc(this);
        m_Pipeline = new GstUnityBridgePipeline(name + GetInstanceID(), OnFinish, null, null, (System.IntPtr)m_instanceHandle);
    }
Пример #5
0
    public void Initialize()
    {
        m_HasBeenInitialized = true;

        m_EventProcessor = GetComponent <EventProcessor>();
        if (m_EventProcessor == null)
        {
            m_EventProcessor = gameObject.AddComponent <EventProcessor>();
        }

        GStreamer.GUBUnityDebugLogPFN log_handler = null;
        if (Application.isEditor && m_DebugOutput.m_Enabled)
        {
            log_handler = (int level, string message) => Debug.logger.Log((LogType)level, "GUB", message);
        }

        GStreamer.Ref(m_DebugOutput.m_GStreamerDebugString.Length == 0 ? null : m_DebugOutput.m_GStreamerDebugString, log_handler);

        m_instanceHandle = GCHandle.Alloc(this);
        m_Pipeline       = new GstUnityBridgePipeline(name + GetInstanceID(), OnFinish, OnError, OnQos, (IntPtr)m_instanceHandle);

        Resize(m_Width, m_Height);

        Material mat = m_TargetMaterial;

        if (mat == null && GetComponent <Renderer>())
        {
            // If no material is given, use the first one in the Renderer component
            mat = GetComponent <Renderer>().material;
        }

        if (mat != null)
        {
            string tex_name = m_IsAlpha ? "_AlphaTex" : "_MainTex";
            mat.SetTexture(tex_name, m_Texture);
            mat.SetTextureScale(tex_name, new Vector2(Mathf.Abs(mat.mainTextureScale.x) * (m_FlipX ? -1F : 1F),
                                                      Mathf.Abs(mat.mainTextureScale.y) * (m_FlipY ? -1F : 1F)));
        }
        else
        if (GetComponent <GUITexture>())
        {
            GetComponent <GUITexture>().texture = m_Texture;
        }
        else
        {
            Debug.LogWarning(string.Format("[{0}] There is no Renderer or guiTexture attached to this GameObject, and TargetMaterial is not set.", name + GetInstanceID()));
        }
    }
Пример #6
0
 private void Destroy()
 {
     if (m_Pipeline != null)
     {
         // Send EOS down the pipeline
         m_Pipeline.StopEncoding();
         // Wait for EOS to reach the end
         while (!m_EOS)
         {
             System.Threading.Thread.Sleep(1000);
         }
         m_Pipeline.Destroy();
         m_Pipeline = null;
         GStreamer.Unref();
         m_instanceHandle.Free();
     }
 }
Пример #7
0
 private void Destroy()
 {
     if (m_Pipeline != null)
     {
         // Send EOS down the pipeline
         m_Pipeline.StopEncoding();
         // Wait for EOS to reach the end
         while (!m_EOS)
         {
             System.Threading.Thread.Sleep(1000);
         }
         m_Pipeline.Destroy();
         m_Pipeline = null;
         GStreamer.Unref();
         m_instanceHandle.Free();
     }
 }
Пример #8
0
    public void Initialize()
    {
        if (!m_HasBeenInitialized)
        {
            m_HasBeenInitialized = true;

            m_EventProcessor = GetComponent <EventProcessor>();
            if (m_EventProcessor == null)
            {
                m_EventProcessor = gameObject.AddComponent <EventProcessor>();
            }

            m_instanceHandle = GCHandle.Alloc(this);

            m_Pipeline = new GstUnityBridgePipeline(name + GetInstanceID(), OnFinish, OnError, OnQos, (IntPtr)m_instanceHandle);

            Resize(m_Width, m_Height);

            Material mat = m_TargetMaterial;
            if (mat == null && GetComponent <Renderer>())
            {
                // If no material is given, use the first one in the Renderer component
                mat = GetComponent <Renderer>().material;
            }

            if (mat != null)
            {
                string tex_name = m_IsAlpha ? "_AlphaTex" : "_MainTex";
                mat.SetTexture(tex_name, m_Texture);
                mat.SetTextureScale(tex_name, new Vector2(Mathf.Abs(mat.mainTextureScale.x) * (m_FlipX ? -1F : 1F),
                                                          Mathf.Abs(mat.mainTextureScale.y) * (m_FlipY ? -1F : 1F)));
            }
            else
            if (GetComponent <GUITexture>())
            {
                GetComponent <GUITexture>().texture = m_Texture;
            }
            else
            {
                Debug.LogWarning(string.Format("[{0}] There is no Renderer or guiTexture attached to this GameObject, and TargetMaterial is not set.", name + GetInstanceID()));
            }
        }
    }