Exemple #1
0
        public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int?audioChannels, int?audioBitrate, int?audioSampleRate)
        {
            container = StringHelper.TrimStart(container ?? string.Empty, '.');

            foreach (var i in ResponseProfiles)
            {
                if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
                {
                    continue;
                }

                List <string> containers = i.GetContainers();
                if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container))
                {
                    continue;
                }

                List <string> audioCodecs = i.GetAudioCodecs();
                if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
                {
                    continue;
                }

                var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();

                var anyOff = false;
                foreach (ProfileCondition c in i.Conditions)
                {
                    if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate))
                    {
                        anyOff = true;
                        break;
                    }
                }

                if (anyOff)
                {
                    continue;
                }

                return(i);
            }
            return(null);
        }
Exemple #2
0
        public ResponseProfile GetImageMediaProfile(string container, int?width, int?height)
        {
            container = StringHelper.TrimStart(container ?? string.Empty, '.');

            foreach (var i in ResponseProfiles)
            {
                if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Photo)
                {
                    continue;
                }

                List <string> containers = i.GetContainers();
                if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container))
                {
                    continue;
                }

                var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();

                var anyOff = false;
                foreach (ProfileCondition c in i.Conditions)
                {
                    if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height))
                    {
                        anyOff = true;
                        break;
                    }
                }

                if (anyOff)
                {
                    continue;
                }

                return(i);
            }
            return(null);
        }
Exemple #3
0
        public ResponseProfile GetVideoMediaProfile(string container,
                                                    string audioCodec,
                                                    string videoCodec,
                                                    int?width,
                                                    int?height,
                                                    int?bitDepth,
                                                    int?videoBitrate,
                                                    string videoProfile,
                                                    double?videoLevel,
                                                    float?videoFramerate,
                                                    int?packetLength,
                                                    TransportStreamTimestamp timestamp,
                                                    bool?isAnamorphic,
                                                    bool?isInterlaced,
                                                    int?refFrames,
                                                    int?numVideoStreams,
                                                    int?numAudioStreams,
                                                    string videoCodecTag,
                                                    bool?isAvc)
        {
            container = StringHelper.TrimStart(container ?? string.Empty, '.');

            foreach (var i in ResponseProfiles)
            {
                if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
                {
                    continue;
                }

                List <string> containers = i.GetContainers();
                if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty))
                {
                    continue;
                }

                List <string> audioCodecs = i.GetAudioCodecs();
                if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
                {
                    continue;
                }

                List <string> videoCodecs = i.GetVideoCodecs();
                if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))
                {
                    continue;
                }

                var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();

                var anyOff = false;
                foreach (ProfileCondition c in i.Conditions)
                {
                    if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
                    {
                        anyOff = true;
                        break;
                    }
                }

                if (anyOff)
                {
                    continue;
                }

                return(i);
            }
            return(null);
        }