Esempio n. 1
0
 public LibEncode(IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int encodeCounter) : base(userSettingService)
 {
     this.userSettingService  = userSettingService;
     this.logInstanceManager  = logInstanceManager;
     this.hbFunctionsProvider = hbFunctionsProvider;
     this.encodeCounter       = encodeCounter;
 }
Esempio n. 2
0
 public LibEncode(IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int encodeCounter, IPortService portService) : base(userSettingService)
 {
     this.userSettingService  = userSettingService;
     this.logInstanceManager  = logInstanceManager;
     this.hbFunctionsProvider = hbFunctionsProvider;
     this.encodeCounter       = encodeCounter;
     this.portService         = portService;
     this.encodeTaskFactory   = new EncodeTaskFactory(this.userSettingService, hbFunctionsProvider.GetHbFunctionsWrapper());
 }
Esempio n. 3
0
        public QueueService(IUserSettingService userSettingService, ILog logService, IErrorService errorService, ILogInstanceManager logInstanceManager, IHbFunctionsProvider hbFunctionsProvider)
        {
            this.userSettingService  = userSettingService;
            this.logService          = logService;
            this.errorService        = errorService;
            this.logInstanceManager  = logInstanceManager;
            this.hbFunctionsProvider = hbFunctionsProvider;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("{0}{1}.json", QueueRecoveryHelper.QueueFileName, GeneralUtilities.ProcessId);

            this.allowedInstances        = this.userSettingService.GetUserSetting <int>(UserSettingConstants.SimultaneousEncodes);
            this.processIsolationEnabled = this.userSettingService.GetUserSetting <bool>(UserSettingConstants.ProcessIsolationEnabled);
        }
Esempio n. 4
0
        /// <summary>
        /// The hb_set_anamorphic_size 2.
        /// </summary>
        /// <param name="job">
        /// The job.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="setting">
        /// The setting.
        /// </param>
        /// <returns>
        /// The <see cref="AnamorphicResult"/>.
        /// </returns>
        public static AnamorphicResult hb_set_anamorphic_size2(PictureSettingsJob job, PictureSettingsTitle title, KeepSetting setting)
        {
            int settingMode = (int)setting + (job.KeepDisplayAspect ? 0x04 : 0);

            hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
            {
                crop      = new[] { job.Crop.Top, job.Crop.Bottom, job.Crop.Left, job.Crop.Right },
                itu_par   = 0,
                keep      = settingMode,
                maxWidth  = job.MaxWidth,
                maxHeight = job.MaxHeight,
                mode      = (int)job.AnamorphicMode,
                modulus   = job.Modulus.HasValue ? job.Modulus.Value : 16,
                geometry  = new hb_geometry_s {
                    height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t {
                        den = title.ParH, num = title.ParW
                    } : new hb_rational_t {
                        den = job.ParH, num = job.ParW
                    }
                }
            };

            hb_geometry_s sourceGeometry = new hb_geometry_s
            {
                width  = title.Width,
                height = title.Height,
                par    = new hb_rational_t {
                    den = title.ParH, num = title.ParW
                }
            };

            hb_geometry_s result = new hb_geometry_s();

            IHbFunctionsProvider provider    = IoC.Get <IHbFunctionsProvider>(); // TODO make this method non static and remove IoC call.
            IHbFunctions         hbFunctions = provider.GetHbFunctionsWrapper();

            hbFunctions.hb_set_anamorphic_size2(ref sourceGeometry, ref uiGeometry, ref result);

            int outputWidth     = result.width;
            int outputHeight    = result.height;
            int outputParWidth  = result.par.num;
            int outputParHeight = result.par.den;

            return(new AnamorphicResult {
                OutputWidth = outputWidth, OutputHeight = outputHeight, OutputParWidth = outputParWidth, OutputParHeight = outputParHeight
            });
        }
Esempio n. 5
0
        private string GetQueueJson(List <EncodeTask> tasks, HBConfiguration configuration)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
            };

            IHbFunctionsProvider provider    = IoC.Get <IHbFunctionsProvider>(); // TODO remove IoC call.
            IHbFunctions         hbFunctions = provider.GetHbFunctionsWrapper();

            List <Task> queueJobs = new List <Task>();

            foreach (var item in tasks)
            {
                Task task = new Task {
                    Job = this.encodeTaskFactory.Create(item, configuration)
                };
                queueJobs.Add(task);
            }

            return(JsonConvert.SerializeObject(queueJobs, Formatting.Indented, settings));
        }
Esempio n. 6
0
 public LibEncode(IHbFunctionsProvider hbFunctionsProvider, ILog logService) : base(logService)
 {
     this.log = logService;
     this.hbFunctionsProvider = hbFunctionsProvider;
 }
Esempio n. 7
0
 public ActiveJob(QueueTask task, IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int jobId, IPortService portService)
 {
     this.job           = task;
     this.encodeService = new LibEncode(hbFunctionsProvider, userSettingService, logInstanceManager, jobId, portService);
 }
        public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService, IHbFunctionsProvider hbFunctionsProvider, ILog logService, ILogInstanceManager logInstanceManager)
        {
            this.scanService          = scanService;
            this.selectedPreviewImage = 1;
            this.Title = Resources.Preview;
            this.PreviewNotAvailable = true;

            // Live Preview
            this.userSettingService = userSettingService;
            this.errorService       = errorService;
            this.encodeService      = new LibEncode(hbFunctionsProvider, userSettingService, logInstanceManager, 0); // Preview needs a separate instance rather than the shared singleton. This could maybe do with being refactored at some point

            this.Title           = "Preview";
            this.Percentage      = "0.00%";
            this.PercentageValue = 0;
            this.Duration        = 30;
            this.CanPlay         = true;

            this.useSystemDefaultPlayer = userSettingService.GetUserSetting <bool>(UserSettingConstants.DefaultPlayer);
            this.Duration          = userSettingService.GetUserSetting <int>(UserSettingConstants.LastPreviewDuration);
            this.previewRotateFlip = userSettingService.GetUserSetting <bool>(UserSettingConstants.PreviewRotationFlip);
            this.NotifyOfPropertyChange(() => this.previewRotateFlip); // Don't want to trigger an Update, so setting the backing variable.
        }
Esempio n. 9
0
        public Title CreateTitle(SourceTitle title, int mainFeature)
        {
            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            = mainFeature == title.Index,
                Playlist             = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,
                FramerateNumerator   = title.FrameRate.Num,
                FramerateDenominator = title.FrameRate.Den,
                Type                 = title.Type
            };

            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, track.Codec, track.SampleRate, track.BitRate, track.ChannelLayout, track.Name));
                currentAudioTrack++;
            }

            int currentSubtitleTrack = 1;

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

                switch (track.Source)
                {
                case (int)hb_subtitle_s_subsource.VOBSUB:
                    convertedType = SubtitleType.VobSub;
                    break;

                case (int)hb_subtitle_s_subsource.CC608SUB:
                case (int)hb_subtitle_s_subsource.CC708SUB:
                    convertedType = SubtitleType.CC;
                    break;

                case (int)hb_subtitle_s_subsource.IMPORTSRT:
                    convertedType = SubtitleType.SRT;
                    break;

                case (int)hb_subtitle_s_subsource.UTF8SUB:
                    convertedType = SubtitleType.UTF8Sub;
                    break;

                case (int)hb_subtitle_s_subsource.TX3GSUB:
                    convertedType = SubtitleType.TX3G;
                    break;

                case (int)hb_subtitle_s_subsource.SSASUB:
                    convertedType = SubtitleType.SSA;
                    break;

                case (int)hb_subtitle_s_subsource.PGSSUB:
                    convertedType = SubtitleType.PGS;
                    break;
                }

                IHbFunctionsProvider provider    = IoC.Get <IHbFunctionsProvider>(); // TODO remove IoC call
                IHbFunctions         hbFunctions = provider.GetHbFunctionsWrapper();

                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, track.Name));
                currentSubtitleTrack++;
            }

            SourceMetadata metadata = title.MetaData;

            if (title.MetaData != null)
            {
                converted.Metadata = new Metadata(
                    metadata.AlbumArtist,
                    metadata.Album,
                    metadata.Artist,
                    metadata.Comment,
                    metadata.Composer,
                    metadata.Description,
                    metadata.Genre,
                    metadata.LongDescription,
                    metadata.Name,
                    metadata.ReleaseDate);
            }

            return(converted);
        }
Esempio n. 10
0
 public LibEncode(IHbFunctionsProvider hbFunctionsProvider, ILog logService, IUserSettingService userSettingService) : base(logService, userSettingService)
 {
     this.log = logService;
     this.userSettingService  = userSettingService;
     this.hbFunctionsProvider = hbFunctionsProvider;
 }
Esempio n. 11
0
 public LibEncode(IHbFunctionsProvider hbFunctionsProvider)
 {
     this.hbFunctionsProvider = hbFunctionsProvider;
 }