home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
Codecs, External Players
Visualisations slow still?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="bigj" data-source="post: 34091" data-attributes="member: 10940"><p>Ok, so I finally got round to checking out the CVS and building the project from the sources...</p><p></p><p>I tried applying the fullscreen flag to the player and it does solve the issue with visualisations running slow when fullscreen. I had to apply a workaround for MP losing focus (borrowed from elsewhere in the project).</p><p></p><p>There's some caveats with this as it stands:</p><p></p><p>1. To prevent it going fullscreen when running MP in a window, I check for this and fallback to the previous stretch-blit method in this case. This is consistent then with the other player modes (tv, movies etc).</p><p></p><p>2. Some vis plugins try to change screen res when going fullscreen; so if using say a TV-out be prepared for this.</p><p></p><p>Perhaps if this was ever to be applied to the tree there should be an option added to the configuration to allow users to choose.</p><p>e.g. </p><p>WMPlayer Visualisation Fullscreen : Use Stretch [ ], Use true fullscreen [X]</p><p>In which case the check for 1. above would be redundant since the user option could be used as an explicit preference.</p><p></p><p>I tested it and it works at high framerates for GForce and for my own test plugin - was 8fps now >35fps</p><p></p><p>Here's the new code; sorry to dump it here, I can't get CVS/tortoise to work consistently for some reason.</p><p></p><p>AudioPlayerWMP9.cs</p><p>See SetVideoWindow...</p><p></p><p></p><p>/* </p><p> * Copyright (C) 2005 Team MediaPortal</p><p> * <a href="https://www.team-mediaportal.com" target="_blank">https://www.team-mediaportal.com</a></p><p> *</p><p> * This Program is free software; you can redistribute it and/or modify</p><p> * it under the terms of the GNU General Public License as published by</p><p> * the Free Software Foundation; either version 2, or (at your option)</p><p> * any later version.</p><p> * </p><p> * This Program is distributed in the hope that it will be useful,</p><p> * but WITHOUT ANY WARRANTY; without even the implied warranty of</p><p> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</p><p> * GNU General Public License for more details.</p><p> * </p><p> * You should have received a copy of the GNU General Public License</p><p> * along with GNU Make; see the file COPYING. If not, write to</p><p> * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. </p><p> * <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">http://www.gnu.org/copyleft/gpl.html</a></p><p> *</p><p> */</p><p>using System;</p><p>using System.Collections;</p><p>using System.Windows.Forms;</p><p>using System.Drawing;</p><p>using System.Runtime.InteropServices;</p><p>using System.Diagnostics;</p><p>using MediaPortal.TagReader;</p><p>using MediaPortal.Util;</p><p>using Microsoft.DirectX;</p><p>using Microsoft.DirectX.Direct3D;</p><p>using Microsoft.Win32;</p><p>using Direct3D = Microsoft.DirectX.Direct3D;</p><p></p><p></p><p></p><p>using MediaPortal.GUI.Library;</p><p>using DirectShowLib;</p><p>namespace MediaPortal.Player</p><p>{</p><p> public class AudioPlayerWMP9 : IPlayer </p><p> {</p><p> private const int SW_SHOW = 5;</p><p> private const int SW_RESTORE = 9;</p><p> public const Int32 TOGGLE_HIDEWINDOW = 0x080;</p><p> public const Int32 TOGGLE_UNHIDEWINDOW = 0x040;</p><p> public const Int32 HWND_TOPMOST = -1;</p><p> public const Int32 HWND_NOTOPMOST = -2;</p><p></p><p> [DllImport("User32")]</p><p> private static extern int SetForegroundWindow(IntPtr hwnd);</p><p></p><p> // Activates a window</p><p> [DllImportAttribute("User32.DLL")]</p><p> private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);</p><p></p><p> [DllImport("user32.dll")]</p><p> static extern IntPtr GetActiveWindow();</p><p></p><p> public enum PlayState</p><p> {</p><p> Init,</p><p> Playing,</p><p> Paused,</p><p> Ended</p><p> }</p><p> string _currentFile = "";</p><p> PlayState _graphState = PlayState.Init;</p><p> bool _isFullScreen = false;</p><p> int _positionX = 10, _positionY = 10, _videoWidth = 100, _videoHeight = 100;</p><p> static AxWMPLib.AxWindowsMediaPlayer _wmp10Player = null;</p><p> bool _needUpdate = true;</p><p> bool _notifyPlaying = true;</p><p></p><p> public AudioPlayerWMP9()</p><p> {</p><p> }</p><p></p><p></p><p> static void CreateInstance()</p><p> {</p><p> // disable auto windows mediaplayer auto cd-play</p><p> if (_wmp10Player != null) return;</p><p> try</p><p> {</p><p> UInt32 dwValue = (UInt32)0;</p><p> RegistryKey hkcu = Registry.CurrentUser;</p><p> RegistryKey subkey = hkcu.OpenSubKey(@"Software\Microsoft\MediaPlayer\Preferences", true);</p><p></p><p> subkey.SetValue("CDAutoPlay", (Int32)dwValue);</p><p></p><p> // enable metadata lookup for CD's</p><p> dwValue = (UInt32)Convert.ToInt32(subkey.GetValue("MetadataRetrieval"));</p><p> dwValue |= 1;</p><p> subkey.SetValue("MetadataRetrieval", (Int32)dwValue);</p><p> subkey.Close();</p><p> hkcu.Close();</p><p> }</p><p> catch (Exception) { }</p><p></p><p> _wmp10Player = new AxWMPLib.AxWindowsMediaPlayer();</p><p> </p><p></p><p> _wmp10Player.BeginInit();</p><p> GUIGraphicsContext.form.SuspendLayout();</p><p> _wmp10Player.Enabled = true;</p><p></p><p> System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Resource1));</p><p> _wmp10Player.Location = new System.Drawing.Point(8, 16);</p><p> _wmp10Player.Name = "axWindowsMediaPlayer1";</p><p> _wmp10Player.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));</p><p> _wmp10Player.Size = new System.Drawing.Size(264, 240);</p><p> _wmp10Player.TabIndex = 0;</p><p> GUIGraphicsContext.form.Controls.Add(_wmp10Player);</p><p></p><p></p><p> try</p><p> {</p><p> _wmp10Player.EndInit();</p><p> }</p><p> catch (COMException)</p><p> {</p><p> }</p><p></p><p> _wmp10Player.uiMode = "none";</p><p> _wmp10Player.windowlessVideo = true;</p><p></p><p> _wmp10Player.enableContextMenu = false;</p><p> _wmp10Player.Ctlenabled = false;</p><p> _wmp10Player.Visible = false;</p><p> GUIGraphicsContext.form.ResumeLayout(false);</p><p></p><p></p><p> }</p><p></p><p> static public ArrayList GetCDTracks()</p><p> {</p><p> GUIListItem item;</p><p> ArrayList list = new ArrayList();</p><p> item = new GUIListItem();</p><p> item.IsFolder = true;</p><p> item.Label = "..";</p><p> item.Label2 = "";</p><p> item.Path = "";</p><p> Utils.SetDefaultIcons(item);</p><p> Utils.SetThumbnails(ref item);</p><p> list.Add(item);</p><p></p><p> CreateInstance();</p><p> if (_wmp10Player.cdromCollection.count <= 0) return list;</p><p> if (_wmp10Player.cdromCollection.count <= 0) return list;</p><p></p><p></p><p> WMPLib.IWMPCdrom cdrom = _wmp10Player.cdromCollection.Item(0);</p><p></p><p> if (cdrom == null) return list;</p><p> if (cdrom.Playlist == null) return list;</p><p></p><p></p><p> for (int iTrack = 0; iTrack < cdrom.Playlist.count; iTrack++)</p><p> {</p><p> try</p><p> {</p><p> MusicTag tag = new MusicTag();</p><p> WMPLib.IWMPMedia media = cdrom.Playlist.get_Item(iTrack);</p><p> item = new GUIListItem();</p><p> item.IsFolder = false;</p><p> item.Label = media.name;</p><p> item.Label2 = "";</p><p> item.Path = String.Format("cdda:{0}", iTrack);</p><p> item.FileInfo = null;</p><p></p><p> for (int i = 0; i < media.attributeCount; ++i)</p><p> {</p><p> string strAttr = media.getAttributeName(i);</p><p> string strValue = media.getItemInfo(strAttr);</p><p> if (String.Compare("album", strAttr, true) == 0) tag.Album = strValue;</p><p> if (String.Compare("actor", strAttr, true) == 0) tag.Artist = strValue;</p><p> if (String.Compare("artist", strAttr, true) == 0) tag.Artist = strValue;</p><p> if (String.Compare("style", strAttr, true) == 0) tag.Genre = strValue;</p><p> if (String.Compare("releasedate", strAttr, true) == 0)</p><p> {</p><p> try</p><p> {</p><p> tag.Year = Convert.ToInt32(strValue.Substring(0, 4));</p><p> }</p><p> catch (Exception)</p><p> {</p><p> }</p><p> }</p><p> }</p><p> tag.Title = media.name;</p><p> tag.Duration = (int)media.duration;</p><p> tag.Track = iTrack + 1;</p><p> //tag.Comment =</p><p> //tag.Year =</p><p> //tag.Genre =</p><p> item.MusicTag = tag;</p><p> list.Add(item);</p><p> }</p><p> catch (Exception)</p><p> {</p><p> }</p><p> }</p><p> return list;</p><p> }</p><p></p><p> public override bool Play(string strFile)</p><p> {</p><p> _graphState = PlayState.Init;</p><p> _currentFile = strFile;</p><p></p><p> _notifyPlaying = true;</p><p> GC.Collect();</p><p> CreateInstance();</p><p></p><p> if (_wmp10Player == null) return false;</p><p> if (_wmp10Player.cdromCollection == null) return false;</p><p></p><p> _wmp10Player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange);</p><p></p><p> //_wmp10Player.enableContextMenu = false;</p><p> //_wmp10Player.Ctlenabled = false;</p><p> if (strFile.IndexOf("cdda:") >= 0)</p><p> {</p><p> string strTrack = strFile.Substring(5);</p><p> int iTrack = Convert.ToInt32(strTrack);</p><p> if (_wmp10Player.cdromCollection.count <= 0) return false;</p><p> if (_wmp10Player.cdromCollection.Item(0).Playlist == null) return false;</p><p> if (iTrack > _wmp10Player.cdromCollection.Item(0).Playlist.count) return false;</p><p> _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(0).Playlist.get_Item(iTrack - 1);</p><p> if (_wmp10Player.currentMedia == null) return false;</p><p></p><p> Log.Write("Audioplayer<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />lay track:{0}/{1}", iTrack, _wmp10Player.cdromCollection.Item(0).Playlist.count);</p><p> }</p><p> else if (strFile.IndexOf(".cda") >= 0)</p><p> {</p><p> string strTrack = "";</p><p> int pos = strFile.IndexOf(".cda");</p><p> if (pos >= 0)</p><p> {</p><p> pos--;</p><p> while (Char.IsDigit(strFile[pos]) && pos > 0)</p><p> {</p><p> strTrack = strFile[pos] + strTrack;</p><p> pos--;</p><p> }</p><p> }</p><p></p><p> if (_wmp10Player.cdromCollection.count <= 0) return false;</p><p> string strDrive = strFile.Substring(0, 1);</p><p> strDrive += ":";</p><p> int iCdRomDriveNr = 0;</p><p> while ((_wmp10Player.cdromCollection.Item(iCdRomDriveNr).driveSpecifier != strDrive) && (iCdRomDriveNr < _wmp10Player.cdromCollection.count))</p><p> {</p><p> iCdRomDriveNr++;</p><p> }</p><p></p><p> int iTrack = Convert.ToInt32(strTrack);</p><p> if (_wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist == null) return false;</p><p> int tracks = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.count;</p><p> if (iTrack > tracks) return false;</p><p> _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.get_Item(iTrack - 1);</p><p> if (_wmp10Player.currentMedia == null) return false;</p><p> /*</p><p> string strStart=strFile.Substring(0,2)+@"\";</p><p> int ipos=strFile.LastIndexOf("+");</p><p> if (ipos >0) strStart += strFile.Substring(ipos+1);</p><p> strFile=strStart;</p><p> _currentFile=strFile;</p><p> Log.Write("Audioplayer<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />lay {0}", strFile);*/</p><p> //_wmp10Player.URL=strFile;</p><p> _currentFile = strFile;</p><p> }</p><p> else</p><p> {</p><p> Log.Write("Audioplayer<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />lay {0}", strFile);</p><p> _wmp10Player.URL = strFile;</p><p> }</p><p> _wmp10Player.Ctlcontrols.play();</p><p> _wmp10Player.Visible = false;</p><p></p><p></p><p> GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null);</p><p> msg.Label = strFile;</p><p></p><p> GUIWindowManager.SendThreadMessage(msg);</p><p> _graphState = PlayState.Playing;</p><p> GC.Collect();</p><p> _needUpdate = true;</p><p> _isFullScreen = GUIGraphicsContext.IsFullScreenVideo;</p><p> _positionX = GUIGraphicsContext.VideoWindow.Left;</p><p> _positionY = GUIGraphicsContext.VideoWindow.Top;</p><p> _videoWidth = GUIGraphicsContext.VideoWindow.Width;</p><p> _videoHeight = GUIGraphicsContext.VideoWindow.Height;</p><p></p><p> SetVideoWindow();</p><p></p><p> return true;</p><p> }</p><p></p><p> private void OnPlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> switch (_wmp10Player.playState)</p><p> {</p><p> case WMPLib.WMPPlayState.wmppsStopped:</p><p> SongEnded(false);</p><p> break;</p><p> }</p><p> }</p><p></p><p> void SongEnded(bool bManualStop)</p><p> {</p><p> // this is triggered only if movie has ended</p><p> // ifso, stop the movie which will trigger MovieStopped</p><p></p><p> if (!Utils.IsAudio(_currentFile))</p><p> GUIGraphicsContext.IsFullScreenVideo = false;</p><p> Log.Write("Audioplayer:ended {0} {1}", _currentFile, bManualStop);</p><p> _currentFile = "";</p><p> if (_wmp10Player != null)</p><p> {</p><p> _wmp10Player.Visible = false;</p><p> _wmp10Player.PlayStateChange -= new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange);</p><p> }</p><p> //GUIGraphicsContext.IsFullScreenVideo=false;</p><p> GUIGraphicsContext.IsPlaying = false;</p><p> if (!bManualStop)</p><p> {</p><p> _graphState = PlayState.Ended;</p><p> }</p><p> else</p><p> {</p><p> _graphState = PlayState.Init;</p><p> }</p><p> GC.Collect();</p><p> }</p><p></p><p></p><p> public override bool Ended</p><p> {</p><p> get { return _graphState == PlayState.Ended; }</p><p> }</p><p></p><p> public override double Duration</p><p> {</p><p> get</p><p> {</p><p> if (_graphState != PlayState.Init && _wmp10Player != null)</p><p> {</p><p> try</p><p> {</p><p> return _wmp10Player.currentMedia.duration;</p><p> }</p><p> catch (Exception)</p><p> {</p><p> }</p><p> }</p><p> return 0.0d;</p><p> }</p><p> }</p><p></p><p> public override double CurrentPosition</p><p> {</p><p> get</p><p> {</p><p> try</p><p> {</p><p> return _wmp10Player.Ctlcontrols.currentPosition;</p><p> }</p><p> catch (Exception)</p><p> {</p><p> }</p><p> return 0.0d;</p><p> }</p><p> }</p><p></p><p> public override void Pause()</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState == PlayState.Paused)</p><p> {</p><p> _graphState = PlayState.Playing;</p><p> _wmp10Player.Ctlcontrols.play();</p><p> }</p><p> else if (_graphState == PlayState.Playing)</p><p> {</p><p> _wmp10Player.Ctlcontrols.pause();</p><p> if (_wmp10Player.playState == WMPLib.WMPPlayState.wmppsPaused)</p><p> _graphState = PlayState.Paused;</p><p> }</p><p> }</p><p></p><p> public override bool Paused</p><p> {</p><p> get</p><p> {</p><p> return (_graphState == PlayState.Paused);</p><p> }</p><p> }</p><p></p><p> public override bool Playing</p><p> {</p><p> get</p><p> {</p><p> return (_graphState == PlayState.Playing || _graphState == PlayState.Paused);</p><p> }</p><p> }</p><p></p><p> public override bool Stopped</p><p> {</p><p> get</p><p> {</p><p> return (_graphState == PlayState.Init);</p><p> }</p><p> }</p><p></p><p> public override string CurrentFile</p><p> {</p><p> get { return _currentFile; }</p><p> }</p><p></p><p> public override void Stop()</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p> _wmp10Player.Ctlcontrols.stop();</p><p> _wmp10Player.Visible = false;</p><p> SongEnded(true);</p><p> }</p><p> }</p><p></p><p> public override int Volume</p><p> {</p><p> get</p><p> {</p><p></p><p> if (_wmp10Player == null) return 100;</p><p> return _wmp10Player.settings.volume;</p><p> }</p><p> set</p><p> {</p><p></p><p> if (_wmp10Player == null) return;</p><p> if (_wmp10Player.settings.volume != value)</p><p> {</p><p> _wmp10Player.settings.volume = value;</p><p> }</p><p> }</p><p> }</p><p></p><p></p><p> public override bool HasVideo</p><p> {</p><p> get { return true; }</p><p> }</p><p></p><p></p><p> #region IDisposable Members</p><p></p><p> public override void Release()</p><p> {</p><p> /*</p><p> if (_wmp10Player == null) return;</p><p> _wmp10Player.Visible = false;</p><p></p><p> try</p><p> {</p><p> GUIGraphicsContext.form.Controls.Remove(_wmp10Player);</p><p> }</p><p> catch (Exception) { }</p><p> _wmp10Player.Dispose();</p><p> _wmp10Player = null;</p><p> * */</p><p> }</p><p> #endregion</p><p></p><p> public override bool FullScreen</p><p> {</p><p> get</p><p> {</p><p> return GUIGraphicsContext.IsFullScreenVideo;</p><p> }</p><p> set</p><p> {</p><p> if (value != _isFullScreen)</p><p> {</p><p> _isFullScreen = value;</p><p> _needUpdate = true;</p><p> }</p><p> }</p><p> }</p><p> public override int PositionX</p><p> {</p><p> get { return _positionX; }</p><p> set</p><p> {</p><p> if (value != _positionX)</p><p> {</p><p> _positionX = value;</p><p> _needUpdate = true;</p><p> }</p><p> }</p><p> }</p><p></p><p> public override int PositionY</p><p> {</p><p> get { return _positionY; }</p><p> set</p><p> {</p><p> if (value != _positionY)</p><p> {</p><p> _positionY = value;</p><p> _needUpdate = true;</p><p> }</p><p> }</p><p> }</p><p></p><p> public override int RenderWidth</p><p> {</p><p> get { return _videoWidth; }</p><p> set</p><p> {</p><p> if (value != _videoWidth)</p><p> {</p><p> _videoWidth = value;</p><p> _needUpdate = true;</p><p> }</p><p> }</p><p> }</p><p> public override int RenderHeight</p><p> {</p><p> get { return _videoHeight; }</p><p> set</p><p> {</p><p> if (value != _videoHeight)</p><p> {</p><p> _videoHeight = value;</p><p> _needUpdate = true;</p><p> }</p><p> }</p><p> }</p><p></p><p> public override void Process()</p><p> {</p><p> if (!Playing) return;</p><p> if (_wmp10Player == null) return;</p><p> if (GUIGraphicsContext.BlankScreen || (GUIGraphicsContext.Overlay == false && GUIGraphicsContext.IsFullScreenVideo == false))</p><p> {</p><p> if (_wmp10Player.Visible)</p><p> {</p><p> _wmp10Player.ClientSize = new Size(0, 0);</p><p> _wmp10Player.Visible = false;</p><p> //_wmp10Player.uiMode = "invisible";</p><p> }</p><p> }</p><p> else if (!_wmp10Player.Visible)</p><p> {</p><p> _needUpdate = true;</p><p> SetVideoWindow();</p><p> //_wmp10Player.uiMode = "none";</p><p> _wmp10Player.Visible = true;</p><p> }</p><p></p><p></p><p> if (CurrentPosition >= 10.0)</p><p> {</p><p> if (_notifyPlaying)</p><p> {</p><p> _notifyPlaying = false;</p><p> GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null);</p><p> msg.Label = CurrentFile;</p><p> GUIWindowManager.SendThreadMessage(msg);</p><p> }</p><p> }</p><p> }</p><p></p><p> public override void SetVideoWindow()</p><p> {</p><p></p><p> if (_wmp10Player == null) return;</p><p> if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen)</p><p> {</p><p> _isFullScreen = GUIGraphicsContext.IsFullScreenVideo;</p><p> _needUpdate = true;</p><p> }</p><p> if (!_needUpdate) return;</p><p> _needUpdate = false;</p><p></p><p></p><p> if (_isFullScreen)</p><p> {</p><p> Log.Write("AudioPlayer:Fullscreen");</p><p></p><p> IntPtr mpHwnd = GetActiveWindow();</p><p></p><p> _positionX = GUIGraphicsContext.OverScanLeft;</p><p> _positionY = GUIGraphicsContext.OverScanTop;</p><p> _videoWidth = GUIGraphicsContext.OverScanWidth;</p><p> _videoHeight = GUIGraphicsContext.OverScanHeight;</p><p></p><p> _wmp10Player.Location = new Point(0, 0);</p><p> _wmp10Player.ClientSize = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height);</p><p> _wmp10Player.Size = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height);</p><p></p><p> _videoRectangle = new Rectangle(0, 0, _wmp10Player.ClientSize.Width, _wmp10Player.ClientSize.Height);</p><p> _sourceRectangle = _videoRectangle; </p><p></p><p> // If MediaPortal app is fullscreen then go true fullscreen</p><p> Rectangle scr = Screen.PrimaryScreen.WorkingArea; </p><p> bool bMPIsFullscreen =</p><p> (GUIGraphicsContext.Width == scr.Width) &&</p><p> (GUIGraphicsContext.Height == scr.Height);</p><p></p><p> Log.Write("Screen is {0}x{1}, GUIGraphicsContext is {2}x{3} => {4}",</p><p> scr.Width, scr.Height, GUIGraphicsContext.Width, GUIGraphicsContext.Height,</p><p> bMPIsFullscreen?"Effectively fullscreen":"Treat as windowed");</p><p></p><p> if (bMPIsFullscreen)</p><p> {</p><p> Log.Write("AudioPlayer<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite5" alt=":confused:" title="Confused :confused:" loading="lazy" data-shortname=":confused:" />witching wmp10Player fullscreen");</p><p> _wmp10Player.fullScreen = true;</p><p> _wmp10Player.stretchToFit = false;</p><p> }</p><p> // else go stretchy</p><p> else</p><p> {</p><p> Log.Write("AudioPlayer<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite5" alt=":confused:" title="Confused :confused:" loading="lazy" data-shortname=":confused:" />witching wmp10Player non-fullscreen, stretchToFit");</p><p> _wmp10Player.stretchToFit = true;</p><p> }</p><p></p><p> // Restore original focus</p><p> ShowWindow(mpHwnd, SW_RESTORE);</p><p> SetForegroundWindow(mpHwnd);</p><p> </p><p> Log.Write("AudioPlayer:done");</p><p></p><p> return;</p><p> }</p><p> else</p><p> {</p><p></p><p> _wmp10Player.ClientSize = new System.Drawing.Size(_videoWidth, _videoHeight);</p><p> _wmp10Player.Location = new Point(_positionX, _positionY);</p><p></p><p> _videoRectangle = new Rectangle(_positionX, _positionY, _wmp10Player.ClientSize.Width, _wmp10Player.ClientSize.Height);</p><p> _sourceRectangle = _videoRectangle;</p><p> //Log.Write("AudioPlayer:set window<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" loading="lazy" data-shortname=":(" />{0},{1})-({2},{3})",_positionX,_positionY,_positionX+_wmp10Player.ClientSize.Width,_positionY+_wmp10Player.ClientSize.Height);</p><p></p><p> Log.Write("AudioPlayer:Not fullscreen");</p><p> _wmp10Player.fullScreen = false;</p><p> _wmp10Player.stretchToFit = true;</p><p> }</p><p> //_wmp10Player.uiMode = "none";</p><p> //_wmp10Player.windowlessVideo = true;</p><p> //_wmp10Player.enableContextMenu = false;</p><p> //_wmp10Player.Ctlenabled = false;</p><p> GUIGraphicsContext.form.Controls[0].Enabled = false;</p><p> }</p><p> /*</p><p> public override int AudioStreams</p><p> {</p><p> get { return _wmp10Player.Ctlcontrols.audioLanguageCount;}</p><p> }</p><p> public override int CurrentAudioStream</p><p> {</p><p> get { return _wmp10Player.Ctlcontrols.currentAudioLanguage;}</p><p> set { _wmp10Player.Ctlcontrols.currentAudioLanguage=value;}</p><p> }</p><p> public override string AudioLanguage(int iStream)</p><p> {</p><p> return _wmp10Player.controls.getLanguageName(iStream);</p><p> }</p><p> */</p><p> public override void SeekRelative(double dTime)</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p></p><p> double dCurTime = CurrentPosition;</p><p> dTime = dCurTime + dTime;</p><p> if (dTime < 0.0d) dTime = 0.0d;</p><p> if (dTime < Duration)</p><p> {</p><p> _wmp10Player.Ctlcontrols.currentPosition = dTime;</p><p> }</p><p> }</p><p> }</p><p></p><p> public override void SeekAbsolute(double dTime)</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p> if (dTime < 0.0d) dTime = 0.0d;</p><p> if (dTime < Duration)</p><p> {</p><p> _wmp10Player.Ctlcontrols.currentPosition = dTime;</p><p> }</p><p> }</p><p> }</p><p></p><p> public override void SeekRelativePercentage(int iPercentage)</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p> double dCurrentPos = CurrentPosition;</p><p> double dDuration = Duration;</p><p></p><p> double fCurPercent = (dCurrentPos / Duration) * 100.0d;</p><p> double fOnePercent = Duration / 100.0d;</p><p> fCurPercent = fCurPercent + (double)iPercentage;</p><p> fCurPercent *= fOnePercent;</p><p> if (fCurPercent < 0.0d) fCurPercent = 0.0d;</p><p> if (fCurPercent < Duration)</p><p> {</p><p> _wmp10Player.Ctlcontrols.currentPosition = fCurPercent;</p><p> }</p><p> }</p><p> }</p><p></p><p></p><p> public override void SeekAsolutePercentage(int iPercentage)</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p> if (iPercentage < 0) iPercentage = 0;</p><p> if (iPercentage >= 100) iPercentage = 100;</p><p> double fPercent = Duration / 100.0f;</p><p> fPercent *= (double)iPercentage;</p><p> _wmp10Player.Ctlcontrols.currentPosition = fPercent;</p><p> }</p><p> }</p><p> public override int Speed</p><p> {</p><p> get</p><p> {</p><p> if (_graphState == PlayState.Init) return 1;</p><p> if (_wmp10Player == null) return 1;</p><p> return (int)_wmp10Player.settings.rate;</p><p> }</p><p> set</p><p> {</p><p> if (_wmp10Player == null) return;</p><p> if (_graphState != PlayState.Init)</p><p> {</p><p> try</p><p> {</p><p> _wmp10Player.settings.rate = (double)value;</p><p> }</p><p> catch (Exception)</p><p> {</p><p> }</p><p> }</p><p> }</p><p> }</p><p></p><p> }</p><p>}</p></blockquote><p></p>
[QUOTE="bigj, post: 34091, member: 10940"] Ok, so I finally got round to checking out the CVS and building the project from the sources... I tried applying the fullscreen flag to the player and it does solve the issue with visualisations running slow when fullscreen. I had to apply a workaround for MP losing focus (borrowed from elsewhere in the project). There's some caveats with this as it stands: 1. To prevent it going fullscreen when running MP in a window, I check for this and fallback to the previous stretch-blit method in this case. This is consistent then with the other player modes (tv, movies etc). 2. Some vis plugins try to change screen res when going fullscreen; so if using say a TV-out be prepared for this. Perhaps if this was ever to be applied to the tree there should be an option added to the configuration to allow users to choose. e.g. WMPlayer Visualisation Fullscreen : Use Stretch [ ], Use true fullscreen [X] In which case the check for 1. above would be redundant since the user option could be used as an explicit preference. I tested it and it works at high framerates for GForce and for my own test plugin - was 8fps now >35fps Here's the new code; sorry to dump it here, I can't get CVS/tortoise to work consistently for some reason. AudioPlayerWMP9.cs See SetVideoWindow... /* * Copyright (C) 2005 Team MediaPortal * [url]https://www.team-mediaportal.com[/url] * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * [url]http://www.gnu.org/copyleft/gpl.html[/url] * */ using System; using System.Collections; using System.Windows.Forms; using System.Drawing; using System.Runtime.InteropServices; using System.Diagnostics; using MediaPortal.TagReader; using MediaPortal.Util; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; using Microsoft.Win32; using Direct3D = Microsoft.DirectX.Direct3D; using MediaPortal.GUI.Library; using DirectShowLib; namespace MediaPortal.Player { public class AudioPlayerWMP9 : IPlayer { private const int SW_SHOW = 5; private const int SW_RESTORE = 9; public const Int32 TOGGLE_HIDEWINDOW = 0x080; public const Int32 TOGGLE_UNHIDEWINDOW = 0x040; public const Int32 HWND_TOPMOST = -1; public const Int32 HWND_NOTOPMOST = -2; [DllImport("User32")] private static extern int SetForegroundWindow(IntPtr hwnd); // Activates a window [DllImportAttribute("User32.DLL")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] static extern IntPtr GetActiveWindow(); public enum PlayState { Init, Playing, Paused, Ended } string _currentFile = ""; PlayState _graphState = PlayState.Init; bool _isFullScreen = false; int _positionX = 10, _positionY = 10, _videoWidth = 100, _videoHeight = 100; static AxWMPLib.AxWindowsMediaPlayer _wmp10Player = null; bool _needUpdate = true; bool _notifyPlaying = true; public AudioPlayerWMP9() { } static void CreateInstance() { // disable auto windows mediaplayer auto cd-play if (_wmp10Player != null) return; try { UInt32 dwValue = (UInt32)0; RegistryKey hkcu = Registry.CurrentUser; RegistryKey subkey = hkcu.OpenSubKey(@"Software\Microsoft\MediaPlayer\Preferences", true); subkey.SetValue("CDAutoPlay", (Int32)dwValue); // enable metadata lookup for CD's dwValue = (UInt32)Convert.ToInt32(subkey.GetValue("MetadataRetrieval")); dwValue |= 1; subkey.SetValue("MetadataRetrieval", (Int32)dwValue); subkey.Close(); hkcu.Close(); } catch (Exception) { } _wmp10Player = new AxWMPLib.AxWindowsMediaPlayer(); _wmp10Player.BeginInit(); GUIGraphicsContext.form.SuspendLayout(); _wmp10Player.Enabled = true; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Resource1)); _wmp10Player.Location = new System.Drawing.Point(8, 16); _wmp10Player.Name = "axWindowsMediaPlayer1"; _wmp10Player.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState"))); _wmp10Player.Size = new System.Drawing.Size(264, 240); _wmp10Player.TabIndex = 0; GUIGraphicsContext.form.Controls.Add(_wmp10Player); try { _wmp10Player.EndInit(); } catch (COMException) { } _wmp10Player.uiMode = "none"; _wmp10Player.windowlessVideo = true; _wmp10Player.enableContextMenu = false; _wmp10Player.Ctlenabled = false; _wmp10Player.Visible = false; GUIGraphicsContext.form.ResumeLayout(false); } static public ArrayList GetCDTracks() { GUIListItem item; ArrayList list = new ArrayList(); item = new GUIListItem(); item.IsFolder = true; item.Label = ".."; item.Label2 = ""; item.Path = ""; Utils.SetDefaultIcons(item); Utils.SetThumbnails(ref item); list.Add(item); CreateInstance(); if (_wmp10Player.cdromCollection.count <= 0) return list; if (_wmp10Player.cdromCollection.count <= 0) return list; WMPLib.IWMPCdrom cdrom = _wmp10Player.cdromCollection.Item(0); if (cdrom == null) return list; if (cdrom.Playlist == null) return list; for (int iTrack = 0; iTrack < cdrom.Playlist.count; iTrack++) { try { MusicTag tag = new MusicTag(); WMPLib.IWMPMedia media = cdrom.Playlist.get_Item(iTrack); item = new GUIListItem(); item.IsFolder = false; item.Label = media.name; item.Label2 = ""; item.Path = String.Format("cdda:{0}", iTrack); item.FileInfo = null; for (int i = 0; i < media.attributeCount; ++i) { string strAttr = media.getAttributeName(i); string strValue = media.getItemInfo(strAttr); if (String.Compare("album", strAttr, true) == 0) tag.Album = strValue; if (String.Compare("actor", strAttr, true) == 0) tag.Artist = strValue; if (String.Compare("artist", strAttr, true) == 0) tag.Artist = strValue; if (String.Compare("style", strAttr, true) == 0) tag.Genre = strValue; if (String.Compare("releasedate", strAttr, true) == 0) { try { tag.Year = Convert.ToInt32(strValue.Substring(0, 4)); } catch (Exception) { } } } tag.Title = media.name; tag.Duration = (int)media.duration; tag.Track = iTrack + 1; //tag.Comment = //tag.Year = //tag.Genre = item.MusicTag = tag; list.Add(item); } catch (Exception) { } } return list; } public override bool Play(string strFile) { _graphState = PlayState.Init; _currentFile = strFile; _notifyPlaying = true; GC.Collect(); CreateInstance(); if (_wmp10Player == null) return false; if (_wmp10Player.cdromCollection == null) return false; _wmp10Player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange); //_wmp10Player.enableContextMenu = false; //_wmp10Player.Ctlenabled = false; if (strFile.IndexOf("cdda:") >= 0) { string strTrack = strFile.Substring(5); int iTrack = Convert.ToInt32(strTrack); if (_wmp10Player.cdromCollection.count <= 0) return false; if (_wmp10Player.cdromCollection.Item(0).Playlist == null) return false; if (iTrack > _wmp10Player.cdromCollection.Item(0).Playlist.count) return false; _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(0).Playlist.get_Item(iTrack - 1); if (_wmp10Player.currentMedia == null) return false; Log.Write("Audioplayer:play track:{0}/{1}", iTrack, _wmp10Player.cdromCollection.Item(0).Playlist.count); } else if (strFile.IndexOf(".cda") >= 0) { string strTrack = ""; int pos = strFile.IndexOf(".cda"); if (pos >= 0) { pos--; while (Char.IsDigit(strFile[pos]) && pos > 0) { strTrack = strFile[pos] + strTrack; pos--; } } if (_wmp10Player.cdromCollection.count <= 0) return false; string strDrive = strFile.Substring(0, 1); strDrive += ":"; int iCdRomDriveNr = 0; while ((_wmp10Player.cdromCollection.Item(iCdRomDriveNr).driveSpecifier != strDrive) && (iCdRomDriveNr < _wmp10Player.cdromCollection.count)) { iCdRomDriveNr++; } int iTrack = Convert.ToInt32(strTrack); if (_wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist == null) return false; int tracks = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.count; if (iTrack > tracks) return false; _wmp10Player.currentMedia = _wmp10Player.cdromCollection.Item(iCdRomDriveNr).Playlist.get_Item(iTrack - 1); if (_wmp10Player.currentMedia == null) return false; /* string strStart=strFile.Substring(0,2)+@"\"; int ipos=strFile.LastIndexOf("+"); if (ipos >0) strStart += strFile.Substring(ipos+1); strFile=strStart; _currentFile=strFile; Log.Write("Audioplayer:play {0}", strFile);*/ //_wmp10Player.URL=strFile; _currentFile = strFile; } else { Log.Write("Audioplayer:play {0}", strFile); _wmp10Player.URL = strFile; } _wmp10Player.Ctlcontrols.play(); _wmp10Player.Visible = false; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msg.Label = strFile; GUIWindowManager.SendThreadMessage(msg); _graphState = PlayState.Playing; GC.Collect(); _needUpdate = true; _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; _positionX = GUIGraphicsContext.VideoWindow.Left; _positionY = GUIGraphicsContext.VideoWindow.Top; _videoWidth = GUIGraphicsContext.VideoWindow.Width; _videoHeight = GUIGraphicsContext.VideoWindow.Height; SetVideoWindow(); return true; } private void OnPlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { if (_wmp10Player == null) return; switch (_wmp10Player.playState) { case WMPLib.WMPPlayState.wmppsStopped: SongEnded(false); break; } } void SongEnded(bool bManualStop) { // this is triggered only if movie has ended // ifso, stop the movie which will trigger MovieStopped if (!Utils.IsAudio(_currentFile)) GUIGraphicsContext.IsFullScreenVideo = false; Log.Write("Audioplayer:ended {0} {1}", _currentFile, bManualStop); _currentFile = ""; if (_wmp10Player != null) { _wmp10Player.Visible = false; _wmp10Player.PlayStateChange -= new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange); } //GUIGraphicsContext.IsFullScreenVideo=false; GUIGraphicsContext.IsPlaying = false; if (!bManualStop) { _graphState = PlayState.Ended; } else { _graphState = PlayState.Init; } GC.Collect(); } public override bool Ended { get { return _graphState == PlayState.Ended; } } public override double Duration { get { if (_graphState != PlayState.Init && _wmp10Player != null) { try { return _wmp10Player.currentMedia.duration; } catch (Exception) { } } return 0.0d; } } public override double CurrentPosition { get { try { return _wmp10Player.Ctlcontrols.currentPosition; } catch (Exception) { } return 0.0d; } } public override void Pause() { if (_wmp10Player == null) return; if (_graphState == PlayState.Paused) { _graphState = PlayState.Playing; _wmp10Player.Ctlcontrols.play(); } else if (_graphState == PlayState.Playing) { _wmp10Player.Ctlcontrols.pause(); if (_wmp10Player.playState == WMPLib.WMPPlayState.wmppsPaused) _graphState = PlayState.Paused; } } public override bool Paused { get { return (_graphState == PlayState.Paused); } } public override bool Playing { get { return (_graphState == PlayState.Playing || _graphState == PlayState.Paused); } } public override bool Stopped { get { return (_graphState == PlayState.Init); } } public override string CurrentFile { get { return _currentFile; } } public override void Stop() { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { _wmp10Player.Ctlcontrols.stop(); _wmp10Player.Visible = false; SongEnded(true); } } public override int Volume { get { if (_wmp10Player == null) return 100; return _wmp10Player.settings.volume; } set { if (_wmp10Player == null) return; if (_wmp10Player.settings.volume != value) { _wmp10Player.settings.volume = value; } } } public override bool HasVideo { get { return true; } } #region IDisposable Members public override void Release() { /* if (_wmp10Player == null) return; _wmp10Player.Visible = false; try { GUIGraphicsContext.form.Controls.Remove(_wmp10Player); } catch (Exception) { } _wmp10Player.Dispose(); _wmp10Player = null; * */ } #endregion public override bool FullScreen { get { return GUIGraphicsContext.IsFullScreenVideo; } set { if (value != _isFullScreen) { _isFullScreen = value; _needUpdate = true; } } } public override int PositionX { get { return _positionX; } set { if (value != _positionX) { _positionX = value; _needUpdate = true; } } } public override int PositionY { get { return _positionY; } set { if (value != _positionY) { _positionY = value; _needUpdate = true; } } } public override int RenderWidth { get { return _videoWidth; } set { if (value != _videoWidth) { _videoWidth = value; _needUpdate = true; } } } public override int RenderHeight { get { return _videoHeight; } set { if (value != _videoHeight) { _videoHeight = value; _needUpdate = true; } } } public override void Process() { if (!Playing) return; if (_wmp10Player == null) return; if (GUIGraphicsContext.BlankScreen || (GUIGraphicsContext.Overlay == false && GUIGraphicsContext.IsFullScreenVideo == false)) { if (_wmp10Player.Visible) { _wmp10Player.ClientSize = new Size(0, 0); _wmp10Player.Visible = false; //_wmp10Player.uiMode = "invisible"; } } else if (!_wmp10Player.Visible) { _needUpdate = true; SetVideoWindow(); //_wmp10Player.uiMode = "none"; _wmp10Player.Visible = true; } if (CurrentPosition >= 10.0) { if (_notifyPlaying) { _notifyPlaying = false; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); msg.Label = CurrentFile; GUIWindowManager.SendThreadMessage(msg); } } } public override void SetVideoWindow() { if (_wmp10Player == null) return; if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen) { _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; _needUpdate = true; } if (!_needUpdate) return; _needUpdate = false; if (_isFullScreen) { Log.Write("AudioPlayer:Fullscreen"); IntPtr mpHwnd = GetActiveWindow(); _positionX = GUIGraphicsContext.OverScanLeft; _positionY = GUIGraphicsContext.OverScanTop; _videoWidth = GUIGraphicsContext.OverScanWidth; _videoHeight = GUIGraphicsContext.OverScanHeight; _wmp10Player.Location = new Point(0, 0); _wmp10Player.ClientSize = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); _wmp10Player.Size = new System.Drawing.Size(GUIGraphicsContext.Width, GUIGraphicsContext.Height); _videoRectangle = new Rectangle(0, 0, _wmp10Player.ClientSize.Width, _wmp10Player.ClientSize.Height); _sourceRectangle = _videoRectangle; // If MediaPortal app is fullscreen then go true fullscreen Rectangle scr = Screen.PrimaryScreen.WorkingArea; bool bMPIsFullscreen = (GUIGraphicsContext.Width == scr.Width) && (GUIGraphicsContext.Height == scr.Height); Log.Write("Screen is {0}x{1}, GUIGraphicsContext is {2}x{3} => {4}", scr.Width, scr.Height, GUIGraphicsContext.Width, GUIGraphicsContext.Height, bMPIsFullscreen?"Effectively fullscreen":"Treat as windowed"); if (bMPIsFullscreen) { Log.Write("AudioPlayer:Switching wmp10Player fullscreen"); _wmp10Player.fullScreen = true; _wmp10Player.stretchToFit = false; } // else go stretchy else { Log.Write("AudioPlayer:Switching wmp10Player non-fullscreen, stretchToFit"); _wmp10Player.stretchToFit = true; } // Restore original focus ShowWindow(mpHwnd, SW_RESTORE); SetForegroundWindow(mpHwnd); Log.Write("AudioPlayer:done"); return; } else { _wmp10Player.ClientSize = new System.Drawing.Size(_videoWidth, _videoHeight); _wmp10Player.Location = new Point(_positionX, _positionY); _videoRectangle = new Rectangle(_positionX, _positionY, _wmp10Player.ClientSize.Width, _wmp10Player.ClientSize.Height); _sourceRectangle = _videoRectangle; //Log.Write("AudioPlayer:set window:({0},{1})-({2},{3})",_positionX,_positionY,_positionX+_wmp10Player.ClientSize.Width,_positionY+_wmp10Player.ClientSize.Height); Log.Write("AudioPlayer:Not fullscreen"); _wmp10Player.fullScreen = false; _wmp10Player.stretchToFit = true; } //_wmp10Player.uiMode = "none"; //_wmp10Player.windowlessVideo = true; //_wmp10Player.enableContextMenu = false; //_wmp10Player.Ctlenabled = false; GUIGraphicsContext.form.Controls[0].Enabled = false; } /* public override int AudioStreams { get { return _wmp10Player.Ctlcontrols.audioLanguageCount;} } public override int CurrentAudioStream { get { return _wmp10Player.Ctlcontrols.currentAudioLanguage;} set { _wmp10Player.Ctlcontrols.currentAudioLanguage=value;} } public override string AudioLanguage(int iStream) { return _wmp10Player.controls.getLanguageName(iStream); } */ public override void SeekRelative(double dTime) { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { double dCurTime = CurrentPosition; dTime = dCurTime + dTime; if (dTime < 0.0d) dTime = 0.0d; if (dTime < Duration) { _wmp10Player.Ctlcontrols.currentPosition = dTime; } } } public override void SeekAbsolute(double dTime) { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { if (dTime < 0.0d) dTime = 0.0d; if (dTime < Duration) { _wmp10Player.Ctlcontrols.currentPosition = dTime; } } } public override void SeekRelativePercentage(int iPercentage) { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { double dCurrentPos = CurrentPosition; double dDuration = Duration; double fCurPercent = (dCurrentPos / Duration) * 100.0d; double fOnePercent = Duration / 100.0d; fCurPercent = fCurPercent + (double)iPercentage; fCurPercent *= fOnePercent; if (fCurPercent < 0.0d) fCurPercent = 0.0d; if (fCurPercent < Duration) { _wmp10Player.Ctlcontrols.currentPosition = fCurPercent; } } } public override void SeekAsolutePercentage(int iPercentage) { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { if (iPercentage < 0) iPercentage = 0; if (iPercentage >= 100) iPercentage = 100; double fPercent = Duration / 100.0f; fPercent *= (double)iPercentage; _wmp10Player.Ctlcontrols.currentPosition = fPercent; } } public override int Speed { get { if (_graphState == PlayState.Init) return 1; if (_wmp10Player == null) return 1; return (int)_wmp10Player.settings.rate; } set { if (_wmp10Player == null) return; if (_graphState != PlayState.Init) { try { _wmp10Player.settings.rate = (double)value; } catch (Exception) { } } } } } } [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
Codecs, External Players
Visualisations slow still?
Contact us
RSS
Top
Bottom