public QueueTitlesDialogViewModel(List<Title> allTitles)
		{
			this.main = Ioc.Container.GetInstance<MainViewModel>();

			this.selectedTitles = new ObservableCollection<TitleSelectionViewModel>();
			this.selectRange = Config.QueueTitlesUseRange;
			this.startRange = Config.QueueTitlesStartTime;
			this.endRange = Config.QueueTitlesEndTime;
			this.titleStartOverrideEnabled = Config.QueueTitlesUseTitleOverride;
			this.titleStartOverride = Config.QueueTitlesTitleOverride;
			this.directoryOverrideEnabled = Config.QueueTitlesUseDirectoryOverride;
			this.directoryOverride = Config.QueueTitlesDirectoryOverride;
			this.nameOverrideEnabled = Config.QueueTitlesUseNameOverride;
			this.nameOverride = Config.QueueTitlesNameOverride;

			this.titles = new List<TitleSelectionViewModel>();
			foreach (Title title in allTitles)
			{
				var titleVM = new TitleSelectionViewModel(title, this);
				this.titles.Add(titleVM);
			}

			// Perform range selection if enabled.
			if (this.selectRange)
			{
				this.SetSelectedFromRange();
			}

			this.selectedTitles.CollectionChanged +=
				(sender, args) =>
			    {
					this.RaisePropertyChanged(() => this.TitleDetailsVisible);

					if (this.selectedTitles.Count == 1)
					{
						Title title = this.selectedTitles[0].Title;

						// Do preview
						var previewProfile =
							new VCProfile
							{
								CustomCropping = true,
								Cropping = new Cropping(),
								VideoEncoder = "x264",
								AudioEncodings = new List<AudioEncoding>()
							};

						var previewJob =
							new VCJob
							{
								RangeType = VideoRangeType.All,
								Title = title.TitleNumber,
								EncodingProfile = previewProfile
							};

						this.PreviewImage = this.main.ScanInstance.GetPreview(previewJob.HbJob, 2);
						this.RaisePropertyChanged(() => this.TitleText);
					}
			    };
		}
Exemple #2
0
		public static void UpgradeEncodingProfileTo24(VCProfile profile)
		{
			profile.VideoOptions = profile.X264Options;
			profile.VideoTunes = profile.X264Tunes;
			profile.VideoPreset = profile.X264Preset;
			profile.VideoProfile = profile.X264Profile;
			profile.VideoLevel = profile.H264Level;

			// If QSV was the old encoder and QSV is available, use the QSV preset.
			string videoEncoderName = profile.VideoEncoder;
			if (Encoders.GetVideoEncoder(videoEncoderName) == null)
			{
				if (videoEncoderName == "qsv_h264")
				{
					profile.VideoPreset = profile.QsvPreset;
				}
			}
		}
Exemple #3
0
		public static void UpgradeEncodingProfileTo23(VCProfile profile)
		{
			if (profile.ContainerName == "mp4v2")
			{
				profile.ContainerName = "av_mp4";
			}
			else if (profile.ContainerName == "libmkv")
			{
				profile.ContainerName = "av_mkv";
			}
		}
Exemple #4
0
		public static void UpgradeEncodingProfileTo22(VCProfile profile)
		{
			profile.QsvDecode = true;
		}
Exemple #5
0
		public static void UpgradeEncodingProfileTo21(VCProfile profile)
		{
#pragma warning disable 612,618
			if (profile.OutputFormat == VCContainer.Mp4)
			{
				profile.ContainerName = "av_mp4";
			}
			else
			{
				profile.ContainerName = "av_mkv";
			}
#pragma warning restore 612,618
		}
