/// <summary>
        /// Setup this window for a new source
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
        {
            this.SourceTracks.Clear();
            this.SourceTracks.Add(ForeignAudioSearchTrack);
            foreach (Subtitle subtitle in title.Subtitles)
            {
                this.SourceTracks.Add(subtitle);
            }

            this.Task = task;
            this.NotifyOfPropertyChange(() => this.Task);

            this.AutomaticSubtitleSelection();
        }
        /// <summary>
        /// Prepare the Preset window to create a Preset Object later.
        /// </summary>
        /// <param name="task">
        /// The Encode Task.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="audioBehaviours">
        /// The audio Behaviours.
        /// </param>
        /// <param name="subtitleBehaviours">
        /// The subtitle Behaviours.
        /// </param>
        public void Setup(EncodeTask task, Title title, AudioBehaviours audioBehaviours, SubtitleBehaviours subtitleBehaviours)
        {
            this.Preset.Task = new EncodeTask(task);
            this.Preset.AudioTrackBehaviours = audioBehaviours.Clone();
            this.Preset.SubtitleTrackBehaviours = subtitleBehaviours.Clone();
            this.selectedTitle = title;

            switch (task.Anamorphic)
            {
                default:
                    this.SelectedPictureSettingMode = PresetPictureSettingsMode.Custom;
                    if (title != null && title.Resolution != null)
                    {
                        this.CustomWidth = title.Resolution.Width;
                        this.CustomHeight = title.Resolution.Height;
                    }
                    break;
                case Anamorphic.Strict:
                    this.SelectedPictureSettingMode = PresetPictureSettingsMode.SourceMaximum;
                    break;
            }
        }
Exemple #3
0
 /// <summary>
 /// Setup this window for a new source
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="preset">
 /// The preset.
 /// </param>
 /// <param name="task">
 /// The task.
 /// </param>
 public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
 {
     this.Task = task;
     this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
 }
 /// <summary>
 /// Setup this window for a new source
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="preset">
 /// The preset.
 /// </param>
 /// <param name="task">
 /// The task.
 /// </param>
 public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
 {
     this.Task = task;
 }
