protected void RendererRecycledConnectionSinkEx(AVRenderer sender, AVConnection connection, object Handle) { TreeNode node = NodeTagSearch(rendererRootNode,connection); if (node != null) { // Connection was recycled, update it node.Text = connection.ConnectionID.ToString() + " - " + connection.CurrentState.ToString(); if (listViewSelectedObject == connection) SetListInfo(connection); } }
protected void RendererAddedSink(AVRendererDiscovery sender, AVRenderer renderer) { if (InvokeRequired) { Invoke(new AVRendererDiscovery.DiscoveryHandler(RendererAddedSink), sender, renderer); return; } renderer.OnRemovedConnection += new AVRenderer.ConnectionHandler(RemovedConnectionSink); TreeNode node = NodeTagSearch(rendererRootNode, renderer); if (node == null) { TreeNode varNode = new TreeNode(renderer.FriendlyName,1,1); varNode.Tag = renderer; rendererRootNode.Nodes.Add(varNode); renderer.OnCreateConnection += new AVRenderer.ConnectionHandler(RendererCreateConnectionSink); renderer.OnRecycledConnection += new AVRenderer.ConnectionHandler(RendererRecycledConnectionSink); renderer.OnCreateConnectionFailed += new AVRenderer.FailedConnectionHandler(RendererCreateConnectionFailedSink); foreach (AVConnection connection in renderer.Connections) { RendererCreateConnectionSink(renderer, connection, 0); } } rendererRootNode.Expand(); }
public RendererDebugForm(AVRenderer renderer) { // // Required for Windows Form Designer support // InitializeComponent(); this.renderer = renderer; renderingControlWatcher = renderer.RenderingControlWatcher; avTransportControlWatcher = renderer.AVTransportWatcher; connectionManagerControlWatcher = renderer.ConnectionManagerWatcher; renderingControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(renderingSniffHandlerSink); avTransportControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(avTransportSniffHandlerSink); connectionManagerControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(connectionManagerSniffHandlerSink); }
protected void RendererCreateConnectionSinkEx(AVRenderer sender, AVConnection connection, object Handle) { TreeNode node = NodeTagSearch(rendererRootNode,connection); if (node != null) { // Connection was recycled, update it node.Text = connection.ConnectionID.ToString() + " - " + connection.CurrentState.ToString(); if (listViewSelectedObject == connection) SetListInfo(connection); } else { // New connection, lets add it to the renderer node = NodeTagSearch(rendererRootNode,sender); if (node == null) MessageBox.Show(this,"Got new connection on unknown renderer"); TreeNode varNode = new TreeNode(connection.ConnectionID.ToString() + " - " + connection.CurrentState.ToString(),1,1); varNode.Tag = connection; node.Nodes.Add(varNode); connection.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink); connection.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink); connection.OnMute += new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink); connection.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangedHandlerSink); connection.OnMediaResourceChanged += new AVConnection.MediaResourceChangedHandler(MediaResourceChangedHandlerSink); connection.OnRemoved += new AVConnection.RendererHandler(RemovedConnectionHandlerSink); connection.OnTrackChanged += new AVConnection.CurrentTrackChangedHandler(TrackChangedSink); connection.OnCurrentMetaDataChanged += new AVConnection.CurrentMetaDataChangedHandler(MetaDataSink); } }
/// <summary> /// This is called when PrepareForConnection was successful /// </summary> /// <param name="sender"></param> /// <param name="c"></param> /// <param name="h"></param> protected void ConnectionSink(AVRenderer sender, AVConnection c, object h) { lock (ConnectionLock) { if (TableOfHandles.ContainsKey(h) == false) { return; } } // OpenSource.Utilities.InstanceTracker.StopTimer("PrepareForConnection"); _AVR.OnCreateConnection2 -= new AVRenderer.ConnectionHandler(ConnectionSink); c.OnCurrentURIChanged += new AVConnection.CurrentURIChangedHandler(UriEventSink); if (this.CurrentPlayListMode == PlayListMode.SINGLE_URI) { c.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateSink); } c.CurrentPlayList = this; OpenSource.Utilities.InstanceTracker.StartTimer(); // c.SetAVTransportURI(PlayListUri, "", c, new CpAVTransport.Delegate_OnResult_SetAVTransportURI(SetURISink)); c.SetAVTransportURI(PlayListUri, PlayListMetaData, c, new CpAVTransport.Delegate_OnResult_SetAVTransportURI(SetURISink)); }
protected void RemoveSink(UPnPSmartControlPoint sender, UPnPDevice device) { AVRenderer RemoveThis = null; lock (ManagerList) { for (int i = 0; i < ManagerList.Count; ++i) { AVRenderer avm = (AVRenderer)ManagerList[i]; if (avm.MainDevice.UniqueDeviceName == device.UniqueDeviceName) { RemoveThis = avm; ManagerList.RemoveAt(i); break; } } } if (RemoveThis != null) { RemoveThis.Removed(); if (RemovedRenderer != null) { RemovedRenderer(RemoveThis); } } }
private void RemovedSink(AVRenderer r) { OpenSource.Utilities.EventLogger.Log(this, System.Diagnostics.EventLogEntryType.Error, r.FriendlyName + " [REMOVED]"); if (this.OnRendererRemoved != null) { OnRendererRemoved(this, r); } }
private void AddSink(AVRenderer r) { OpenSource.Utilities.EventLogger.Log(this, System.Diagnostics.EventLogEntryType.Error, r.FriendlyName + " [ADDED]"); if (OnRenderer != null) { OnRenderer(this, r); } }
public void Dispose() { if (MWS != null) { MWS.Dispose(); } OnReady = null; OnFailed = null; _AVR = null; }
protected void AddSink(UPnPSmartControlPoint sender, UPnPDevice device) { AVRenderer avm = new AVRenderer(device); lock (ManagerList) { ManagerList.Add(avm); } if (OnRenderer != null) { OnRenderer(avm); } }
private void Weak_RemovedRendererSink(AVRenderer r) { WeakReference[] wr = (WeakReference[])Weak_RemovedRendererList.ToArray(typeof(WeakReference)); foreach (WeakReference W in wr) { if (W.IsAlive) { ((ManagerHandler)W.Target)(r); } else { Weak_RemovedRendererList.Remove(W); } } }
/// <summary> /// This is called when PrepareForConnection failed on the renderer /// </summary> /// <param name="sender"></param> /// <param name="reason"></param> /// <param name="h"></param> protected void FailedSink(AVRenderer sender, AVRenderer.CreateFailedReason reason, object h) { lock (ConnectionLock) { if (TableOfHandles.ContainsKey(h) == false) { return; } } _AVR.OnCreateConnectionFailed2 -= new AVRenderer.FailedConnectionHandler(FailedSink); if (OnFailed != null) { OnFailed(this, reason); } }
/// <summary> /// This is called when PrepareForConnection was successful and /// returned a recycled connection id /// </summary> /// <param name="sender"></param> /// <param name="c"></param> /// <param name="h"></param> protected void RecycledSink(AVRenderer sender, AVConnection c, object h) { lock (ConnectionLock) { if (TableOfHandles.ContainsKey(h) == false) { return; } } _AVR.OnRecycledConnection2 -= new AVRenderer.ConnectionHandler(RecycledSink); IsRecycled = true; c.OnCurrentURIChanged += new AVConnection.CurrentURIChangedHandler(UriEventSink); if (this.CurrentPlayListMode == PlayListMode.SINGLE_URI) { c.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateSink); } c.CurrentPlayList = this; // c.SetAVTransportURI(PlayListUri, "", c, new CpAVTransport.Delegate_OnResult_SetAVTransportURI(this.SetURISink)); c.SetAVTransportURI(PlayListUri, PlayListMetaData, c, new CpAVTransport.Delegate_OnResult_SetAVTransportURI(this.SetURISink)); }
public AVPlayList(AVRenderer AVR, IMediaResource[] r, ReadyHandler rh, FailedHandler fh, object Tag) { OpenSource.Utilities.InstanceTracker.Add(this); _AVR = AVR; string UseThisProtocolInfo = ""; _Tag = Tag; /* * ArrayList branches = new ArrayList(); * ToXmlData_Custom txdc = new ToXmlData_Custom(); * foreach(IMediaResource R in r) * { * if(branches.Contains(R.Owner)==false) * { * branches.Add(R.Owner); * } * txdc.Mappings[R] = false; * } * * MediaBuilder.container container = new MediaBuilder.container("Autogenerated Playlist"); * container.ID = Guid.NewGuid().ToString(); * container.IdIsValid = true; * ToXmlFormatter txf = new ToXmlFormatter(); * txf.WriteResource = new ToXmlFormatter.ToXml_FormatResource(WriteResource); * txdc.DesiredProperties = new ArrayList(); * txdc.IsRecursive = true; * txdc.VirtualOwner = MediaBuilder.CreateContainer(container); * * // Obtain the DIDL-Lite MetaData * this.PlayListMetaData = MediaBuilder.BuildDidl(txf, txdc, branches); * if(PlayListMetaData.Length>32768) PlayListMetaData = ""; */ int TempHandle = this.GetHashCode(); bool Done = false; OnReady += rh; OnFailed += fh; //Subscribe to the internal events on the Renderer to initiate a connection AVR.OnCreateConnection2 += new AVRenderer.ConnectionHandler(ConnectionSink); AVR.OnRecycledConnection2 += new AVRenderer.ConnectionHandler(RecycledSink); AVR.OnCreateConnectionFailed2 += new AVRenderer.FailedConnectionHandler(FailedSink); if (r.Length == 1) { // There is only one resource, so no need to build a playlist Done = true; _CurrentPlayListMode = PlayListMode.NOT_A_PLAYLIST; PlayListUri = ConvertLocalFileToHTTPResource(r[0]); lock (ConnectionLock) { TableOfHandles[TempHandle] = TempHandle; AVR.CreateConnection(r[0].ProtocolInfo.ToString(), "", -1, TempHandle); } } if ((Done == false && AVR.SupportsProtocolInfo(new ProtocolInfoString("http-get:*:audio/mpegurl:*"))) || (Done == false && AVR.SupportsProtocolInfo(new ProtocolInfoString("http-get:*:audio/x-mpegurl:*")))) { // Build M3U Done = true; _CurrentPlayListMode = PlayListMode.M3U; CheckMiniWebServer(); //OpenSource.Utilities.InstanceTracker.StartTimer(); StringBuilder M3U = new StringBuilder(); if (AVPlayList.EnableExtendedM3U) { M3U.Append("#EXTM3U\r\n"); } foreach (IMediaResource R in r) { if (AVPlayList.EnableExtendedM3U) { PrintExtInfLine(M3U, R); } M3U.Append(ConvertLocalFileToHTTPResource(R) + "\r\n"); } M3UString = M3U.ToString(); //OpenSource.Utilities.InstanceTracker.StopTimer("Build M3U"); PlayListUri = "http://" + AVR.Interface.ToString() + ":" + MWS.LocalIPEndPoint.Port.ToString() + "/item.m3u"; if (AVR.SupportsProtocolInfo(new ProtocolInfoString("http-get:*:audio/x-mpegurl:*"))) { UseThisProtocolInfo = "http-get:*:audio/x-mpegurl:*"; } if (AVR.SupportsProtocolInfo(new ProtocolInfoString("http-get:*:audio/mpegurl:*"))) { UseThisProtocolInfo = "http-get:*:audio/mpegurl:*"; } //OpenSource.Utilities.InstanceTracker.StartTimer(); lock (ConnectionLock) { TableOfHandles[TempHandle] = TempHandle; AVR.CreateConnection(UseThisProtocolInfo, "/", -1, TempHandle); } } if (Done == false) { // Fake a play list by switching Uri's on the fly _CurrentPlayListMode = PlayListMode.SINGLE_URI; foreach (IMediaResource rsc in r) { FakePlayQueue.Enqueue(rsc); } PlayListUri = r[0].ContentUri; FakePlayQueue.Dequeue(); lock (ConnectionLock) { TableOfHandles[TempHandle] = TempHandle; AVR.CreateConnection(r[0].ProtocolInfo.ToString(), "/", -1, TempHandle); } } }
protected void DiscoSink(AVRendererDiscovery sender, AVRenderer r) { r.OnEventRenewalFailure += new AVRenderer.EventRenewalFailureHandler(EventFailSink); lock (this) { r.OnCreateConnection += new AVRenderer.ConnectionHandler(NewConnectionsSink); r.OnRecycledConnection += new AVRenderer.ConnectionHandler(RecycledConnectionsSink); r.OnRemovedConnection += new AVRenderer.ConnectionHandler(RemovedConnectionSink); r.OnCreateConnectionFailed += new AVRenderer.FailedConnectionHandler(FailedConnectionSink); RendererList.Add(r); if (CurrentRenderer == null) { CurrentRenderer = r; if (CurrentRenderer.Connections.Count != 0) { CurrentConnection = (AVConnection)CurrentRenderer.Connections[0]; foreach (AVConnection c in CurrentRenderer.Connections) { c.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateSink); c.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangeSink); c.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangeSink); c.OnTrackChanged += new AVConnection.CurrentTrackChangedHandler(TrackChangedSink); c.OnNumberOfTracksChanged += new AVConnection.NumberOfTracksChangedHandler(NumberOfTracksChangedSink); c.OnTrackURIChanged += new AVConnection.TrackURIChangedHandler(TrackURIChangedSink); c.OnCurrentPlayModeChanged += new AVConnection.CurrentPlayModeChangedHandler(PlayModeChangedSink); } } else { CurrentConnection = null; } ShowRenderer(); } } }
protected void EventFailSink(AVRenderer sender) { AVDisco.ForceDisposeRenderer(sender); }
private void RendererDebugForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { renderingControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(renderingSniffHandlerSink); avTransportControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(avTransportSniffHandlerSink); connectionManagerControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(connectionManagerSniffHandlerSink); renderingControlWatcher = null; avTransportControlWatcher = null; connectionManagerControlWatcher = null; renderer = null; }
protected void AddSink(UPnPSmartControlPoint sender, UPnPDevice device) { AVRenderer avm = new AVRenderer(device); lock(ManagerList) { ManagerList.Add(avm); } if(OnRenderer!=null) OnRenderer(avm); }
protected void RendererRecycledConnectionSink(AVRenderer sender, AVConnection r, object Handle) { if (renderer != sender) MessageBox.Show(this,"Incorrect renderer event"); if (r != connection && (connection == null || (long)Handle == PendingConnection)) { if (connection != null) { connection.OnMediaResourceChanged -= new AVConnection.MediaResourceChangedHandler(OnMediaResourceChangedHandlerSink); connection.OnMute -= new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink); connection.OnPlayStateChanged -= new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink); connection.OnPositionChanged -= new AVConnection.PositionChangedHandler(PositionChangedHandlerSink); connection.OnRemoved -= new AVConnection.RendererHandler(RemovedConnectionHandlerSink); connection.OnVolume -= new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink); } connection = r; connection.OnMediaResourceChanged += new AVConnection.MediaResourceChangedHandler(OnMediaResourceChangedHandlerSink); connection.OnMute += new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink); connection.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink); connection.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangedHandlerSink); connection.OnRemoved += new AVConnection.RendererHandler(RemovedConnectionHandlerSink); connection.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink); } UpdateUserInterface(); }
protected void RemoveSink(AVRendererDiscovery sender, AVRenderer r) { RendererList.Remove(r); if (CurrentRenderer.UniqueDeviceName == r.UniqueDeviceName) { CurrentRenderer = null; CurrentConnection = null; if (RendererList.Count > 0) CurrentRenderer = (AVRenderer)RendererList[0]; ShowRenderer(); } }
public void RendererControlFormClose(RendererControlForm form,AVRenderer renderer) { if (rendererFormTable.ContainsKey(renderer)) rendererFormTable.Remove(renderer); }
public void PopupRendererForm(AVRenderer renderer, CpMediaItem[] playmedias) { if (rendererFormTable.ContainsKey(renderer) == true) { RendererControlForm form = (RendererControlForm)rendererFormTable[renderer]; if (playmedias != null) form.SetupConnection(playmedias); form.Activate(); } else { RendererControlForm form = new RendererControlForm(this,renderer,null); rendererFormTable.Add(renderer,form); if (playmedias != null) form.SetupConnection(playmedias); form.Show(); } }
private void ajax_OnReceive(HTTPSession sender, HTTPMessage msg) { string query = ""; HTTPMessage r; if (msg.Directive.ToUpper() == "GET" && msg.DirectiveObj.StartsWith("/Query?")) { query = msg.DirectiveObj.Substring(msg.DirectiveObj.IndexOf("?") + 1); if (query == "-1") { r = new HTTPMessage("1.1"); r.StatusCode = 200; r.StatusData = "OK"; r.StringBuffer = ScrapeUI(); sender.Send(r); } if (query == "-2") { r = new HTTPMessage("1.1"); r.StatusCode = 205; r.StatusData = "OK"; sender.Send(r); if (CurrentConnection != null) { CurrentConnection.Play(); } } if (query == "-3") { r = new HTTPMessage("1.1"); r.StatusCode = 205; r.StatusData = "OK"; sender.Send(r); if (CurrentConnection != null) { CurrentConnection.Stop(); } } if (query == "-4") { r = new HTTPMessage("1.1"); r.StatusCode = 205; r.StatusData = "OK"; sender.Send(r); if (CurrentConnection != null) { CurrentConnection.Pause(); } } if (query == "-5") { // // Event // lock (SessionQ) { SessionQ.Enqueue(sender); } } if (query == "-6" || query == "-7") { AVRenderer[] Rs = (AVRenderer[])RendererList.ToArray(typeof(AVRenderer)); int i = 0; foreach (AVRenderer cr in Rs) { if (cr.UniqueDeviceName == CurrentRenderer.UniqueDeviceName) { break; } ++i; } if (query == "-6") { if (i != 0) { CurrentRenderer = Rs[i - 1]; CurrentConnection = (AVConnection)CurrentRenderer.Connections[0]; ShowRenderer(); } } else { if (i != Rs.Length - 1) { CurrentRenderer = Rs[i + 1]; CurrentConnection = (AVConnection)CurrentRenderer.Connections[0]; ShowRenderer(); } } r = new HTTPMessage("1.1"); r.StatusCode = 200; r.StatusData = "OK"; r.StringBuffer = ScrapeUI(); sender.Send(r); } if (query.StartsWith("http://")) { r = new HTTPMessage("1.1"); r.StatusCode = 205; r.StatusData = "OK"; sender.Send(r); if (CurrentRenderer != null) { ResourceBuilder.ResourceAttributes resInfo = new ResourceBuilder.ResourceAttributes(); resInfo.contentUri = query; resInfo.protocolInfo = new ProtocolInfoString("http-get:*:*:*"); CurrentRenderer.OnCreateConnection += new AVRenderer.ConnectionHandler(CreateConnectionSink); CurrentRenderer.OnRecycledConnection += new AVRenderer.ConnectionHandler(CreateConnectionSink); CurrentRenderer.CreateConnection(new MediaResource[1] { ResourceBuilder.CreateResource(resInfo) }, true); } } } }
private void Weak_OnRendererSink(AVRenderer r) { WeakReference[] wr = (WeakReference[])Weak_OnRendererList.ToArray(typeof(WeakReference)); foreach(WeakReference W in wr) { if(W.IsAlive) { ((ManagerHandler)W.Target)(r); } else { Weak_OnRendererList.Remove(W); } } }
public void ForceDisposeRenderer(AVRenderer r) { scp.ForceDisposeDevice(r.MainDevice); }
protected void RemovedConnectionSink(AVRenderer sender, AVConnection c, object Handle) { if (CurrentRenderer.UniqueDeviceName == sender.UniqueDeviceName) { Location.Text = sender.FriendlyName; //mediaInfoLabel.Text = "Renderer Connections: " + CurrentRenderer.Connections.Count.ToString(); } if (CurrentConnection != null) { if (CurrentConnection.Identifier == c.Identifier) { if (CurrentRenderer.Connections.Count > 0) { CurrentConnection = (AVConnection)CurrentRenderer.Connections[0]; } else { CurrentConnection = null; } ShowRenderer(); } } }
public void ForceDisposeRenderer(AVRenderer r) { disco.ForceDisposeRenderer(r); }
protected void RecycledConnectionsSink(AVRenderer sender, AVConnection c, object Handle) { if (CurrentRenderer.UniqueDeviceName == sender.UniqueDeviceName) { if (CurrentConnection == null) CurrentConnection = c; ShowRenderer(); } c.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateSink); c.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangeSink); c.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangeSink); c.OnTrackChanged += new AVConnection.CurrentTrackChangedHandler(TrackChangedSink); c.OnNumberOfTracksChanged += new AVConnection.NumberOfTracksChangedHandler(NumberOfTracksChangedSink); c.OnTrackURIChanged += new AVConnection.TrackURIChangedHandler(TrackURIChangedSink); c.OnCurrentPlayModeChanged += new AVConnection.CurrentPlayModeChangedHandler(PlayModeChangedSink); c.OnMute += new AVConnection.MuteStateChangedHandler(MuteSink); if (Handle != null) c.Play(); }
public RendererControlForm(MainForm parent, AVRenderer renderer, AVConnection connection) { // // Required for Windows Form Designer support // InitializeComponent(); this.parent = parent; this.renderer = renderer; this.connection = connection; renderer.OnCreateConnection += new AVRenderer.ConnectionHandler(RendererCreateConnectionSink); renderer.OnRecycledConnection += new AVRenderer.ConnectionHandler(RendererRecycledConnectionSink); renderer.OnRemovedConnection += new AVRenderer.ConnectionHandler(RendererRemovedConnectionSink); if (connection == null && renderer.Connections.Count > 0) { connection = (AVConnection)renderer.Connections[0]; this.connection = connection; } if (connection != null) { connection.OnMediaResourceChanged += new AVConnection.MediaResourceChangedHandler(OnMediaResourceChangedHandlerSink); connection.OnMute += new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink); connection.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink); connection.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangedHandlerSink); connection.OnRemoved += new AVConnection.RendererHandler(RemovedConnectionHandlerSink); connection.OnTrackChanged += new AVConnection.CurrentTrackChangedHandler(CurrentTrackChangedHandlerSink); connection.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink); volumeTrackBar.Value = (int)connection.MasterVolume; PositionChangedHandlerSink(connection, connection.CurrentPosition); muteMenuItem.Checked = connection.IsMute; if (connection.IsMute == true) { muteButton.Image = mutedPictureBox.Image; } else { muteButton.Image = mutePictureBox.Image; } } this.Text = "Renderer - " + renderer.FriendlyName; rendererNameLabel.Text = renderer.FriendlyName; if (connection != null) PlayStateChangedHandlerSink(connection,connection.CurrentState); UpdateUserInterface(); }
protected void FailedConnectionSink(AVRenderer sender, AVRenderer.CreateFailedReason reason, object Handle) { MessageBox.Show("Could not fulfill request: " + reason.ToString()); }
protected void RendererRemovedConnectionSink(AVRenderer sender, AVConnection r, object Handle) { UpdateUserInterface(); }
private void CreateConnectionSink(AVRenderer sender, AVConnection c, object Handle) { sender.OnCreateConnection -= new AVRenderer.ConnectionHandler(CreateConnectionSink); sender.OnRecycledConnection -= new AVRenderer.ConnectionHandler(CreateConnectionSink); CurrentConnection = c; ShowRenderer(); }
public void PopupRendererForm(AVRenderer renderer, ICpContainer container) { if (rendererFormTable.ContainsKey(renderer) == true) { RendererControlForm form = (RendererControlForm)rendererFormTable[renderer]; if (container != null) form.SetupConnection(container); form.Activate(); } else { RendererControlForm form = new RendererControlForm(this,renderer,null); rendererFormTable.Add(renderer,form); if (container != null) form.SetupConnection(container); form.Show(); } }
public void ForceDisposeRenderer(AVRenderer r) { scp.ForceDisposeDevice(r.MainDevice); }
protected void RemovedConnectionSinkEx(AVRenderer sender, AVConnection r, object Handle) { TreeNode node = NodeTagSearch(rendererRootNode,r); if (node != null) { node.Remove(); } }
private void InitSink(AVRenderer sender) { Ev2.Set(); }
protected void RendererCreateConnectionFailedSink(AVRenderer sender, AVRenderer.CreateFailedReason r, object Handle) { MessageBox.Show(this,sender.FriendlyName + " failed to create a connection. " + r.ToString()); }
private void RecycledConnectionSink(AVRenderer sender, AVConnection c, object Tag) { TestConnection = c; Ev2.Set(); }
protected void RendererRecycledConnectionSink(AVRenderer sender, AVConnection r, object Handle) { Object[] args = new Object[3]; args[0] = sender; args[1] = r; args[2] = Handle; this.Invoke(new AVRenderer.ConnectionHandler(RendererRecycledConnectionSinkEx),args); }
private void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason) { PlayListTable.Remove(sender.GetHashCode()); if(OnReuseConnectionFailed!=null) OnReuseConnectionFailed(this,Tag); }
protected void RendererRemovedSink(AVRendererDiscovery sender, AVRenderer renderer) { if (InvokeRequired) { Invoke(new AVRendererDiscovery.DiscoveryHandler(RendererRemovedSink), sender, renderer); return; } renderer.OnCreateConnection -= new AVRenderer.ConnectionHandler(RendererCreateConnectionSink); foreach (AVConnection connection in renderer.Connections) { connection.OnVolume -= new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink); connection.OnPlayStateChanged -= new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink); connection.OnMute -= new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink); connection.OnPositionChanged -= new AVConnection.PositionChangedHandler(PositionChangedHandlerSink); connection.OnMediaResourceChanged -= new AVConnection.MediaResourceChangedHandler(MediaResourceChangedHandlerSink); connection.OnRemoved -= new AVConnection.RendererHandler(RemovedConnectionHandlerSink); connection.OnTrackChanged -= new AVConnection.CurrentTrackChangedHandler(TrackChangedSink); connection.OnCurrentMetaDataChanged -= new AVConnection.CurrentMetaDataChangedHandler(MetaDataSink); } TreeNode node = NodeTagSearch(rendererRootNode,renderer); if (node != null) { if (rendererFormTable.ContainsKey(node.Tag)) { RendererControlForm form = (RendererControlForm)rendererFormTable[node.Tag]; form.Close(); rendererFormTable.Remove(node.Tag); } rendererRootNode.Nodes.Remove(node); } }
protected void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason) { PlayListTable.Remove(sender.GetHashCode()); OnCreateConnectionFailedEvent.Fire(this,reason,sender.PlayListHandle); }