Exemple #6
0
		public static void UpgradeEncodingProfileTo20(VCProfile profile)
		{
			if (!Encoders.VideoEncoders.Any(e => e.ShortName == profile.VideoEncoder))
			{
				string newVideoEncoder = UpgradeVideoEncoder(profile.VideoEncoder);
				if (newVideoEncoder == null)
				{
					newVideoEncoder = "x264";
				}

				profile.VideoEncoder = newVideoEncoder;
			}
		}
		public static string GetExtensionForProfile(VCProfile profile, bool includeDot = true)
		{
			HBContainer container = Encoders.GetContainer(profile.ContainerName);

			string extension;

			if (container.DefaultExtension == "mkv")
			{
				extension = "mkv";
			}
			else if (container.DefaultExtension == "mp4" && profile.PreferredExtension == VCOutputExtension.Mp4)
			{
				extension = "mp4";
			}
			else
			{
				extension = "m4v";
			}

			return includeDot ? "." + extension : extension;
		}
Exemple #8
0
		/// <summary>
		/// Modify the current preset. Called when first making a change to a preset.
		/// </summary>
		/// <param name="newProfile">The new encoding profile to use.</param>
		public void ModifyPreset(VCProfile newProfile)
		{
			Trace.Assert(!this.SelectedPreset.IsModified, "Cannot start modification on already modified preset.");
			Trace.Assert(this.SelectedPreset.OriginalProfile == null, "Preset already has OriginalProfile.");

			if (this.SelectedPreset.IsModified || this.SelectedPreset.OriginalProfile != null)
			{
				return;
			}

			this.SelectedPreset.OriginalProfile = this.SelectedPreset.Preset.EncodingProfile;
			this.SelectedPreset.Preset.EncodingProfile = newProfile;
			this.SelectedPreset.Preset.IsModified = true;
			this.SelectedPreset.RefreshView();
		}
Exemple #9
0
		public static void UpgradeEncodingProfileTo16(VCProfile profile)
		{
#pragma warning disable 612,618
			if (profile.CustomCropping)
#pragma warning restore 612,618
			{
				profile.CroppingType = VCCroppingType.Custom;
			}
			else
			{
                profile.CroppingType = VCCroppingType.Automatic;
			}

#pragma warning disable 612,618
			if (string.IsNullOrWhiteSpace(profile.X264Tune))
			{
				profile.X264Tunes = new List<string> { profile.X264Tune };
			}
#pragma warning restore 612,618
		}
Exemple #10
0
		public static void UpgradeEncodingProfileTo15(VCProfile profile)
		{
			if (profile.Framerate == 0)
			{
				// Profile had only VFR for Same as Source framerate before.
				profile.ConstantFramerate = false;
			}
			else
			{
				// If Peak Framerate was checked under a specific framerate
				// that meant we wanted VFR. Otherwise, CFR with the listed framerate
#pragma warning disable 612,618
				profile.ConstantFramerate = !profile.PeakFramerate;
#pragma warning restore 612,618
			}

			foreach (AudioEncoding encoding in profile.AudioEncodings)
			{
				if (encoding.Mixdown == "6ch")
				{
					encoding.Mixdown = "5point1";
				}
			}
		}
Exemple #11
0
		public static void UpgradeEncodingProfileTo14(VCProfile profile)
		{
			profile.AudioEncoderFallback = UpgradeAudioEncoder(profile.AudioEncoderFallback);
		}
