protected void GetMediaInfoSink(System.UInt32 InstanceID, out System.UInt32 NrTracks, out System.String MediaDuration, out System.String CurrentURI, out System.String CurrentURIMetaData, out System.String NextURI, out System.String NextURIMetaData, out DvAVTransport.Enum_PlaybackStorageMedium PlayMedium, out DvAVTransport.Enum_RecordStorageMedium RecordMedium, out DvAVTransport.Enum_RecordMediumWriteStatus WriteStatus) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; NrTracks = c._NumberOfTracks; MediaDuration = string.Format("{0:00}", c._Duration.Hours) + ":" + string.Format("{0:00}", c._Duration.Minutes) + ":" + string.Format("{0:00}", c._Duration.Seconds); if (c._CurrentURI == null) { CurrentURI = ""; } else { CurrentURI = HTTPMessage.UnEscapeString(c._CurrentURI.AbsoluteUri); } if (c._NextURI == null) { NextURI = ""; } else { NextURI = HTTPMessage.UnEscapeString(c._NextURI.AbsoluteUri); } CurrentURIMetaData = c._CurrentURIMetaData; NextURIMetaData = c._NextURIMetaData; PlayMedium = c._PlaybackMedium; RecordMedium = c._RecordMedium; WriteStatus = c._WriteStatus; } }
internal void ConnectionClosed(AVConnection sender) { lock (ConnectionLock) { --CurrentConnections; if (CurrentConnections < 0) { CurrentConnections = 0; } ID_Table.Remove((UInt32)sender.Connection_ID); } IDictionaryEnumerator en = ID_Table.GetEnumerator(); string EventString = ""; while (en.MoveNext()) { if (EventString == "") { EventString = en.Key.ToString(); } else { EventString = EventString + "," + en.Key.ToString(); } } Manager.Evented_CurrentConnectionIDs = EventString; }
public ImageVideoForm(RendererForm referer, AVConnection c) { Connection = c; Parent = referer; // // Required for Windows Form Designer support // InitializeComponent(); this.Text = "Image/Video Controls [" + c.ID.ToString() + "]"; RedBlack.Value = (int)c.RedVideoBlackLevel; RedGain.Value = (int)c.RedVideoGain; GreenBlack.Value = (int)c.GreenVideoBlackLevel; GreenGain.Value = (int)c.GreenVideoGain; BlueBlack.Value = (int)c.BlueVideoBlackLevel; BlueGain.Value = (int)c.BlueVideoGain; c.OnBlueVideoBlackLevelChanged += new AVConnection.VariableChangedHandler(BlueBlackSink); c.OnBlueVideoGainChanged += new AVConnection.VariableChangedHandler(BlueGainSink); c.OnGreenVideoBlackLevelChanged += new AVConnection.VariableChangedHandler(GreenBlackSink); c.OnGreenVideoGainChanged += new AVConnection.VariableChangedHandler(GreenGainSink); c.OnRedVideoBlackLevelChanged += new AVConnection.VariableChangedHandler(RedBlackSink); c.OnRedVideoGainChanged += new AVConnection.VariableChangedHandler(RedGainSink); c.OnSharpnessChanged += new AVConnection.VariableChangedHandler(SharpnessSink); c.OnBrightnessChanged += new AVConnection.VariableChangedHandler(BrightnessSink); c.OnContrastChanged += new AVConnection.VariableChangedHandler(ContrastSink); }
protected void PlaySink(System.UInt32 InstanceID, DvAVTransport.Enum_TransportPlaySpeed Speed) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; c.Play(Speed); } }
protected void NextSink(System.UInt32 InstanceID) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; c.Next(); } }
protected void GetVolumeSink(System.UInt32 InstanceID, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, out System.UInt16 CurrentVolume) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; CurrentVolume = c.GetVolume(Channel); } }
protected void SetRecordQualityModeSink(System.UInt32 InstanceID, DvAVTransport.Enum_CurrentRecordQualityMode NewRecordQualityMode) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; c.SetRecordQualityMode(NewRecordQualityMode); } }
protected void SetMuteSink(System.UInt32 InstanceID, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, System.Boolean DesiredMute) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; c._SetMute(Channel, DesiredMute); } }
protected void GetRedVideoGainSink(System.UInt32 InstanceID, out System.UInt16 CurrentRedVideoGain) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; CurrentRedVideoGain = c.RedVideoGain; } }
protected void SetRedVideoGainSink(System.UInt32 InstanceID, System.UInt16 DesiredRedVideoGain) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; c._SetRedVideoGain(DesiredRedVideoGain); } }
protected void GetCurrentTransportActionsSink(System.UInt32 InstanceID, out System.String Actions) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; Actions = c._Actions; } }
protected void GetTransportSettingsSink(System.UInt32 InstanceID, out DvAVTransport.Enum_CurrentPlayMode PlayMode, out DvAVTransport.Enum_CurrentRecordQualityMode RecQualityMode) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; PlayMode = c._CurrentPlayMode; RecQualityMode = c._CurrentRecMode; } }
protected void GetDeviceCapabilitiesSink(System.UInt32 InstanceID, out System.String PlayMedia, out System.String RecMedia, out System.String RecQualityModes) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; PlayMedia = ""; RecMedia = ""; RecQualityModes = ""; foreach (string m in DvAVTransport.Values_PlaybackStorageMedium) { if (PlayMedia == "") { PlayMedia = m; } else { PlayMedia = PlayMedia + "," + m; } } foreach (string m in DvAVTransport.Values_RecordStorageMedium) { if (RecMedia == "") { RecMedia = m; } else { RecMedia = RecMedia + "," + m; } } foreach (string m in DvAVTransport.Values_CurrentRecordQualityMode) { if (RecQualityModes == "") { RecQualityModes = m; } else { RecQualityModes = RecQualityModes + "," + m; } } } }
protected void GetTransportInfoSink(System.UInt32 InstanceID, out DvAVTransport.Enum_TransportState CurrentTransportState, out DvAVTransport.Enum_TransportStatus CurrentTransportStatus, out DvAVTransport.Enum_TransportPlaySpeed CurrentSpeed) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; CurrentTransportState = c._CurrentTransportState; CurrentSpeed = c._CurrentTransportSpeed; CurrentTransportStatus = c._CurrentStatus; } }
protected void SeekSink(System.UInt32 InstanceID, DvAVTransport.Enum_A_ARG_TYPE_SeekMode Unit, System.String Target) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; if ((c.NumberOfTracks <= 1) && (Unit == DvAVTransport.Enum_A_ARG_TYPE_SeekMode.TRACK_NR)) { throw new UPnPCustomException(710, "Invalid seek mode. Cannot seek on a zero or one-item playlist or media."); } c.Seek(Unit, Target); } }
protected void GetCurrentConnectionInfoSink(System.Int32 ConnectionID, out System.Int32 RcsID, out System.Int32 AVTransportID, out System.String ProtocolInfo, out System.String PeerConnectionManager, out System.Int32 PeerConnectionID, out DvConnectionManager.Enum_A_ARG_TYPE_Direction Direction, out DvConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status) { if (ID_Table.ContainsKey((UInt32)ConnectionID) == false) { throw(new UPnPCustomException(802, ConnectionID.ToString() + " is not a valid ID")); } else { AVConnection c = (AVConnection)ID_Table[(UInt32)ConnectionID]; RcsID = c.RenderingControl_ID; AVTransportID = c.AVTransport_ID; ProtocolInfo = c.InfoString.ToString(); PeerConnectionManager = c.PeerConnectionManager; PeerConnectionID = c.PeerConnectionManagerID; Direction = c._Direction; Status = c._Status; } }
protected void ConnectionCompleteSink(Int32 ConnectionID) { if (ID_Table.ContainsKey((UInt32)ConnectionID) == false) { throw(new UPnPCustomException(802, ConnectionID.ToString() + " is not a valid ID")); } else { AVConnection c = (AVConnection)ID_Table[(UInt32)ConnectionID]; ID_Table.Remove((UInt32)ConnectionID); if (OnClosedConnection != null) { OnClosedConnection(this, c); } c.dispose(); } }
protected void SetNextAVTransportURISink(System.UInt32 InstanceID, System.String NextURI, System.String NextURIMetaData) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; if ((NextURI == "") || (NextURI == null)) { c.SetNextAVTransportURI(null, NextURIMetaData); } else { c.SetNextAVTransportURI(new Uri(NextURI), NextURIMetaData); } } }
protected void GetPositionInfoSink(System.UInt32 InstanceID, out System.UInt32 Track, out System.String TrackDuration, out System.String TrackEmbeddedMetaData, out System.String TrackURI, out System.String RelTime, out System.String AbsTime, out System.Int32 RelCount, out System.Int32 AbsCount) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; Track = c._Track; TrackDuration = string.Format("{0:00}", c._TrackDuration.Hours) + ":" + string.Format("{0:00}", c._TrackDuration.Minutes) + ":" + string.Format("{0:00}", c._TrackDuration.Seconds); TrackEmbeddedMetaData = c._TrackEmbeddedMetaData; if (c._TrackURI == null) { TrackURI = ""; } else { TrackURI = c._TrackURI.AbsoluteUri; } if (c._RelativeTime.TotalSeconds < 0) { RelTime = "NOT_IMPLEMENTED"; } else { RelTime = string.Format("{0:00}", c._RelativeTime.Hours) + ":" + string.Format("{0:00}", c._RelativeTime.Minutes) + ":" + string.Format("{0:00}", c._RelativeTime.Seconds); } if (c._AbsoluteTime.TotalSeconds < 0) { AbsTime = "NOT_IMPLEMENTED"; } else { AbsTime = string.Format("{0:00}", c._AbsoluteTime.Hours) + ":" + string.Format("{0:00}", c._AbsoluteTime.Minutes) + ":" + string.Format("{0:00}", c._AbsoluteTime.Seconds); } RelCount = c._RelativeCounter; AbsCount = c._AbsoluteCounter; } }
protected void ListPresetsSink(System.UInt32 InstanceID, out System.String CurrentPresetNameList) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; CurrentPresetNameList = ""; foreach (string preset in c.Presets) { if (CurrentPresetNameList == "") { CurrentPresetNameList = preset; } else { CurrentPresetNameList = CurrentPresetNameList + "," + preset; } } } }
protected void PlayModeSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(PlayModeSink), sender); return; } if (sender.ID == _connection.ID) { this.PlayModeLabel.Text = DvAVTransport.Enum_CurrentPlayMode_ToString(sender.CurrentPlayMode); //player.PreviewMode = sender.CurrentPlayMode == DvAVTransport.Enum_CurrentPlayMode.INTRO; REPEAT_ALL = sender.CurrentPlayMode == DvAVTransport.Enum_CurrentPlayMode.REPEAT_ALL; } }
protected void PrepareForConnectionSink(System.String RemoteProtocolInfo, System.String PeerConnectionManager, int PeerConnectionID, DvConnectionManager.Enum_A_ARG_TYPE_Direction Direction, out System.Int32 ConnectionID, out System.Int32 AVTransportID, out System.Int32 RcsID) { bool OK = false; ConnectionID = 0; string EventString = ""; foreach(ProtocolInfoString s in InfoStrings) { if(s.Equals(new ProtocolInfoString(RemoteProtocolInfo))) { OK = true; break; } } if(OK==false) { // We don't support this protocol Info; throw(new UPnPCustomException(801,RemoteProtocolInfo + " NOT supported")); } OK = false; if(ManualPrepareForConnection!=null) { try { ConnectionID = ManualPrepareForConnection(this,new ProtocolInfoString(RemoteProtocolInfo)); OK = true; ID_Table[(UInt32)ConnectionID] = ""; } catch(PrepareForConnectionFailedException pfcfe) { throw(new UPnPCustomException(800,pfcfe.Message)); } } lock(ConnectionLock) { if(OK==false) { if(CurrentConnections<ConnectionMax) { ++ CurrentConnections; Random r = new Random(); do { ConnectionID = r.Next(4096,65535); }while(ID_Table.ContainsKey(ConnectionID)==true); ID_Table[(UInt32)ConnectionID] = ""; OK = true; } else { OK = false; } } if(OK==true) { // BuildEventString IDictionaryEnumerator KEYS = ID_Table.GetEnumerator(); while(KEYS.MoveNext()) { if(EventString=="") { EventString = KEYS.Key.ToString(); } else { EventString = EventString + "," + KEYS.Key.ToString(); } } } } if(OK==false) throw(new UPnPCustomException(800,"No more resources")); AVTransportID = (int)ConnectionID; RcsID = (int)ConnectionID; AVConnection c = new AVConnection(this, RemoteProtocolInfo, PeerConnectionManager, PeerConnectionID, Direction, ConnectionID, AVTransportID, RcsID); c._WhoCreatedMe = AVT.GetCaller(); ID_Table[(UInt32)ConnectionID] = c; Manager.Evented_CurrentConnectionIDs = EventString; if(OnNewConnection!=null) OnNewConnection(this,c); }
internal void ConnectionClosed(AVConnection sender) { lock(ConnectionLock) { --CurrentConnections; if(CurrentConnections<0) CurrentConnections = 0; ID_Table.Remove((UInt32)sender.Connection_ID); } IDictionaryEnumerator en = ID_Table.GetEnumerator(); string EventString = ""; while(en.MoveNext()) { if(EventString == "") { EventString = en.Key.ToString(); } else { EventString = EventString + "," + en.Key.ToString(); } } Manager.Evented_CurrentConnectionIDs = EventString; }
protected void RecModeSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(RecModeSink), sender); return; } if (sender.ID == _connection.ID) { this.RecordQualityModeLabel.Text = DvAVTransport.Enum_CurrentRecordQualityMode_ToString(sender.CurrentRecordQualityMode); } }
protected void SeekSink(AVConnection sender, DvAVTransport.Enum_A_ARG_TYPE_SeekMode SeekMode, string Target) { if (InvokeRequired) { Invoke(new AVConnection.SeekHandler(SeekSink), sender, SeekMode, Target); return; } DText p = new DText(); p.ATTRMARK = ":"; p[0] = Target; if ((SeekMode == DvAVTransport.Enum_A_ARG_TYPE_SeekMode.REL_TIME) && (this.m_SeekPositionEnabled)) { TimeSpan ts = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3])); player.Ctlcontrols.currentPosition = ts.TotalSeconds; } }
protected void PauseSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(PauseSink), sender); return; } if (sender.CurrentTransportState == DvAVTransport.Enum_TransportState.RECORDING) { set_Pause(); sender.CurrentTransportState = DvAVTransport.Enum_TransportState.PAUSED_RECORDING; } else { player.Ctlcontrols.pause(); } }
protected void PrepareForConnectionSink(System.String RemoteProtocolInfo, System.String PeerConnectionManager, int PeerConnectionID, DvConnectionManager.Enum_A_ARG_TYPE_Direction Direction, out System.Int32 ConnectionID, out System.Int32 AVTransportID, out System.Int32 RcsID) { bool OK = false; ConnectionID = 0; string EventString = ""; foreach (ProtocolInfoString s in InfoStrings) { if (s.Equals(new ProtocolInfoString(RemoteProtocolInfo))) { OK = true; break; } } if (OK == false) { // We don't support this protocol Info; throw(new UPnPCustomException(801, RemoteProtocolInfo + " NOT supported")); } OK = false; if (ManualPrepareForConnection != null) { try { ConnectionID = ManualPrepareForConnection(this, new ProtocolInfoString(RemoteProtocolInfo)); OK = true; ID_Table[(UInt32)ConnectionID] = ""; } catch (PrepareForConnectionFailedException pfcfe) { throw(new UPnPCustomException(800, pfcfe.Message)); } } lock (ConnectionLock) { if (OK == false) { if (CurrentConnections < ConnectionMax) { ++CurrentConnections; Random r = new Random(); do { ConnectionID = r.Next(4096, 65535); }while(ID_Table.ContainsKey(ConnectionID) == true); ID_Table[(UInt32)ConnectionID] = ""; OK = true; } else { OK = false; } } if (OK == true) { // BuildEventString IDictionaryEnumerator KEYS = ID_Table.GetEnumerator(); while (KEYS.MoveNext()) { if (EventString == "") { EventString = KEYS.Key.ToString(); } else { EventString = EventString + "," + KEYS.Key.ToString(); } } } } if (OK == false) { throw(new UPnPCustomException(800, "No more resources")); } AVTransportID = (int)ConnectionID; RcsID = (int)ConnectionID; AVConnection c = new AVConnection(this, RemoteProtocolInfo, PeerConnectionManager, PeerConnectionID, Direction, ConnectionID, AVTransportID, RcsID); c._WhoCreatedMe = AVT.GetCaller(); ID_Table[(UInt32)ConnectionID] = c; Manager.Evented_CurrentConnectionIDs = EventString; if (OnNewConnection != null) { OnNewConnection(this, c); } }
protected void UriChangeSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(UriChangeSink), sender); return; } if (sender.ID == _connection.ID) { if (sender.CurrentURI != null) { // if(sender.InfoString.MimeType.ToLower()=="audio/mpegurl" || // sender.CurrentURI.PathAndQuery.ToLower().EndsWith(".m3u")) // { // HTTPRequest R = new HTTPRequest(); // R.OnResponse += new HTTPRequest.RequestHandler(PreProcessPlayList); // FetchTable[R] = R; // R.PipelineRequest(sender.CurrentURI,sender); // } contentUriLabel.Text = sender.CurrentURI.AbsoluteUri; } else { contentUriLabel.Text = ""; } if (player.playState == WMPLib.WMPPlayState.wmppsPlaying) { StopSink(sender); PlaySink(sender, DvAVTransport.Enum_TransportPlaySpeed._1); } } }
protected void StopSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(StopSink), sender); return; } if ((sender.CurrentTransportState == DvAVTransport.Enum_TransportState.RECORDING) || (sender.CurrentTransportState == DvAVTransport.Enum_TransportState.PAUSED_RECORDING)) { set_Stop(); _connection.CurrentTransportState = DvAVTransport.Enum_TransportState.STOPPED; } else { player.Ctlcontrols.stop(); } }
protected void BlueGainSink(AVConnection sender) { BlueGain.Value = (int)sender.BlueVideoGain; }
protected void RecordSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(RecordSink), sender); return; } if (RecordButton.Image != RecordRed.Image) { playButton.Image = PlayGrey.Image; stopButton.Image = StopGrey.Image; pauseButton.Image = PauseGrey.Image; // NotRecording RecordButton.Image = RecordRed.Image; sender.CurrentTransportState = DvAVTransport.Enum_TransportState.RECORDING; } }
protected void ContrastSink(AVConnection sender) { Contrast.Value = (int)sender.Contrast; }
protected void PreviousSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.PreviousNextHandler(PreviousSink), sender); return; } try { player.Ctlcontrols.previous(); } catch (Exception) { } }
protected void GreenGainSink(AVConnection sender) { GreenGain.Value = (int)sender.GreenVideoGain; }
protected void SelectPresetSink(System.UInt32 InstanceID, DvRenderingControl.Enum_A_ARG_TYPE_PresetName PresetName) { if (ID_Table.ContainsKey(InstanceID) == false) { throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID")); } else { AVConnection c = (AVConnection)ID_Table[InstanceID]; bool OK = false; foreach (string preset in c.Presets) { if (preset == DvRenderingControl.Enum_A_ARG_TYPE_PresetName_ToString(PresetName)) { OK = true; break; } } if (OK == true) { c.CurrentPreset = DvRenderingControl.Enum_A_ARG_TYPE_PresetName_ToString(PresetName); c._SetBlueVideoBlack(100); c._SetBlueVideoGain(100); c._SetBrightness(100); c._SetContrast(100); c._SetGreenVideoBlack(100); c._SetGreenVideoGain(100); c._SetRedVideoBlack(100); c._SetRedVideoGain(100); c._SetSharpness(100); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.B, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.CF, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LF, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LFC, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LFE, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LS, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RF, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RFC, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RS, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SD, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SL, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SR, false); c._SetMute(DvRenderingControl.Enum_A_ARG_TYPE_Channel.T, false); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.B, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.CF, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LF, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LFC, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LFE, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LS, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RF, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RFC, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RS, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SD, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SL, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.SR, 100); c._SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.T, 100); } else { throw(new UPnPCustomException(701, DvRenderingControl.Enum_A_ARG_TYPE_PresetName_ToString(PresetName) + " is not a supported preset")); } } }
protected void RedGainSink(AVConnection sender) { RedGain.Value = (int)sender.RedVideoGain; }
public AVRenderer(int MaxConnections, ProtocolInfoString[] Info, ConnectionHandler h) { ConnectionMax = MaxConnections; OnNewConnection += h; InfoStrings = Info; device = UPnPDevice.CreateEmbeddedDevice(1,Guid.NewGuid().ToString()); device.FriendlyName = "AVRenderer Device (" + Dns.GetHostName() +")"; AVT = new DvAVTransport(); AVT.GetUPnPService().Major = 1; AVT.GetUPnPService().Minor = 0; Manager = new DvConnectionManager(); Manager.GetUPnPService().Major = 1; Manager.GetUPnPService().Minor = 0; Control = new DvRenderingControl(); Control.GetUPnPService().Major = 1; Control.GetUPnPService().Minor = 0; Manager.External_PrepareForConnection = new DvConnectionManager.Delegate_PrepareForConnection(PrepareForConnectionSink); Manager.External_ConnectionComplete = new DvConnectionManager.Delegate_ConnectionComplete(ConnectionCompleteSink); Manager.External_GetCurrentConnectionIDs = new DvConnectionManager.Delegate_GetCurrentConnectionIDs(GetCurrentConnectionIDsSink); Manager.External_GetProtocolInfo = new DvConnectionManager.Delegate_GetProtocolInfo(GetProtocolInfoSink); Manager.External_GetCurrentConnectionInfo = new DvConnectionManager.Delegate_GetCurrentConnectionInfo(GetCurrentConnectionInfoSink); Manager.Evented_CurrentConnectionIDs = ""; //Manager.Evented_PhysicalConnections = ""; string Sink = ""; foreach(ProtocolInfoString s in InfoStrings) { if(Sink=="") { Sink = s.ToString(); } else { Sink = Sink + "," + s.ToString(); } } Manager.Evented_SinkProtocolInfo = Sink; Manager.Evented_SourceProtocolInfo = ""; AVT.Accumulator_LastChange = new InstanceID_LastChangeAccumulator("AVT"); AVT.ModerationDuration_LastChange = 0.5; AVT.Evented_LastChange = "<Event xmlns = "urn:schemas-upnp-org:metadata-1-0/AVT/"/>"; AVT.External_GetMediaInfo = new DvAVTransport.Delegate_GetMediaInfo(GetMediaInfoSink); AVT.External_GetPositionInfo = new DvAVTransport.Delegate_GetPositionInfo(GetPositionInfoSink); AVT.External_GetTransportInfo = new DvAVTransport.Delegate_GetTransportInfo(GetTransportInfoSink); AVT.External_GetTransportSettings = new DvAVTransport.Delegate_GetTransportSettings(GetTransportSettingsSink); AVT.External_GetDeviceCapabilities = new DvAVTransport.Delegate_GetDeviceCapabilities(GetDeviceCapabilitiesSink); AVT.External_GetCurrentTransportActions = new DvAVTransport.Delegate_GetCurrentTransportActions(GetCurrentTransportActionsSink); AVT.External_Play = new DvAVTransport.Delegate_Play(PlaySink); AVT.External_Stop = new DvAVTransport.Delegate_Stop(StopSink); AVT.External_Pause = new DvAVTransport.Delegate_Pause(PauseSink); AVT.External_Record = new DvAVTransport.Delegate_Record(RecordSink); AVT.External_Previous = new DvAVTransport.Delegate_Previous(PreviousSink); AVT.External_Next = new DvAVTransport.Delegate_Next(NextSink); AVT.External_Seek = new DvAVTransport.Delegate_Seek(SeekSink); AVT.External_SetAVTransportURI = new DvAVTransport.Delegate_SetAVTransportURI(SetAVTransportURISink); AVT.External_SetNextAVTransportURI = new DvAVTransport.Delegate_SetNextAVTransportURI(SetNextAVTransportURISink); AVT.External_SetPlayMode = new DvAVTransport.Delegate_SetPlayMode(SetPlayModeSink); AVT.External_SetRecordQualityMode = new DvAVTransport.Delegate_SetRecordQualityMode(SetRecordQualityModeSink); AVT.External_Record = new DvAVTransport.Delegate_Record(RecordSink); Control.Evented_LastChange = "<Event xmlns = "urn:schemas-upnp-org:metadata-1-0/RCS/"/>"; Control.Accumulator_LastChange = new InstanceID_LastChangeAccumulator("RCS"); Control.ModerationDuration_LastChange = 1; Control.External_GetMute = new DvRenderingControl.Delegate_GetMute(GetMuteSink); Control.External_SetMute = new DvRenderingControl.Delegate_SetMute(SetMuteSink); Control.External_GetVolume = new DvRenderingControl.Delegate_GetVolume(GetVolumeSink); Control.External_SetVolume = new DvRenderingControl.Delegate_SetVolume(SetVolumeSink); Control.External_GetBlueVideoBlackLevel = new DvRenderingControl.Delegate_GetBlueVideoBlackLevel(GetBlueVideoBlackSink); Control.External_GetBlueVideoGain = new DvRenderingControl.Delegate_GetBlueVideoGain(GetBlueVideoGainSink); Control.External_SetBlueVideoBlackLevel = new DvRenderingControl.Delegate_SetBlueVideoBlackLevel(SetBlueVideoBlackSink); Control.External_SetBlueVideoGain = new DvRenderingControl.Delegate_SetBlueVideoGain(SetBlueVideoGainSink); Control.External_GetGreenVideoBlackLevel = new DvRenderingControl.Delegate_GetGreenVideoBlackLevel(GetGreenVideoBlackSink); Control.External_GetGreenVideoGain = new DvRenderingControl.Delegate_GetGreenVideoGain(GetGreenVideoGainSink); Control.External_SetGreenVideoBlackLevel = new DvRenderingControl.Delegate_SetGreenVideoBlackLevel(SetGreenVideoBlackSink); Control.External_SetGreenVideoGain = new DvRenderingControl.Delegate_SetGreenVideoGain(SetGreenVideoGainSink); Control.External_GetRedVideoBlackLevel = new DvRenderingControl.Delegate_GetRedVideoBlackLevel(GetRedVideoBlackSink); Control.External_GetRedVideoGain = new DvRenderingControl.Delegate_GetRedVideoGain(GetRedVideoGainSink); Control.External_SetRedVideoBlackLevel = new DvRenderingControl.Delegate_SetRedVideoBlackLevel(SetRedVideoBlackSink); Control.External_SetRedVideoGain = new DvRenderingControl.Delegate_SetRedVideoGain(SetRedVideoGainSink); Control.External_GetBrightness = new DvRenderingControl.Delegate_GetBrightness(GetBrightnessSink); Control.External_SetBrightness = new DvRenderingControl.Delegate_SetBrightness(SetBrightnessSink); Control.External_GetContrast = new DvRenderingControl.Delegate_GetContrast(GetContrastSink); Control.External_SetContrast = new DvRenderingControl.Delegate_SetContrast(SetContrastSink); Control.External_GetSharpness = new DvRenderingControl.Delegate_GetSharpness(GetSharpnessSink); Control.External_SetSharpness = new DvRenderingControl.Delegate_SetSharpness(SetSharpnessSink); Control.External_ListPresets = new DvRenderingControl.Delegate_ListPresets(ListPresetsSink); Control.External_SelectPreset = new DvRenderingControl.Delegate_SelectPreset(SelectPresetSink); device.Manufacturer = "OpenSource"; device.ManufacturerURL = ""; device.PresentationURL = "/"; device.HasPresentation = false; device.ModelName = "Renderer"; device.ModelDescription = "AV Media Renderer Device"; device.ModelURL = new Uri("http://www.sourceforge.org"); device.StandardDeviceType = "MediaRenderer"; device.AddService(Manager); device.AddService(Control); device.AddService(AVT); if(ConnectionMax == 0) { Manager.Evented_CurrentConnectionIDs = "0"; CurrentConnections = 1; AVConnection c = new AVConnection(this, "", "/", -1, DvConnectionManager.Enum_A_ARG_TYPE_Direction.INPUT, 0, 0, 0); c.Parent = this; c._WhoCreatedMe = new IPEndPoint(IPAddress.Parse("127.0.0.1"),0); ID_Table[(UInt32)0] = c; if(h!=null) h(this,c); } }
protected void PresetSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(PresetSink), sender); return; } if (sender.ID == _connection.ID) PresetLabel.Text = sender.CurrentPreset; }
protected void BlueBlackSink(AVConnection sender) { BlueBlack.Value = (int)sender.BlueVideoBlackLevel; }
protected void VolumeSink(AVConnection sender, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, System.UInt16 DesiredVolume) { if (InvokeRequired) { Invoke(new AVConnection.VolumeChangedHandler(VolumeSink), sender, Channel, DesiredVolume); return; } SetVolume((int)DesiredVolume, Channel); switch (Channel) { case DvRenderingControl.Enum_A_ARG_TYPE_Channel.LF: LeftChannel = DesiredVolume; break; case DvRenderingControl.Enum_A_ARG_TYPE_Channel.RF: RightChannel = DesiredVolume; break; } int balance = ((int)System.Math.Pow(((double)LeftChannel - (double)RightChannel) / (double)10, 4)); if (LeftChannel > RightChannel) balance = balance * (-1); if (Channel != DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER) { player.settings.balance = balance; DesiredVolume = (UInt16)((float)System.Math.Max(LeftChannel, RightChannel) * ((float)sender.GetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER) / (float)100)); } else { DesiredVolume = (UInt16)((float)System.Math.Max(LeftChannel, RightChannel) * ((float)sender.GetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER) / (float)100)); } //int nv = -1 * (int)(System.Math.Pow(((100 - ((((double)DesiredVolume) / 2.2) + 20)) / 10),4)); player.settings.volume = DesiredVolume; }
protected void BrightnessSink(AVConnection sender) { Brightness.Value = (int)sender.Brightness; }
protected void NextUriChangeSink(AVConnection sender) { if (InvokeRequired) { Invoke(new AVConnection.VariableChangedHandler(NextUriChangeSink), sender); return; } if (sender.ID == _connection.ID) { if (sender.NextURI != null) { this.nextContentUriLabel.Text = sender.NextURI.AbsoluteUri; } else { this.nextContentUriLabel.Text = ""; } } }
protected void GreenBlackSink(AVConnection sender) { GreenBlack.Value = (int)sender.GreenVideoBlackLevel; }
private void FormSink(AVRenderer r, AVConnection c) { RendererForm f = new RendererForm(c); ConnectionTable[c] = f; f.Show(); }
protected void RedBlackSink(AVConnection sender) { RedBlack.Value = (int)sender.RedVideoBlackLevel; }
protected void MuteSink(AVConnection sender, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, bool NewMute) { if (InvokeRequired) { Invoke(new AVConnection.MuteChangedHandler(MuteSink), sender, Channel, NewMute); return; } if (Channel == DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER) { player.settings.mute = (bool)NewMute; SetMuteButton((bool)NewMute); } }
protected void SharpnessSink(AVConnection sender) { Sharpness.Value = (int)sender.Sharpness; }
protected void PlaySink(AVConnection sender, DvAVTransport.Enum_TransportPlaySpeed Speed) { if (InvokeRequired) { Invoke(new AVConnection.PlayHandler(PlaySink), sender, Speed); return; } if (sender.CurrentURI == null) { player.Ctlcontrols.stop(); sender.CurrentTransportState = DvAVTransport.Enum_TransportState.STOPPED; return; } if (sender.CurrentTransportState == DvAVTransport.Enum_TransportState.PAUSED_PLAYBACK) { player.Ctlcontrols.play(); } else { if (sender.CurrentTransportState != DvAVTransport.Enum_TransportState.PLAYING) { if (sender.CurrentURI.LocalPath.EndsWith(".m3u", true, System.Threading.Thread.CurrentThread.CurrentUICulture)) { lock (this.m_LockRequest) { sender.CurrentTransportState = DvAVTransport.Enum_TransportState.TRANSITIONING; string mediaUri = sender.CurrentURI.AbsoluteUri.Trim();//.ToLower(); if (this.m_PlainM3U.ContainsKey(mediaUri)) { player.openPlayer((string)this.m_PlainM3U[mediaUri]); StreamReader sr = System.IO.File.OpenText((string)this.m_PlainM3U[mediaUri]); this.m_M3U = sr.ReadToEnd(); sr = System.IO.File.OpenText((string)this.m_Metadata[mediaUri]); this.m_METADATA = sr.ReadToEnd(); DetermineMediaDuration(this.m_METADATA); } else { HTTPRequest R = new HTTPRequest(); R.OnResponse += new HTTPRequest.RequestHandler(Sink_AcquireAndSetPlaylist); this.PlaylistRequests[R] = sender.CurrentURI.AbsoluteUri.Trim();//.ToLower(); this.m_LastRequest = R; try { R.PipelineRequest(new Uri(mediaUri), sender); } catch { this.m_LastRequest = null; this.PlaylistRequests.Remove(R); } } } } else { lock (this.m_LockRequest) { sender.CurrentTransportState = DvAVTransport.Enum_TransportState.TRANSITIONING; player.URL = sender.CurrentURI.ToString(); player.Ctlcontrols.play(); } } } } }
private void ClosedConnectionSink(AVRenderer sender, AVConnection c) { RendererForm f = (RendererForm)ConnectionTable[c]; ConnectionTable.Remove(c); f.Close(); }
public AVRenderer(int MaxConnections, ProtocolInfoString[] Info, ConnectionHandler h) { ConnectionMax = MaxConnections; OnNewConnection += h; InfoStrings = Info; device = UPnPDevice.CreateEmbeddedDevice(1, Guid.NewGuid().ToString()); device.FriendlyName = "AVRenderer Device (" + Dns.GetHostName() + ")"; AVT = new DvAVTransport(); AVT.GetUPnPService().Major = 1; AVT.GetUPnPService().Minor = 0; Manager = new DvConnectionManager(); Manager.GetUPnPService().Major = 1; Manager.GetUPnPService().Minor = 0; Control = new DvRenderingControl(); Control.GetUPnPService().Major = 1; Control.GetUPnPService().Minor = 0; Manager.External_PrepareForConnection = new DvConnectionManager.Delegate_PrepareForConnection(PrepareForConnectionSink); Manager.External_ConnectionComplete = new DvConnectionManager.Delegate_ConnectionComplete(ConnectionCompleteSink); Manager.External_GetCurrentConnectionIDs = new DvConnectionManager.Delegate_GetCurrentConnectionIDs(GetCurrentConnectionIDsSink); Manager.External_GetProtocolInfo = new DvConnectionManager.Delegate_GetProtocolInfo(GetProtocolInfoSink); Manager.External_GetCurrentConnectionInfo = new DvConnectionManager.Delegate_GetCurrentConnectionInfo(GetCurrentConnectionInfoSink); Manager.Evented_CurrentConnectionIDs = ""; //Manager.Evented_PhysicalConnections = ""; string Sink = ""; foreach (ProtocolInfoString s in InfoStrings) { if (Sink == "") { Sink = s.ToString(); } else { Sink = Sink + "," + s.ToString(); } } Manager.Evented_SinkProtocolInfo = Sink; Manager.Evented_SourceProtocolInfo = ""; AVT.Accumulator_LastChange = new InstanceID_LastChangeAccumulator("AVT"); AVT.ModerationDuration_LastChange = 0.5; AVT.Evented_LastChange = "<Event xmlns = "urn:schemas-upnp-org:metadata-1-0/AVT/"/>"; AVT.External_GetMediaInfo = new DvAVTransport.Delegate_GetMediaInfo(GetMediaInfoSink); AVT.External_GetPositionInfo = new DvAVTransport.Delegate_GetPositionInfo(GetPositionInfoSink); AVT.External_GetTransportInfo = new DvAVTransport.Delegate_GetTransportInfo(GetTransportInfoSink); AVT.External_GetTransportSettings = new DvAVTransport.Delegate_GetTransportSettings(GetTransportSettingsSink); AVT.External_GetDeviceCapabilities = new DvAVTransport.Delegate_GetDeviceCapabilities(GetDeviceCapabilitiesSink); AVT.External_GetCurrentTransportActions = new DvAVTransport.Delegate_GetCurrentTransportActions(GetCurrentTransportActionsSink); AVT.External_Play = new DvAVTransport.Delegate_Play(PlaySink); AVT.External_Stop = new DvAVTransport.Delegate_Stop(StopSink); AVT.External_Pause = new DvAVTransport.Delegate_Pause(PauseSink); AVT.External_Record = new DvAVTransport.Delegate_Record(RecordSink); AVT.External_Previous = new DvAVTransport.Delegate_Previous(PreviousSink); AVT.External_Next = new DvAVTransport.Delegate_Next(NextSink); AVT.External_Seek = new DvAVTransport.Delegate_Seek(SeekSink); AVT.External_SetAVTransportURI = new DvAVTransport.Delegate_SetAVTransportURI(SetAVTransportURISink); AVT.External_SetNextAVTransportURI = new DvAVTransport.Delegate_SetNextAVTransportURI(SetNextAVTransportURISink); AVT.External_SetPlayMode = new DvAVTransport.Delegate_SetPlayMode(SetPlayModeSink); AVT.External_SetRecordQualityMode = new DvAVTransport.Delegate_SetRecordQualityMode(SetRecordQualityModeSink); AVT.External_Record = new DvAVTransport.Delegate_Record(RecordSink); Control.Evented_LastChange = "<Event xmlns = "urn:schemas-upnp-org:metadata-1-0/RCS/"/>"; Control.Accumulator_LastChange = new InstanceID_LastChangeAccumulator("RCS"); Control.ModerationDuration_LastChange = 1; Control.External_GetMute = new DvRenderingControl.Delegate_GetMute(GetMuteSink); Control.External_SetMute = new DvRenderingControl.Delegate_SetMute(SetMuteSink); Control.External_GetVolume = new DvRenderingControl.Delegate_GetVolume(GetVolumeSink); Control.External_SetVolume = new DvRenderingControl.Delegate_SetVolume(SetVolumeSink); Control.External_GetBlueVideoBlackLevel = new DvRenderingControl.Delegate_GetBlueVideoBlackLevel(GetBlueVideoBlackSink); Control.External_GetBlueVideoGain = new DvRenderingControl.Delegate_GetBlueVideoGain(GetBlueVideoGainSink); Control.External_SetBlueVideoBlackLevel = new DvRenderingControl.Delegate_SetBlueVideoBlackLevel(SetBlueVideoBlackSink); Control.External_SetBlueVideoGain = new DvRenderingControl.Delegate_SetBlueVideoGain(SetBlueVideoGainSink); Control.External_GetGreenVideoBlackLevel = new DvRenderingControl.Delegate_GetGreenVideoBlackLevel(GetGreenVideoBlackSink); Control.External_GetGreenVideoGain = new DvRenderingControl.Delegate_GetGreenVideoGain(GetGreenVideoGainSink); Control.External_SetGreenVideoBlackLevel = new DvRenderingControl.Delegate_SetGreenVideoBlackLevel(SetGreenVideoBlackSink); Control.External_SetGreenVideoGain = new DvRenderingControl.Delegate_SetGreenVideoGain(SetGreenVideoGainSink); Control.External_GetRedVideoBlackLevel = new DvRenderingControl.Delegate_GetRedVideoBlackLevel(GetRedVideoBlackSink); Control.External_GetRedVideoGain = new DvRenderingControl.Delegate_GetRedVideoGain(GetRedVideoGainSink); Control.External_SetRedVideoBlackLevel = new DvRenderingControl.Delegate_SetRedVideoBlackLevel(SetRedVideoBlackSink); Control.External_SetRedVideoGain = new DvRenderingControl.Delegate_SetRedVideoGain(SetRedVideoGainSink); Control.External_GetBrightness = new DvRenderingControl.Delegate_GetBrightness(GetBrightnessSink); Control.External_SetBrightness = new DvRenderingControl.Delegate_SetBrightness(SetBrightnessSink); Control.External_GetContrast = new DvRenderingControl.Delegate_GetContrast(GetContrastSink); Control.External_SetContrast = new DvRenderingControl.Delegate_SetContrast(SetContrastSink); Control.External_GetSharpness = new DvRenderingControl.Delegate_GetSharpness(GetSharpnessSink); Control.External_SetSharpness = new DvRenderingControl.Delegate_SetSharpness(SetSharpnessSink); Control.External_ListPresets = new DvRenderingControl.Delegate_ListPresets(ListPresetsSink); Control.External_SelectPreset = new DvRenderingControl.Delegate_SelectPreset(SelectPresetSink); device.Manufacturer = "OpenSource"; device.ManufacturerURL = ""; device.PresentationURL = "/"; device.HasPresentation = false; device.ModelName = "Renderer"; device.ModelDescription = "AV Media Renderer Device"; device.ModelURL = new Uri("http://www.sourceforge.org"); device.StandardDeviceType = "MediaRenderer"; device.AddService(Manager); device.AddService(Control); device.AddService(AVT); if (ConnectionMax == 0) { Manager.Evented_CurrentConnectionIDs = "0"; CurrentConnections = 1; AVConnection c = new AVConnection(this, "", "/", -1, DvConnectionManager.Enum_A_ARG_TYPE_Direction.INPUT, 0, 0, 0); c.Parent = this; c._WhoCreatedMe = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 0); ID_Table[(UInt32)0] = c; if (h != null) { h(this, c); } } }
private void NewConnectionSink(AVRenderer sender, AVConnection c) { object[] args = new Object[2]; args[0] = sender; args[1] = c; Invoke(new FormCreator(FormSink),args); }
public RendererForm(AVConnection connection) { // // Required for Windows Form Designer support // InitializeComponent(); _connection = connection; _connection.OnPlay += new AVConnection.PlayHandler(PlaySink); _connection.OnPause += new AVConnection.StopPauseRecordHandler(PauseSink); _connection.OnStop += new AVConnection.StopPauseRecordHandler(StopSink); _connection.OnNext += new AVConnection.PreviousNextHandler(NextSink); _connection.OnPrevious += new AVConnection.PreviousNextHandler(PreviousSink); _connection.OnMuteChanged += new AVConnection.MuteChangedHandler(MuteSink); _connection.OnVolumeChanged += new AVConnection.VolumeChangedHandler(VolumeSink); _connection.OnCurrentURIChanged += new AVConnection.VariableChangedHandler(UriChangeSink); _connection.OnNextURIChanged += new AVConnection.VariableChangedHandler(NextUriChangeSink); _connection.OnSeek += new AVConnection.SeekHandler(SeekSink); _connection.OnRecord += new AVConnection.StopPauseRecordHandler(RecordSink); _connection.OnCurrentPreset += new AVConnection.VariableChangedHandler(PresetSink); _connection.OnCurrentRecordQualityModeChanged += new AVConnection.VariableChangedHandler(RecModeSink); _connection.OnCurrentPlayModeChanged += new AVConnection.VariableChangedHandler(PlayModeSink); this.Text = "Media Renderer [" + connection.ID.ToString() + "] <" + connection.WhoCreatedMe.ToString() + ">"; PresetLabel.Text = connection.CurrentPreset; this.RecordQualityModeLabel.Text = DvAVTransport.Enum_CurrentRecordQualityMode_ToString(_connection.CurrentRecordQualityMode); this.PlayModeLabel.Text = DvAVTransport.Enum_CurrentPlayMode_ToString(_connection.CurrentPlayMode); muteButton.Image = mutePictureBox.Image; contentUriLabel.Text = player.URL; toolTip.SetToolTip(contentUriLabel, player.URL); SetVolume(50, DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER); SetVolume(100, DvRenderingControl.Enum_A_ARG_TYPE_Channel.LF); SetVolume(100, DvRenderingControl.Enum_A_ARG_TYPE_Channel.RF); connection.SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER, 50); connection.SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.LF, 100); connection.SetVolume(DvRenderingControl.Enum_A_ARG_TYPE_Channel.RF, 100); VolumeSink(connection, DvRenderingControl.Enum_A_ARG_TYPE_Channel.MASTER, (UInt16)50); }