internal static VideoStreamInfo ESVideoStreamInfo(this Demuxer.Common.StreamConfig streamConfig)
        {
            if (!(streamConfig is Demuxer.Common.VideoStreamConfig))
            {
                throw new ArgumentException("StreamConfig is not of VideoStreamConfig Type");
            }

            var videoConfig = (Demuxer.Common.VideoStreamConfig)streamConfig;

            // Sort configuration by FPS (lowest first) & get an entry matching codec & FPS
            var fpsOrderedConfigs = VideoConfigurations.OrderBy(entry => entry.Fps);
            var configParameters  = fpsOrderedConfigs.FirstOrDefault(entry =>
                                                                     videoConfig.Codec == entry.Codec && entry.Fps >= videoConfig.FrameRate) ??
                                    fpsOrderedConfigs.LastOrDefault(entry => videoConfig.Codec == entry.Codec);

            if (configParameters == null)
            {
                throw new ArgumentException($"Unsupported codec {videoConfig.Codec}");
            }

            return(new VideoStreamInfo
            {
                codecData = videoConfig.CodecExtraData,
                mimeType = EsPlayerUtils.GetCodecMimeType(videoConfig.Codec),
                width = videoConfig.Size.Width,
                maxWidth = configParameters.Width,
                height = videoConfig.Size.Height,
                maxHeight = configParameters.Height,
                num = videoConfig.FrameRateNum,
                den = videoConfig.FrameRateDen
            });
        }
        internal static AudioStreamInfo ESAudioStreamInfo(this Demuxer.Common.StreamConfig streamConfig)
        {
            if (!(streamConfig is Demuxer.Common.AudioStreamConfig))
            {
                throw new ArgumentException("StreamConfig is not of AudioStreamConfig Type");
            }

            var audioConfig = (Demuxer.Common.AudioStreamConfig)streamConfig;

            return(new AudioStreamInfo
            {
                codecData = audioConfig.CodecExtraData,
                mimeType = EsPlayerUtils.GetCodecMimeType(audioConfig.Codec),
                sampleRate = audioConfig.SampleRate,
                channels = audioConfig.ChannelLayout
            });
        }