コード例 #1
0
        public void Attach(IStreamConsumer consumer)
        {
            if (!consumer.AcceptType.IsAssignableFrom(ValueType))
            {
                throw new ArgumentException($"Type not match, streamer value type: {ValueType}, consumer accept type: {consumer.AcceptType}");
            }
            var priority = consumer.Priority;

            try
            {
                _consumersLock.EnterWriteLock();
                if (!_consumers.IsEmpty())
                {
                    if (_consumers.Contains(consumer))
                    {
                        throw new ArgumentException("The given consumer is already attached");
                    }
                    var node = _consumers.First;
                    while (node != null)
                    {
                        if (node.Value.Priority > priority)
                        {
                            _consumers.AddBefore(node, consumer);
                            return;
                        }
                        node = node.Next;
                    }
                }
                _consumers.AddLast(consumer);
            }
            finally
            {
                _consumersLock.ExitWriteLock();
            }
        }
コード例 #2
0
 public NumberController(
     IDistributedLog distributedLog,
     IStreamConsumer consumer,
     ITopicNamingConvention namingConvention, ILogger <NumberController> logger)
 {
     _distributedLog   = distributedLog;
     _consumer         = consumer;
     _namingConvention = namingConvention;
     _logger           = logger;
 }
コード例 #3
0
 public EventProjector(
     IStreamConsumer streamConsumer,
     ITopicNamingConvention topicNamingConvention,
     IEnumerable <IEventApplier <TEvent> > eventAppliers,
     ILogger <EventProjector <TEvent> > logger)
 {
     _streamConsumer        = streamConsumer;
     _topicNamingConvention = topicNamingConvention;
     _eventAppliers         = eventAppliers;
     _logger = logger;
 }
コード例 #4
0
        /// <summary>
        /// Initialize this instance.
        /// </summary>
        /// <param name="consumer">Related transport stream.</param>
        /// <param name="pid">Corresponding transport stream identifier.</param>
        /// <param name="isPCR">Set if this stream provides the PCR from the PTS information
        /// in the PES headers.</param>
        protected StreamBase(IStreamConsumer consumer, short pid, bool isPCR)
        {
            // Remember
            m_Consumer2 = consumer as IStreamConsumer2;
            Consumer    = consumer;
            IsPCR       = isPCR;
            PID         = pid;

            // Configure
            EnableDataFlow = !AwaitKeyFrame || !IsPCR;
        }
コード例 #5
0
        public Streamer(IStreamProducer producer, IStreamConsumer consumer, CancellationToken cancellationToken)
        {
            var options     = new PipeOptions(minimumSegmentSize: 8 * 1024);
            var triggerSize = Math.Min(options.Pool.MaxBufferSize, options.MinimumSegmentSize);
            var pipe        = new Pipe(options);

            ConsumerCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
            Producer = producer ?? throw new ArgumentNullException(nameof(producer));
            Consumer = consumer ?? throw new ArgumentNullException(nameof(consumer));
            Writer   = new PipeWriterWrapper <Streamer>(pipe.Writer, triggerSize, ProductionStartedCallback, WriterCompletionCallback, this);
            Reader   = pipe.Reader;
        }
コード例 #6
0
 public bool Detach(IStreamConsumer consumer)
 {
     if (!consumer.AcceptType.IsAssignableFrom(ValueType))
     {
         return(false);
     }
     try
     {
         _consumersLock.EnterWriteLock();
         return(_consumers.Remove(consumer));
     }
     finally
     {
         _consumersLock.ExitWriteLock();
     }
 }
コード例 #7
0
 public MarkerStreamer(IClock clock, IStreamConsumer <Timestamped <int> > consumer) : this(clock) => Attach(consumer);
コード例 #8
0
 public BiosignalStreamer(IBiosignalSampler biosignalSampler, IClock clock, IStreamConsumer <Timestamped <ISample> > consumer, ArrayQuery channelSelector = null)
     : this(biosignalSampler, clock, channelSelector) => Attach(consumer);
コード例 #9
0
 public GazePointStreamer(IEyeTracker eyeTracker, IClock clock, IStreamConsumer <Timestamped <IGazePoint> > consumer) : this(eyeTracker, clock) => Attach(consumer);
コード例 #10
0
 /// <summary>
 /// Initialize this instance.
 /// </summary>
 /// <remarks>
 /// This stream will not provide the PCR.
 /// </remarks>
 /// <param name="consumer">Related transport stream.</param>
 /// <param name="pid">Corresponding transport stream identifier.</param>
 protected StreamBase( IStreamConsumer consumer, short pid )
     : this( consumer, pid, false )
 {
 }
コード例 #11
0
 public void SetUp()
 {
     _consumer = new StreamConsumer(_log.Object);
 }
コード例 #12
0
 internal void Consumer(IStreamConsumer <StreamHandle> consumer)
 {
     Contract.Requires(consumer != null);
     this.streamConsumer = consumer;
 }
コード例 #13
0
ファイル: Pipeline.cs プロジェクト: yyjdelete/SpanNetty
 internal void Consumer(IStreamConsumer <StreamHandle> consumer)
 {
     Debug.Assert(consumer is object);
     _streamConsumer = consumer;
 }
コード例 #14
0
 public void OneTimeSetup()
 {
     _log      = new InMemoryDistributedLog();
     _consumer = new StreamConsumer(_log);
 }