Exemple #12
0
		public static void UpgradeEncodingProfileTo13(VCProfile profile)
		{
			// Upgrade preset: translate old Enum-based values to short name strings
			if (!Encoders.VideoEncoders.Any(e => e.ShortName == profile.VideoEncoder))
			{
				string newVideoEncoder = "x264";
				switch (profile.VideoEncoder)
				{
					case "X264":
						newVideoEncoder = "x264";
						break;
					case "FFMpeg":
						newVideoEncoder = "ffmpeg4";
						break;
					case "FFMpeg2":
						newVideoEncoder = "ffmpeg2";
						break;
					case "Theora":
						newVideoEncoder = "theora";
						break;
				}

				profile.VideoEncoder = newVideoEncoder;
			}

			foreach (AudioEncoding encoding in profile.AudioEncodings)
			{
				if (!Encoders.AudioEncoders.Any(e => e.ShortName == encoding.Encoder))
				{
					string newAudioEncoder = UpgradeAudioEncoder(encoding.Encoder);
					if (newAudioEncoder == null)
					{
						newAudioEncoder = "faac";
					}

					encoding.Encoder = newAudioEncoder;
				}

				if (!Encoders.Mixdowns.Any(m => m.ShortName == encoding.Mixdown))
				{
					string newMixdown = "dpl2";
					switch (encoding.Mixdown)
					{
						case "Auto":
							newMixdown = "none";
							break;
						case "None":
							newMixdown = "none";
							break;
						case "Mono":
							newMixdown = "mono";
							break;
						case "Stereo":
							newMixdown = "stereo";
							break;
						case "DolbySurround":
							newMixdown = "dpl1";
							break;
						case "DolbyProLogicII":
							newMixdown = "dpl2";
							break;
						case "SixChannelDiscrete":
							newMixdown = "6ch";
							break;
					}

					encoding.Mixdown = newMixdown;
				}
			}
		}
Exemple #13
0
		public static void UpgradeEncodingProfile(VCProfile profile, int databaseVersion)
		{
			if (databaseVersion >= Utilities.CurrentDatabaseVersion)
			{
				return;
			}

			if (databaseVersion < 13)
			{
				UpgradeEncodingProfileTo13(profile);
			}

			if (databaseVersion < 14)
			{
				UpgradeEncodingProfileTo14(profile);
			}

			if (databaseVersion < 15)
			{
				UpgradeEncodingProfileTo15(profile);
			}

			if (databaseVersion < 16)
			{
				UpgradeEncodingProfileTo16(profile);
			}

			if (databaseVersion < 17)
			{
				UpgradeEncodingProfileTo17(profile);
			}

			if (databaseVersion < 19)
			{
				UpgradeEncodingProfileTo19(profile);
			}

			if (databaseVersion < 20)
			{
				UpgradeEncodingProfileTo20(profile);
			}

			if (databaseVersion < 21)
			{
				UpgradeEncodingProfileTo21(profile);
			}

			if (databaseVersion < 22)
			{
				UpgradeEncodingProfileTo22(profile);
			}

			if (databaseVersion < 23)
			{
				UpgradeEncodingProfileTo23(profile);
			}

			if (databaseVersion < 24)
			{
				UpgradeEncodingProfileTo24(profile);
			}

		    if (databaseVersion < 25)
		    {
		        UpgradeEncodingProfileTo25(profile);
		    }

		    if (databaseVersion < 26)
		    {
		        UpgradeEncodingProfileTo26(profile);
		    }
		}
Exemple #14
0
		private static TransformedBitmap CreateTransformedBitmap(BitmapSource source, VCProfile profile)
		{
			var transformedBitmap = new TransformedBitmap();
			transformedBitmap.BeginInit();
			transformedBitmap.Source = source;
			var transformGroup = new TransformGroup();
			transformGroup.Children.Add(new ScaleTransform(profile.FlipHorizontal ? -1 : 1, profile.FlipVertical ? -1 : 1));
			transformGroup.Children.Add(new RotateTransform(ConvertRotationToDegrees(profile.Rotation)));
			transformedBitmap.Transform = transformGroup;
			transformedBitmap.EndInit();
			transformedBitmap.Freeze();

			return transformedBitmap;
		}