Exemple #5
0
        /// <summary>
        /// Set the Source Title
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
        {
            this.SourceTracks = title.AudioTracks;

            // Only reset the audio tracks if we have none, or if the task is null.
            if (this.Task == null)
            {
                this.SetPreset(preset, task);
            }

            // If there are no source tracks, clear the list, otherwise try to Auto-Select the correct tracks
            if (this.SourceTracks == null || !this.SourceTracks.Any())
            {
                this.Task.AudioTracks.Clear();
            }
            else
            {
                this.SetupTracks();
            }

            // Force UI Updates
            this.NotifyOfPropertyChange(() => this.Task);
        }
        /// <summary>
        /// Convert Interop Title objects to App Services Title object
        /// </summary>
        /// <param name="titles">
        /// The titles.
        /// </param>
        /// <param name="featureTitle">
        /// The feature Title.
        /// </param>
        /// <returns>
        /// The convert titles.
        /// </returns>
        internal static List<Title> ConvertTitles(JsonScanObject titles)
        {
            List<Title> titleList = new List<Title>();
            foreach (SourceTitle title in titles.TitleList)
            {
                Title converted = new Title
                    {
                        TitleNumber = title.Index,
                        Duration = new TimeSpan(0, title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),
                        Resolution = new Size(title.Geometry.Width, title.Geometry.Height),
                        AngleCount = title.AngleCount,
                        ParVal = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den),
                        AutoCropDimensions = new Cropping
                        {
                            Top = title.Crop[0],
                            Bottom = title.Crop[1],
                            Left = title.Crop[2],
                            Right = title.Crop[3]
                        },
                        Fps = ((double)title.FrameRate.Num) / title.FrameRate.Den,
                        SourceName = title.Path,
                        MainTitle = titles.MainFeature == title.Index,
                        Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,
                        FramerateNumerator = title.FrameRate.Num,
                        FramerateDenominator = title.FrameRate.Den
                    };

                int currentTrack = 1;
                foreach (ChapterTrack chapter in title.ChapterList)
                {
                    string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;
                    converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)));
                    currentTrack++;
                }

                int currentAudioTrack = 1;
                foreach (AudioTrack track in title.AudioList)
                {
                    converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate));
                    currentAudioTrack++;
                }

                int currentSubtitleTrack = 1;
                foreach (SubtitleTrack track in title.SubtitleList)
                {
                    SubtitleType convertedType = new SubtitleType();

                    switch (track.Source)
                    {
                        case 0:
                            convertedType = SubtitleType.VobSub;
                            break;
                        case 4:
                            convertedType = SubtitleType.UTF8Sub;
                            break;
                        case 5:
                            convertedType = SubtitleType.TX3G;
                            break;
                        case 6:
                            convertedType = SubtitleType.SSA;
                            break;
                        case 1:
                            convertedType = SubtitleType.SRT;
                            break;
                        case 2:
                            convertedType = SubtitleType.CC;
                            break;
                        case 3:
                            convertedType = SubtitleType.CC;
                            break;
                        case 7:
                            convertedType = SubtitleType.PGS;
                            break;
                    }

                    bool canBurn = HBFunctions.hb_subtitle_can_burn(track.Source) > 0;
                    bool canSetForcedOnly = HBFunctions.hb_subtitle_can_force(track.Source) > 0;

                    converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly));
                    currentSubtitleTrack++;
                }

                titleList.Add(converted);
            }

            return titleList;
        }
        /// <summary>
        /// Setup this window for a new source
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
        {
            this.Task = task;
            this.NotifyOfPropertyChange(() => this.Task);

            if (preset != null)
            {
                this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
            }

            this.sourceChaptersList = title.Chapters;
            this.SetSourceChapters(title.Chapters);
        }
        /// <summary>
        /// Setup this window for a new source
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="preset">
        /// The preset.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
        {
            this.currentTitle = title;
            this.Task = task;

            this.scannedSource = source;

            if (title != null)
            {
                // Set cached info
                this.sourceParValues = title.ParVal;
                this.sourceResolution = title.Resolution;

                // Update the cropping values, preffering those in the presets.
                if (!preset.Task.HasCropping)
                {
                    this.Task.Cropping.Top = title.AutoCropDimensions.Top;
                    this.Task.Cropping.Bottom = title.AutoCropDimensions.Bottom;
                    this.Task.Cropping.Left = title.AutoCropDimensions.Left;
                    this.Task.Cropping.Right = title.AutoCropDimensions.Right;
                    this.IsCustomCrop = false;
                }
                else
                {
                    this.Task.Cropping.Left = preset.Task.Cropping.Left;
                    this.Task.Cropping.Right = preset.Task.Cropping.Right;
                    this.Task.Cropping.Top = preset.Task.Cropping.Top;
                    this.Task.Cropping.Bottom = preset.Task.Cropping.Bottom;
                    this.IsCustomCrop = true;
                }

                if (preset.PictureSettingsMode == PresetPictureSettingsMode.None)
                {
                    // We have no instructions, so simply set it to the source.
                    this.Task.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
                    this.MaintainAspectRatio = true;
                }
                else
                {
                    // Set the Max Width / Height available to the user controls
                    if (this.sourceResolution.Width < this.MaxWidth)
                    {
                        this.MaxWidth = this.sourceResolution.Width;
                    }
                    else if (this.sourceResolution.Width > this.MaxWidth)
                    {
                        this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
                    }

                    if (this.sourceResolution.Height < this.MaxHeight)
                    {
                        this.MaxHeight = this.sourceResolution.Height;
                    }
                    else if (this.sourceResolution.Height > this.MaxHeight)
                    {
                        this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
                    }

                    // Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
                    if (this.SelectedAnamorphicMode == Anamorphic.None)
                    {
                        this.Task.Width = preset.Task.Width ?? (this.MaxWidth - this.CropLeft - this.CropRight);
                        // Note: This will be auto-corrected in the property if it's too large.
                    }
                    else
                    {
                        this.Task.Width = preset.Task.Width ?? this.MaxWidth;
                    }

                    // If our height is too large, let it downscale the width for us by setting the height to the lower value.
                    if (!this.MaintainAspectRatio && this.Height > this.MaxHeight)
                    {
                        this.Task.Height = this.MaxHeight;
                    }
                }

                // Set Screen Controls
                this.SourceInfo = string.Format(
                    "{0}x{1}, PAR: {2}/{3}",
                    title.Resolution.Width,
                    title.Resolution.Height,
                    title.ParVal.Width,
                    title.ParVal.Height);

                this.RecaulcatePictureSettingsProperties(ChangedPictureField.Width);
            }

            this.NotifyOfPropertyChange(() => this.Task);
        }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectionTitle"/> class.
 /// </summary>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="sourceName">
 /// The source Name.
 /// </param>
 public SelectionTitle(Title title, string sourceName)
 {
     this.sourceName = sourceName;
     this.Title = title;
 }
