private bool PrepareMovie() { if (_movieSource != AVProQuickTimePlugin.MovieSource.Memory) { if (!AVProQuickTimePlugin.LoadMovieProperties(_movieHandle)) { Debug.LogWarning("[AVProQuickTime] Failed loading movie properties"); Close(); return(false); } } AVProQuickTimePlugin.SetVolume(_movieHandle, _volume); AVProQuickTimePlugin.SetAudioBalance(_movieHandle, _audioBalance); Width = AVProQuickTimePlugin.GetWidth(_movieHandle); Height = AVProQuickTimePlugin.GetHeight(_movieHandle); FrameCount = (uint)(AVProQuickTimePlugin.GetFrameCount(_movieHandle)); DurationSeconds = AVProQuickTimePlugin.GetDurationSeconds(_movieHandle); FrameRate = AVProQuickTimePlugin.GetFrameRate(_movieHandle); PixelFormat = (AVProQuickTimePlugin.PixelFormat)AVProQuickTimePlugin.GetFramePixelFormat(_movieHandle); IsPrepared = true; PlayState = PlaybackState.Loaded; Debug.Log("[AVProQuickTime] loaded movie " + Filename + "[" + Width + "x" + Height + " @ " + FrameRate + "hz] " + PixelFormat.ToString() + " " + DurationSeconds + " sec " + FrameCount + " frames"); // Movie may not be visual, it could be audio so check width and height if (Width > 0 && Height > 0) { if (Width <= 4096 && Height <= 4096) { if (PixelFormat != AVProQuickTimePlugin.PixelFormat.Unknown) { IsVisual = true; if (_formatConverter == null) { _formatConverter = new AVProQuickTimeFormatConverter(); } if (!_formatConverter.Build(_movieHandle, Width, Height, PixelFormat, _yuvHD, false, true)) { Debug.LogWarning("[AVProQuickTime] unable to convert video format"); Width = Height = 0; if (_formatConverter != null) { _formatConverter.Dispose(); _formatConverter = null; } } } else { Debug.LogWarning("[AVProQuickTime] unknown video format"); Width = Height = 0; if (_formatConverter != null) { _formatConverter.Dispose(); _formatConverter = null; } } } else { Debug.LogError("[AVProQuickTime] Movie resolution is too large"); Width = Height = 0; if (_formatConverter != null) { _formatConverter.Dispose(); _formatConverter = null; } } } else { // No video frame found, must be audio? Width = Height = 0; if (_formatConverter != null) { _formatConverter.Dispose(); _formatConverter = null; } } return(true); }