Exemple #15
0
        public VCProfile Clone()
        {
            var profile = new VCProfile
            {
#pragma warning disable 612, 618
                OutputFormat = this.OutputFormat,
#pragma warning restore 612, 618
                ContainerName         = this.ContainerName,
                PreferredExtension    = this.PreferredExtension,
                IncludeChapterMarkers = this.IncludeChapterMarkers,
                LargeFile             = this.LargeFile,
                Optimize      = this.Optimize,
                IPod5GSupport = this.IPod5GSupport,

                Width             = this.Width,
                Height            = this.Height,
                MaxWidth          = this.MaxWidth,
                MaxHeight         = this.MaxHeight,
                ScaleMethod       = this.ScaleMethod,
                CroppingType      = this.CroppingType,
                Cropping          = this.Cropping.Clone(),
                Anamorphic        = this.Anamorphic,
                UseDisplayWidth   = this.UseDisplayWidth,
                DisplayWidth      = this.DisplayWidth,
                KeepDisplayAspect = this.KeepDisplayAspect,
                PixelAspectX      = this.PixelAspectX,
                PixelAspectY      = this.PixelAspectY,
                Modulus           = this.Modulus,
                Rotation          = this.Rotation,
                FlipHorizontal    = this.FlipHorizontal,
                FlipVertical      = this.FlipVertical,

                Deinterlace       = this.Deinterlace,
                CustomDeinterlace = this.CustomDeinterlace,
                Decomb            = this.Decomb,
                CustomDecomb      = this.CustomDecomb,
                Detelecine        = this.Detelecine,
                CustomDetelecine  = this.CustomDetelecine,
                DenoiseType       = this.DenoiseType,
                DenoisePreset     = this.DenoisePreset,
                DenoiseTune       = this.DenoiseTune,
                UseCustomDenoise  = this.UseCustomDenoise,
                CustomDenoise     = this.CustomDenoise,
                Deblock           = this.Deblock,
                Grayscale         = this.Grayscale,

                UseAdvancedTab      = this.UseAdvancedTab,
                X264Options         = this.X264Options,
                X264Profile         = this.X264Profile,
                X264Preset          = this.X264Preset,
                QsvPreset           = this.QsvPreset,
                X264Tunes           = this.X264Tunes,
                H264Level           = this.H264Level,
                VideoEncoder        = this.VideoEncoder,
                VideoOptions        = this.VideoOptions,
                VideoProfile        = this.VideoProfile,
                VideoPreset         = this.VideoPreset,
                VideoTunes          = this.VideoTunes,
                VideoLevel          = this.VideoLevel,
                QsvDecode           = this.QsvDecode,
                VideoEncodeRateType = this.VideoEncodeRateType,
                Quality             = this.Quality,
                TargetSize          = this.TargetSize,
                VideoBitrate        = this.VideoBitrate,
                TwoPass             = this.TwoPass,
                TurboFirstPass      = this.TurboFirstPass,
                Framerate           = this.Framerate,
                ConstantFramerate   = this.ConstantFramerate,

                AudioEncodings       = new List <AudioEncoding>(this.AudioEncodings),
                AudioEncoderFallback = this.AudioEncoderFallback
            };

            return(profile);
        }
Exemple #16
0
		public static void UpgradeEncodingProfileTo25(VCProfile profile)
		{
#pragma warning disable 618
			if (profile.Denoise == null || profile.Denoise == "Off")
			{
				profile.DenoiseType = VCDenoise.Off;
			}
			else
			{
				profile.DenoiseType = VCDenoise.hqdn3d;
			}

			switch (profile.Denoise)
			{
				case "Off":
					break;
				case "Weak":
					profile.DenoisePreset = "light";
					break;
				case "Medium":
					profile.DenoisePreset = "medium";
					break;
				case "Strong":
					profile.DenoisePreset = "strong";
					break;
				case "Custom":
					profile.DenoisePreset = null;
					profile.UseCustomDenoise = true;
					break;
				default:
					profile.DenoisePreset = "medium";
					break;
			}
#pragma warning restore 618
		}
Exemple #17
0
	    public static void UpgradeEncodingProfileTo26(VCProfile profile)
	    {
#pragma warning disable 618
            if (profile.DenoiseType == VCDenoise.NlMeans)
	        {
	            profile.DenoiseType = VCDenoise.NLMeans;
	        }
#pragma warning restore 618
        }
