private static void PlatformPlaySong(Song song) { // Cleanup the last song first. if (State != MediaState.Stopped) { _session.Stop(); _session.ClearTopologies(); _session.Close(); _volumeController.Dispose(); _clock.Dispose(); } // Set the new song. _session.SetTopology(SessionSetTopologyFlags.Immediate, song.Topology); // Get the volume interface. _volumeController = CppObject.FromPointer <AudioStreamVolume>(MediaPlayer.GetVolumeObj(_session)); SetChannelVolumes(); // Get the clock. _clock = _session.Clock.QueryInterface <PresentationClock>(); //create the callback if it hasn't been created yet if (_callback == null) { _callback = new Callback(); _session.BeginGetEvent(_callback, null); } // Start playing. var varStart = new Variant(); _session.Start(null, varStart); }
private void PlatformPlay() { // Cleanup the last song first. if (State != MediaState.Stopped) { _session.Stop(); _session.ClearTopologies(); _session.Close(); if (_volumeController != null) { _volumeController.Dispose(); _volumeController = null; } _clock.Dispose(); } //create the callback if it hasn't been created yet if (_callback == null) { _callback = new Callback(this); _session.BeginGetEvent(_callback, null); } // Set the new song. _session.SetTopology(SessionSetTopologyFlags.Immediate, _currentVideo.Topology); // Get the clock. _clock = _session.Clock.QueryInterface <PresentationClock>(); // Start playing. var varStart = new Variant(); _session.Start(null, varStart); }
private static void PlatformPlaySong(Song song) { // Cleanup the last song first. if (State != MediaState.Stopped) { _session.Stop(); _session.ClearTopologies(); _session.Close(); _volumeController.Dispose(); _clock.Dispose(); } // Set the new song. _session.SetTopology(SessionSetTopologyFlags.Immediate, song.Topology); // Get the volume interface. IntPtr volumeObj; try { MediaFactory.GetService(_session, MRPolicyVolumeService, SimpleAudioVolumeGuid, out volumeObj); } catch { MediaFactory.GetService(_session, MRPolicyVolumeService, SimpleAudioVolumeGuid, out volumeObj); } _volumeController = CppObject.FromPointer <SimpleAudioVolume>(volumeObj); _volumeController.Mute = _isMuted; _volumeController.MasterVolume = _volume; // Get the clock. _clock = _session.Clock.QueryInterface <PresentationClock>(); //create the callback if it hasn't been created yet if (_callback == null) { _callback = new Callback(); _session.BeginGetEvent(_callback, null); } // Start playing. var varStart = new Variant(); _session.Start(null, varStart); }
public override void Dispose() { FLLog.Info("Video", "Closing Windows Media Foundation backend"); if (session != null) { session.ClearTopologies(); session.Stop(); session.Close(); session.Dispose(); } if (topology != null) { topology.Dispose(); } if (videoSampler != null) { videoSampler.Dispose(); } if (clock != null) { clock.Dispose(); } if (_texture != null) { _texture.Dispose(); } if (cb != null) { cb.Dispose(); } }
private void PlatformStop() { _session.ClearTopologies(); _session.Stop(); _session.Close(); _volumeController.Dispose(); _volumeController = null; _clock.Dispose(); _clock = null; }
private void PlatformPlay() { // Cleanup the last song first. if (State != MediaState.Stopped) { _session.Stop(); _session.ClearTopologies(); _session.Close(); if (_volumeController != null) { _volumeController.Dispose(); _volumeController = null; } _clock.Dispose(); } //create the callback if it hasn't been created yet if (_callback == null) { _callback = new Callback(this); _session.BeginGetEvent(_callback, null); } // Set the new song. _session.SetTopology(SessionSetTopologyFlags.Immediate, _currentVideo.Topology); // Get the clock. _clock = _session.Clock.QueryInterface <PresentationClock>(); // Start playing. var varStart = new Variant(); _session.Start(null, varStart); // we need to dispose of the old texture if we have one if (_videoCache != null) { _videoCache.Dispose(); } // Create cached texture _videoCache = new Texture2D(_graphicsDevice, _currentVideo.Width, _currentVideo.Height, false, SurfaceFormat.Bgr32); }
public void Close() { Stop(); try { _audioVolume?.Dispose(); _videoControl?.Dispose(); _mediaSession?.Close(); } catch (SharpDXException) { } _audioVolume = null; _videoControl = null; }
/// <summary> /// The current call has ended. Reset the state of the user agent. /// </summary> private void CallEnded() { m_uac = null; m_uas = null; if (MediaSession != null && !MediaSession.IsClosed) { MediaSession.Close("normal"); MediaSession = null; } OnCallHungup?.Invoke(); }
/// <summary> /// The current call has ended. Reset the state of the user agent. /// </summary> private void CallEnded() { m_uac = null; m_uas = null; if (MediaSession != null) { MediaSession.SessionMediaChanged -= MediaSessionOnSessionMediaChanged; MediaSession.Close(); MediaSession = null; } OnCallHungup?.Invoke(); }
/// <summary> /// Cancel our call attempt prior to it being answered. /// </summary> public void Cancel() { MediaSession.SessionMediaChanged -= MediaSessionOnSessionMediaChanged; MediaSession?.Close(); if (m_uac != null) { if (m_uac.IsUACAnswered == false) { m_uac.Cancel(); } else { m_uac.Hangup(); } } }
/// <summary> /// Hangup established call /// </summary> public void Hangup() { m_cts.Cancel(); if (MediaSession != null && !MediaSession.IsClosed) { MediaSession?.Close("call hungup"); } if (Dialogue?.DialogueState != SIPDialogueStateEnum.Terminated) { Dialogue?.Hangup(m_transport, m_outboundProxy); } IsOnLocalHold = false; IsOnRemoteHold = false; CallEnded(); }
/// <summary> /// Cancel our call attempt prior to it being answered. /// </summary> public void Cancel() { if (m_uac != null) { if (m_uac.IsUACAnswered == false) { m_uac.Cancel(); } else { m_uac.Hangup(); } } if (MediaSession != null) { MediaSession.Close("call cancelled"); } }
public override void Dispose() { FLLog.Info("Video", "Closing Windows Media Foundation backend"); if (session != null) { session.Stop(); session.ClearTopologies(); //Sample grabber thread works asynchronously (as task), so we need give him a time, to understand, that session is closed //minimal time to wait: 33 ms (1000 ms / 30 fps), but I decide to use a little more System.Threading.Thread.Sleep(100); session.Close(); session.Dispose(); session = null; } if (topology != null) { topology.Dispose(); topology = null; } if (videoSampler != null) { videoSampler.Dispose(); videoSampler = null; } if (clock != null) { clock.Dispose(); clock = null; } if (_texture != null) { _texture.Dispose(); _texture = null; } if (cb != null) { cb.Dispose(); cb = null; } }
private void ResetMusicPlayer() { mediaSession.Close(); }
/// <summary> /// Hangup established call /// </summary> public void Hangup() { MediaSession?.Close(); Dialogue?.Hangup(m_transport, m_outboundProxy); CallEnded(); }
internal override void ResetMusicPlayer() { base.ResetMusicPlayer(); mediaSession.Close(); }