2 * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_VIDEO_META_H__
21 #define __GST_VIDEO_META_H__
25 #include <gst/video/video.h>
29 #define GST_VIDEO_META_API "GstVideoMeta"
30 #define GST_VIDEO_META_INFO (gst_video_meta_get_info())
31 typedef struct _GstVideoMeta GstVideoMeta;
33 #define GST_VIDEO_CROP_META_API "GstVideoCropMeta"
34 #define GST_VIDEO_CROP_META_INFO (gst_video_crop_meta_get_info())
35 typedef struct _GstVideoCropMeta GstVideoCropMeta;
39 * @meta: parent #GstMeta
40 * @buffer: the buffer this metadata belongs to
41 * @flags: additional video flags
42 * @format: the video format
43 * @id: identifier of the frame
44 * @width: the video width
45 * @height: the video height
46 * @n_planes: the number of planes in the image
47 * @offset: array of offsets for the planes
48 * @stride: array of strides for the planes
49 * @map: map the memory of a plane
50 * @unmap: unmap the memory of a plane
52 * Extra buffer metadata describing image properties
54 struct _GstVideoMeta {
60 GstVideoFormat format;
66 gsize offset[GST_VIDEO_MAX_PLANES];
67 gint stride[GST_VIDEO_MAX_PLANES];
69 gpointer (*map) (GstVideoMeta *meta, guint plane, gint *stride,
71 gboolean (*unmap) (GstVideoMeta *meta, guint plane, gpointer data);
74 const GstMetaInfo * gst_video_meta_get_info (void);
76 #define gst_buffer_get_video_meta(b) ((GstVideoMeta*)gst_buffer_get_meta((b),GST_VIDEO_META_INFO))
77 GstVideoMeta * gst_buffer_get_video_meta_id (GstBuffer *buffer, gint id);
79 GstVideoMeta * gst_buffer_add_video_meta (GstBuffer *buffer, GstVideoFlags flags,
80 GstVideoFormat format, guint width, guint height);
81 GstVideoMeta * gst_buffer_add_video_meta_full (GstBuffer *buffer, GstVideoFlags flags,
82 GstVideoFormat format, guint width, guint height,
83 guint n_planes, gsize offset[GST_VIDEO_MAX_PLANES],
84 gint stride[GST_VIDEO_MAX_PLANES]);
86 gpointer gst_video_meta_map (GstVideoMeta *meta, guint plane, gint *stride,
88 gboolean gst_video_meta_unmap (GstVideoMeta *meta, guint plane, gpointer data);
92 * @meta: parent #GstMeta
93 * @x: the horizontal offset
94 * @y: the vertical offset
95 * @width: the cropped width
96 * @height: the cropped height
98 * Extra buffer metadata describing image cropping.
100 struct _GstVideoCropMeta {
109 const GstMetaInfo * gst_video_crop_meta_get_info (void);
111 #define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_INFO))
112 #define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))
116 #endif /* __GST_VIDEO_META_H__ */