2011-04-28 17:20:58 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2011-04-28 17:20:58 +00:00
|
|
|
*/
|
|
|
|
|
2011-10-31 01:23:21 +00:00
|
|
|
#ifndef __GST_VIDEO_META_H__
|
|
|
|
#define __GST_VIDEO_META_H__
|
2011-04-28 17:20:58 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
#define GST_VIDEO_META_API_TYPE (gst_video_meta_api_get_type())
|
2011-10-31 01:23:21 +00:00
|
|
|
#define GST_VIDEO_META_INFO (gst_video_meta_get_info())
|
|
|
|
typedef struct _GstVideoMeta GstVideoMeta;
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2013-04-01 08:21:00 +00:00
|
|
|
#define GST_CAPS_FEATURE_META_GST_VIDEO_META "meta:GstVideoMeta"
|
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
#define GST_VIDEO_CROP_META_API_TYPE (gst_video_crop_meta_api_get_type())
|
2011-10-31 01:23:21 +00:00
|
|
|
#define GST_VIDEO_CROP_META_INFO (gst_video_crop_meta_get_info())
|
|
|
|
typedef struct _GstVideoCropMeta GstVideoCropMeta;
|
2011-06-23 07:30:19 +00:00
|
|
|
|
2011-04-28 17:20:58 +00:00
|
|
|
/**
|
2011-10-31 01:23:21 +00:00
|
|
|
* GstVideoMeta:
|
2011-04-28 17:20:58 +00:00
|
|
|
* @meta: parent #GstMeta
|
2011-08-22 13:57:30 +00:00
|
|
|
* @buffer: the buffer this metadata belongs to
|
2011-04-28 17:20:58 +00:00
|
|
|
* @flags: additional video flags
|
2011-08-22 13:57:30 +00:00
|
|
|
* @format: the video format
|
2011-08-24 11:52:20 +00:00
|
|
|
* @id: identifier of the frame
|
2011-08-22 13:57:30 +00:00
|
|
|
* @width: the video width
|
|
|
|
* @height: the video height
|
2011-04-28 17:20:58 +00:00
|
|
|
* @n_planes: the number of planes in the image
|
2012-02-23 15:28:29 +00:00
|
|
|
* @offset: array of offsets for the planes. This field might not always be
|
|
|
|
* valid, it is used by the default implementation of @map.
|
|
|
|
* @stride: array of strides for the planes. This field might not always be
|
|
|
|
* valid, it is used by the default implementation of @map.
|
2011-04-28 17:20:58 +00:00
|
|
|
* @map: map the memory of a plane
|
|
|
|
* @unmap: unmap the memory of a plane
|
|
|
|
*
|
|
|
|
* Extra buffer metadata describing image properties
|
|
|
|
*/
|
2011-10-31 01:23:21 +00:00
|
|
|
struct _GstVideoMeta {
|
2011-07-04 08:19:13 +00:00
|
|
|
GstMeta meta;
|
2011-04-28 17:20:58 +00:00
|
|
|
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
2012-04-19 12:14:35 +00:00
|
|
|
GstVideoFrameFlags flags;
|
2011-04-28 17:20:58 +00:00
|
|
|
GstVideoFormat format;
|
2011-08-24 11:52:20 +00:00
|
|
|
gint id;
|
2011-04-28 17:20:58 +00:00
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
|
|
|
|
guint n_planes;
|
2011-06-20 09:25:58 +00:00
|
|
|
gsize offset[GST_VIDEO_MAX_PLANES];
|
|
|
|
gint stride[GST_VIDEO_MAX_PLANES];
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2012-02-23 15:28:29 +00:00
|
|
|
gboolean (*map) (GstVideoMeta *meta, guint plane, GstMapInfo *info,
|
|
|
|
gpointer *data, gint * stride, GstMapFlags flags);
|
2012-01-20 15:11:54 +00:00
|
|
|
gboolean (*unmap) (GstVideoMeta *meta, guint plane, GstMapInfo *info);
|
2011-04-28 17:20:58 +00:00
|
|
|
};
|
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
GType gst_video_meta_api_get_type (void);
|
2011-10-31 01:23:21 +00:00
|
|
|
const GstMetaInfo * gst_video_meta_get_info (void);
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
#define gst_buffer_get_video_meta(b) ((GstVideoMeta*)gst_buffer_get_meta((b),GST_VIDEO_META_API_TYPE))
|
2011-10-31 01:23:21 +00:00
|
|
|
GstVideoMeta * gst_buffer_get_video_meta_id (GstBuffer *buffer, gint id);
|
2011-08-24 11:52:20 +00:00
|
|
|
|
2012-04-19 12:14:35 +00:00
|
|
|
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,
|
2011-06-20 09:25:58 +00:00
|
|
|
guint n_planes, gsize offset[GST_VIDEO_MAX_PLANES],
|
|
|
|
gint stride[GST_VIDEO_MAX_PLANES]);
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2012-01-20 15:11:54 +00:00
|
|
|
gboolean gst_video_meta_map (GstVideoMeta *meta, guint plane, GstMapInfo *info,
|
2012-02-23 15:28:29 +00:00
|
|
|
gpointer *data, gint *stride, GstMapFlags flags);
|
2012-01-20 15:11:54 +00:00
|
|
|
gboolean gst_video_meta_unmap (GstVideoMeta *meta, guint plane, GstMapInfo *info);
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2011-06-23 07:30:19 +00:00
|
|
|
/**
|
2011-10-31 01:23:21 +00:00
|
|
|
* GstVideoCropMeta:
|
2011-06-23 07:30:19 +00:00
|
|
|
* @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.
|
|
|
|
*/
|
2011-10-31 01:23:21 +00:00
|
|
|
struct _GstVideoCropMeta {
|
2011-06-23 07:30:19 +00:00
|
|
|
GstMeta meta;
|
|
|
|
|
|
|
|
guint x;
|
|
|
|
guint y;
|
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
};
|
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
GType gst_video_crop_meta_api_get_type (void);
|
2011-10-31 01:23:21 +00:00
|
|
|
const GstMetaInfo * gst_video_crop_meta_get_info (void);
|
2011-06-23 07:30:19 +00:00
|
|
|
|
2012-02-29 16:25:10 +00:00
|
|
|
#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_API_TYPE))
|
2011-10-31 01:23:21 +00:00
|
|
|
#define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))
|
2011-04-28 17:20:58 +00:00
|
|
|
|
2012-03-06 11:52:01 +00:00
|
|
|
/* video metadata transforms */
|
2012-03-02 12:04:26 +00:00
|
|
|
|
|
|
|
GQuark gst_video_meta_transform_scale_get_quark (void);
|
|
|
|
/**
|
|
|
|
* gst_video_meta_transform_scale:
|
|
|
|
*
|
|
|
|
* GQuark for the video "gst-video-scale" transform.
|
|
|
|
*/
|
|
|
|
#define GST_VIDEO_META_TRANSFORM_IS_SCALE(type) ((type) == gst_video_meta_transform_scale_get_quark())
|
|
|
|
|
|
|
|
/**
|
2012-03-06 11:52:01 +00:00
|
|
|
* GstVideoMetaTransform:
|
2013-05-17 13:40:50 +00:00
|
|
|
* @in_info: the input #GstVideoInfo
|
|
|
|
* @out_info: the output #GstVideoInfo
|
2012-03-02 12:04:26 +00:00
|
|
|
*
|
2012-03-06 11:52:01 +00:00
|
|
|
* Extra data passed to a video transform #GstMetaTransformFunction such as:
|
|
|
|
* "gst-video-scale".
|
2012-03-02 12:04:26 +00:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2012-03-06 11:52:01 +00:00
|
|
|
GstVideoInfo *in_info;
|
|
|
|
GstVideoInfo *out_info;
|
|
|
|
} GstVideoMetaTransform;
|
2012-03-02 12:04:26 +00:00
|
|
|
|
2013-04-17 08:35:22 +00:00
|
|
|
/**
|
|
|
|
* GstVideoGLTextureType:
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE: Luminance texture, GL_LUMINANCE
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA: Luminance-alpha texture, GL_LUMINANCE_ALPHA
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_RGB16: RGB 565 texture, GL_RGB
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_RGB: RGB texture, GL_RGB
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_RGBA: RGBA texture, GL_RGBA
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_R: R texture, GL_RED_EXT
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_TYPE_RG: RG texture, GL_RG_EXT
|
|
|
|
*
|
|
|
|
* The GL texture type.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_RGB16,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_RGB,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_R,
|
|
|
|
GST_VIDEO_GL_TEXTURE_TYPE_RG
|
|
|
|
} GstVideoGLTextureType;
|
|
|
|
|
2013-09-09 13:52:05 +00:00
|
|
|
/**
|
|
|
|
* GstVideoGLTextureOrientation:
|
2013-04-17 08:35:22 +00:00
|
|
|
* @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL: Top line first in memory, left row first
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP: Bottom line first in memory, left row first
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL: Top line first in memory, right row first
|
|
|
|
* @GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP: Bottom line first in memory, right row first
|
|
|
|
*
|
|
|
|
* The orientation of the GL texture.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL,
|
|
|
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP,
|
|
|
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL,
|
|
|
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP
|
|
|
|
} GstVideoGLTextureOrientation;
|
|
|
|
|
2013-03-29 13:46:00 +00:00
|
|
|
#define GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE (gst_video_gl_texture_upload_meta_api_get_type())
|
|
|
|
#define GST_VIDEO_GL_TEXTURE_UPLOAD_META_INFO (gst_video_gl_texture_upload_meta_get_info())
|
|
|
|
|
|
|
|
typedef struct _GstVideoGLTextureUploadMeta GstVideoGLTextureUploadMeta;
|
2013-04-17 08:35:22 +00:00
|
|
|
typedef gboolean (*GstVideoGLTextureUpload) (GstVideoGLTextureUploadMeta *meta, guint texture_id[4]);
|
2013-03-29 13:46:00 +00:00
|
|
|
|
2013-04-01 08:21:00 +00:00
|
|
|
#define GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META "meta:GstVideoGLTextureUploadMeta"
|
|
|
|
|
2013-11-21 11:54:42 +00:00
|
|
|
/**
|
|
|
|
* GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META:
|
|
|
|
*
|
|
|
|
* An option that can be activated on a bufferpool to request gl texture upload
|
|
|
|
* meta on buffers from the pool.
|
|
|
|
*
|
|
|
|
* When this option is enabled on the bufferpool,
|
|
|
|
* @GST_BUFFER_POOL_OPTION_VIDEO_META should also be enabled.
|
|
|
|
*
|
|
|
|
* Since: 1.2.2
|
|
|
|
*/
|
|
|
|
#define GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META "GstBufferPoolOptionVideoGLTextureUploadMeta"
|
|
|
|
|
2013-03-29 13:46:00 +00:00
|
|
|
/**
|
|
|
|
* GstVideoGLTextureUploadMeta:
|
|
|
|
* @meta: parent #GstMeta
|
2013-04-17 08:35:22 +00:00
|
|
|
* @texture_orientation: Orientation of the textures
|
|
|
|
* @n_textures: Number of textures that are generated
|
|
|
|
* @texture_type: Type of each texture
|
2013-03-29 13:46:00 +00:00
|
|
|
*
|
|
|
|
* Extra buffer metadata for uploading a buffer to an OpenGL texture
|
|
|
|
* ID. The caller of gst_video_gl_texture_upload_meta_upload() must
|
|
|
|
* have OpenGL set up and call this from a thread where it is valid
|
|
|
|
* to upload something to an OpenGL texture.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _GstVideoGLTextureUploadMeta {
|
|
|
|
GstMeta meta;
|
|
|
|
|
2013-04-17 08:35:22 +00:00
|
|
|
GstVideoGLTextureOrientation texture_orientation;
|
|
|
|
guint n_textures;
|
|
|
|
GstVideoGLTextureType texture_type[4];
|
|
|
|
|
|
|
|
/* <private> */
|
2013-03-29 13:46:00 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
GstVideoGLTextureUpload upload;
|
|
|
|
|
|
|
|
gpointer user_data;
|
2013-03-29 15:37:01 +00:00
|
|
|
GBoxedCopyFunc user_data_copy;
|
|
|
|
GBoxedFreeFunc user_data_free;
|
2013-03-29 13:46:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_video_gl_texture_upload_meta_api_get_type (void);
|
|
|
|
const GstMetaInfo * gst_video_gl_texture_upload_meta_get_info (void);
|
|
|
|
|
2013-07-12 07:37:51 +00:00
|
|
|
#define gst_buffer_get_video_gl_texture_upload_meta(b) ((GstVideoGLTextureUploadMeta*)gst_buffer_get_meta((b),GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE))
|
|
|
|
GstVideoGLTextureUploadMeta *
|
|
|
|
gst_buffer_add_video_gl_texture_upload_meta (GstBuffer *buffer,
|
|
|
|
GstVideoGLTextureOrientation texture_orientation,
|
|
|
|
guint n_textures,
|
|
|
|
GstVideoGLTextureType texture_type[4],
|
|
|
|
GstVideoGLTextureUpload upload,
|
|
|
|
gpointer user_data,
|
|
|
|
GBoxedCopyFunc user_data_copy,
|
|
|
|
GBoxedFreeFunc user_data_free);
|
|
|
|
gboolean gst_video_gl_texture_upload_meta_upload (GstVideoGLTextureUploadMeta *meta,
|
|
|
|
guint texture_id[4]);
|
|
|
|
|
2013-07-16 08:04:00 +00:00
|
|
|
|
|
|
|
/**
|
2013-09-09 13:52:05 +00:00
|
|
|
* GstVideoRegionOfInterestMeta:
|
2013-07-16 08:04:00 +00:00
|
|
|
* @meta: parent #GstMeta
|
|
|
|
* @roi_type: GQuark describing the semantic of the Roi (f.i. a face, a pedestrian)
|
|
|
|
* @id: identifier of this particular ROI
|
|
|
|
* @parent_id: identifier of its parent ROI, used f.i. for ROI hierarchisation.
|
|
|
|
* @x: x component of upper-left corner
|
|
|
|
* @y: y component of upper-left corner
|
2014-08-14 15:04:45 +00:00
|
|
|
* @w: bounding box width
|
|
|
|
* @h: bounding box height
|
2013-07-16 08:04:00 +00:00
|
|
|
*
|
|
|
|
* Extra buffer metadata describing an image region of interest
|
|
|
|
*/
|
2013-07-16 08:09:27 +00:00
|
|
|
typedef struct {
|
2013-07-16 08:04:00 +00:00
|
|
|
GstMeta meta;
|
2013-07-16 08:09:27 +00:00
|
|
|
|
2013-07-16 08:04:00 +00:00
|
|
|
GQuark roi_type;
|
|
|
|
gint id;
|
|
|
|
gint parent_id;
|
|
|
|
|
|
|
|
guint x;
|
|
|
|
guint y;
|
|
|
|
guint w;
|
|
|
|
guint h;
|
2013-08-21 10:20:28 +00:00
|
|
|
} GstVideoRegionOfInterestMeta;
|
2013-07-16 08:04:00 +00:00
|
|
|
|
|
|
|
GType gst_video_region_of_interest_meta_api_get_type (void);
|
|
|
|
#define GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE (gst_video_region_of_interest_meta_api_get_type())
|
|
|
|
const GstMetaInfo *gst_video_region_of_interest_meta_get_info (void);
|
|
|
|
#define GST_VIDEO_REGION_OF_INTEREST_META_INFO (gst_video_region_of_interest_meta_get_info())
|
|
|
|
|
|
|
|
#define gst_buffer_get_video_region_of_interest_meta(b) \
|
|
|
|
((GstVideoRegionOfInterestMeta*)gst_buffer_get_meta((b),GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE))
|
2013-07-16 08:09:27 +00:00
|
|
|
GstVideoRegionOfInterestMeta *gst_buffer_get_video_region_of_interest_meta_id (GstBuffer * buffer,
|
|
|
|
gint id);
|
|
|
|
GstVideoRegionOfInterestMeta *gst_buffer_add_video_region_of_interest_meta (GstBuffer * buffer,
|
|
|
|
const gchar * roi_type,
|
|
|
|
guint x,
|
|
|
|
guint y,
|
|
|
|
guint w,
|
|
|
|
guint h);
|
|
|
|
GstVideoRegionOfInterestMeta *gst_buffer_add_video_region_of_interest_meta_id (GstBuffer * buffer,
|
|
|
|
GQuark roi_type,
|
|
|
|
guint x,
|
|
|
|
guint y,
|
|
|
|
guint w,
|
|
|
|
guint h);
|
2013-07-16 08:04:00 +00:00
|
|
|
|
2011-04-28 17:20:58 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2011-10-31 01:23:21 +00:00
|
|
|
#endif /* __GST_VIDEO_META_H__ */
|