private void LoadBGA(BGAObject bgaObject) { string filename = bgaObject.path; string fullPath = Path.Combine(basePath, filename); string path = Utility.FindRealFile(fullPath, lookupPaths, lookupImageExtensions); if (File.Exists(path)) { if (Path.GetExtension(filename).ToLower() == ".lua") { Log.Error("Failed to load BGA '" + filename + "', scripted BGAs are not supported"); return; } FFmpegVideo video = new FFmpegVideo(); try { video.Load(path); byte[] bytes = video.ReadFrame(); bgaObject.SetVideo(video); lock (rendererLock) video.OnNextFrame(bytes); } catch (ThreadAbortException) { } catch (Exception e) { Log.Error("Failed to load BGA '" + Path.GetFileName(filename) + "': " + e.Message); } finally { if (!video.isVideo) { video.Dispose(); } } } else if (!missingFiles.Contains(filename)) { missingFiles.Add(filename); Log.Warning("BGA file not found: " + filename); } }
public void SetVideo(FFmpegVideo video) { this.video = video; video.OnNextFrame = UpdateTexture; }