예제 #1
0
        public EsStreamController(EsPlayerPacketStorage storage, Window window)
        {
            if (SynchronizationContext.Current == null)
            {
                throw new ArgumentNullException(nameof(SynchronizationContext.Current));
            }

            _syncCtx = SynchronizationContext.Current;

            // Create placeholder to data streams & chunk states
            esStreams         = new EsStream[(int)StreamType.Count];
            playbackErrorSubs = new IDisposable[(int)StreamType.Count];

            _playerClock                 = new PlayerClockProvider(_clockScheduler);
            dataSynchronizer             = new Synchronizer(_playerClock);
            _dataClock                   = new DataClockProvider(_clockScheduler, _playerClock);
            _dataClock.SynchronizerClock = dataSynchronizer.Pts();

            packetStorage = storage;
            displayWindow = window;

            try
            {
                player = new ESPlayer.ESPlayer();
                OpenPlayer();
            }
            catch (Exception e)
            {
                logger.Error(e);
            }
        }
예제 #2
0
        public EsStreamController(EsPlayerPacketStorage storage, Window window)
        {
            displayWindow = window;

            CreatePlayer();

            packetStorage = storage;

            // Create placeholder to data streams & chunk states
            dataStreams           = new DataStream[(int)StreamType.Count];
            streamReconfigureSubs = new IDisposable[(int)StreamType.Count];
            playbackErrorSubs     = new IDisposable[(int)StreamType.Count];

            AttachEventHandlers();
        }
예제 #3
0
        public EsPlayer(Window window)
        {
            try
            {
                packetStorage = new EsPlayerPacketStorage();
                packetStorage.Initialize(StreamType.Audio);
                packetStorage.Initialize(StreamType.Video);

                streamControl = new EsStreamController(packetStorage, window);
                streamControl.Initialize(StreamType.Audio);
                streamControl.Initialize(StreamType.Video);
            }
            catch (InvalidOperationException ioe)
            {
                logger.Error(ioe, "EsPlayer failure");
                throw ioe;
            }
        }
예제 #4
0
        public EsStreamController(EsPlayerPacketStorage storage, Window window)
        {
            _playerClock        = new PlayerClockProvider(_clockScheduler);
            _dataClock          = new DataClockProvider(_clockScheduler);
            _suspendResumeLogic = new SuspendResumeLogic(SuspendPlayback, ResumePlayback, SetPlayerState,
                                                         GetVideoPlayerState, SetDataTransferState, activeTaskCts.Token);

            displayWindow = window;

            CreatePlayer();

            packetStorage = storage;

            // Create placeholder to data streams & chunk states
            esStreams             = new EsStream[(int)StreamType.Count];
            streamReconfigureSubs = new IDisposable[(int)StreamType.Count];
            playbackErrorSubs     = new IDisposable[(int)StreamType.Count];
            dataSynchronizer      = new Synchronizer(_playerClock);

            AttachEventHandlers();
        }
예제 #5
0
        public EsStream(Common.StreamType type, EsPlayerPacketStorage storage)
        {
            streamType    = type;
            packetStorage = storage;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }

            wakeup = new ManualResetEventSlim(false);
        }
예제 #6
0
        public EsStream(StreamType type, EsPlayerPacketStorage storage, Synchronizer synchronizer, PlayerClockProvider playerClock)
        {
            streamType        = type;
            packetStorage     = storage;
            _dataSynchronizer = synchronizer;
            _dataSynchronizer.Initialize(streamType);
            _playerClock = playerClock;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }
        }
예제 #7
0
        public EsStream(Common.StreamType type, EsPlayerPacketStorage storage, StreamBufferController bufferController)
        {
            streamType             = type;
            packetStorage          = storage;
            streamBufferController = bufferController;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }

            wakeup  = new ManualResetEventSlim(false);
            barrier = new PacketBarrier(TransferChunk);
        }
예제 #8
0
        public EsStream(StreamType type, EsPlayerPacketStorage storage, Synchronizer synchronizer, SuspendResumeLogic suspendRedumeLogic)
        {
            streamType        = type;
            packetStorage     = storage;
            _dataSynchronizer = synchronizer;
            _dataSynchronizer.Initialize(streamType);
            _suspendResumeLogic = suspendRedumeLogic;

            switch (streamType)
            {
            case StreamType.Audio:
                PushStreamConfig = PushAudioConfig;
                break;

            case StreamType.Video:
                PushStreamConfig = PushVideoConfig;
                break;

            default:
                throw new ArgumentException($"Stream Type {streamType} is unsupported");
            }

            _firstDataPacketTcs = new TaskCompletionSource <object>();
        }
예제 #9
0
 public EsStreamController(EsPlayerPacketStorage storage)
     : this(storage,
            WindowUtils.CreateElmSharpWindow())
 {
     usesExternalWindow = false;
 }