Safe Haskell | None |
---|
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.
- avformat_open_input :: Ptr AVFormatContext -> CString -> Ptr () -> Ptr (Ptr ()) -> IO CInt
- avformat_find_stream_info :: AVFormatContext -> Ptr () -> IO CInt
- av_find_best_stream :: AVFormatContext -> AVMediaType -> CInt -> CInt -> Ptr AVCodec -> CInt -> IO CInt
- avcodec_find_decoder :: AVCodecID -> IO AVCodec
- avcodec_find_decoder_by_name :: CString -> IO AVCodec
- avcodec_get_frame_defaults :: AVFrame -> IO ()
- avpicture_get_size :: AVPixelFormat -> CInt -> CInt -> IO CInt
- av_malloc :: CSize -> IO (Ptr ())
- av_read_frame :: AVFormatContext -> AVPacket -> IO CInt
- decode_video :: AVCodecContext -> AVFrame -> Ptr CInt -> AVPacket -> IO CInt
- close_input :: Ptr AVFormatContext -> IO ()
- openInput :: (MonadIO m, Error e, MonadError e m) => String -> m AVFormatContext
- frameAsPicture :: AVFrame -> AVPicture
- findDecoder :: (MonadIO m, Error e, MonadError e m) => String -> m AVCodec
- checkStreams :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> m ()
- findVideoStream :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> m (CInt, AVCodecContext, AVCodec)
- getDecoder :: (MonadIO m, Error e, MonadError e m) => AVCodecContext -> m AVCodec
- openCodec :: (MonadIO m, Error e, MonadError e m) => AVCodecContext -> AVCodec -> m AVDictionary
- read_frame_check :: AVFormatContext -> AVPacket -> IO ()
- frameReader :: (MonadIO m, Error e, MonadError e m) => FilePath -> m (IO (Maybe AVFrame), IO ())
- frameReaderT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO AVFrame, IO ())
- frameReaderTime :: (MonadIO m, Error e, MonadError e m) => FilePath -> m (IO (Maybe (AVFrame, Double)), IO ())
- frameReaderTimeT :: (Functor m, MonadIO m, Error e, MonadError e m) => FilePath -> m (MaybeT IO (AVFrame, Double), IO ())
- prepareReader :: (MonadIO m, Error e, MonadError e m) => AVFormatContext -> CInt -> AVCodecContext -> m (IO (Maybe AVFrame), IO ())
FFI Declarations
avformat_open_input :: Ptr AVFormatContext -> CString -> Ptr () -> Ptr (Ptr ()) -> IO CIntSource
avformat_find_stream_info :: AVFormatContext -> Ptr () -> IO CIntSource
av_find_best_stream :: AVFormatContext -> AVMediaType -> CInt -> CInt -> Ptr AVCodec -> CInt -> IO CIntSource
avcodec_get_frame_defaults :: AVFrame -> IO ()Source
avpicture_get_size :: AVPixelFormat -> CInt -> CInt -> IO CIntSource
av_read_frame :: AVFormatContext -> AVPacket -> IO CIntSource
decode_video :: AVCodecContext -> AVFrame -> Ptr CInt -> AVPacket -> IO CIntSource
close_input :: Ptr AVFormatContext -> IO ()Source
FFmpeg Decoding Interface
openInput :: (MonadIO m, Error e, MonadError e m) => String -> m AVFormatContextSource
Open an input media file.
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) => FilePath -> m (IO (Maybe AVFrame), IO ())Source
Read RGB frames 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) => FilePath -> m (IO (Maybe (AVFrame, Double)), IO ())Source
Read time stamped RGB frames 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 -> 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.