Hosted Projects - FS2 Required > Just Another Day

All about APNGs

<< < (3/3)

Sorry for derailing the thread...

I'll work a bit on the FFmpeg APNG support and get that working a bit more efficiently. Maybe the multi-threading of the movie player will help APNG performance a bit if used properly.

I wish all thread derails could be the cause for some performance improvements. :)

I finished adding the scripting API for movie files ( and it looks very promising. This also supports displaying APNG files with full transparency support so it's basically a drop-in solution for the streaming animation API. However, since the movie player code preloads a few frames and also uses a separate thread it uses more resources than the streaming animation code so it might not be ideal in all circumstances. Also, it doesn't support seeking in the movie file yet so looping animations are not supported currently.

I used this script for testing the playback so you can use that to see how displaying a cutscene is done from Lua. player:isPlaybackReady() is basically the part where the background thread is involved since that checks if enough frames have been preloaded to start playback.

--- Code: ---
#Conditional Hooks

$Application: FS2_Open
$On State Start:
player = gr.openMovie("test")
playbackActive = true

$On Frame:
if playbackActive and player:isPlaybackReady() then
if lastPlayerTime == nil then
lastPlayerTime = time.getCurrentTime()
local currentTime = time.getCurrentTime()

playbackActive = player:update(currentTime - lastPlayerTime)

player:drawMovie(100, 100)

lastPlayerTime = currentTime

$On State End:
player = nil


--- End code ---


[0] Message Index

[*] Previous page

Go to full version