From: <mis...@us...> - 2007-03-29 08:29:35
|
Revision: 256 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=256&view=rev Author: misterd_sf Date: 2007-03-29 01:29:33 -0700 (Thu, 29 Mar 2007) Log Message: ----------- MPlayer: Added OSD for seek steps and jump to Modified Paths: -------------- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-03-29 05:27:39 UTC (rev 255) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-03-29 08:29:33 UTC (rev 256) @@ -309,6 +309,11 @@ /// Path to mplayer.exe /// </summary> private String mplayerPath; + + /// <summary> + /// Timeout before a seek step is performed + /// </summary> + private int seekStepTimeout; #endregion #region ctor @@ -473,6 +478,12 @@ extensionSettings.Add(settings.Name, settings); videoArguments = xmlreader.GetValueAsString("mplayer", "videoArguments", String.Empty); audioArguments = xmlreader.GetValueAsString("mplayer", "audioArguments", String.Empty); + string timeout = (xmlreader.GetValueAsString("movieplayer", "skipsteptimeout", "1500")); + + if (timeout == string.Empty) + seekStepTimeout = 1500; + else + seekStepTimeout = Convert.ToInt16(timeout); } try { loadXMLData(); @@ -778,6 +789,13 @@ public String[] SupportedExtensions { get { return m_supportedExtensions; } } + + /// <summary> + /// Timeout before a seek step is performed + /// </summary> + public int SeekStepTimeout { + get { return seekStepTimeout; } + } #endregion } Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-29 05:27:39 UTC (rev 255) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-29 08:29:33 UTC (rev 256) @@ -256,6 +256,16 @@ /// Configuration Manager /// </summary> private ConfigurationManager configManager; + + /// <summary> + /// OSD Timestamp + /// </summary> + private String _timeStamp; + + /// <summary> + /// Position in the osd timestamp + /// </summary> + private int _timeCodePosition; #endregion #region ctor @@ -477,6 +487,15 @@ /// </summary> /// <param name="text">osd command</param> private void sendOSDText(string text) { + sendOSDText(text, displayDuration); + } + + /// <summary> + /// Sends a OSD command to the mplayer process + /// </summary> + /// <param name="text">osd command</param> + /// <param name="duration">Duration to display</param> + private void sendOSDText(string text, int duration) { if (_isFullScreen) { sendCommand("osd_show_text \"" + text + "\" " + displayDuration + " 0"); } @@ -495,7 +514,7 @@ if (result.StartsWith("ANS_TIME_POSITION=")) { additionalTime = DateTime.Now; Double.TryParse(result.Substring(18).Replace(".", - CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator),out baseTime); + CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator), out baseTime); } else if (result.StartsWith("ANS_PERCENT_POSITION=")) { additionalTime = DateTime.Now; int tempValue; @@ -516,12 +535,12 @@ String help = result.Substring(7); int index = help.IndexOf('_'); int temp; - Int32.TryParse(help.Substring(0, index),out temp); + Int32.TryParse(help.Substring(0, index), out temp); index = result.IndexOf('='); audioNames[temp] = result.Substring(index + 1); } else if (result.StartsWith("ID_SUBTITLE_ID")) { int temp; - Int32.TryParse(result.Substring(15),out temp); + Int32.TryParse(result.Substring(15), out temp); if (!subtitleNames.ContainsKey(temp)) { subtitleID.Add(numberOfSubtitles, temp); subtitleNames.Add(temp, Strings.Unknown); @@ -531,7 +550,7 @@ String help = result.Substring(7); int index = help.IndexOf('_'); int temp; - Int32.TryParse(help.Substring(0, index),out temp); + Int32.TryParse(help.Substring(0, index), out temp); index = result.IndexOf('='); subtitleNames[temp] = result.Substring(index + 1); } else if (result.StartsWith("Exiting... (End of file)")) { @@ -547,7 +566,7 @@ Int32.TryParse(temp.Substring(0, pos), out videoWith); temp = temp.Substring(pos + 1); pos = temp.IndexOf(' '); - Int32.TryParse(temp.Substring(0, pos),out videoHeight); + Int32.TryParse(temp.Substring(0, pos), out videoHeight); Log.Info("MPlayer: ASPECT: " + videoWith + "x" + videoHeight); _needUpdate = true; SetVideoWindow(); @@ -914,7 +933,7 @@ return speed; } set { - if (value > 0) { + if (value > 0 && value != speed) { speed = value; sendCommand("speed_set " + speed); if (speed > 9) { @@ -1111,6 +1130,34 @@ osdVisible = false; } break; + case Action.ActionType.ACTION_MOVE_LEFT: + case Action.ActionType.ACTION_STEP_BACK: + case Action.ActionType.ACTION_MOVE_RIGHT: + case Action.ActionType.ACTION_STEP_FORWARD: + if (!osdVisible) { + String description = g_Player.GetStepDescription(); + if (!String.IsNullOrEmpty(description)) { + sendOSDText("Seek: " + description, configManager.SeekStepTimeout); + } else { + sendOSDText("", 1); + } + } + break; + case Action.ActionType.ACTION_KEY_PRESSED: + if (!osdVisible && action.m_key != null) { + char chKey = (char)action.m_key.KeyChar; + if (chKey >= '0' && chKey <= '9') { + if (g_Player.CanSeek) { + ChangetheTimeCode(chKey); + if (!String.IsNullOrEmpty(_timeStamp)) { + sendOSDText("Jump to: " + _timeStamp); + } else { + sendOSDText("", 1); + } + } + } + } + break; } } @@ -1128,6 +1175,23 @@ } } + + private void ChangetheTimeCode(char chKey) { + if (_timeCodePosition <= 4) { + //00:12 + _timeStamp += chKey; + _timeCodePosition++; + if (_timeCodePosition == 2) { + _timeStamp += ":"; + _timeCodePosition++; + } + } + if (_timeCodePosition > 4) { + _timeStamp = ""; + _timeCodePosition = 0; + } + } + #endregion } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |