// savevmr9bitmap public void GetVideoWindows(out Rectangle rSource, out Rectangle rDest) { Geometry m_geometry = new Geometry(); // get the window where the video/tv should be shown float x = GUIGraphicsContext.VideoWindow.X; float y = GUIGraphicsContext.VideoWindow.Y; float nw = GUIGraphicsContext.VideoWindow.Width; float nh = GUIGraphicsContext.VideoWindow.Height; GUIGraphicsContext.Correct(ref x, ref y); //sanity checks if (nw > GUIGraphicsContext.OverScanWidth) { nw = GUIGraphicsContext.OverScanWidth; } if (nh > GUIGraphicsContext.OverScanHeight) { nh = GUIGraphicsContext.OverScanHeight; } //are we supposed to show video in fullscreen or in a preview window? if (GUIGraphicsContext.IsFullScreenVideo || !GUIGraphicsContext.ShowBackground) { //yes fullscreen, then use the entire screen x = GUIGraphicsContext.OverScanLeft; y = GUIGraphicsContext.OverScanTop; nw = GUIGraphicsContext.OverScanWidth; nh = GUIGraphicsContext.OverScanHeight; } //calculate the video window according to the current aspect ratio settings float fVideoWidth = (float)VideoWidth; float fVideoHeight = (float)VideoHeight; m_geometry.ImageWidth = (int)fVideoWidth; m_geometry.ImageHeight = (int)fVideoHeight; m_geometry.ScreenWidth = (int)nw; m_geometry.ScreenHeight = (int)nh; m_geometry.ARType = GUIGraphicsContext.ARType; m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; m_geometry.GetWindow(VideoAspectRatioX, VideoAspectRatioY, out rSource, out rDest); rDest.X += (int)x; rDest.Y += (int)y; m_geometry = null; }
public override void SetVideoWindow() { if (GUIGraphicsContext.Vmr9Active) { _updateNeeded = false; m_bStarted = true; return; } if (GUIGraphicsContext.IsFullScreenVideo != m_bFullScreen) { m_bFullScreen = GUIGraphicsContext.IsFullScreenVideo; _updateNeeded = true; } if (!_updateNeeded) { return; } _updateNeeded = false; m_bStarted = true; float x = m_iPositionX; float y = m_iPositionY; int nw = m_iWidth; int nh = m_iHeight; if (nw > GUIGraphicsContext.OverScanWidth) { nw = GUIGraphicsContext.OverScanWidth; } if (nh > GUIGraphicsContext.OverScanHeight) { nh = GUIGraphicsContext.OverScanHeight; } //lock ( typeof(VideoPlayerVMR7) ) { if (GUIGraphicsContext.IsFullScreenVideo) { x = m_iPositionX = GUIGraphicsContext.OverScanLeft; y = m_iPositionY = GUIGraphicsContext.OverScanTop; nw = m_iWidth = GUIGraphicsContext.OverScanWidth; nh = m_iHeight = GUIGraphicsContext.OverScanHeight; } if (x < 0 || y < 0) { return; } if (nw <= 0 || nh <= 0) { return; } int aspectX, aspectY; if (basicVideo != null) { basicVideo.GetVideoSize(out m_iVideoWidth, out m_iVideoHeight); } aspectX = m_iVideoWidth; aspectY = m_iVideoHeight; if (basicVideo != null) { basicVideo.GetPreferredAspectRatio(out aspectX, out aspectY); } m_aspectX = aspectX; m_aspectY = aspectY; GUIGraphicsContext.VideoSize = new Size(m_iVideoWidth, m_iVideoHeight); Rectangle rSource, rDest; Geometry m_geometry = new Geometry(); m_geometry.ImageWidth = m_iVideoWidth; m_geometry.ImageHeight = m_iVideoHeight; m_geometry.ScreenWidth = nw; m_geometry.ScreenHeight = nh; m_geometry.ARType = GUIGraphicsContext.ARType; m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; m_geometry.GetWindow(aspectX, aspectY, out rSource, out rDest); rDest.X += (int)x; rDest.Y += (int)y; Log.Info("overlay: video WxH : {0}x{1}", m_iVideoWidth, m_iVideoHeight); Log.Info("overlay: video AR : {0}:{1}", aspectX, aspectY); Log.Info("overlay: screen WxH : {0}x{1}", nw, nh); Log.Info("overlay: AR type : {0}", GUIGraphicsContext.ARType); Log.Info("overlay: PixelRatio : {0}", GUIGraphicsContext.PixelRatio); Log.Info("overlay: src : ({0},{1})-({2},{3})", rSource.X, rSource.Y, rSource.X + rSource.Width, rSource.Y + rSource.Height); Log.Info("overlay: dst : ({0},{1})-({2},{3})", rDest.X, rDest.Y, rDest.X + rDest.Width, rDest.Y + rDest.Height); SetSourceDestRectangles(rSource, rDest); SetVideoPosition(rDest); _sourceRectangle = rSource; _videoRectangle = rDest; } }
public override void SetVideoWindow() { if (GUIGraphicsContext.IsFullScreenVideo != _isFullscreen) { _isFullscreen = GUIGraphicsContext.IsFullScreenVideo; _updateNeeded = true; } if (!_updateNeeded) { return; } _updateNeeded = false; _isStarted = true; float x = _positionX; float y = _positionY; int nw = _width; int nh = _height; if (nw > GUIGraphicsContext.OverScanWidth) { nw = GUIGraphicsContext.OverScanWidth; } if (nh > GUIGraphicsContext.OverScanHeight) { nh = GUIGraphicsContext.OverScanHeight; } if (GUIGraphicsContext.IsFullScreenVideo) { x = _positionX = GUIGraphicsContext.OverScanLeft; y = _positionY = GUIGraphicsContext.OverScanTop; nw = _width = GUIGraphicsContext.OverScanWidth; nh = _height = GUIGraphicsContext.OverScanHeight; } /* Log.Info("{0},{1}-{2},{3} vidwin:{4},{5}-{6},{7} fs:{8}", x,y,nw,nh, GUIGraphicsContext.VideoWindow.Left, GUIGraphicsContext.VideoWindow.Top, GUIGraphicsContext.VideoWindow.Right, GUIGraphicsContext.VideoWindow.Bottom, GUIGraphicsContext.IsFullScreenVideo);*/ if (nw <= 0 || nh <= 0) { return; } if (x < 0 || y < 0) { return; } int aspectX, aspectY; if (_basicVideo != null) { _basicVideo.GetVideoSize(out _videoWidth, out _videoHeight); } aspectX = _videoWidth; aspectY = _videoHeight; if (_basicVideo != null) { _basicVideo.GetPreferredAspectRatio(out aspectX, out aspectY); } GUIGraphicsContext.VideoSize = new Size(_videoWidth, _videoHeight); _aspectX = aspectX; _aspectY = aspectY; Geometry m_geometry = new Geometry(); Rectangle rSource, rDest; m_geometry.ImageWidth = _videoWidth; m_geometry.ImageHeight = _videoHeight; m_geometry.ScreenWidth = nw; m_geometry.ScreenHeight = nh; m_geometry.ARType = GUIGraphicsContext.ARType; m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; m_geometry.GetWindow(aspectX, aspectY, out rSource, out rDest); rDest.X += (int)x; rDest.Y += (int)y; Log.Info("overlay: video WxH : {0}x{1}", _videoWidth, _videoHeight); Log.Info("overlay: video AR : {0}:{1}", aspectX, aspectY); Log.Info("overlay: screen WxH : {0}x{1}", nw, nh); Log.Info("overlay: AR type : {0}", GUIGraphicsContext.ARType); Log.Info("overlay: PixelRatio : {0}", GUIGraphicsContext.PixelRatio); Log.Info("overlay: src : ({0},{1})-({2},{3})", rSource.X, rSource.Y, rSource.X + rSource.Width, rSource.Y + rSource.Height); Log.Info("overlay: dst : ({0},{1})-({2},{3})", rDest.X, rDest.Y, rDest.X + rDest.Width, rDest.Y + rDest.Height); Log.Info("TSStreamBufferPlayer:Window ({0},{1})-({2},{3}) - ({4},{5})-({6},{7})", rSource.X, rSource.Y, rSource.Right, rSource.Bottom, rDest.X, rDest.Y, rDest.Right, rDest.Bottom); if (rSource.Y == 0) { rSource.Y += 5; rSource.Height -= 10; } SetSourceDestRectangles(rSource, rDest); SetVideoPosition(rDest); _sourceRectangle = rSource; _videoRectangle = rDest; }
public override void SetVideoWindow() { if (GUIGraphicsContext.IsFullScreenVideo != _isFullscreen) { _isFullscreen = GUIGraphicsContext.IsFullScreenVideo; _updateNeeded = true; } if (!_updateNeeded && !GUIGraphicsContext.UpdateVideoWindow) { return; } _updateNeeded = false; GUIGraphicsContext.UpdateVideoWindow = false; float x = _positionX; float y = _positionY; int nw = _width; int nh = _height; if (nw > GUIGraphicsContext.OverScanWidth) { nw = GUIGraphicsContext.OverScanWidth; } if (nh > GUIGraphicsContext.OverScanHeight) { nh = GUIGraphicsContext.OverScanHeight; } if (GUIGraphicsContext.IsFullScreenVideo) { x = _positionX = GUIGraphicsContext.OverScanLeft; y = _positionY = GUIGraphicsContext.OverScanTop; nw = _width = GUIGraphicsContext.OverScanWidth; nh = _height = GUIGraphicsContext.OverScanHeight; } if (nw <= 0 || nh <= 0 || x < 0 || y < 0) { return; } int aspectX, aspectY; if (_basicVideo != null) { _basicVideo.GetVideoSize(out _videoWidth, out _videoHeight); } aspectX = _videoWidth; aspectY = _videoHeight; if (_basicVideo != null) { _basicVideo.GetPreferredAspectRatio(out aspectX, out aspectY); } _aspectX = aspectX; _aspectY = aspectY; GUIGraphicsContext.VideoSize = new Size(_videoWidth, _videoHeight); GUIGraphicsContext.ScaleVideoWindow(ref nw, ref nh, ref x, ref y); Rectangle rSource, rDest; Geometry m_geometry = new Geometry(); m_geometry.ImageWidth = _videoWidth; m_geometry.ImageHeight = _videoHeight; m_geometry.ScreenWidth = nw; m_geometry.ScreenHeight = nh; m_geometry.ARType = GUIGraphicsContext.ARType; m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; m_geometry.GetWindow(aspectX, aspectY, out rSource, out rDest); rDest.X += (int)x; rDest.Y += (int)y; Log.Info("overlay: video WxH : {0}x{1}", _videoWidth, _videoHeight); Log.Info("overlay: video AR : {0}:{1}", aspectX, aspectY); Log.Info("overlay: screen WxH : {0}x{1}", nw, nh); Log.Info("overlay: AR type : {0}", GUIGraphicsContext.ARType); Log.Info("overlay: PixelRatio : {0}", GUIGraphicsContext.PixelRatio); Log.Info("overlay: src : ({0},{1})-({2},{3})", rSource.X, rSource.Y, rSource.X + rSource.Width, rSource.Y + rSource.Height); Log.Info("overlay: dst : ({0},{1})-({2},{3})", rDest.X, rDest.Y, rDest.X + rDest.Width, rDest.Y + rDest.Height); SetSourceDestRectangles(rSource, rDest); SetVideoPosition(rDest); _sourceRectangle = rSource; _videoRectangle = rDest; }
public override void SetVideoWindow() { if (_videoWin == null) { return; } if (GUIGraphicsContext.IsFullScreenVideo != _fullScreen) { _fullScreen = GUIGraphicsContext.IsFullScreenVideo; _updateNeeded = true; } if (!_updateNeeded) { return; } _started = true; _updateNeeded = false; float x = _positionX; float y = _positionY; int nw = _width; int nh = _height; if (nw > GUIGraphicsContext.OverScanWidth) { nw = GUIGraphicsContext.OverScanWidth; } if (nh > GUIGraphicsContext.OverScanHeight) { nh = GUIGraphicsContext.OverScanHeight; } lock (typeof (DVDPlayer)) { if (GUIGraphicsContext.IsFullScreenVideo) { x = _positionX = GUIGraphicsContext.OverScanLeft; y = _positionY = GUIGraphicsContext.OverScanTop; nw = _width = GUIGraphicsContext.OverScanWidth; nh = _height = GUIGraphicsContext.OverScanHeight; } if (nw <= 0 || nh <= 0) { return; } Rectangle source, destination; int aspectX, aspectY; if (_basicVideo != null) { _basicVideo.GetVideoSize(out _videoWidth, out _videoHeight); } aspectX = _videoWidth; aspectY = _videoHeight; if (_basicVideo != null) { _basicVideo.GetPreferredAspectRatio(out aspectX, out aspectY); } GUIGraphicsContext.VideoSize = new Size(_videoWidth, _videoHeight); Geometry m_geometry = new Geometry(); m_geometry.ImageWidth = _videoWidth; m_geometry.ImageHeight = _videoHeight; m_geometry.ScreenWidth = nw; m_geometry.ScreenHeight = nh; m_geometry.ARType = GUIGraphicsContext.ARType; using (Settings xmlreader = new MPSettings()) { bool bUseAR = xmlreader.GetValueAsBool("dvdplayer", "pixelratiocorrection", false); if (bUseAR) { m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; } else { m_geometry.PixelRatio = 1.0f; } } m_geometry.GetWindow(aspectX, aspectY, out source, out destination); destination.X += (int)x; destination.Y += (int)y; Log.Info("overlay: video WxH : {0}x{1}", _videoWidth, _videoHeight); Log.Info("overlay: video AR : {0}:{1}", aspectX, aspectY); Log.Info("overlay: screen WxH : {0}x{1}", nw, nh); Log.Info("overlay: AR type : {0}", GUIGraphicsContext.ARType); Log.Info("overlay: PixelRatio : {0}", GUIGraphicsContext.PixelRatio); Log.Info("overlay: src : ({0},{1})-({2},{3})", source.X, source.Y, source.X + source.Width, source.Y + source.Height); Log.Info("overlay: dst : ({0},{1})-({2},{3})", destination.X, destination.Y, destination.X + destination.Width, destination.Y + destination.Height); SetSourceDestRectangles(source, destination); SetVideoPosition(destination); //hr=_videoWin.SetWindowPosition( destination.X, destination.Y, destination.Width, destination.Height ); //hr=_dvdCtrl.SelectVideoModePreference(_videoPref); DirectShowUtil.SetARMode(_graphBuilder, arMode); _sourceRectangle = source; _videoRectangle = destination; } }
/// <summary> /// Changes the aspect ratio of MediaPortal /// </summary> /// <param name="MessageString">Message text of the switch message</param> /// <param name="AR">the aspect ratio to switch to</param> private void SetAspectRatio(string MessageString, Geometry.Type AR) { Log.Info("ViewModeSwitcher: Switching to viewmode: " + AR); GUIGraphicsContext.ARType = AR; if (currentSettings.ShowSwitchMsg) { GUIDialogNotify SwitchMsg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); SwitchMsg.SetHeading("ViewModeSwitcher"); SwitchMsg.SetText(MessageString + " > " + AR); SwitchMsg.TimeOut = 2; SwitchMsg.DoModal(GUIWindowManager.ActiveWindow); } }
/// <summary> /// Changes the aspect ratio of MediaPortal /// </summary> /// <param name="MessageString">Message text of the switch message</param> /// <param name="AR">the aspect ratio to switch to</param> private bool SetAspectRatio(string MessageString, Geometry.Type AR) { if (GUIGraphicsContext.ARType == AR) { return false; } Log.Info("ViewModeSwitcher: Switching to viewmode: " + AR); GUIGraphicsContext.ARType = AR; return true; }
/// <summary> /// Sets up a change to aspect ratio of MediaPortal (actually happens later) /// </summary> /// <param name="MessageString">Message text of the switch message</param> /// <param name="AR">the aspect ratio to switch to</param> private bool SetNewGeometry(string MessageString, Geometry.Type AR) { if (LastSwitchedGeometry == AR) { return false; } LastSwitchedGeometry = AR; NewGeometryMessage = MessageString; return true; }
/// <summary> /// Places the video window /// </summary> public void SetVideoWindow() { if (_videoHeight < 0) { return; } if (_mplayerBackgroundPanel == null) return; if (_mplayerOuterPanel == null) return; if (_mplayerInnerPanel == null) return; if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen) { _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; _needUpdate = true; } if (!_needUpdate) return; _needUpdate = false; if (_isFullScreen) { _positionX = GUIGraphicsContext.OverScanTop; _positionY = GUIGraphicsContext.OverScanLeft; _renderWidth = GUIGraphicsContext.OverScanWidth; _renderHeight = GUIGraphicsContext.OverScanHeight; } _mplayerBackgroundPanel.Location = new Point(GUIGraphicsContext.OverScanTop, GUIGraphicsContext.OverScanLeft); _mplayerBackgroundPanel.ClientSize = new Size(GUIGraphicsContext.OverScanWidth, GUIGraphicsContext.OverScanHeight); _mplayerBackgroundPanel.Size = new Size(GUIGraphicsContext.OverScanWidth, GUIGraphicsContext.OverScanHeight); Geometry mGeometry = new Geometry { ImageWidth = _videoWidth, ImageHeight = _videoHeight, ScreenWidth = _renderWidth, ScreenHeight = _renderHeight, ARType = GUIGraphicsContext.ARType, PixelRatio = GUIGraphicsContext.PixelRatio }; mGeometry.GetWindow(_videoWidth, _videoHeight, out _sourceRectangle, out _videoRectangle); _positionX += _videoRectangle.X; _positionY += _videoRectangle.Y; _renderWidth = _videoRectangle.Width; _renderHeight = _videoRectangle.Height; _mplayerOuterPanel.Location = new Point(_positionX, _positionY); _mplayerOuterPanel.ClientSize = new Size(_renderWidth, _renderHeight); _mplayerOuterPanel.Size = new Size(_renderWidth, _renderHeight); int sourceY = (int)-(((double)_videoRectangle.Height) / _sourceRectangle.Height * _sourceRectangle.Top); int sourceHeight = (int)(((double)_videoRectangle.Height) / _sourceRectangle.Height * _videoHeight); int sourceX = (int)-(((double)_videoRectangle.Width) / _sourceRectangle.Width * _sourceRectangle.Left); int sourceWidth = (int)(((double)_videoRectangle.Width) / _sourceRectangle.Width * _videoWidth); _mplayerInnerPanel.Location = new Point(sourceX, sourceY); _mplayerInnerPanel.ClientSize = new Size(sourceWidth, sourceHeight); _mplayerInnerPanel.Size = new Size(sourceWidth, sourceHeight); if (_isFullScreen) { _mplayerBackgroundPanel.Visible = true; Log.Info("MPlayer: Fullscreen (Destination): (" + _positionX + "," + _positionY + "," + _renderWidth + "," + _renderHeight + ") : " + GUIGraphicsContext.ARType); Log.Info("MPlayer: Fullscreen (Source): (" + _sourceRectangle.X + "," + _sourceRectangle.Y + "," + _sourceRectangle.Width + "," + _sourceRectangle.Height + ") : " + GUIGraphicsContext.ARType); _osdHandler.ActivateOSD(false); } else { _mplayerBackgroundPanel.Visible = false; Log.Info("MPlayer: Video Window (Destination): (" + _positionX + "," + _positionY + "," + _renderWidth + "," + _renderHeight + ")"); Log.Info("MPlayer: Video Window (Source): (" + _sourceRectangle.X + "," + _sourceRectangle.Y + "," + _sourceRectangle.Width + "," + _sourceRectangle.Height + ") : " + GUIGraphicsContext.ARType); _osdHandler.DeactivateOSD(true); } _mplayerOuterPanel.BringToFront(); if (_openGl) { _player.SendPausingKeepCommand("switch_ratio " + _aspectRatio); } }