mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 10:42:22 +00:00
meta: add video crop metadata
This commit is contained in:
parent
1a5d88b68c
commit
d68f2d4694
2 changed files with 54 additions and 1 deletions
|
@ -155,3 +155,30 @@ gst_meta_video_unmap (GstMetaVideo * meta, guint plane, gpointer data)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GstMetaInfo *
|
||||||
|
gst_meta_video_crop_get_info (void)
|
||||||
|
{
|
||||||
|
static const GstMetaInfo *meta_video_crop_info = NULL;
|
||||||
|
|
||||||
|
if (meta_video_crop_info == NULL) {
|
||||||
|
meta_video_crop_info =
|
||||||
|
gst_meta_register (GST_META_API_VIDEO_CROP, "GstMetaVideoCrop",
|
||||||
|
sizeof (GstMetaVideoCrop), (GstMetaInitFunction) NULL,
|
||||||
|
(GstMetaFreeFunction) NULL, (GstMetaCopyFunction) NULL,
|
||||||
|
(GstMetaTransformFunction) NULL);
|
||||||
|
}
|
||||||
|
return meta_video_crop_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
GstMetaVideoCrop *
|
||||||
|
gst_buffer_add_meta_video_crop (GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
GstMetaVideoCrop *meta;
|
||||||
|
|
||||||
|
meta =
|
||||||
|
(GstMetaVideoCrop *) gst_buffer_add_meta (buffer,
|
||||||
|
GST_META_INFO_VIDEO_CROP, NULL);
|
||||||
|
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
|
@ -28,9 +28,12 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_META_API_VIDEO "GstMetaVideo"
|
#define GST_META_API_VIDEO "GstMetaVideo"
|
||||||
#define GST_META_INFO_VIDEO (gst_meta_video_get_info())
|
#define GST_META_INFO_VIDEO (gst_meta_video_get_info())
|
||||||
|
|
||||||
typedef struct _GstMetaVideo GstMetaVideo;
|
typedef struct _GstMetaVideo GstMetaVideo;
|
||||||
|
|
||||||
|
#define GST_META_API_VIDEO_CROP "GstMetaVideoCrop"
|
||||||
|
#define GST_META_INFO_VIDEO_CROP (gst_meta_video_crop_get_info())
|
||||||
|
typedef struct _GstMetaVideoCrop GstMetaVideoCrop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstMetaVideo:
|
* GstMetaVideo:
|
||||||
* @meta: parent #GstMeta
|
* @meta: parent #GstMeta
|
||||||
|
@ -76,6 +79,29 @@ gpointer gst_meta_video_map (GstMetaVideo *meta, guint plane, gint
|
||||||
GstMapFlags flags);
|
GstMapFlags flags);
|
||||||
gboolean gst_meta_video_unmap (GstMetaVideo *meta, guint plane, gpointer data);
|
gboolean gst_meta_video_unmap (GstMetaVideo *meta, guint plane, gpointer data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstMetaVideoCrop:
|
||||||
|
* @meta: parent #GstMeta
|
||||||
|
* @x: the horizontal offset
|
||||||
|
* @y: the vertical offset
|
||||||
|
* @width: the cropped width
|
||||||
|
* @height: the cropped height
|
||||||
|
*
|
||||||
|
* Extra buffer metadata describing image cropping.
|
||||||
|
*/
|
||||||
|
struct _GstMetaVideoCrop {
|
||||||
|
GstMeta meta;
|
||||||
|
|
||||||
|
guint x;
|
||||||
|
guint y;
|
||||||
|
guint width;
|
||||||
|
guint height;
|
||||||
|
};
|
||||||
|
|
||||||
|
const GstMetaInfo * gst_meta_video_crop_get_info (void);
|
||||||
|
|
||||||
|
#define gst_buffer_get_meta_video_crop(b) ((GstMetaVideoCrop*)gst_buffer_get_meta((b),GST_META_INFO_VIDEO_CROP))
|
||||||
|
GstMetaVideoCrop * gst_buffer_add_meta_video_crop (GstBuffer *buffer);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue