コード例 #1
0
        public VideoTranscodingTarget GetMatchingVideoTranscoding(MetadataContainer info, int edition, int matchedAudioStream, out VideoMatch matchedSource)
        {
            matchedSource = null;

            if (info == null)
            {
                throw new ArgumentException("Parameter cannot be empty", nameof(info));
            }
            if (!info.HasEdition(edition))
            {
                throw new ArgumentException("Parameter is invalid", nameof(edition));
            }

            foreach (VideoTranscodingTarget tDef in VideoTargets)
            {
                foreach (VideoInfo src in tDef.Sources)
                {
                    if (src.Matches(info, edition, matchedAudioStream, VideoSettings.H264LevelCheckMethod))
                    {
                        matchedSource = new VideoMatch();
                        matchedSource.MatchedAudioStream = matchedAudioStream;
                        matchedSource.MatchedVideoSource = src;
                        return(tDef);
                    }
                }
            }
            return(null);
        }
コード例 #2
0
        public AudioTranscodingTarget GetMatchingAudioTranscoding(MetadataContainer info, int edition, out AudioMatch matchedSource)
        {
            matchedSource = null;

            if (info == null)
            {
                throw new ArgumentException("Parameter cannot be empty", nameof(info));
            }
            if (!info.HasEdition(edition))
            {
                throw new ArgumentException("Parameter is invalid", nameof(edition));
            }

            int matchedAudioStream = info.Audio[edition].First().StreamIndex;

            foreach (AudioTranscodingTarget tDef in AudioTargets)
            {
                foreach (AudioInfo src in tDef.Sources)
                {
                    if (src.Matches(info, edition, matchedAudioStream))
                    {
                        matchedSource = new AudioMatch();
                        matchedSource.MatchedAudioStream = matchedAudioStream;
                        matchedSource.MatchedAudioSource = src;
                        return(tDef);
                    }
                }
            }
            return(null);
        }
コード例 #3
0
        public ImageTranscodingTarget GetMatchingImageTranscoding(MetadataContainer info, int edition, out ImageMatch matchedSource)
        {
            matchedSource = null;

            if (info == null)
            {
                throw new ArgumentException("Parameter cannot be empty", nameof(info));
            }
            if (!info.HasEdition(edition))
            {
                throw new ArgumentException("Parameter is invalid", nameof(edition));
            }

            foreach (ImageTranscodingTarget tDef in ImageTargets)
            {
                foreach (ImageInfo src in tDef.Sources)
                {
                    if (src.Matches(info, edition))
                    {
                        matchedSource = new ImageMatch();
                        matchedSource.MatchedImageSource = src;
                        return(tDef);
                    }
                }
            }
            if (info.Image[edition].Height > ImageSettings.MaxHeight ||
                info.Image[edition].Width > ImageSettings.MaxWidth ||
                (info.Image[edition].Orientation > 1 && ImageSettings.AutoRotate == true))
            {
                matchedSource = new ImageMatch();
                matchedSource.MatchedImageSource = new ImageInfo();

                ImageTranscodingTarget tDef = new ImageTranscodingTarget();
                tDef.Target = new ImageInfo();
                tDef.Target.ImageContainerType = info.Metadata[edition].ImageContainerType;
                tDef.Target.PixelFormatType    = info.Image[edition].PixelFormatType;
                tDef.Target.QualityType        = ImageSettings.Quality;
                return(tDef);
            }
            return(null);
        }