Exemple #10
0
        /// <summary>
        /// Convert Interop Title objects to App Services Title object
        /// </summary>
        /// <param name="titles">
        /// The titles.
        /// </param>
        /// <returns>
        /// The convert titles.
        /// </returns>
        internal static List <Title> ConvertTitles(JsonScanObject titles)
        {
            List <Title> titleList = new List <Title>();

            foreach (SourceTitle title in titles.TitleList)
            {
                Title converted = new Title
                {
                    TitleNumber        = title.Index,
                    Duration           = new TimeSpan(0, title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),
                    Resolution         = new Size(title.Geometry.Width, title.Geometry.Height),
                    AngleCount         = title.AngleCount,
                    ParVal             = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den),
                    AutoCropDimensions = new Cropping
                    {
                        Top    = title.Crop[0],
                        Bottom = title.Crop[1],
                        Left   = title.Crop[2],
                        Right  = title.Crop[3]
                    },
                    Fps                  = ((double)title.FrameRate.Num) / title.FrameRate.Den,
                    SourceName           = title.Path,
                    MainTitle            = titles.MainFeature == title.Index,
                    Playlist             = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,
                    FramerateNumerator   = title.FrameRate.Num,
                    FramerateDenominator = title.FrameRate.Den
                };

                int currentTrack = 1;
                foreach (SourceChapter chapter in title.ChapterList)
                {
                    string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;
                    converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)));
                    currentTrack++;
                }

                int currentAudioTrack = 1;
                foreach (SourceAudioTrack track in title.AudioList)
                {
                    converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate));
                    currentAudioTrack++;
                }

                int currentSubtitleTrack = 1;
                foreach (SourceSubtitleTrack track in title.SubtitleList)
                {
                    SubtitleType convertedType = new SubtitleType();

                    switch (track.Source)
                    {
                    case 0:
                        convertedType = SubtitleType.VobSub;
                        break;

                    case 4:
                        convertedType = SubtitleType.UTF8Sub;
                        break;

                    case 5:
                        convertedType = SubtitleType.TX3G;
                        break;

                    case 6:
                        convertedType = SubtitleType.SSA;
                        break;

                    case 1:
                        convertedType = SubtitleType.SRT;
                        break;

                    case 2:
                        convertedType = SubtitleType.CC;
                        break;

                    case 3:
                        convertedType = SubtitleType.CC;
                        break;

                    case 7:
                        convertedType = SubtitleType.PGS;
                        break;
                    }

                    bool canBurn          = HBFunctions.hb_subtitle_can_burn(track.Source) > 0;
                    bool canSetForcedOnly = HBFunctions.hb_subtitle_can_force(track.Source) > 0;

                    converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly));
                    currentSubtitleTrack++;
                }

                titleList.Add(converted);
            }

            return(titleList);
        }
Exemple #11
0
        /// <summary>
        /// Convert Interop Title objects to App Services Title object
        /// </summary>
        /// <param name="titles">
        /// The titles.
        /// </param>
        /// <param name="featureTitle">
        /// The feature Title.
        /// </param>
        /// <returns>
        /// The convert titles.
        /// </returns>
        internal static List <Title> ConvertTitles(IEnumerable <Interop.Model.Scan.Title> titles, int featureTitle)
        {
            List <Title> titleList = new List <Title>();

            foreach (Interop.Model.Scan.Title title in titles)
            {
                Title converted = new Title
                {
                    TitleNumber        = title.TitleNumber,
                    Duration           = title.Duration,
                    Resolution         = new Size(title.Resolution.Width, title.Resolution.Height),
                    AngleCount         = title.AngleCount,
                    ParVal             = new Size(title.ParVal.Width, title.ParVal.Height),
                    AutoCropDimensions = title.AutoCropDimensions,
                    Fps                  = title.Framerate,
                    SourceName           = title.Path,
                    MainTitle            = title.TitleNumber == featureTitle,
                    Playlist             = title.InputType == InputType.Bluray ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,
                    FramerateNumerator   = title.FramerateNumerator,
                    FramerateDenominator = title.FramerateDenominator
                };

                foreach (Interop.Model.Scan.Chapter chapter in title.Chapters)
                {
                    string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;
                    converted.Chapters.Add(new Chapter(chapter.ChapterNumber, chapterName, chapter.Duration));
                }

                foreach (AudioTrack track in title.AudioTracks)
                {
                    converted.AudioTracks.Add(new Audio(track.TrackNumber, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.Bitrate));
                }

                foreach (Interop.Model.Scan.Subtitle track in title.Subtitles)
                {
                    SubtitleType convertedType = new SubtitleType();

                    switch (track.SubtitleSource)
                    {
                    case SubtitleSource.VobSub:
                        convertedType = SubtitleType.VobSub;
                        break;

                    case SubtitleSource.UTF8:
                        convertedType = SubtitleType.UTF8Sub;
                        break;

                    case SubtitleSource.TX3G:
                        convertedType = SubtitleType.TX3G;
                        break;

                    case SubtitleSource.SSA:
                        convertedType = SubtitleType.SSA;
                        break;

                    case SubtitleSource.SRT:
                        convertedType = SubtitleType.SRT;
                        break;

                    case SubtitleSource.CC608:
                        convertedType = SubtitleType.CC;
                        break;

                    case SubtitleSource.CC708:
                        convertedType = SubtitleType.CC;
                        break;

                    case SubtitleSource.PGS:
                        convertedType = SubtitleType.PGS;
                        break;
                    }

                    converted.Subtitles.Add(new Subtitle(track.SubtitleSourceInt, track.TrackNumber, track.Language, track.LanguageCode, convertedType, track.CanBurn, track.CanSetForcedOnly));
                }

                titleList.Add(converted);
            }

            return(titleList);
        }
 /// <summary>
 /// Setup this window for a new source
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="preset">
 /// The preset.
 /// </param>
 /// <param name="task">
 /// The task.
 /// </param>
 public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
 {
     this.X264ViewModel.SetSource(source, title, preset, task);
 }