Exemplo n.º 1
0
 /// <summary>
 /// Pause the playback
 /// </summary>
 public override void Pause()
 {
     if (_playState == PlayState.Playing)
     {
         _osdHandler.SetOSDVisibleForPause(true);
         _osdHandler.ActivateOSD(false);
         _playState = PlayState.Paused;
     }
     else if (_playState == PlayState.Paused)
     {
         _osdHandler.SetOSDVisibleForPause(false);
         _osdHandler.DeactivateOSD(false);
         _playState = PlayState.Playing;
     }
     SendCommand("pause");
 }
Exemplo n.º 2
0
        /// <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);
            }
        }