gstreamermm  1.10.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Gst::VideoFrame Class Reference

#include <gstreamermm/videoframe.h>

Public Member Functions

 VideoFrame ()
 
 VideoFrame (const GstVideoFrame* gobject)
 
GstVideoFrame* gobj ()
 Provides access to the underlying C instance. More...
 
const GstVideoFrame* gobj () const
 Provides access to the underlying C instance. More...
 
bool map (const Gst::VideoInfo& info, const Glib::RefPtr< Gst::Buffer >& buffer, Gst::MapFlags flags)
 Use info and buffer to fill in the values of frame. More...
 
bool map_id (const Gst::VideoInfo& info, const Glib::RefPtr< Gst::Buffer >& buffer, gint id, Gst::MapFlags flags)
 Use info and buffer to fill in the values of frame with the video frame information of frame id. More...
 
void unmap ()
 Unmap the memory previously mapped with gst_video_frame_map. More...
 
void set_info (const Gst::VideoInfo& value)
 
Gst::VideoInfo get_info () const
 
void set_flags (const Gst::VideoFrameFlags& value)
 
Gst::VideoFrameFlags get_flags () const
 
void set_buffer (const Glib::RefPtr< Gst::Buffer >& value)
 
Glib::RefPtr< Gst::Bufferget_buffer () const
 
void set_meta (const gpointer& value)
 
gpointer get_meta () const
 
void set_id (const gint& value)
 
gint get_id () const
 

Static Public Member Functions

static bool copy (const Gst::VideoFrame& dest, const Gst::VideoFrame& src)
 Copy the contents from src to dest. More...
 
static bool copy_plane (const Gst::VideoFrame& dest, const Gst::VideoFrame& src, guint plane)
 Copy the plane with index plane from src to dest. More...
 

Protected Attributes

GstVideoFrame gobject_
 

Constructor & Destructor Documentation

◆ VideoFrame() [1/2]

Gst::VideoFrame::VideoFrame ( )

◆ VideoFrame() [2/2]

Gst::VideoFrame::VideoFrame ( const GstVideoFrame *  gobject)
explicit

Member Function Documentation

◆ copy()

static bool Gst::VideoFrame::copy ( const Gst::VideoFrame dest,
const Gst::VideoFrame src 
)
static

Copy the contents from src to dest.

Parameters
destA Gst::VideoFrame.
srcA Gst::VideoFrame.
Returns
true if the contents could be copied.

◆ copy_plane()

static bool Gst::VideoFrame::copy_plane ( const Gst::VideoFrame dest,
const Gst::VideoFrame src,
guint  plane 
)
static

Copy the plane with index plane from src to dest.

Parameters
destA Gst::VideoFrame.
srcA Gst::VideoFrame.
planeA plane.
Returns
true if the contents could be copied.

◆ get_buffer()

Glib::RefPtr<Gst::Buffer> Gst::VideoFrame::get_buffer ( ) const

◆ get_flags()

Gst::VideoFrameFlags Gst::VideoFrame::get_flags ( ) const

◆ get_id()

gint Gst::VideoFrame::get_id ( ) const

◆ get_info()

Gst::VideoInfo Gst::VideoFrame::get_info ( ) const

◆ get_meta()

gpointer Gst::VideoFrame::get_meta ( ) const

◆ gobj() [1/2]

GstVideoFrame* Gst::VideoFrame::gobj ( )
inline

Provides access to the underlying C instance.

◆ gobj() [2/2]

const GstVideoFrame* Gst::VideoFrame::gobj ( ) const
inline

Provides access to the underlying C instance.

◆ map()

bool Gst::VideoFrame::map ( const Gst::VideoInfo info,
const Glib::RefPtr< Gst::Buffer >&  buffer,
Gst::MapFlags  flags 
)

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 Gst::VideoFrame structure allocated on the stack; map() 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 example ellipted]

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 Gst::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.

Parameters
infoA Gst::VideoInfo.
bufferThe buffer to map.
flagsGst::MapFlags.
Returns
true on success.

◆ map_id()

bool Gst::VideoFrame::map_id ( const Gst::VideoInfo info,
const Glib::RefPtr< Gst::Buffer >&  buffer,
gint  id,
Gst::MapFlags  flags 
)

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.

Parameters
infoA Gst::VideoInfo.
bufferThe buffer to map.
idThe frame id to map.
flagsGst::MapFlags.
Returns
true on success.

◆ set_buffer()

void Gst::VideoFrame::set_buffer ( const Glib::RefPtr< Gst::Buffer >&  value)

◆ set_flags()

void Gst::VideoFrame::set_flags ( const Gst::VideoFrameFlags value)

◆ set_id()

void Gst::VideoFrame::set_id ( const gint &  value)

◆ set_info()

void Gst::VideoFrame::set_info ( const Gst::VideoInfo value)

◆ set_meta()

void Gst::VideoFrame::set_meta ( const gpointer &  value)

◆ unmap()

void Gst::VideoFrame::unmap ( )

Unmap the memory previously mapped with gst_video_frame_map.

Member Data Documentation

◆ gobject_

GstVideoFrame Gst::VideoFrame::gobject_
protected