meta: add video crop metadata

This commit is contained in:
Wim Taymans 2011-06-23 09:30:19 +02:00
parent 1a5d88b68c
commit d68f2d4694
2 changed files with 54 additions and 1 deletions

View file

@ -155,3 +155,30 @@ gst_meta_video_unmap (GstMetaVideo * meta, guint plane, gpointer data)
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;
}

View file

@ -28,9 +28,12 @@ G_BEGIN_DECLS
#define GST_META_API_VIDEO "GstMetaVideo"
#define GST_META_INFO_VIDEO (gst_meta_video_get_info())
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:
* @meta: parent #GstMeta
@ -76,6 +79,29 @@ gpointer gst_meta_video_map (GstMetaVideo *meta, guint plane, gint
GstMapFlags flags);
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