public void Initialize() { m_HasBeenInitialized = true; m_EventProcessor = GetComponent <EventProcessor>(); if (m_EventProcessor == null) { m_EventProcessor = gameObject.AddComponent <EventProcessor>(); } GStreamerNativeMethods.GUBUnityDebugLogPFN log_handler = null; if (m_DebugOutput.m_Enabled) { log_handler = (int level, string message) => Debug.logger.Log((LogType)level, "GUB", message); } GStreamerNativeMethods.Ref(m_DebugOutput.m_GStreamerDebugString.Length == 0 ? null : m_DebugOutput.m_GStreamerDebugString, log_handler); m_instanceHandle = GCHandle.Alloc(this); m_Pipeline = new GStreamerNativeMethods(name + GetInstanceID(), OnFinish, OnError, OnQos, (IntPtr)m_instanceHandle); #if (UNITY_EDITOR || UNITY_STANDALONE) && OCULUS audioGUID = "{" + OVRManager.audioOutId + "}"; #endif }
public void Destroy() { if (m_Pipeline != null) { m_Pipeline.Destroy(); m_Pipeline = null; GStreamerNativeMethods.Unref(); } m_instanceHandle.Free(); }
void Initialize() { GStreamerNativeMethods.GUBUnityDebugLogPFN log_handler = null; if (Application.isEditor) { log_handler = (int level, string message) => Debug.logger.Log((LogType)level, "GUB", message); } GStreamerNativeMethods.Ref("2", log_handler); m_instanceHandle = GCHandle.Alloc(this); m_Pipeline = new GStreamerNativeMethods(name + GetInstanceID(), OnFinish, null, null, (System.IntPtr)m_instanceHandle); }
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; GStreamerNativeMethods.Unref(); m_instanceHandle.Free(); } }
void Update() { if (m_Pipeline == null) { return; } if (m_Texture == null) { GL.IssuePluginEvent(GStreamerNativeMethods.GetRenderEventFunc(), 0); int width = 0; int height = 0; bool isNowReady = GStreamerNativeMethods.IsReadyToRender(ref width, ref height); if (!isNowReady) { return; } //This means that we've just initialized, so create a texture and send it to the active pipeline CreateTexture(width, height); if (m_FirstFrame) { if (m_AdaptiveBitrateLimit != 1.0F) { SetAdaptiveBitrateLimit(m_AdaptiveBitrateLimit); } if (m_Events.m_OnStart != null) { m_Events.m_OnStart.Invoke(); } m_FirstFrame = false; } } GL.IssuePluginEvent(GStreamerNativeMethods.GetRenderEventFunc(), 1); }
void Awake() { GStreamerNativeMethods.AddPluginsToPath(); }