public void loadPlayingPreset(AnimeEpisodeVM curEpisode, string fileName) { debug("Loading preset for episode: " + curEpisode.EpisodeName); List <VideoDetailedVM> fileLocals = curEpisode.FilesForEpisode; FileFfdshowPresetVM fileFfdshowPreset = null; foreach (VideoDetailedVM fileLocal in fileLocals) { if (fileLocal.FullPath.ToUpper() == fileName.ToUpper()) { fileFfdshowPreset = fileLocal.FileFfdshowPreset; break; } } if (fileFfdshowPreset != null && fileFfdshowPreset.Preset != null && fileFfdshowPreset.Preset != "") { debug("Found preset for episode \"" + curEpisode.EpisodeName + "\", preset name is: \"" + fileFfdshowPreset.Preset + "\""); debug("Episode file name is: " + fileName); AnimePluginSettings settings = new AnimePluginSettings(); if (settings.FfdshowNotificationsLock) { Thread.Sleep(settings.FfdshowNotificationsLockTime); //make sure ffdshow has time to load } // Retrieve the ffdshow instance corresponding to the file name // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(fileName, FFDShowAPI.FFDShowAPI.FileNameMode.FileName); <- currently doesn't work // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); <- retrieve only the first ffdshow instance FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); List <FFDShowAPI.FFDShowAPI.FFDShowInstance> ffdshowInstances = FFDShowAPI.FFDShowAPI.getFFDShowInstances(); if (ffdshowInstances == null || ffdshowInstances.Count == 0) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } debug("FFDShow number of instance found: " + ffdshowInstances.Count); for (int i = 0; i < ffdshowInstances.Count; i++) { if (ffdshowInstances[i].fileName == null || ffdshowInstances[i].fileName.Trim() == "") // ffdshow raw doesn't have filename { debug("FFDShow instance without file name found (raw ffdshow)"); ffdshowAPI = new FFDShowAPI.FFDShowAPI(ffdshowInstances[i].handle); if (ffdshowAPI == null) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } break; } } bool isFFDShowActive = ffdshowAPI.checkFFDShowActive(); if (isFFDShowActive) { debug("FFDShow has been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); debug("FFDShow file played: " + ffdshowAPI.getFileName()); try { ffdshowAPI.ActivePreset = fileFfdshowPreset.Preset; DialogInfo("Set ffdshow raw preset:", "\n\"" + fileFfdshowPreset.Preset + "\""); debug("ffdshow raw preset set: " + fileFfdshowPreset.Preset); } catch (Exception ex) { debug("Error while setting ffdshow preset : " + ex.Message + "\n" + ex.StackTrace.ToString()); } } else { debug("FFDShow has not been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); return; } } else { debug("Preset not found for episode \"" + curEpisode.EpisodeName + "\""); } }
public void loadPlayingPreset(AnimeEpisodeVM curEpisode, string fileName) { debug("Loading preset for episode: " + curEpisode.EpisodeName); List<VideoDetailedVM> fileLocals = curEpisode.FilesForEpisode; FileFfdshowPresetVM fileFfdshowPreset = null; foreach (VideoDetailedVM fileLocal in fileLocals) { if (fileLocal.Uri.ToUpper() == fileName.ToUpper()) { fileFfdshowPreset = fileLocal.FileFfdshowPreset; break; } } if (fileFfdshowPreset != null && fileFfdshowPreset.Preset != null && fileFfdshowPreset.Preset != "") { debug("Found preset for episode \"" + curEpisode.EpisodeName + "\", preset name is: \"" + fileFfdshowPreset.Preset + "\""); debug("Episode file name is: " + fileName); AnimePluginSettings settings = new AnimePluginSettings(); if (settings.FfdshowNotificationsLock) { Thread.Sleep(settings.FfdshowNotificationsLockTime); //make sure ffdshow has time to load } // Retrieve the ffdshow instance corresponding to the file name // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(fileName, FFDShowAPI.FFDShowAPI.FileNameMode.FileName); <- currently doesn't work // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); <- retrieve only the first ffdshow instance FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); List<FFDShowAPI.FFDShowAPI.FFDShowInstance> ffdshowInstances = FFDShowAPI.FFDShowAPI.getFFDShowInstances(); if (ffdshowInstances == null || ffdshowInstances.Count == 0) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } debug("FFDShow number of instance found: " + ffdshowInstances.Count); for (int i = 0; i < ffdshowInstances.Count; i++) { if (ffdshowInstances[i].fileName == null || ffdshowInstances[i].fileName.Trim() == "") // ffdshow raw doesn't have filename { debug("FFDShow instance without file name found (raw ffdshow)"); ffdshowAPI = new FFDShowAPI.FFDShowAPI(ffdshowInstances[i].handle); if (ffdshowAPI == null) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } break; } } bool isFFDShowActive = ffdshowAPI.checkFFDShowActive(); if (isFFDShowActive) { debug("FFDShow has been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); debug("FFDShow file played: " + ffdshowAPI.getFileName()); try { ffdshowAPI.ActivePreset = fileFfdshowPreset.Preset; DialogInfo("Set ffdshow raw preset:", "\n\"" + fileFfdshowPreset.Preset + "\""); debug("ffdshow raw preset set: " + fileFfdshowPreset.Preset); } catch (Exception ex) { debug("Error while setting ffdshow preset : " + ex.Message + "\n" + ex.StackTrace.ToString()); } } else { debug("FFDShow has not been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); return; } } else { debug("Preset not found for episode \"" + curEpisode.EpisodeName + "\""); } }