Пример #1
0
        /// <summary>
        /// Sets the shape of the player's display window. See also: Player.Display.Shape.
        /// </summary>
        /// <param name="shape">A value that indicates the shape of the player's display window.</param>
        /// <param name="videoShape">A value that indicates whether the shape applies to the video image (or to the display window).</param>
        /// <param name="overlayShape">A value that indicates whether the shape should also be applied to display overlays.</param>
        public int SetShape(DisplayShape shape, bool videoShape, bool overlayShape)
        {
            _base._lastError = Player.NO_ERROR;

            if (shape == DisplayShape.Normal)
            {
                _base.AV_RemoveDisplayShape(true);
            }
            else
            {
                if (_base._hasDisplay)
                {
                    if (_base._displayShape != shape || videoShape != _base._hasVideoShape || overlayShape != _base._hasOverlayClipping)
                    {
                        _base._displayShape         = shape;
                        _base._hasVideoShape        = videoShape;
                        _base._displayShapeCallback = _base.AV_GetShapeCallback(shape);
                        _base.AV_SetOverlayClipping(overlayShape);

                        _base._hasDisplayShape = true;
                        _base.AV_UpdateDisplayShape();

                        if (videoShape)
                        {
                            _base._mediaVideoBoundsChanged += _base.AV_DisplayShapeChanged;
                        }
                        _base._mediaDisplayShapeChanged?.Invoke(_base, EventArgs.Empty);
                    }
                }
                else
                {
                    if (_base._displayShape != DisplayShape.Normal)
                    {
                        _base.AV_RemoveDisplayShape(true);
                    }
                    _base._lastError = HResult.MF_E_NOT_AVAILABLE; // No Display
                }
            }
            return((int)_base._lastError);
        }