Skip to content

Instantly share code, notes, and snippets.

@TomMD
Created July 26, 2015 15:25
Show Gist options
  • Save TomMD/ae6dd7e1bbc1f041e440 to your computer and use it in GitHub Desktop.
Save TomMD/ae6dd7e1bbc1f041e440 to your computer and use it in GitHub Desktop.
Shows how to use Friday, Friday-JuicyPixels and FFmpeg-light to get a lazy image list.
module LazyDemo where
import Vision.Image.JuicyPixels
import Vision.Image (RGBA)
import Codec.FFmpeg
import System.IO.Unsafe
lazyStream :: FilePath -> IO [RGBA]
lazyStream fp = do
initFFmpeg
(rd,close) <- imageReader fp
go rd close
where
go rd close = do
mi <- rd
case mi of
Nothing -> close >> return []
Just i -> (toFridayRGBA i : ) <$> unsafeInterleaveIO (go rd close)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment