protected virtual void SaveSubtitlePreference() { BaseStreamInfoHandler subtitleStreams; lock (SyncObj) subtitleStreams = _streamInfoSubtitles; if (subtitleStreams == null) { return; } VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>() ?? new VideoSettings(); settings.PreferredSubtitleStreamName = subtitleStreams.CurrentStreamName; // if the subtitle stream has proper LCID, remember it. int lcid = subtitleStreams.CurrentStream.IsAutoSubtitle ? 0 : subtitleStreams.CurrentStream.LCID; if (lcid != 0) { settings.PreferredSubtitleLanguage = lcid; } // if selected stream is "No subtitles" or "forced subtitle", we disable the setting settings.EnableMpcSubtitlesEngine = subtitleStreams.CurrentStreamName.ToLowerInvariant().Contains(GetNoSubsName().ToLowerInvariant()) == false && subtitleStreams.CurrentStreamName.ToLowerInvariant().Contains(FORCED_SUBTITLES.ToLowerInvariant()) == false; ServiceRegistration.Get <ISettingsManager>().Save(settings); // Make sure MPC subs engine is enabled when valid subtitle got selected. MpcSubtitles.SetEnable(settings.EnableMpcSubtitlesEngine); }
protected override void AddSubtitleFilter(bool isSourceFilterPresent) { VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>() ?? new VideoSettings(); int preferredSubtitleLcid = settings.PreferredSubtitleLanguage; var fileSystemResourceAccessor = _resourceAccessor as IFileSystemResourceAccessor; if (fileSystemResourceAccessor != null) { ServiceRegistration.Get <ILogger>().Debug("{0}: Adding MPC-HC subtitle engine", PlayerTitle); SubtitleStyle defStyle = new SubtitleStyle(); defStyle.Load(); MpcSubtitles.SetDefaultStyle(ref defStyle, false); IntPtr upDevice = SkinContext.Device.NativePointer; string filename = fileSystemResourceAccessor.ResourcePathName; MpcSubtitles.LoadSubtitles(upDevice, _displaySize, filename, _graphBuilder, @".\", preferredSubtitleLcid); if (settings.EnableSubtitles) { MpcSubtitles.SetEnable(true); } } AddClosedCaptionsFilter(); }
protected override void AddSubtitleFilter(bool isSourceFilterPresent) { VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>() ?? new VideoSettings(); int preferredSubtitleLcid = settings.PreferredSubtitleLanguage; ServiceRegistration.Get <ILogger>().Debug("{0}: Adding MPC-HC subtitle engine", PlayerTitle); SubtitleStyle defStyle = new SubtitleStyle(); defStyle.Load(); MpcSubtitles.SetDefaultStyle(ref defStyle, false); IntPtr upDevice = SkinContext.Device.NativePointer; string filename = string.Empty; string paths; if (GetSubtitlePath(out paths, out filename)) { MpcSubtitles.LoadSubtitles(upDevice, _displaySize, filename, _graphBuilder, paths, preferredSubtitleLcid); MpcSubtitles.SetEnable(settings.EnableMpcSubtitlesEngine); } }