예제 #1
0
        public ISegmentMetadata CreateSegmentMetadata(WebResponse webResponse, ContentType contentType)
        {
            var shoutcast = new ShoutcastHeaders(webResponse.RequestUri, webResponse.Headers);

            if (shoutcast.MetaInterval > 0 || shoutcast.SupportsIcyMetadata)
            {
                var segmentMetadata = new ShoutcastSegmentMetadata
                {
                    Url = webResponse.RequestUri,
                    ContentType = contentType ?? webResponse.ContentType,
                    Length = webResponse.ContentLength,
                    IcyMetaInt = shoutcast.MetaInterval,
                    SupportsIcyMetadata = shoutcast.SupportsIcyMetadata
                };

                return segmentMetadata;
            }

            var streamMetadata = new SegmentMetadata
            {
                Url = webResponse.RequestUri,
                ContentType = contentType ?? webResponse.ContentType,
                Length = webResponse.ContentLength
            };

            return streamMetadata;
        }
예제 #2
0
        public IStreamMetadata CreateStreamMetadata(WebResponse webResponse, ContentType contentType = null)
        {
            ShoutcastHeaders shoutcastHeaders = new ShoutcastHeaders(webResponse.RequestUri, webResponse.Headers);

            return((IStreamMetadata) new StreamMetadata()
            {
                Url = webResponse.RequestUri,
                ContentType = (contentType ?? webResponse.ContentType),
                Bitrate = shoutcastHeaders.Bitrate,
                Description = shoutcastHeaders.Description,
                Genre = shoutcastHeaders.Genre,
                Name = shoutcastHeaders.Name,
                Website = shoutcastHeaders.Website
            });
        }
예제 #3
0
        public IStreamMetadata CreateStreamMetadata(WebResponse webResponse, ContentType contentType = null)
        {
            var shoutcast = new ShoutcastHeaders(webResponse.RequestUri, webResponse.Headers);

            var streamMetadata = new StreamMetadata
            {
                Url = webResponse.RequestUri,
                ContentType = contentType ?? webResponse.ContentType,
                Bitrate = shoutcast.Bitrate,
                Description = shoutcast.Description,
                Genre = shoutcast.Genre,
                Name = shoutcast.Name,
                Website = shoutcast.Website
            };

            return streamMetadata;
        }
예제 #4
0
        public ISegmentMetadata CreateSegmentMetadata(WebResponse webResponse, ContentType contentType)
        {
            ShoutcastHeaders shoutcastHeaders = new ShoutcastHeaders(webResponse.RequestUri, webResponse.Headers);
            int?metaInterval = shoutcastHeaders.MetaInterval;

            if ((metaInterval.GetValueOrDefault() <= 0 ? 0 : (metaInterval.HasValue ? 1 : 0)) != 0 || shoutcastHeaders.SupportsIcyMetadata)
            {
                ShoutcastSegmentMetadata shoutcastSegmentMetadata = new ShoutcastSegmentMetadata();
                shoutcastSegmentMetadata.Url                 = webResponse.RequestUri;
                shoutcastSegmentMetadata.ContentType         = contentType ?? webResponse.ContentType;
                shoutcastSegmentMetadata.Length              = webResponse.ContentLength;
                shoutcastSegmentMetadata.IcyMetaInt          = shoutcastHeaders.MetaInterval;
                shoutcastSegmentMetadata.SupportsIcyMetadata = shoutcastHeaders.SupportsIcyMetadata;
                return((ISegmentMetadata)shoutcastSegmentMetadata);
            }
            return((ISegmentMetadata) new SegmentMetadata()
            {
                Url = webResponse.RequestUri,
                ContentType = (contentType ?? webResponse.ContentType),
                Length = webResponse.ContentLength
            });
        }