gstvideometa

gstvideometa

Synopsis

#include <>gst/video/gstvideometa.h>

struct              GstVideoMeta;
gboolean            gst_video_meta_map                  (GstVideoMeta *meta,
                                                         guint plane,
                                                         GstMapInfo *info,
                                                         gpointer *data,
                                                         gint *stride,
                                                         GstMapFlags flags);
gboolean            gst_video_meta_unmap                (GstVideoMeta *meta,
                                                         guint plane,
                                                         GstMapInfo *info);
const GstMetaInfo * gst_video_meta_get_info             (void);
GstVideoMeta *      gst_buffer_add_video_meta           (GstBuffer *buffer,
                                                         GstVideoFrameFlags flags,
                                                         GstVideoFormat format,
                                                         guint width,
                                                         guint height);
GstVideoMeta *      gst_buffer_add_video_meta_full      (GstBuffer *buffer,
                                                         GstVideoFrameFlags flags,
                                                         GstVideoFormat format,
                                                         guint width,
                                                         guint height,
                                                         guint n_planes,
                                                         gsize offset[GST_VIDEO_MAX_PLANES],
                                                         gint stride[GST_VIDEO_MAX_PLANES]);
#define             gst_buffer_get_video_meta           (b)
GstVideoMeta *      gst_buffer_get_video_meta_id        (GstBuffer *buffer,
                                                         gint id);
struct              GstVideoCropMeta;
#define             gst_buffer_add_video_crop_meta      (b)
#define             gst_buffer_get_video_crop_meta      (b)

Description

Details

struct GstVideoMeta

struct GstVideoMeta {
  GstMeta            meta;

  GstBuffer         *buffer;

  GstVideoFrameFlags flags;
  GstVideoFormat     format;
  gint               id;
  guint              width;
  guint              height;

  guint              n_planes;
  gsize              offset[GST_VIDEO_MAX_PLANES];
  gint               stride[GST_VIDEO_MAX_PLANES];

  gboolean (*map)    (GstVideoMeta *meta, guint plane, GstMapInfo *info,
                      gpointer *data, gint * stride, GstMapFlags flags);
  gboolean (*unmap)  (GstVideoMeta *meta, guint plane, GstMapInfo *info);
};

Extra buffer metadata describing image properties

GstMeta meta;

parent GstMeta

GstBuffer *buffer;

the buffer this metadata belongs to

GstVideoFrameFlags flags;

additional video flags

GstVideoFormat format;

the video format

gint id;

identifier of the frame

guint width;

the video width

guint height;

the video height

guint n_planes;

the number of planes in the image

gsize offset[GST_VIDEO_MAX_PLANES];

array of offsets for the planes. This field might not always be valid, it is used by the default implementation of map.

gint stride[GST_VIDEO_MAX_PLANES];

array of strides for the planes. This field might not always be valid, it is used by the default implementation of map.

map ()

map the memory of a plane

unmap ()

unmap the memory of a plane

gst_video_meta_map ()

gboolean            gst_video_meta_map                  (GstVideoMeta *meta,
                                                         guint plane,
                                                         GstMapInfo *info,
                                                         gpointer *data,
                                                         gint *stride,
                                                         GstMapFlags flags);

Map the video plane with index plane in meta and return a pointer to the first byte of the plane and the stride of the plane.

meta :

a GstVideoMeta

plane :

a plane

info :

a GstMapInfo

data :

the data of plane

stride :

the stride of plane

flags :

GstMapFlags

Returns :

TRUE if the map operation was successful.

gst_video_meta_unmap ()

gboolean            gst_video_meta_unmap                (GstVideoMeta *meta,
                                                         guint plane,
                                                         GstMapInfo *info);

Unmap a previously mapped plane with gst_video_meta_map().

meta :

a GstVideoMeta

plane :

a plane

info :

a GstMapInfo

Returns :

TRUE if the memory was successfully unmapped.

gst_video_meta_get_info ()

const GstMetaInfo * gst_video_meta_get_info             (void);

gst_buffer_add_video_meta ()

GstVideoMeta *      gst_buffer_add_video_meta           (GstBuffer *buffer,
                                                         GstVideoFrameFlags flags,
                                                         GstVideoFormat format,
                                                         guint width,
                                                         guint height);

Attaches GstVideoMeta metadata to buffer with the given parameters and the default offsets and strides for format and width x height.

This function calculates the default offsets and strides and then calls gst_buffer_add_video_meta_full() with them.

buffer :

a GstBuffer

flags :

GstVideoFrameFlags

format :

a GstVideoFormat

width :

the width

height :

the height

Returns :

the GstVideoMeta on buffer.

gst_buffer_add_video_meta_full ()

GstVideoMeta *      gst_buffer_add_video_meta_full      (GstBuffer *buffer,
                                                         GstVideoFrameFlags flags,
                                                         GstVideoFormat format,
                                                         guint width,
                                                         guint height,
                                                         guint n_planes,
                                                         gsize offset[GST_VIDEO_MAX_PLANES],
                                                         gint stride[GST_VIDEO_MAX_PLANES]);

Attaches GstVideoMeta metadata to buffer with the given parameters.

buffer :

a GstBuffer

flags :

GstVideoFrameFlags

format :

a GstVideoFormat

width :

the width

height :

the height

n_planes :

number of planes

offset :

offset of each plane

stride :

stride of each plane

Returns :

the GstVideoMeta on buffer.

gst_buffer_get_video_meta()

#define gst_buffer_get_video_meta(b) ((GstVideoMeta*)gst_buffer_get_meta((b),GST_VIDEO_META_API_TYPE))

gst_buffer_get_video_meta_id ()

GstVideoMeta *      gst_buffer_get_video_meta_id        (GstBuffer *buffer,
                                                         gint id);

Find the GstVideoMeta on buffer with the given id.

Buffers can contain multiple GstVideoMeta metadata items when dealing with multiview buffers.

buffer :

a GstBuffer

id :

a metadata id

Returns :

the GstVideoMeta with id or NULL when there is no such metadata on buffer.

struct GstVideoCropMeta

struct GstVideoCropMeta {
  GstMeta       meta;

  guint         x;
  guint         y;
  guint         width;
  guint         height;
};

Extra buffer metadata describing image cropping.

GstMeta meta;

parent GstMeta

guint x;

the horizontal offset

guint y;

the vertical offset

guint width;

the cropped width

guint height;

the cropped height

gst_buffer_add_video_crop_meta()

#define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))

gst_buffer_get_video_crop_meta()

#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_API_TYPE))