Exemplo n.º 1
0
        internal void RaiseRenderingAudioEvent(
            byte[] buffer, int bufferLength, TimeSpan startTime, TimeSpan duration, TimeSpan latency)
        {
            if (RenderingAudio == null)
            {
                return;
            }
            if (MediaCore == null || MediaCore.IsDisposed)
            {
                return;
            }
            if (MediaCore.MediaInfo.Streams.ContainsKey(MediaCore.State.AudioStreamIndex) == false)
            {
                return;
            }

            var e = new RenderingAudioEventArgs(
                buffer,
                bufferLength,
                MediaCore.State,
                MediaCore.MediaInfo.Streams[MediaCore.State.AudioStreamIndex],
                startTime,
                duration,
                MediaCore.PlaybackPosition,
                latency);

            RenderingAudio?.Invoke(this, e);
        }
        internal void RaiseRenderingAudioEvent(AudioBlock audioBlock, TimeSpan clock)
        {
            var args = new RenderingAudioEventArgs(
                audioBlock.Buffer, audioBlock.BufferLength, Container.MediaInfo.Streams[audioBlock.StreamIndex], audioBlock.StartTime, audioBlock.Duration, clock);

            RenderingAudio?.Invoke(this, args);
        }
        internal void RaiseRenderingAudioEvent(AudioBlock audioBlock, TimeSpan clock)
        {
            if (RenderingAudio == null)
            {
                return;
            }

            var e = new RenderingAudioEventArgs(
                audioBlock.Buffer,
                audioBlock.BufferLength,
                MediaCore.MediaInfo.Streams[audioBlock.StreamIndex],
                audioBlock.StartTime,
                audioBlock.Duration,
                clock);

            RenderingAudio?.Invoke(this, e);
        }