Exemple #18
0
		public static void UpgradeEncodingProfileTo17(VCProfile profile)
		{
			if (profile.X264Profile == "high444")
			{
				profile.X264Profile = null;
			}
		}
Exemple #19
0
		public static void UpgradeEncodingProfileTo19(VCProfile profile)
		{
			foreach (AudioEncoding encoding in profile.AudioEncodings)
			{
				if (!Encoders.AudioEncoders.Any(e => e.ShortName == encoding.Encoder))
				{
					string newAudioEncoder = UpgradeAudioEncoder2(encoding.Encoder);
					if (newAudioEncoder == null)
					{
						newAudioEncoder = "av_aac";
					}

					encoding.Encoder = newAudioEncoder;
				}
			}
		}
Exemple #20
0
		public VCProfile Clone()
		{
			var profile = new VCProfile
			{
#pragma warning disable 612, 618
				OutputFormat = this.OutputFormat,
#pragma warning restore 612, 618
				ContainerName = this.ContainerName,
				PreferredExtension = this.PreferredExtension,
				IncludeChapterMarkers = this.IncludeChapterMarkers,
				LargeFile = this.LargeFile,
				Optimize = this.Optimize,
				IPod5GSupport = this.IPod5GSupport,

				Width = this.Width,
				Height = this.Height,
				MaxWidth = this.MaxWidth,
				MaxHeight = this.MaxHeight,
				ScaleMethod = this.ScaleMethod,
				CroppingType = this.CroppingType,
				Cropping = this.Cropping.Clone(),
				Anamorphic = this.Anamorphic,
				UseDisplayWidth = this.UseDisplayWidth,
				DisplayWidth = this.DisplayWidth,
				KeepDisplayAspect = this.KeepDisplayAspect,
				PixelAspectX = this.PixelAspectX,
				PixelAspectY = this.PixelAspectY,
				Modulus = this.Modulus,
				Rotation = this.Rotation,
				FlipHorizontal = this.FlipHorizontal,
				FlipVertical = this.FlipVertical,

				Deinterlace = this.Deinterlace,
				CustomDeinterlace = this.CustomDeinterlace,
				Decomb = this.Decomb,
				CustomDecomb = this.CustomDecomb,
				Detelecine = this.Detelecine,
				CustomDetelecine = this.CustomDetelecine,
				DenoiseType = this.DenoiseType,
				DenoisePreset = this.DenoisePreset,
				DenoiseTune = this.DenoiseTune,
				UseCustomDenoise = this.UseCustomDenoise,
				CustomDenoise = this.CustomDenoise,
				Deblock = this.Deblock,
				Grayscale = this.Grayscale,

				UseAdvancedTab = this.UseAdvancedTab,
				X264Options = this.X264Options,
				X264Profile = this.X264Profile,
				X264Preset = this.X264Preset,
				QsvPreset = this.QsvPreset,
				X264Tunes = this.X264Tunes,
				H264Level = this.H264Level,
				VideoEncoder = this.VideoEncoder,
				VideoOptions = this.VideoOptions,
				VideoProfile = this.VideoProfile,
				VideoPreset = this.VideoPreset,
				VideoTunes = this.VideoTunes,
				VideoLevel = this.VideoLevel,
				QsvDecode = this.QsvDecode,
				VideoEncodeRateType = this.VideoEncodeRateType,
				Quality = this.Quality,
				TargetSize = this.TargetSize,
				VideoBitrate = this.VideoBitrate,
				TwoPass = this.TwoPass,
				TurboFirstPass = this.TurboFirstPass,
				Framerate = this.Framerate,
				ConstantFramerate = this.ConstantFramerate,

				AudioEncodings = new List<AudioEncoding>(this.AudioEncodings),
				AudioEncoderFallback = this.AudioEncoderFallback
			};

			return profile;
		}