ffmpeg-light-0.13.0: Minimal bindings to the FFmpeg library.
Safe HaskellNone
LanguageHaskell2010

Codec.FFmpeg.Decode

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

openCamera :: (MonadIO m, MonadError String m) => String -> CameraConfig -> m AVFormatContext Source #

Open the first video input device enumerated by FFMPEG.

openFile :: (MonadIO m, MonadError String m) => String -> m AVFormatContext Source #

Open an input media file.

frameAsPicture :: AVFrame -> AVPicture Source #

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

findDecoder :: (MonadIO m, MonadError String m) => String -> m AVCodec Source #

Find a codec given by name.

checkStreams :: (MonadIO m, MonadError String 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, MonadError String m) => AVFormatContext -> m (CInt, AVCodecContext, AVCodec, AVStream) 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, MonadError String m) => AVCodecContext -> m AVCodec Source #

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

openCodec :: (MonadIO m, MonadError String m) => AVCodecContext -> AVCodec -> m AVDictionary Source #

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, MonadError String m) => AVPixelFormat -> InputSource -> m (IO (Maybe AVFrame), IO ()) Source #

Read frames of the given AVPixelFormat from a video stream.

frameReaderT :: (Functor m, MonadIO m, MonadError String m) => InputSource -> m (MaybeT IO AVFrame, IO ()) Source #

Read RGB frames with the result in the MaybeT transformer.

frameReaderT = fmap (first MaybeT) . frameReader

frameReaderTime :: (MonadIO m, MonadError String m) => AVPixelFormat -> InputSource -> 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, MonadError String m) => InputSource -> 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, MonadError String 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.