コード例 #15
0
 public static DelegatedStreamConsumer <TIn> Map <TIn, TOut>(this IStreamConsumer <TOut> consumer, Func <TIn, TOut> mapFunc) =>
 new DelegatedStreamConsumer <TIn>(input => consumer.Accept(mapFunc(input)), consumer.Priority);
コード例 #16
0
        /// <summary>
        /// Initialize this instance.
        /// </summary>
        /// <param name="consumer">Related transport stream.</param>
        /// <param name="pid">Corresponding transport stream identifier.</param>
        /// <param name="isPCR">Set if this stream provides the PCR from the PTS information
        /// in the PES headers.</param>
        protected StreamBase( IStreamConsumer consumer, short pid, bool isPCR )
        {
            // Remember
            m_Consumer2 = consumer as IStreamConsumer2;
            Consumer = consumer;
            IsPCR = isPCR;
            PID = pid;

            // Configure
            EnableDataFlow = !AwaitKeyFrame || !IsPCR;
        }
コード例 #17
0
 /// <summary>
 /// Initialize this instance.
 /// </summary>
 /// <remarks>
 /// This stream will not provide the PCR.
 /// </remarks>
 /// <param name="consumer">Related transport stream.</param>
 /// <param name="pid">Corresponding transport stream identifier.</param>
 protected StreamBase(IStreamConsumer consumer, short pid)
     : this(consumer, pid, false)
 {
 }
コード例 #18
0
		/// <summary>
		/// Create a new instance.
		/// </summary>
		/// <param name="consumer">Related transport stream.</param>
		/// <param name="pid">Transport stream identifier for this audio stream.</param>
		/// <param name="isPCR">Set if this stream supplies the PCR.</param>
		public AudioStream(IStreamConsumer consumer, short pid, bool isPCR)
			: base(consumer, pid, isPCR)
		{
		}
コード例 #19
0
ファイル: Pipeline.cs プロジェクト: yyjdelete/SpanNetty
 public void Dispose()
 {
     _pendingRead.Dispose();
     _streamConsumer = null;
 }
コード例 #20
0
 public BoundConsumer(IStreamConsumer <T> consumer, Action <T> store)
 {
     _consumer = consumer ?? throw new ArgumentNullException(nameof(consumer));
     _store    = store ?? throw new ArgumentNullException(nameof(store));
 }
コード例 #21
0
 public void Dispose()
 {
     this.bufferQueue.Dispose();
     this.streamConsumer = null;
 }
コード例 #22
0
 public ConsumerDestination(IStreamConsumer consumer)
 => _consumer = consumer ?? throw new ArgumentNullException(nameof(consumer));
コード例 #23
0
 public VideoFrameStreamer(IVideoSource videoSource, IClock clock, IStreamConsumer <Timestamped <IVideoFrame> > consumer) : this(videoSource, clock) => Attach(consumer);
コード例 #24
0
        /// <summary>
        /// Erzeugt eine neue Repräsentation.
        /// </summary>
        /// <param name="consumer">Der zugehörige Gesamtdatenstrom, im Allgemeinen ein
        /// <i>Transport Stream</i> <see cref="Manager"/>.</param>
        /// <param name="pid">Die Datenstromkennung im Gesamtstrom.</param>
        /// <param name="isPCR">Gesetzt, wenn dieser Datenstrom die Zeitbasis für den Gesamtstrom
        /// bereitstellt (sehr unüblich für Untertitel).</param>
        public SubtitleStream(IStreamConsumer consumer, short pid, bool isPCR)
			: base(consumer, pid, isPCR)
		{
		}
コード例 #25
0
 public ChainedConsumer(IStreamTransformation transformation, IStreamConsumer consumer)
 {
     _transformation = transformation ?? throw new ArgumentNullException(nameof(transformation));
     _consumer       = consumer ?? throw new ArgumentNullException(nameof(consumer));
 }
コード例 #26
0
ファイル: Pipeline.cs プロジェクト: wazazhang/NetUV
 public void Dispose()
 {
     this.pendingRead.Dispose();
     this.streamConsumer = null;
 }
コード例 #27
0
 /// <summary>
 /// Create a new instance.
 /// </summary>
 /// <param name="consumer">Related transport stream.</param>
 /// <param name="pid">Transport stream identifier for this video stream.</param>
 /// <param name="isPCR">Set if this stream supplies the PCR.</param>
 public HDTVStream(IStreamConsumer consumer, short pid, bool isPCR)
     : base(consumer, pid, isPCR)
 {
 }
コード例 #28
0
 /// <summary>
 /// Erzeugt eine neue Repräsentation.
 /// </summary>
 /// <param name="consumer">Der zugehörige Gesamtdatenstrom, im Allgemeinen ein
 /// <i>Transport Stream</i> <see cref="Manager"/>.</param>
 /// <param name="pid">Die Datenstromkennung im Gesamtstrom.</param>
 /// <param name="isPCR">Gesetzt, wenn dieser Datenstrom die Zeitbasis für den Gesamtstrom
 /// bereitstellt (sehr unüblich für Untertitel).</param>
 public SubtitleStream(IStreamConsumer consumer, short pid, bool isPCR)
     : base(consumer, pid, isPCR)
 {
 }