예제 #1
0
        private void RefreshLevelCompatibility()
        {
            if (this.LevelChoices == null)
            {
                return;
            }

            foreach (LevelChoiceViewModel levelChoice in this.LevelChoices)
            {
                if (levelChoice.Value != null)
                {
                    var main         = this.EncodingViewModel.MainViewModel;
                    var picturePanel = this.EncodingViewModel.PicturePanelViewModel;
                    if (main.HasVideoSource && picturePanel.StorageWidth > 0 && picturePanel.StorageHeight > 0)
                    {
                        int fpsNumerator;
                        int fpsDenominator;

                        if (this.Profile.Framerate == 0)
                        {
                            fpsNumerator   = main.SelectedTitle.FramerateNumerator;
                            fpsDenominator = main.SelectedTitle.FramerateDenominator;
                        }
                        else
                        {
                            fpsNumerator   = 27000000;
                            fpsDenominator = HandBrake.Interop.Converters.Converters.FramerateToVrate(this.Profile.Framerate);
                        }

                        bool interlaced     = false;
                        bool fakeInterlaced = false;

                        Dictionary <string, string> advancedOptions = AdvancedOptionsParsing.ParseOptions(this.Profile.VideoOptions);
                        if (advancedOptions.ContainsKey("interlaced") && advancedOptions["interlaced"] == "1" ||
                            advancedOptions.ContainsKey("tff") && advancedOptions["tff"] == "1" ||
                            advancedOptions.ContainsKey("bff") && advancedOptions["bff"] == "1")
                        {
                            interlaced = true;
                        }

                        if (advancedOptions.ContainsKey("fake-interlaced") && advancedOptions["fake-interlaced"] == "1")
                        {
                            fakeInterlaced = true;
                        }

                        levelChoice.IsCompatible = HandBrakeUtils.IsH264LevelValid(
                            levelChoice.Value,
                            picturePanel.StorageWidth,
                            picturePanel.StorageHeight,
                            fpsNumerator,
                            fpsDenominator,
                            interlaced,
                            fakeInterlaced);
                    }
                    else
                    {
                        levelChoice.IsCompatible = true;
                    }
                }
            }
        }