示例#1
0
        public override void StartSegment(ISegmentMetadata segmentMetadata)
        {
            this._audioParser = (IAudioParser)this.Parser;
            IShoutcastSegmentMetadata shoutcastSegmentMetadata = segmentMetadata as IShoutcastSegmentMetadata;

            if (null != shoutcastSegmentMetadata)
            {
                int?icyMetaInt = shoutcastSegmentMetadata.IcyMetaInt;
                int num;
                if (icyMetaInt.HasValue)
                {
                    int?nullable = icyMetaInt;
                    num = (nullable.GetValueOrDefault() <= 0 ? 0 : (nullable.HasValue ? 1 : 0)) == 0 ? 1 : 0;
                }
                else
                {
                    num = 1;
                }
                if (num == 0)
                {
                    this._audioParser = this._shoutcastMetadataFilterFactory.Create(segmentMetadata, (IAudioParser)this.Parser, new Action <ITrackMetadata>(((MediaParserBase <TConfigurator>) this).SetTrackMetadata), icyMetaInt.Value);
                }
            }
            this._metadataSink.ReportSegmentMetadata(this.Parser.Position ?? TimeSpan.Zero, segmentMetadata);
        }
示例#2
0
 public ShoutcastMetadataFilter(IAudioParser audioParser, Action<ITrackMetadata> reportMetadata, int interval, Encoding encoding)
 {
   if (null == audioParser)
     throw new ArgumentNullException("audioParser");
   if (null == reportMetadata)
     throw new ArgumentNullException("reportMetadata");
   if (interval < 1)
     throw new ArgumentOutOfRangeException("interval", "must be positive");
   this._encoding = encoding;
   this._audioParser = audioParser;
   this._reportMetadata = reportMetadata;
   this._interval = interval;
   this._remainingData = this._interval;
 }
        public ShoutcastMetadataFilter(IAudioParser audioParser, Action<ITrackMetadata> reportMetadata, int interval, Encoding encoding)
        {
            if (null == audioParser)
                throw new ArgumentNullException(nameof(audioParser));
            if (null == reportMetadata)
                throw new ArgumentNullException(nameof(reportMetadata));
            if (interval < 1)
                throw new ArgumentOutOfRangeException(nameof(interval), "must be positive");

            _encoding = encoding;
            _audioParser = audioParser;
            _reportMetadata = reportMetadata;
            _interval = interval;

            _remainingData = _interval;
        }
        public IAudioParser Create(ISegmentMetadata segmentMetadata, IAudioParser audioParser, Action<ITrackMetadata> reportMetadata, int interval)
        {
            var encoding = _shoutcastEncodingSelector.GetEncoding(segmentMetadata.Url);

            return new ShoutcastMetadataFilter(audioParser, reportMetadata, interval, encoding);
        }
示例#5
0
        public IAudioParser Create(ISegmentMetadata segmentMetadata, IAudioParser audioParser, Action <ITrackMetadata> reportMetadata, int interval)
        {
            Encoding encoding = this._shoutcastEncodingSelector.GetEncoding(segmentMetadata.Url);

            return((IAudioParser) new ShoutcastMetadataFilter(audioParser, reportMetadata, interval, encoding));
        }