public SubtitleSelector(ISubtitleStream dvbStreams, SubtitleRenderer subRender, TeletextSubtitleDecoder subDecoder) { Log.Debug("SubtitleSelector ctor"); if (subRender == null) { throw new Exception("Nullpointer input not allowed ( SubtitleRenderer)"); } else { this.dvbStreams = dvbStreams; this.subRender = subRender; } // load preferences using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { preferedLanguages = new List <string>(); string languages = reader.GetValueAsString("tvservice", "preferredsublanguages", ""); Log.Debug("SubtitleSelector: sublangs entry content: " + languages); StringTokenizer st = new StringTokenizer(languages, ";"); while (st.HasMore) { string lang = st.NextToken(); if (lang.Length != 3) { Log.Warn("Language {0} is not in the correct format!", lang); } else { preferedLanguages.Add(lang); Log.Info("Prefered language {0} is {1}", preferedLanguages.Count, lang); } } } pageEntries = new Dictionary <int, TeletextPageEntry>(); bitmapSubtitleCache = new List <SubtitleOption>(); lock (syncLock) { if (subDecoder != null) { subDecoder.SetPageInfoCallback(new MediaPortal.Player.Subtitles.TeletextSubtitleDecoder.PageInfoCallback(OnPageInfo)); } if (dvbStreams != null) { RetrieveBitmapSubtitles(); subStreamCallback = new SubtitleStreamEventCallback(OnSubtitleReset); IntPtr pSubStreamCallback = Marshal.GetFunctionPointerForDelegate(subStreamCallback); Log.Debug("Calling SetSubtitleStreamEventCallback"); dvbStreams.SetSubtitleResetCallback(pSubStreamCallback); } if (preferedLanguages.Count > 0) { autoSelectOption = new SubtitleOption(); autoSelectOption.language = "None"; autoSelectOption.isAuto = true; autoSelectOption.type = SubtitleType.None; SetOption(0); // the autoselect mode will have index 0 (ugly) } } Log.Debug("End SubtitleSelector ctor"); }
public void SetOwner(TeletextSubtitleDecoder owner) { Assert(owner != null, "TeletextSubtitleDecoder must not be null!"); _owner = owner; }
public SubtitleSelector(ISubtitleStream dvbStreams, SubtitleRenderer subRender, TeletextSubtitleDecoder subDecoder) { Log.Debug("SubtitleSelector ctor"); if (subRender == null) { throw new Exception("Nullpointer input not allowed ( SubtitleRenderer)"); } else { this.dvbStreams = dvbStreams; this.subRender = subRender; } // load preferences using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { preferedLanguages = new List<string>(); string languages = reader.GetValueAsString("tvservice", "preferredsublanguages", ""); Log.Debug("SubtitleSelector: sublangs entry content: " + languages); StringTokenizer st = new StringTokenizer(languages, ";"); while (st.HasMore) { string lang = st.NextToken(); if (lang.Length != 3) { Log.Warn("Language {0} is not in the correct format!", lang); } else { preferedLanguages.Add(lang); Log.Info("Prefered language {0} is {1}", preferedLanguages.Count, lang); } } } pageEntries = new Dictionary<int, TeletextPageEntry>(); bitmapSubtitleCache = new List<SubtitleOption>(); lock (syncLock) { if (subDecoder != null) { subDecoder.SetPageInfoCallback(new MediaPortal.Player.Subtitles.TeletextSubtitleDecoder.PageInfoCallback(OnPageInfo)); } if (dvbStreams != null) { RetrieveBitmapSubtitles(); subStreamCallback = new SubtitleStreamEventCallback(OnSubtitleReset); IntPtr pSubStreamCallback = Marshal.GetFunctionPointerForDelegate(subStreamCallback); Log.Debug("Calling SetSubtitleStreamEventCallback"); dvbStreams.SetSubtitleResetCallback(pSubStreamCallback); } if (preferedLanguages.Count > 0) { autoSelectOption = new SubtitleOption(); autoSelectOption.language = "None"; autoSelectOption.isAuto = true; autoSelectOption.type = SubtitleType.None; SetOption(0); // the autoselect mode will have index 0 (ugly) } } Log.Debug("End SubtitleSelector ctor"); }
public void AddTeletextSubtitleDecoder(ITeletextSource teletextSource) { TeletextSubtitleDecoder ttxtDecoder = new TeletextSubtitleDecoder(this); _ttxtReceiver = new TeletextReceiver(teletextSource, ttxtDecoder); }