Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A video frame obtained from videoFrameMap
- newtype VideoFrame = VideoFrame (ManagedPtr VideoFrame)
- newZeroVideoFrame :: MonadIO m => m VideoFrame
- noVideoFrame :: Maybe VideoFrame
- data VideoFrameCopyMethodInfo
- videoFrameCopy :: (HasCallStack, MonadIO m) => VideoFrame -> VideoFrame -> m Bool
- data VideoFrameCopyPlaneMethodInfo
- videoFrameCopyPlane :: (HasCallStack, MonadIO m) => VideoFrame -> VideoFrame -> Word32 -> m Bool
- data VideoFrameMapMethodInfo
- videoFrameMap :: (HasCallStack, MonadIO m) => VideoFrame -> VideoInfo -> Buffer -> [MapFlags] -> m Bool
- data VideoFrameMapIdMethodInfo
- videoFrameMapId :: (HasCallStack, MonadIO m) => VideoFrame -> VideoInfo -> Buffer -> Int32 -> [MapFlags] -> m Bool
- data VideoFrameUnmapMethodInfo
- videoFrameUnmap :: (HasCallStack, MonadIO m) => VideoFrame -> m ()
- clearVideoFrameBuffer :: MonadIO m => VideoFrame -> m ()
- getVideoFrameBuffer :: MonadIO m => VideoFrame -> m (Maybe Buffer)
- setVideoFrameBuffer :: MonadIO m => VideoFrame -> Ptr Buffer -> m ()
- videoFrame_buffer :: AttrLabelProxy "buffer"
- getVideoFrameFlags :: MonadIO m => VideoFrame -> m [VideoFrameFlags]
- setVideoFrameFlags :: MonadIO m => VideoFrame -> [VideoFrameFlags] -> m ()
- videoFrame_flags :: AttrLabelProxy "flags"
- getVideoFrameId :: MonadIO m => VideoFrame -> m Int32
- setVideoFrameId :: MonadIO m => VideoFrame -> Int32 -> m ()
- videoFrame_id :: AttrLabelProxy "id"
- getVideoFrameInfo :: MonadIO m => VideoFrame -> m VideoInfo
- videoFrame_info :: AttrLabelProxy "info"
- clearVideoFrameMeta :: MonadIO m => VideoFrame -> m ()
- getVideoFrameMeta :: MonadIO m => VideoFrame -> m (Ptr ())
- setVideoFrameMeta :: MonadIO m => VideoFrame -> Ptr () -> m ()
- videoFrame_meta :: AttrLabelProxy "meta"
Exported types
newtype VideoFrame Source #
newZeroVideoFrame :: MonadIO m => m VideoFrame Source #
Construct a VideoFrame
struct initialized to zero.
Methods
copy
data VideoFrameCopyMethodInfo Source #
((~) * signature (VideoFrame -> m Bool), MonadIO m) => MethodInfo * VideoFrameCopyMethodInfo VideoFrame signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> VideoFrame |
|
-> VideoFrame |
|
-> m Bool | Returns: TRUE if the contents could be copied. |
Copy the contents from src
to dest
.
copyPlane
data VideoFrameCopyPlaneMethodInfo Source #
((~) * signature (VideoFrame -> Word32 -> m Bool), MonadIO m) => MethodInfo * VideoFrameCopyPlaneMethodInfo VideoFrame signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> VideoFrame |
|
-> VideoFrame |
|
-> Word32 |
|
-> m Bool | Returns: TRUE if the contents could be copied. |
Copy the plane with index plane
from src
to dest
.
map
data VideoFrameMapMethodInfo Source #
((~) * signature (VideoInfo -> Buffer -> [MapFlags] -> m Bool), MonadIO m) => MethodInfo * VideoFrameMapMethodInfo VideoFrame signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> VideoFrame |
|
-> VideoInfo |
|
-> Buffer |
|
-> [MapFlags] |
|
-> m Bool | Returns: |
Use info
and buffer
to fill in the values of frame
. frame
is usually
allocated on the stack, and you will pass the address to the VideoFrame
structure allocated on the stack; videoFrameMap
will then fill in
the structures with the various video-specific information you need to access
the pixels of the video buffer. You can then use accessor macros such as
GST_VIDEO_FRAME_COMP_DATA()
, GST_VIDEO_FRAME_PLANE_DATA()
,
GST_VIDEO_FRAME_COMP_STRIDE()
, GST_VIDEO_FRAME_PLANE_STRIDE()
etc.
to get to the pixels.
C code
GstVideoFrame vframe; ... // set RGB pixels to black one at a time if (gst_video_frame_map (&vframe, video_info, video_buffer, GST_MAP_WRITE)) { guint8 *pixels = GST_VIDEO_FRAME_PLANE_DATA (vframe, 0); guint stride = GST_VIDEO_FRAME_PLANE_STRIDE (vframe, 0); guint pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (vframe, 0); for (h = 0; h < height; ++h) { for (w = 0; w < width; ++w) { guint8 *pixel = pixels + h * stride + w * pixel_stride; memset (pixel, 0, pixel_stride); } } gst_video_frame_unmap (&vframe); } ...
All video planes of buffer
will be mapped and the pointers will be set in
frame
->data.
The purpose of this function is to make it easy for you to get to the video
pixels in a generic way, without you having to worry too much about details
such as whether the video data is allocated in one contiguous memory chunk
or multiple memory chunks (e.g. one for each plane); or if custom strides
and custom plane offsets are used or not (as signalled by GstVideoMeta on
each buffer). This function will just fill the VideoFrame
structure
with the right values and if you use the accessor macros everything will
just work and you can access the data easily. It also maps the underlying
memory chunks for you.
mapId
data VideoFrameMapIdMethodInfo Source #
((~) * signature (VideoInfo -> Buffer -> Int32 -> [MapFlags] -> m Bool), MonadIO m) => MethodInfo * VideoFrameMapIdMethodInfo VideoFrame signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> VideoFrame |
|
-> VideoInfo |
|
-> Buffer |
|
-> Int32 |
|
-> [MapFlags] |
|
-> m Bool | Returns: |
Use info
and buffer
to fill in the values of frame
with the video frame
information of frame id
.
When id
is -1, the default frame is mapped. When id
!= -1, this function
will return False
when there is no GstVideoMeta with that id.
All video planes of buffer
will be mapped and the pointers will be set in
frame
->data.
unmap
data VideoFrameUnmapMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * VideoFrameUnmapMethodInfo VideoFrame signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> VideoFrame |
|
-> m () |
Unmap the memory previously mapped with gst_video_frame_map.
Properties
buffer
clearVideoFrameBuffer :: MonadIO m => VideoFrame -> m () Source #
getVideoFrameBuffer :: MonadIO m => VideoFrame -> m (Maybe Buffer) Source #
setVideoFrameBuffer :: MonadIO m => VideoFrame -> Ptr Buffer -> m () Source #
videoFrame_buffer :: AttrLabelProxy "buffer" Source #
flags
getVideoFrameFlags :: MonadIO m => VideoFrame -> m [VideoFrameFlags] Source #
setVideoFrameFlags :: MonadIO m => VideoFrame -> [VideoFrameFlags] -> m () Source #
videoFrame_flags :: AttrLabelProxy "flags" Source #
id
getVideoFrameId :: MonadIO m => VideoFrame -> m Int32 Source #
setVideoFrameId :: MonadIO m => VideoFrame -> Int32 -> m () Source #
videoFrame_id :: AttrLabelProxy "id" Source #
info
getVideoFrameInfo :: MonadIO m => VideoFrame -> m VideoInfo Source #
videoFrame_info :: AttrLabelProxy "info" Source #
meta
clearVideoFrameMeta :: MonadIO m => VideoFrame -> m () Source #
getVideoFrameMeta :: MonadIO m => VideoFrame -> m (Ptr ()) Source #
setVideoFrameMeta :: MonadIO m => VideoFrame -> Ptr () -> m () Source #
videoFrame_meta :: AttrLabelProxy "meta" Source #