meta: add video crop metadata
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 23 Jun 2011 07:30:19 +0000 (09:30 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 23 Jun 2011 07:30:19 +0000 (09:30 +0200)
gst-libs/gst/video/gstmetavideo.c
gst-libs/gst/video/gstmetavideo.h

index 8f0df5c..9ff221a 100644 (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;
+}
index eb69b19..a0401e5 100644 (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