Exemplo n.º 1
0
        public void Register()
        {
            IStreamableFileFactory factory = ObjectFactory.CreateInstance(FluorineConfiguration.Instance.FluorineSettings.StreamableFileFactory.Type) as IStreamableFileFactory;

            base.AddService(typeof(IStreamableFileFactory), factory, false);
            factory.Start(null);
            SchedulingService service = new SchedulingService();

            base.AddService(typeof(ISchedulingService), service, false);
            service.Start(null);
            IBWControlService service2 = ObjectFactory.CreateInstance(FluorineConfiguration.Instance.FluorineSettings.BWControlService.Type) as IBWControlService;

            base.AddService(typeof(IBWControlService), service2, false);
            service2.Start(null);
            base.Init();
        }
        public override void Start()
        {
            // Ensure the play engine exists
            if (_engine == null)
            {
                IScope scope = this.Scope;
                if (scope != null)
                {
                    ISchedulingService schedulingService = scope.GetService(typeof(ISchedulingService)) as ISchedulingService;
                    IConsumerService   consumerService   = scope.GetService(typeof(IConsumerService)) as IConsumerService;
                    IProviderService   providerService   = scope.GetService(typeof(IProviderService)) as IProviderService;
                    _engine = new PlayEngine.Builder(this, schedulingService, consumerService, providerService).Build();
                }
                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Scope was null on start");
                    }
                }
            }

            // Create bw control service and register myself
            // Bandwidth control service should not be bound to a specific scope because it's designed to control
            // the bandwidth system-wide.
            _bwController = this.Scope.GetService(typeof(IBWControlService)) as IBWControlService;
            _bwContext    = _bwController.RegisterBWControllable(this);
            //Set bandwidth members on the engine
            _engine.SetBandwidthController(_bwController, _bwContext);
            //Set buffer check interval
            _engine.BufferCheckInterval = _bufferCheckInterval;
            //Set underrun trigger
            _engine.UnderrunTrigger = _underrunTrigger;
            // Start playback engine
            _engine.Start();
            // Notify subscribers on start
            NotifySubscriberStart();
        }
Exemplo n.º 3
0
 public void SetBandwidthController(IBWControlService bwController, IBWControlContext bwContext)
 {
     _bwController = bwController;
     _bwContext = bwContext;
 }
Exemplo n.º 4
0
		public override void Start() {
			// Ensure the play engine exists
			if (_engine == null) {
				IScope scope = this.Scope;
				if (scope != null) {
					ISchedulingService schedulingService = scope.GetService(typeof(ISchedulingService)) as ISchedulingService;
					IConsumerService consumerService = scope.GetService(typeof(IConsumerService)) as IConsumerService;
					IProviderService providerService = scope.GetService(typeof(IProviderService)) as IProviderService;
					_engine = new PlayEngine.Builder(this, schedulingService, consumerService, providerService).Build();
				} else {
					if (log.IsErrorEnabled)
						log.Error("Scope was null on start");
				}
			}

			// Create bw control service and register myself
			// Bandwidth control service should not be bound to a specific scope because it's designed to control
			// the bandwidth system-wide.
			_bwController = this.Scope.GetService(typeof(IBWControlService)) as IBWControlService;
			_bwContext = _bwController.RegisterBWControllable(this);
			//Set bandwidth members on the engine
			_engine.SetBandwidthController(_bwController, _bwContext);
			//Set buffer check interval
			_engine.BufferCheckInterval = _bufferCheckInterval;
			//Set underrun trigger
			_engine.UnderrunTrigger = _underrunTrigger;
			// Start playback engine
			_engine.Start();
			// Notify subscribers on start
			NotifySubscriberStart();
		}