ffmpeg-light 0.11.1 → 0.11.3
raw patch · 2 files changed
+11/−11 lines, 2 filesdep ~vector
Dependency ranges changed: vector
Files
- ffmpeg-light.cabal +3/−3
- src/Codec/FFmpeg/Encode.hs +8/−8
ffmpeg-light.cabal view
@@ -1,5 +1,5 @@ name: ffmpeg-light-version: 0.11.1+version: 0.11.3 synopsis: Minimal bindings to the FFmpeg library. description: Stream frames from an encoded video, or stream frames to@@ -15,7 +15,7 @@ > go = do (getFrame, cleanup) <- imageReader "myVideo.mov" > (fmap ImageRGB8 <$> getFrame) <* cleanup .- Tested with FFmpeg 2.7 - 3.0+ Tested with FFmpeg 3.1 license: BSD3 license-file: LICENSE@@ -59,7 +59,7 @@ build-depends: base >=4.6 && < 4.10, either, exceptions,- vector >= 0.10.9 && < 0.12,+ vector >= 0.10.9 && < 0.13, transformers >= 0.4.1 && < 0.6, mtl >= 2.2.1 && < 2.3, JuicyPixels >= 3.1 && < 3.3
src/Codec/FFmpeg/Encode.hs view
@@ -2,7 +2,7 @@ -- | Video encoding API. Includes FFI declarations for the underlying -- FFmpeg functions, wrappers for these functions that wrap error -- condition checking, and high level Haskellized interfaces.--- +-- -- Note: If you need to import this module, consider qualifying the -- import. module Codec.FFmpeg.Encode where@@ -97,7 +97,7 @@ -- * FFmpeg Encoding Interface -- | Minimal parameters describing the desired video output.-data EncodingParams = +data EncodingParams = EncodingParams { epWidth :: CInt , epHeight :: CInt , epFps :: Int@@ -155,7 +155,7 @@ ctx <- getCodecContext st setWidth ctx (epWidth ep) setHeight ctx (epHeight ep)- -- setTimeBase ctx framePeriod+ setTimeBase ctx framePeriod setPixelFormat ctx $ case epPixelFormat ep of Just fmt -> fmt Nothing@@ -164,9 +164,9 @@ | otherwise -> avPixFmtYuv420p -- Some formats want stream headers to be separate- needsHeader <- checkFlag avfmtGlobalheader <$> + needsHeader <- checkFlag avfmtGlobalheader <$> (getOutputFormat oc >>= getFormatFlags)- when needsHeader $ + when needsHeader $ getCodecFlags ctx >>= setCodecFlags ctx . (.|. codecFlagGlobalHeader) -- _ <- withCString "vprofile" $ \kStr ->@@ -206,7 +206,7 @@ allocOutputContext :: FilePath -> IO AVFormatContext allocOutputContext fname = do oc <- alloca $ \ocTmp -> do- r <- withCString fname $ \fname' -> + r <- withCString fname $ \fname' -> avformat_alloc_output_context ocTmp (AVOutputFormat nullPtr) nullPtr fname'@@ -282,7 +282,7 @@ -- result is packed such that the BGRA palette is laid out -- contiguously following the palettized image data. palettizeJuicy :: EncodingParams -> V.Vector CUChar -> V.Vector CUChar-palettizeJuicy ep pix = +palettizeJuicy ep pix = let (pix', pal) = palettize (PaletteOptions MedianMeanCut doDither 256) (mkImage $ V.unsafeCast pix) pal' = V.map (\(V3 r g b) -> V4 b g r (255::CUChar))@@ -296,7 +296,7 @@ -- format, resolution, and pixel data). If this function is applied to -- 'Nothing', then the output stream is closed. Note that 'Nothing' -- /must/ be provided to properly terminate video encoding.--- +-- -- Support for source images that are of a different size to the -- output resolution is limited to non-palettized destination formats -- (i.e. those that are handled by @libswscaler@). Practically, this