コード例 #1
0
        public override void CloseVideo()
        {
            AVPPlayerClose(_player);

            if (_texture[0] != null)
            {
                IssuePluginEvent(AVPPluginEventType.PlayerFreeResources);
                // Have to update with zero to release Metal textures!
                for (int i = 0; i < _planeCount; ++i)
                {
                    _texture[i].UpdateExternalTexture(IntPtr.Zero);
                    Texture2D.Destroy(_texture[i]);
                    _texture[i] = null;
                }
            }

            _width                  = 0;
            _height                 = 0;
            _isMetaDataReady        = false;
            _planeCount             = 0;
            _YpCbCrTransformIsValid = false;
            _status                 = AVPPlayerStatus.Unknown;

            base.CloseVideo();
        }
コード例 #2
0
ファイル: OSXMediaPlayer.cs プロジェクト: threepat1/cslOculus
        public override void Update()
        {
            _status = AVPPlayerGetStatus(_player);

            if (AVPPlayerUpdate(_player))
            {
                IssuePluginEvent(AVPPluginEventType.PlayerRender);
            }

            _lastError = AVPPlayerGetLastError(_player);
            UpdateTextures();

            UpdateSubtitles();

            // Check for meta data to become available
            if (!_isMetaDataReady)
            {
                if (AVPPlayerHasMetaData(_player) || CanPlay())
                {
                    // MOZ - had to move this outside of HasVideo check
                    _isMetaDataReady = true;

                    if (HasVideo())
                    {
                        if (_width > 0 && _height > 0)
                        {
                            if (Mathf.Max(_width, _height) > SystemInfo.maxTextureSize)
                            {
                                Debug.LogError("[AVProVideo] Video dimensions larger than maxTextureSize");
                            }
                        }
                        _playerDescription = "AVFoundation";

                        int width  = 0;
                        int height = 0;
                        AVPPlayerGetNaturalSize(_player, out width, out height);

                        Helper.LogInfo("Using playback path: " + _playerDescription + " (" + width + "x" + height + "@" + GetVideoFrameRate().ToString("F2") + ")");
                    }
                    else if (HasAudio())
                    {
                    }
                }
            }
        }