public void CreateConnection(IMediaResource[] resources, object Tag)
        {
            if (resources.Length > 1)
            {
                if (!(new ProtocolInfoString(this.ProtocolInfoString)).Matches(new ProtocolInfoString("http-get:*:audio/mpegurl:*")))
                {
                    throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
                }
            }
            else
            {
                if (this.Parent.HasConnectionHandling)
                {
                    if (!(new ProtocolInfoString(this.ProtocolInfoString).Matches(resources[0].ProtocolInfo)))
                    {
                        throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
                    }
                }
                else
                {
                    if (!this.Parent.SupportsProtocolInfo(resources[0].ProtocolInfo))
                    {
                        throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
                    }
                }
            }

            AVPlayList pl = new AVPlayList(this, resources, new AVPlayList.ReadyHandler(PlayListSink), new AVPlayList.FailedHandler(PlayListFailedSink), Tag);

            PlayListTable[pl.GetHashCode()] = pl;
        }
 private void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason)
 {
     PlayListTable.Remove(sender.GetHashCode());
     if (OnReuseConnectionFailed != null)
     {
         OnReuseConnectionFailed(this, Tag);
     }
 }
 private void PlayListSink(AVPlayList sender, AVConnection c, object Tag)
 {
     PlayListTable.Remove(sender.GetHashCode());
     if (OnReuseConnection != null)
     {
         OnReuseConnection(this, Tag);
     }
 }
        /// <summary>
        /// This is invoked when you wish to instantiate a new rendering session.
        /// </summary>
        /// <param name="resources">the IMediaResource(s) you wish to render</param>
        /// <returns>Unique Handle</returns>
        public void CreateConnection(IMediaResource[] resources, object Tag)
        {
            lock (this.CreateConnectionLock)
            {
                ++this.PendingCreateConnection;
            }
            AVPlayList pl = new AVPlayList(this, resources, new AVPlayList.ReadyHandler(PlayListSink), new AVPlayList.FailedHandler(PlayListFailedSink), Tag);

            PlayListTable[pl.GetHashCode()] = pl;
        }
        protected void PlayListSink(AVPlayList sender, AVConnection c, object Tag)
        {
            PlayListTable.Remove(sender.GetHashCode());
            lock (this.CreateConnectionLock)
            {
                --this.PendingCreateConnection;
                if (this.PendingCreateConnection < 0)
                {
                    PendingCreateConnection = 0;
                }
                ConnectionMonitor.Remove(c.ConnectionID);
            }

            if (sender.IsRecycled)
            {
                OnRecycledConnectionEvent.Fire(this, c, Tag);
            }
            else
            {
                OnCreateConnectionEvent.Fire(this, c, Tag);
            }
        }
 protected void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason)
 {
     PlayListTable.Remove(sender.GetHashCode());
     OnCreateConnectionFailedEvent.Fire(this, reason, sender.PlayListHandle);
 }
示例#7
0
		protected void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason)
		{
			PlayListTable.Remove(sender.GetHashCode());
			OnCreateConnectionFailedEvent.Fire(this,reason,sender.PlayListHandle);
		}
示例#8
0
		protected void PlayListSink(AVPlayList sender, AVConnection c, object Tag)
		{
			PlayListTable.Remove(sender.GetHashCode());
			lock(this.CreateConnectionLock)
			{
				--this.PendingCreateConnection;
				if(this.PendingCreateConnection<0) PendingCreateConnection = 0;
				ConnectionMonitor.Remove(c.ConnectionID);
			}

			if(sender.IsRecycled)
			{
				OnRecycledConnectionEvent.Fire(this,c,Tag);
			}
			else
			{
				OnCreateConnectionEvent.Fire(this,c,Tag);
			}
		}
示例#9
0
		/// <summary>
		/// This is invoked when you wish to instantiate a new rendering session.
		/// </summary>
		/// <param name="resources">the IMediaResource(s) you wish to render</param>
		/// <returns>Unique Handle</returns>
		public void CreateConnection(IMediaResource[] resources, object Tag)
		{
			lock(this.CreateConnectionLock)
			{
				++this.PendingCreateConnection;
			}
			AVPlayList pl = new AVPlayList(this,resources,new AVPlayList.ReadyHandler(PlayListSink), new AVPlayList.FailedHandler(PlayListFailedSink),Tag);
			PlayListTable[pl.GetHashCode()] = pl;
		}
示例#10
0
		private void PlayListFailedSink(AVPlayList sender, AVRenderer.CreateFailedReason reason)
		{
			PlayListTable.Remove(sender.GetHashCode());
			if(OnReuseConnectionFailed!=null) OnReuseConnectionFailed(this,Tag);
		}
示例#11
0
		private void PlayListSink(AVPlayList sender, AVConnection c, object Tag)
		{
			PlayListTable.Remove(sender.GetHashCode());
			if(OnReuseConnection!=null) OnReuseConnection(this,Tag);
		}
示例#12
0
		public void CreateConnection(IMediaResource[] resources, object Tag)
		{
			if(resources.Length>1)
			{
				if(!(new ProtocolInfoString(this.ProtocolInfoString)).Matches(new ProtocolInfoString("http-get:*:audio/mpegurl:*")))
				{
					throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
				}
			}
			else
			{
				if (this.Parent.HasConnectionHandling)
				{
					if(!(new ProtocolInfoString(this.ProtocolInfoString).Matches(resources[0].ProtocolInfo)))
					{
						throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
					}
				}
				else
				{
					if(!this.Parent.SupportsProtocolInfo(resources[0].ProtocolInfo))
					{
						throw(new MimeTypeMismatchException("Cannot call SetAVTransportURI with a different MimeType"));
					}
				}
			}

			AVPlayList pl = new AVPlayList(this,resources,new AVPlayList.ReadyHandler(PlayListSink), new AVPlayList.FailedHandler(PlayListFailedSink),Tag);
			PlayListTable[pl.GetHashCode()] = pl;
		}
        public void Dispose()
        {
            AVTransport.Dispose();
            RenderingControl.Dispose();
            ConnectionManager.Dispose();

            this.AV_LastChange.Dispose();
            this.AV_LastChange = null;
            this.RC_LastChange.Dispose();
            this.RC_LastChange = null;
            if(CurrentPlayList!=null)
                CurrentPlayList.Dispose();
            this.CurrentPlayList = null;

            this.OnCurrentMetaDataChanged = null;

            this.OnMediaResourceChanged = null;
            this.OnMute = null;
            this.OnNumberOfTracksChanged = null;

            this.OnPositionChanged = null;
            this.OnReady = null;
            this.OnRemoved = null;

            this.OnTrackChanged = null;
            this.OnTrackURIChanged = null;
            this.OnVolume = null;

            if(OnRemoved!=null) OnRemoved(this);
        }