ffmpeg-light-0.6: Minimal bindings to the FFmpeg library.

Safe HaskellNone

Codec.FFmpeg.Decode

Contents

Description

Video decoding API. Includes FFI declarations for the underlying FFmpeg functions, wrappers for these functions that wrap error condition checking, and high level Haskellized interfaces.

Synopsis

FFI Declarations

FFmpeg Decoding Interface

openInput :: (MonadIO m, Error e, MonadError e m) => String -> m AVFormatContextSource

Open an input media file.

frameAsPicture :: AVFrame -> AVPictureSource

AVFrame is a superset of AVPicture, so we can upcast an AVFrame to an AVPicture.

findDecoder :: (MonadIO m, Error e, MonadError e m) => String -> m AVCodecSource

Find a codec given by name.

checkStreams :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> m ()Source

Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG.

findVideoStream :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> m (CInt, AVCodecContext, AVCodec)Source

Searches for a video stream in an AVFormatContext. If one is found, returns the index of the stream in the container, and its associated AVCodecContext and AVCodec.

getDecoder :: (MonadIO m, Error e, MonadError e m) => AVCodecContext -> m AVCodecSource

Find a registered decoder with a codec ID matching that found in the given AVCodecContext.

openCodec :: (MonadIO m, Error e, MonadError e m) => AVCodecContext -> AVCodec -> m AVDictionarySource

Initialize the given AVCodecContext to use the given AVCodec. **NOTE**: This function is not thread safe!

read_frame_check :: AVFormatContext -> AVPacket -> IO ()Source

Return the next frame of a stream.

frameReader :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe AVFrame), IO ())Source

Read frames of the given AVPixelFormat from a video stream.

frameReaderT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO AVFrame, IO ())Source

Read RGB frames with the result in the MaybeT transformer.

 frameReaderT = fmap (first MaybeT) . frameReader

frameReaderTime :: (MonadIO m, Error e, MonadError e m) => AVPixelFormat -> FilePath -> m (IO (Maybe (AVFrame, Double)), IO ())Source

Read time stamped frames of the given AVPixelFormat from a video stream. Time is given in seconds from the start of the stream.

frameReaderTimeT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO (AVFrame, Double), IO ())Source

Read time stamped RGB frames with the result in the MaybeT transformer.

 frameReaderT = fmap (first MaybeT) . frameReader

prepareReader :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> CInt -> AVPixelFormat -> AVCodecContext -> m (IO (Maybe AVFrame), IO ())Source

Construct an action that gets the next available frame, and an action to release all resources associated with this video stream.