Esempio n. 1
0
 private PlayEngine(Builder builder)
 {
     _playlistSubscriberStream = builder.PlaylistSubscriberStream;
     _schedulingService = builder.SchedulingService;
     _consumerService = builder.ConsumerService;
     _providerService = builder.ProviderService;
     //_playlistSubscriberStream = stream;
     //_schedulingService = _playlistSubscriberStream.Scope.GetService(typeof(ISchedulingService)) as ISchedulingService;
 }
Esempio n. 2
0
 public Builder(PlaylistSubscriberStream playlistSubscriberStream, ISchedulingService schedulingService, IConsumerService consumerService, IProviderService providerService)
 {
     _playlistSubscriberStream = playlistSubscriberStream;
     _schedulingService = schedulingService;
     _consumerService = consumerService;
     _providerService = providerService;
 }
Esempio n. 3
0
        /// <summary>
        /// Creates a stream that can play a list.
        /// </summary>
        /// <param name="streamId">Stream id.</param>
        /// <returns>New stream that can play sequence of items.</returns>
        public IPlaylistSubscriberStream NewPlaylistSubscriberStream(int streamId)
        {
#if !FXCLIENT
            try
            {
                ReaderWriterLock.AcquireReaderLock();
                if (_reservedStreams.Length <= streamId - 1 || !_reservedStreams[streamId - 1])
                {
                    // StreamId has not been reserved before
                    return null;
                }
            }
            finally
            {
                ReaderWriterLock.ReleaseReaderLock();
            }

            IClientStream stream;
            if (_streams.TryGetValue(streamId - 1, out stream) && stream != null)
            {
                // Another stream already exists with this id
                return null;
            }
            //TODO
            PlaylistSubscriberStream pss = new PlaylistSubscriberStream();
            int buffer;
            if( _streamBuffers.TryGetValue(streamId - 1, out buffer) )
                pss.SetClientBufferDuration((int)buffer);
            pss.Name = CreateStreamName();
            pss.Connection = this;
            pss.Scope = this.Scope;
            pss.StreamId = streamId;
            RegisterStream(pss);
            _streamCount.Increment();
            return pss;
#else
            return null;
#endif
        }