mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
videometa: Extend GstVideoGLTextureUploadMeta
https://bugzilla.gnome.org/show_bug.cgi?id=697112
This commit is contained in:
parent
e96ca66c36
commit
74f6376c53
2 changed files with 67 additions and 14 deletions
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "gstvideometa.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static gboolean
|
||||
gst_video_meta_transform (GstBuffer * dest, GstMeta * meta,
|
||||
GstBuffer * buffer, GQuark type, gpointer data)
|
||||
|
@ -430,6 +432,10 @@ gst_video_gl_texture_upload_meta_transform (GstBuffer * dest, GstMeta * meta,
|
|||
if (!dmeta)
|
||||
return FALSE;
|
||||
|
||||
dmeta->texture_orientation = smeta->texture_orientation;
|
||||
dmeta->n_textures = smeta->n_textures;
|
||||
memcpy (dmeta->texture_type, smeta->texture_type,
|
||||
sizeof (smeta->texture_type[0] * 4));
|
||||
dmeta->buffer = dest;
|
||||
dmeta->upload = smeta->upload;
|
||||
dmeta->user_data = smeta->user_data;
|
||||
|
@ -475,13 +481,16 @@ gst_video_gl_texture_upload_meta_get_info (void)
|
|||
*/
|
||||
GstVideoGLTextureUploadMeta *
|
||||
gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer,
|
||||
GstVideoGLTextureUpload upload, gpointer user_data,
|
||||
GBoxedCopyFunc user_data_copy, GBoxedFreeFunc user_data_free)
|
||||
GstVideoGLTextureOrientation texture_orientation, guint n_textures,
|
||||
GstVideoGLTextureType texture_type[4], GstVideoGLTextureUpload upload,
|
||||
gpointer user_data, GBoxedCopyFunc user_data_copy,
|
||||
GBoxedFreeFunc user_data_free)
|
||||
{
|
||||
GstVideoGLTextureUploadMeta *meta;
|
||||
|
||||
g_return_val_if_fail (buffer != NULL, NULL);
|
||||
g_return_val_if_fail (upload != NULL, NULL);
|
||||
g_return_val_if_fail (n_textures > 0 && n_textures < 5, NULL);
|
||||
|
||||
meta =
|
||||
(GstVideoGLTextureUploadMeta *) gst_buffer_add_meta (buffer,
|
||||
|
@ -490,6 +499,9 @@ gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer,
|
|||
if (!meta)
|
||||
return NULL;
|
||||
|
||||
meta->texture_orientation = texture_orientation;
|
||||
meta->n_textures = n_textures;
|
||||
memcpy (meta->texture_type, texture_type, sizeof (texture_type[0] * 4));
|
||||
meta->buffer = buffer;
|
||||
meta->upload = upload;
|
||||
meta->user_data = user_data;
|
||||
|
@ -502,8 +514,7 @@ gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer,
|
|||
/**
|
||||
* gst_video_gl_texture_upload_meta_upload:
|
||||
* @meta: a #GstVideoGLTextureUploadMeta
|
||||
* @format: the GL format of the texture, e.g. GL_RGBA
|
||||
* @texture_id: the texture ID to upload to
|
||||
* @texture_id: the texture IDs to upload to
|
||||
*
|
||||
* Uploads the buffer which owns the meta to a specific texture ID.
|
||||
*
|
||||
|
@ -511,9 +522,9 @@ gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer,
|
|||
*/
|
||||
gboolean
|
||||
gst_video_gl_texture_upload_meta_upload (GstVideoGLTextureUploadMeta * meta,
|
||||
guint format, guint texture_id)
|
||||
guint texture_id[4])
|
||||
{
|
||||
g_return_val_if_fail (meta != NULL, FALSE);
|
||||
|
||||
return meta->upload (meta, format, texture_id);
|
||||
return meta->upload (meta, texture_id);
|
||||
}
|
||||
|
|
|
@ -140,22 +140,59 @@ typedef struct {
|
|||
GstVideoInfo *out_info;
|
||||
} GstVideoMetaTransform;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/** GstVideoGLTextureOrientation:
|
||||
* @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;
|
||||
|
||||
#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;
|
||||
typedef gboolean (*GstVideoGLTextureUpload) (GstVideoGLTextureUploadMeta *meta, guint format, guint texture_id);
|
||||
typedef gboolean (*GstVideoGLTextureUpload) (GstVideoGLTextureUploadMeta *meta, guint texture_id[4]);
|
||||
|
||||
#define GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META "meta:GstVideoGLTextureUploadMeta"
|
||||
|
||||
/**
|
||||
* GstVideoGLTextureUploadMeta:
|
||||
* @meta: parent #GstMeta
|
||||
* @buffer: the buffer of this meta
|
||||
* @upload: the function to upload the buffer to a specific texture ID
|
||||
* @user_data: user data for the implementor of @upload
|
||||
* @user_data_copy: function to copy @user_data
|
||||
* @user_data_free: function to free @user_data
|
||||
* @texture_orientation: Orientation of the textures
|
||||
* @n_textures: Number of textures that are generated
|
||||
* @texture_type: Type of each texture
|
||||
*
|
||||
* Extra buffer metadata for uploading a buffer to an OpenGL texture
|
||||
* ID. The caller of gst_video_gl_texture_upload_meta_upload() must
|
||||
|
@ -166,6 +203,11 @@ typedef gboolean (*GstVideoGLTextureUpload) (GstVideoGLTextureUploadMeta *meta,
|
|||
struct _GstVideoGLTextureUploadMeta {
|
||||
GstMeta meta;
|
||||
|
||||
GstVideoGLTextureOrientation texture_orientation;
|
||||
guint n_textures;
|
||||
GstVideoGLTextureType texture_type[4];
|
||||
|
||||
/* <private> */
|
||||
GstBuffer *buffer;
|
||||
GstVideoGLTextureUpload upload;
|
||||
|
||||
|
@ -175,8 +217,8 @@ struct _GstVideoGLTextureUploadMeta {
|
|||
};
|
||||
|
||||
#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, GstVideoGLTextureUpload upload, gpointer user_data, GBoxedCopyFunc copy_user_data, GBoxedFreeFunc free_user_data);
|
||||
gboolean gst_video_gl_texture_upload_meta_upload (GstVideoGLTextureUploadMeta *meta, guint format, guint texture_id);
|
||||
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]);
|
||||
|
||||
GType gst_video_gl_texture_upload_meta_api_get_type (void);
|
||||
const GstMetaInfo * gst_video_gl_texture_upload_meta_get_info (void);
|
||||
|
|
Loading…
Reference in a new issue