mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
This commit is contained in:
parent
04f8c7d729
commit
956c4d0bde
31 changed files with 232 additions and 304 deletions
|
@ -1212,9 +1212,7 @@ GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE
|
|||
GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES
|
||||
GstGLFormat
|
||||
gst_gl_format_type_n_bytes
|
||||
gst_gl_texture_type_n_bytes
|
||||
gst_gl_format_from_gl_texture_type
|
||||
gst_gl_texture_type_from_format
|
||||
gst_gl_format_from_video_info
|
||||
gst_gl_sized_gl_format_from_gl_format_type
|
||||
gst_gl_texture_target_from_string
|
||||
gst_gl_texture_target_to_string
|
||||
|
@ -1331,7 +1329,7 @@ gst_gl_memory_texsubimage
|
|||
gst_gl_memory_get_texture_height
|
||||
gst_gl_memory_get_texture_id
|
||||
gst_gl_memory_get_texture_target
|
||||
gst_gl_memory_get_texture_type
|
||||
gst_gl_memory_get_texture_format
|
||||
gst_gl_memory_get_texture_width
|
||||
gst_gl_memory_setup_buffer
|
||||
<SUBSECTION Standard>
|
||||
|
@ -1441,7 +1439,7 @@ gst_gl_renderbuffer_allocation_params_new
|
|||
gst_gl_renderbuffer_allocation_params_new_wrapped
|
||||
gst_gl_renderbuffer_get_height
|
||||
gst_gl_renderbuffer_get_id
|
||||
gst_gl_renderbuffer_get_type
|
||||
gst_gl_renderbuffer_get_format
|
||||
gst_gl_renderbuffer_get_width
|
||||
gst_gl_renderbuffer_init_once
|
||||
gst_is_gl_renderbuffer
|
||||
|
|
|
@ -93,8 +93,7 @@ gst_gl_differencematte_gl_start (GstGLBaseFilter * base_filter)
|
|||
gst_gl_memory_allocator_get_default (context);
|
||||
params =
|
||||
(GstGLAllocationParams *) gst_gl_video_allocation_params_new (context,
|
||||
NULL, &filter->out_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, &filter->out_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
differencematte->midtexture[i] =
|
||||
|
@ -306,8 +305,7 @@ init_pixbuf_texture (GstGLDifferenceMatte * differencematte)
|
|||
differencematte->pbuf_width, differencematte->pbuf_height);
|
||||
params =
|
||||
(GstGLAllocationParams *) gst_gl_video_allocation_params_new (context,
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
|
||||
differencematte->newbgtexture =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (tex_alloc, params);
|
||||
|
@ -317,7 +315,7 @@ init_pixbuf_texture (GstGLDifferenceMatte * differencematte)
|
|||
params =
|
||||
(GstGLAllocationParams *) gst_gl_video_allocation_params_new (context,
|
||||
NULL, &filter->out_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
GST_GL_RGBA);
|
||||
|
||||
differencematte->savedbgtexture =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (tex_alloc, params);
|
||||
|
|
|
@ -286,8 +286,7 @@ gst_gl_effects_gl_start (GstGLBaseFilter * base_filter)
|
|||
gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
|
||||
params =
|
||||
(GstGLAllocationParams *) gst_gl_video_allocation_params_new (context,
|
||||
NULL, &filter->out_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, &filter->out_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
|
||||
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
||||
if (effects->midtexture[i])
|
||||
|
|
|
@ -688,8 +688,7 @@ gst_gl_overlay_load_jpeg (GstGLOverlay * overlay, FILE * fp)
|
|||
(GST_GL_BASE_FILTER (overlay)->context));
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (GST_GL_BASE_FILTER (overlay)->context,
|
||||
NULL, &v_info, 0, &v_align, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, &v_info, 0, &v_align, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
overlay->image_memory = (GstGLMemory *)
|
||||
gst_gl_base_memory_alloc (mem_allocator,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -804,8 +803,7 @@ gst_gl_overlay_load_png (GstGLOverlay * overlay, FILE * fp)
|
|||
(GST_GL_BASE_FILTER (overlay)->context));
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (GST_GL_BASE_FILTER (overlay)->context,
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
overlay->image_memory = (GstGLMemory *)
|
||||
gst_gl_base_memory_alloc (mem_allocator,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -393,7 +393,7 @@ gst_qt_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
|
|||
|
||||
glparams =
|
||||
gst_gl_video_allocation_params_new (qt_src->context, ¶ms, &vinfo, 0,
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
gst_buffer_pool_config_set_gl_allocation_params (config,
|
||||
(GstGLAllocationParams *) glparams);
|
||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) glparams);
|
||||
|
|
|
@ -144,7 +144,7 @@ _gst_egl_image_copy (GstMiniObject * obj)
|
|||
* gst_egl_image_new_wrapped:
|
||||
* @context: a #GstGLContext (must be an EGL context)
|
||||
* @image: the image to wrap
|
||||
* @type: the #GstVideoGLTextureType
|
||||
* @format: the #GstGLFormat
|
||||
* @user_data: user data
|
||||
* @user_data_destroy: called when @user_data is no longer needed
|
||||
*
|
||||
|
@ -152,7 +152,7 @@ _gst_egl_image_copy (GstMiniObject * obj)
|
|||
*/
|
||||
GstEGLImage *
|
||||
gst_egl_image_new_wrapped (GstGLContext * context, EGLImageKHR image,
|
||||
GstVideoGLTextureType type, gpointer user_data,
|
||||
GstGLFormat format, gpointer user_data,
|
||||
GstEGLImageDestroyNotify user_data_destroy)
|
||||
{
|
||||
GstEGLImage *img = NULL;
|
||||
|
@ -169,7 +169,7 @@ gst_egl_image_new_wrapped (GstGLContext * context, EGLImageKHR image,
|
|||
|
||||
img->context = gst_object_ref (context);
|
||||
img->image = image;
|
||||
img->type = type;
|
||||
img->format = format;
|
||||
|
||||
img->destroy_data = user_data;
|
||||
img->destroy_notify = user_data_destroy;
|
||||
|
@ -329,7 +329,7 @@ gst_egl_image_from_texture (GstGLContext * context, GstGLMemory * gl_mem,
|
|||
if (!img)
|
||||
return NULL;
|
||||
|
||||
return gst_egl_image_new_wrapped (context, img, gl_mem->tex_type, NULL,
|
||||
return gst_egl_image_new_wrapped (context, img, gl_mem->tex_format, NULL,
|
||||
(GstEGLImageDestroyNotify) _destroy_egl_image);
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ GstEGLImage *
|
|||
gst_egl_image_from_dmabuf (GstGLContext * context,
|
||||
gint dmabuf, GstVideoInfo * in_info, gint plane, gsize offset)
|
||||
{
|
||||
GstVideoGLTextureType type;
|
||||
GstGLFormat format;
|
||||
guintptr attribs[13];
|
||||
EGLImageKHR img;
|
||||
gint atti = 0;
|
||||
|
@ -426,9 +426,7 @@ gst_egl_image_from_dmabuf (GstGLContext * context,
|
|||
gint i;
|
||||
|
||||
fourcc = _drm_fourcc_from_info (in_info, plane);
|
||||
type =
|
||||
gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (in_info),
|
||||
plane);
|
||||
format = gst_gl_format_from_video_info (context, in_info, plane);
|
||||
|
||||
GST_DEBUG ("fourcc %.4s (%d) plane %d (%dx%d)",
|
||||
(char *) &fourcc, fourcc, plane,
|
||||
|
@ -461,7 +459,7 @@ gst_egl_image_from_dmabuf (GstGLContext * context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return gst_egl_image_new_wrapped (context, img, type, NULL,
|
||||
return gst_egl_image_new_wrapped (context, img, format, NULL,
|
||||
(GstEGLImageDestroyNotify) _destroy_egl_image);
|
||||
}
|
||||
#endif /* GST_GL_HAVE_DMABUF */
|
||||
|
|
|
@ -53,7 +53,7 @@ struct _GstEGLImage
|
|||
|
||||
GstGLContext *context;
|
||||
EGLImageKHR image;
|
||||
GstVideoGLTextureType type;
|
||||
GstGLFormat format;
|
||||
|
||||
/* <private> */
|
||||
gpointer destroy_data;
|
||||
|
@ -64,7 +64,7 @@ struct _GstEGLImage
|
|||
|
||||
GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context,
|
||||
EGLImageKHR image,
|
||||
GstVideoGLTextureType type,
|
||||
GstGLFormat format,
|
||||
gpointer user_data,
|
||||
GstEGLImageDestroyNotify user_data_destroy);
|
||||
EGLImageKHR gst_egl_image_get_image (GstEGLImage * image);
|
||||
|
|
|
@ -151,7 +151,7 @@ _gl_mem_egl_alloc (GstGLBaseMemoryAllocator * allocator,
|
|||
}
|
||||
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
|
||||
NULL, params->parent.context, params->target, params->tex_type,
|
||||
NULL, params->parent.context, params->target, params->tex_format,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ struct _GstGLColorConvertPrivate
|
|||
GstGLMemory *in_tex[GST_VIDEO_MAX_PLANES];
|
||||
GstGLMemory *out_tex[GST_VIDEO_MAX_PLANES];
|
||||
|
||||
GstVideoGLTextureType in_tex_types[GST_VIDEO_MAX_PLANES];
|
||||
GstGLFormat in_tex_formats[GST_VIDEO_MAX_PLANES];
|
||||
|
||||
GLuint vao;
|
||||
GLuint vertex_buffer;
|
||||
|
@ -1521,9 +1521,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
{
|
||||
char uv_val =
|
||||
convert->priv->in_tex_types[0] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char uv_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_YUY2_UYVY_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', uv_val,
|
||||
uv_val, 'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
|
@ -1533,9 +1531,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
}
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
{
|
||||
char y_val =
|
||||
convert->priv->in_tex_types[0] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char y_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_YUY2_UYVY_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, y_val, 'g',
|
||||
'g', 'r', 'b', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
|
@ -1545,9 +1541,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
}
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
{
|
||||
char val2 =
|
||||
convert->priv->in_tex_types[1] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_NV12_NV21_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
|
@ -1557,9 +1551,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
}
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
{
|
||||
char val2 =
|
||||
convert->priv->in_tex_types[1] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_NV12_NV21_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
|
@ -1733,9 +1725,7 @@ _GRAY_to_RGB (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_GRAY16_LE:
|
||||
{
|
||||
char val2 =
|
||||
convert->priv->in_tex_types[0] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_COMPOSE;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
|
@ -1743,9 +1733,7 @@ _GRAY_to_RGB (GstGLColorConvert * convert)
|
|||
}
|
||||
case GST_VIDEO_FORMAT_GRAY16_BE:
|
||||
{
|
||||
char val2 =
|
||||
convert->priv->in_tex_types[0] ==
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RG ? 'g' : 'a';
|
||||
char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_COMPOSE;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
|
@ -2195,8 +2183,8 @@ _do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert,
|
|||
mem_width = gst_gl_memory_get_texture_width (out_tex);
|
||||
mem_height = gst_gl_memory_get_texture_height (out_tex);
|
||||
|
||||
if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
|
||||
if (out_tex->tex_format == GST_GL_LUMINANCE
|
||||
|| out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
|
||||
|| out_width != mem_width || out_height != mem_height) {
|
||||
/* Luminance formats are not color renderable */
|
||||
/* renderering to a framebuffer only renders the intersection of all
|
||||
|
@ -2213,8 +2201,7 @@ _do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert,
|
|||
allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
|
||||
base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
|
||||
0, NULL, convert->priv->to_texture_target,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
0, NULL, convert->priv->to_texture_target, GST_GL_RGBA);
|
||||
|
||||
convert->priv->out_tex[j] =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
|
||||
|
@ -2258,8 +2245,8 @@ out:
|
|||
mem_width = gst_gl_memory_get_texture_width (out_tex);
|
||||
mem_height = gst_gl_memory_get_texture_height (out_tex);
|
||||
|
||||
if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
|
||||
if (out_tex->tex_format == GST_GL_LUMINANCE
|
||||
|| out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
|
||||
|| out_width != mem_width || out_height != mem_height) {
|
||||
GstMapInfo to_info, from_info;
|
||||
|
||||
|
@ -2276,8 +2263,8 @@ out:
|
|||
continue;
|
||||
}
|
||||
gst_gl_memory_copy_into (convert->priv->out_tex[j],
|
||||
out_tex->tex_id, convert->priv->to_texture_target, out_tex->tex_type,
|
||||
mem_width, mem_height);
|
||||
out_tex->tex_id, convert->priv->to_texture_target,
|
||||
out_tex->tex_format, mem_width, mem_height);
|
||||
gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &from_info);
|
||||
gst_memory_unmap ((GstMemory *) out_tex, &to_info);
|
||||
} else {
|
||||
|
@ -2329,7 +2316,7 @@ _do_convert (GstGLContext * context, GstGLColorConvert * convert)
|
|||
_get_n_textures (GST_VIDEO_INFO_FORMAT (&convert->out_info));
|
||||
|
||||
{
|
||||
gboolean tex_type_change = FALSE;
|
||||
gboolean tex_format_change = FALSE;
|
||||
guint i, v;
|
||||
|
||||
for (v = 0; v < views; v++) {
|
||||
|
@ -2347,21 +2334,21 @@ _do_convert (GstGLContext * context, GstGLColorConvert * convert)
|
|||
/* our arrays aren't that big */
|
||||
g_assert_not_reached ();
|
||||
|
||||
if (v > 0 && in_tex->tex_type != convert->priv->in_tex_types[i]) {
|
||||
if (v > 0 && in_tex->tex_format != convert->priv->in_tex_formats[i]) {
|
||||
GST_ERROR_OBJECT (convert, "Cannot convert textures with "
|
||||
"different types");
|
||||
convert->priv->result = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (convert->priv->in_tex_types[j] != in_tex->tex_type)
|
||||
tex_type_change = TRUE;
|
||||
if (convert->priv->in_tex_formats[j] != in_tex->tex_format)
|
||||
tex_format_change = TRUE;
|
||||
|
||||
convert->priv->in_tex_types[j] = in_tex->tex_type;
|
||||
convert->priv->in_tex_formats[j] = in_tex->tex_format;
|
||||
}
|
||||
}
|
||||
|
||||
if (tex_type_change)
|
||||
if (tex_format_change)
|
||||
gst_gl_color_convert_reset_shader (convert);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,70 +117,23 @@ gst_gl_format_type_n_bytes (guint format, guint type)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_gl_texture_type_n_bytes:
|
||||
* @tex_format: a #GstVideoGLTextureType
|
||||
*
|
||||
* Returns: the number of bytes @tex_format used per pixel
|
||||
*/
|
||||
guint
|
||||
gst_gl_texture_type_n_bytes (GstVideoGLTextureType tex_format)
|
||||
{
|
||||
guint format, type;
|
||||
|
||||
format = gst_gl_format_from_gl_texture_type (tex_format);
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
if (tex_format == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
return gst_gl_format_type_n_bytes (format, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gl_format_from_gl_texture_type:
|
||||
* @tex_format: a #GstVideoGLTextureType
|
||||
*
|
||||
* Returns: the OpenGL format specified by @tex_format
|
||||
*/
|
||||
guint
|
||||
gst_gl_format_from_gl_texture_type (GstVideoGLTextureType tex_format)
|
||||
{
|
||||
switch (tex_format) {
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA:
|
||||
return GST_GL_LUMINANCE_ALPHA;
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE:
|
||||
return GST_GL_LUMINANCE;
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_RGBA:
|
||||
return GST_GL_RGBA;
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_RGB:
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_RGB16:
|
||||
return GST_GL_RGB;
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_RG:
|
||||
return GST_GL_RG;
|
||||
case GST_VIDEO_GL_TEXTURE_TYPE_R:
|
||||
return GST_GL_RED;
|
||||
default:
|
||||
return tex_format;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gl_texture_type_from_format:
|
||||
* gst_gl_format_from_video_info:
|
||||
* @context: a #GstGLContext
|
||||
* @v_format: a #GstVideoFormat
|
||||
* @plane: the plane number (starting from 0)
|
||||
* @vinfo: a #GstVideoInfo
|
||||
* @plane: the plane number in @vinfo
|
||||
*
|
||||
* Returns: the #GstVideoGLTextureType for the specified @format and @plane
|
||||
* that can be allocated using @context
|
||||
* Returns: the #GstGLFormat necessary for holding the data in @plane of @vinfo
|
||||
*/
|
||||
GstVideoGLTextureType
|
||||
gst_gl_texture_type_from_format (GstGLContext * context,
|
||||
GstVideoFormat v_format, guint plane)
|
||||
GstGLFormat
|
||||
gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
|
||||
guint plane)
|
||||
{
|
||||
gboolean texture_rg =
|
||||
gst_gl_context_check_feature (context, "GL_EXT_texture_rg")
|
||||
|| gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0)
|
||||
|| gst_gl_context_check_feature (context, "GL_ARB_texture_rg")
|
||||
|| gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 0);
|
||||
GstVideoFormat v_format = GST_VIDEO_INFO_FORMAT (vinfo);
|
||||
guint n_plane_components;
|
||||
|
||||
switch (v_format) {
|
||||
|
@ -228,18 +181,16 @@ gst_gl_texture_type_from_format (GstGLContext * context,
|
|||
|
||||
switch (n_plane_components) {
|
||||
case 4:
|
||||
return GST_VIDEO_GL_TEXTURE_TYPE_RGBA;
|
||||
return GST_GL_RGBA;
|
||||
break;
|
||||
case 3:
|
||||
return GST_VIDEO_GL_TEXTURE_TYPE_RGB;
|
||||
return GST_GL_RGB;
|
||||
break;
|
||||
case 2:
|
||||
return texture_rg ? GST_VIDEO_GL_TEXTURE_TYPE_RG :
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA;
|
||||
return texture_rg ? GST_GL_RG : GST_GL_LUMINANCE_ALPHA;
|
||||
break;
|
||||
case 1:
|
||||
return texture_rg ? GST_VIDEO_GL_TEXTURE_TYPE_R :
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE;
|
||||
return texture_rg ? GST_GL_RED : GST_GL_LUMINANCE;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
|
|
@ -101,12 +101,8 @@ GST_EXPORT
|
|||
guint gst_gl_format_type_n_bytes (guint format,
|
||||
guint type);
|
||||
GST_EXPORT
|
||||
guint gst_gl_texture_type_n_bytes (GstVideoGLTextureType tex_format);
|
||||
GST_EXPORT
|
||||
guint gst_gl_format_from_gl_texture_type (GstVideoGLTextureType tex_format);
|
||||
GST_EXPORT
|
||||
GstVideoGLTextureType gst_gl_texture_type_from_format (GstGLContext * context,
|
||||
GstVideoFormat v_format,
|
||||
GstGLFormat gst_gl_format_from_video_info (GstGLContext * context,
|
||||
GstVideoInfo * vinfo,
|
||||
guint plane);
|
||||
GST_EXPORT
|
||||
guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
|
||||
|
|
|
@ -84,10 +84,10 @@ typedef struct
|
|||
{
|
||||
/* in */
|
||||
GstGLMemory *src;
|
||||
GstVideoGLTextureType out_format;
|
||||
GstGLFormat out_format;
|
||||
guint out_width, out_height;
|
||||
GstGLTextureTarget tex_target;
|
||||
GstVideoGLTextureType tex_type;
|
||||
GstGLFormat tex_format;
|
||||
/* inout */
|
||||
guint tex_id;
|
||||
/* out */
|
||||
|
@ -122,15 +122,20 @@ static inline void
|
|||
_calculate_unpack_length (GstGLMemory * gl_mem, GstGLContext * context)
|
||||
{
|
||||
guint n_gl_bytes;
|
||||
guint tex_type;
|
||||
|
||||
gl_mem->tex_scaling[0] = 1.0f;
|
||||
gl_mem->tex_scaling[1] = 1.0f;
|
||||
gl_mem->unpack_length = 1;
|
||||
gl_mem->tex_width = GL_MEM_WIDTH (gl_mem);
|
||||
|
||||
n_gl_bytes = gst_gl_texture_type_n_bytes (gl_mem->tex_type);
|
||||
tex_type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->tex_format == GST_GL_RGB565)
|
||||
tex_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
n_gl_bytes = gst_gl_format_type_n_bytes (gl_mem->tex_format, tex_type);
|
||||
if (n_gl_bytes == 0) {
|
||||
GST_ERROR ("Unsupported texture type %d", gl_mem->tex_type);
|
||||
GST_ERROR ("Unsupported texture type %d", gl_mem->tex_format);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -237,9 +242,9 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
|
|||
GLenum tex_format;
|
||||
GLenum tex_type;
|
||||
|
||||
tex_format = gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
|
||||
tex_format = gl_mem->tex_format;
|
||||
tex_type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (gl_mem->tex_format == GST_GL_RGB565)
|
||||
tex_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
internal_format =
|
||||
|
@ -267,7 +272,7 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
|
|||
* @parent: (allow-none): the parent #GstMemory to initialize with
|
||||
* @context: the #GstGLContext to initialize with
|
||||
* @target: the #GstGLTextureTarget for this #GstGLMemory
|
||||
* @tex_type: the #GstVideoGLTextureType for this #GstGLMemory
|
||||
* @tex_format: the #GstGLFormat for this #GstGLMemory
|
||||
* @params: (allow-none): the @GstAllocationParams to initialize with
|
||||
* @info: the #GstVideoInfo for this #GstGLMemory
|
||||
* @plane: the plane number (starting from 0) for this #GstGLMemory
|
||||
|
@ -283,7 +288,7 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
|
|||
void
|
||||
gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
|
||||
GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type, GstAllocationParams * params,
|
||||
GstGLFormat tex_format, GstAllocationParams * params,
|
||||
GstVideoInfo * info, guint plane, GstVideoAlignment * valign,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
|
@ -316,7 +321,7 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
|
|||
size = gst_gl_get_plane_data_size (info, valign, plane);
|
||||
|
||||
mem->tex_target = target;
|
||||
mem->tex_type = tex_type;
|
||||
mem->tex_format = tex_format;
|
||||
mem->plane = plane;
|
||||
|
||||
_calculate_unpack_length (mem, context);
|
||||
|
@ -328,7 +333,7 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
|
|||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture context:%"
|
||||
GST_PTR_FORMAT " memory:%p target:%s format:%u dimensions:%ux%u "
|
||||
"stride:%u size:%" G_GSIZE_FORMAT, context, mem, target_str,
|
||||
mem->tex_type, mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem),
|
||||
mem->tex_format, mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem),
|
||||
mem->mem.mem.size);
|
||||
}
|
||||
|
||||
|
@ -355,9 +360,9 @@ gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer read_pointer)
|
|||
guint format, type;
|
||||
guint fbo;
|
||||
|
||||
format = gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
|
||||
format = gl_mem->tex_format;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (gl_mem->tex_format == GST_GL_RGB565)
|
||||
type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
/* FIXME: avoid creating a framebuffer every download/copy */
|
||||
|
@ -420,8 +425,8 @@ _gl_tex_download_get_tex_image (GstGLMemory * gl_mem, GstMapInfo * info,
|
|||
return NULL;
|
||||
|
||||
/* taken care of by read pixels */
|
||||
if (gl_mem->tex_type != GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
&& gl_mem->tex_type != GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA)
|
||||
if (gl_mem->tex_format != GST_GL_LUMINANCE
|
||||
&& gl_mem->tex_format != GST_GL_LUMINANCE_ALPHA)
|
||||
return NULL;
|
||||
|
||||
if (info->flags & GST_MAP_READ
|
||||
|
@ -433,9 +438,9 @@ _gl_tex_download_get_tex_image (GstGLMemory * gl_mem, GstMapInfo * info,
|
|||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "attempting download of texture %u "
|
||||
"using glGetTexImage", gl_mem->tex_id);
|
||||
|
||||
format = gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
|
||||
format = gl_mem->tex_format;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (gl_mem->tex_format == GST_GL_RGB565)
|
||||
type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
target = gst_gl_texture_target_to_gl (gl_mem->tex_target);
|
||||
|
@ -517,10 +522,10 @@ gst_gl_memory_texsubimage (GstGLMemory * gl_mem, gpointer read_pointer)
|
|||
gl = context->gl_vtable;
|
||||
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (gl_mem->tex_format == GST_GL_RGB565)
|
||||
gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
gl_format = gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
|
||||
gl_format = gl_mem->tex_format;
|
||||
gl_target = gst_gl_texture_target_to_gl (gl_mem->tex_target);
|
||||
|
||||
if (USING_OPENGL (context) || USING_GLES3 (context)
|
||||
|
@ -614,12 +619,12 @@ _gl_tex_unmap (GstGLMemory * gl_mem, GstMapInfo * info)
|
|||
* @gl_mem: the source #GstGLMemory
|
||||
* @tex_id: the destination texture id
|
||||
* @out_target: the destination #GstGLTextureTarget
|
||||
* @out_tex_type: the destination #GstVideoGLTextureType
|
||||
* @out_tex_format: the destination #GstGLFormat
|
||||
* @out_width: the destination width
|
||||
* @out_height: the destination height
|
||||
*
|
||||
* Copies the texture in #GstGLMemory into the texture specified by @tex_id,
|
||||
* @out_target, @out_tex_type, @out_width and @out_height.
|
||||
* @out_target, @out_tex_format, @out_width and @out_height.
|
||||
*
|
||||
* Returns: whether the copy succeeded.
|
||||
*
|
||||
|
@ -627,11 +632,11 @@ _gl_tex_unmap (GstGLMemory * gl_mem, GstMapInfo * info)
|
|||
*/
|
||||
gboolean
|
||||
gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
||||
GstGLTextureTarget out_target, GstVideoGLTextureType out_tex_type,
|
||||
GstGLTextureTarget out_target, GstGLFormat out_tex_format,
|
||||
gint out_width, gint out_height)
|
||||
{
|
||||
const GstGLFuncs *gl;
|
||||
guint out_gl_format, out_tex_target;
|
||||
guint out_tex_target;
|
||||
GstMapInfo sinfo;
|
||||
guint src_tex_id;
|
||||
guint fbo[2];
|
||||
|
@ -639,7 +644,6 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
|||
|
||||
gl = src->mem.context->gl_vtable;
|
||||
out_tex_target = gst_gl_texture_target_to_gl (out_target);
|
||||
out_gl_format = gst_gl_format_from_gl_texture_type (out_tex_type);
|
||||
|
||||
if (!gl->GenFramebuffers) {
|
||||
GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Framebuffer objects not supported");
|
||||
|
@ -647,8 +651,8 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
|||
}
|
||||
|
||||
if (USING_GLES2 (src->mem.context)
|
||||
&& (src->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| src->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA)) {
|
||||
&& (src->tex_format == GST_GL_LUMINANCE
|
||||
|| src->tex_format == GST_GL_LUMINANCE_ALPHA)) {
|
||||
GST_CAT_FIXME (GST_CAT_GL_MEMORY,
|
||||
"Cannot copy Luminance/Luminance Alpha textures in GLES");
|
||||
goto error;
|
||||
|
@ -682,7 +686,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
|||
gl->BindTexture (out_tex_target, tex_id);
|
||||
gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
|
||||
GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "CopyTexImage2D took");
|
||||
gl->CopyTexImage2D (out_tex_target, 0, out_gl_format, 0, 0, out_width,
|
||||
gl->CopyTexImage2D (out_tex_target, 0, out_tex_format, 0, 0, out_width,
|
||||
out_height, 0);
|
||||
gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
|
||||
|
||||
|
@ -759,10 +763,9 @@ _gl_tex_copy_thread (GstGLContext * context, gpointer data)
|
|||
guint internal_format, out_gl_format, out_gl_type, out_tex_target;
|
||||
|
||||
out_tex_target = gst_gl_texture_target_to_gl (copy_params->tex_target);
|
||||
out_gl_format =
|
||||
gst_gl_format_from_gl_texture_type (copy_params->src->tex_type);
|
||||
out_gl_format = copy_params->src->tex_format;
|
||||
out_gl_type = GL_UNSIGNED_BYTE;
|
||||
if (copy_params->out_format == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (copy_params->out_format == GST_GL_RGB565)
|
||||
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
internal_format =
|
||||
|
@ -776,7 +779,7 @@ _gl_tex_copy_thread (GstGLContext * context, gpointer data)
|
|||
}
|
||||
|
||||
copy_params->result = gst_gl_memory_copy_teximage (copy_params->src,
|
||||
copy_params->tex_id, copy_params->tex_target, copy_params->tex_type,
|
||||
copy_params->tex_id, copy_params->tex_target, copy_params->tex_format,
|
||||
copy_params->out_width, copy_params->out_height);
|
||||
}
|
||||
|
||||
|
@ -806,7 +809,8 @@ _default_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
dest = g_new0 (GstGLMemory, 1);
|
||||
|
||||
gst_gl_memory_init (dest, allocator, NULL, src->mem.context, src->tex_target,
|
||||
src->tex_type, ¶ms, &src->info, src->plane, &src->valign, NULL, NULL);
|
||||
src->tex_format, ¶ms, &src->info, src->plane, &src->valign, NULL,
|
||||
NULL);
|
||||
|
||||
if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
GstMapInfo dinfo;
|
||||
|
@ -821,7 +825,7 @@ _default_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
|
||||
if (!gst_gl_memory_copy_into ((GstGLMemory *) src,
|
||||
((GstGLMemory *) dest)->tex_id, src->tex_target,
|
||||
src->tex_type, src->tex_width, GL_MEM_HEIGHT (src))) {
|
||||
src->tex_format, src->tex_width, GL_MEM_HEIGHT (src))) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
goto memcpy;
|
||||
|
@ -894,7 +898,7 @@ _default_gl_tex_alloc (GstGLMemoryAllocator * allocator,
|
|||
}
|
||||
|
||||
gst_gl_memory_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
|
||||
params->parent.context, params->target, params->tex_type,
|
||||
params->parent.context, params->target, params->tex_format,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
|
@ -948,12 +952,12 @@ gst_gl_memory_allocator_init (GstGLMemoryAllocator * allocator)
|
|||
* @gl_mem:a #GstGLMemory
|
||||
* @tex_id:OpenGL texture id
|
||||
* @target: the #GstGLTextureTarget
|
||||
* @tex_type: the #GstVideoGLTextureType
|
||||
* @tex_format: the #GstGLFormat
|
||||
* @width: width of @tex_id
|
||||
* @height: height of @tex_id
|
||||
*
|
||||
* Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
|
||||
* is specified by @tex_type, @width and @height.
|
||||
* is specified by @tex_format, @width and @height.
|
||||
*
|
||||
* Returns: Whether the copy suceeded
|
||||
*
|
||||
|
@ -961,15 +965,14 @@ gst_gl_memory_allocator_init (GstGLMemoryAllocator * allocator)
|
|||
*/
|
||||
gboolean
|
||||
gst_gl_memory_copy_into (GstGLMemory * gl_mem, guint tex_id,
|
||||
GstGLTextureTarget target, GstVideoGLTextureType tex_type, gint width,
|
||||
gint height)
|
||||
GstGLTextureTarget target, GstGLFormat tex_format, gint width, gint height)
|
||||
{
|
||||
GstGLMemoryCopyParams copy_params;
|
||||
|
||||
copy_params.src = gl_mem;
|
||||
copy_params.tex_id = tex_id;
|
||||
copy_params.tex_target = target;
|
||||
copy_params.tex_type = tex_type;
|
||||
copy_params.tex_format = tex_format;
|
||||
copy_params.out_width = width;
|
||||
copy_params.out_height = height;
|
||||
|
||||
|
@ -1012,19 +1015,19 @@ gst_gl_memory_get_texture_height (GstGLMemory * gl_mem)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_gl_memory_get_texture_type:
|
||||
* gst_gl_memory_get_texture_format:
|
||||
* @gl_mem: a #GstGLMemory
|
||||
*
|
||||
* Returns: the #GstVideoGLTextureType of @gl_mem
|
||||
* Returns: the #GstGLFormat of @gl_mem
|
||||
*
|
||||
* Since: 1.8
|
||||
* Since: 1.12
|
||||
*/
|
||||
GstVideoGLTextureType
|
||||
gst_gl_memory_get_texture_type (GstGLMemory * gl_mem)
|
||||
GstGLFormat
|
||||
gst_gl_memory_get_texture_format (GstGLMemory * gl_mem)
|
||||
{
|
||||
g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
|
||||
|
||||
return gl_mem->tex_type;
|
||||
return gl_mem->tex_format;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1135,7 +1138,7 @@ _gst_gl_video_allocation_params_set_video_alignment (GstGLVideoAllocationParams
|
|||
* @plane: the video plane @wrapped_data represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
|
||||
* @target: the #GstGLTextureTarget
|
||||
* @tex_type: the #GstVideoGLTextureType
|
||||
* @tex_format: the #GstGLFormat
|
||||
* @wrapped_data: (allow-none): the optional data pointer to wrap
|
||||
* @gl_handle: the optional OpenGL handle to wrap or 0
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
|
@ -1153,7 +1156,7 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
GstGLAllocationParamsFreeFunc free, GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info,
|
||||
guint plane, GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type, gpointer wrapped_data, gpointer gl_handle,
|
||||
GstGLFormat tex_format, gpointer wrapped_data, gpointer gl_handle,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
guint i;
|
||||
|
@ -1179,7 +1182,7 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
}
|
||||
_gst_gl_video_allocation_params_set_video_alignment (params, valign);
|
||||
params->target = target;
|
||||
params->tex_type = tex_type;
|
||||
params->tex_format = tex_format;
|
||||
params->plane = plane;
|
||||
|
||||
return TRUE;
|
||||
|
@ -1193,7 +1196,7 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
* @plane: the video plane of @v_info to allocate
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of the texture
|
||||
* @target: the #GstGLTextureTarget for the created textures
|
||||
* @tex_type: the #GstVideoGLTextureType for the created textures
|
||||
* @tex_format: the #GstGLFormat for the created textures
|
||||
*
|
||||
* Returns: a new #GstGLVideoAllocationParams for allocating #GstGLMemory's
|
||||
*
|
||||
|
@ -1203,7 +1206,7 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type)
|
||||
GstGLFormat tex_format)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
||||
|
@ -1215,7 +1218,7 @@ gst_gl_video_allocation_params_new (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, tex_type, NULL, 0, NULL, NULL)) {
|
||||
v_info, plane, valign, target, tex_format, NULL, 0, NULL, NULL)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1231,7 +1234,7 @@ gst_gl_video_allocation_params_new (GstGLContext * context,
|
|||
* @plane: the video plane @wrapped_data represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
|
||||
* @target: the #GstGLTextureTarget for @wrapped_data
|
||||
* @tex_type: the #GstVideoGLTextureType for @wrapped_data
|
||||
* @tex_format: the #GstGLFormat for @wrapped_data
|
||||
* @wrapped_data: the data pointer to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1244,7 +1247,7 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type, gpointer wrapped_data, gpointer user_data,
|
||||
GstGLFormat tex_format, gpointer wrapped_data, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
@ -1257,7 +1260,7 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, tex_type, wrapped_data, 0, user_data,
|
||||
v_info, plane, valign, target, tex_format, wrapped_data, 0, user_data,
|
||||
notify)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
|
@ -1274,7 +1277,7 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
|||
* @plane: the video plane @tex_id represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
|
||||
* @target: the #GstGLTextureTarget for @tex_id
|
||||
* @tex_type: the #GstVideoGLTextureType for @tex_id
|
||||
* @tex_format: the #GstGLFormat for @tex_id
|
||||
* @gl_handle: the GL handle to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1291,7 +1294,7 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type, gpointer gl_handle, gpointer user_data,
|
||||
GstGLFormat tex_format, gpointer gl_handle, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
@ -1304,7 +1307,7 @@ gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, tex_type, NULL, gl_handle, user_data,
|
||||
v_info, plane, valign, target, tex_format, NULL, gl_handle, user_data,
|
||||
notify)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
|
@ -1321,7 +1324,7 @@ gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
|||
* @plane: the video plane @tex_id represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
|
||||
* @target: the #GstGLTextureTarget for @tex_id
|
||||
* @tex_type: the #GstVideoGLTextureType for @tex_id
|
||||
* @tex_format: the #GstGLFormat for @tex_id
|
||||
* @tex_id: the GL texture to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1334,11 +1337,11 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type, guint tex_id, gpointer user_data,
|
||||
GstGLFormat tex_format, guint tex_id, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
return gst_gl_video_allocation_params_new_wrapped_gl_handle (context,
|
||||
alloc_params, v_info, plane, valign, target, tex_type,
|
||||
alloc_params, v_info, plane, valign, target, tex_format,
|
||||
GUINT_TO_POINTER (tex_id), user_data, notify);
|
||||
}
|
||||
|
||||
|
@ -1389,7 +1392,7 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
_gst_gl_video_allocation_params_set_video_alignment (dest_vid,
|
||||
src_vid->valign);
|
||||
dest_vid->target = src_vid->target;
|
||||
dest_vid->tex_type = src_vid->tex_type;
|
||||
dest_vid->tex_format = src_vid->tex_format;
|
||||
dest_vid->plane = src_vid->plane;
|
||||
}
|
||||
|
||||
|
@ -1398,9 +1401,9 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
* @allocator: the @GstGLMemoryAllocator to allocate from
|
||||
* @buffer: a #GstBuffer to setup
|
||||
* @params: the #GstGLVideoAllocationParams to allocate with
|
||||
* @tex_types: (allow-none): a list of #GstVideoGLTextureType's to allocate with.
|
||||
* @tex_formats: (allow-none): a list of #GstGLFormat's to allocate with.
|
||||
* @wrapped_data: a list of wrapped data pointers
|
||||
* @n_wrapped_pointers: the number of elements in @tex_types and @wrapped_data
|
||||
* @n_wrapped_pointers: the number of elements in @tex_formats and @wrapped_data
|
||||
*
|
||||
* Returns: whether the buffer was correctly setup
|
||||
*
|
||||
|
@ -1409,7 +1412,7 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
gboolean
|
||||
gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||
GstBuffer * buffer, GstGLVideoAllocationParams * params,
|
||||
GstVideoGLTextureType * tex_types, gpointer * wrapped_data,
|
||||
GstGLFormat * tex_formats, gpointer * wrapped_data,
|
||||
gsize n_wrapped_pointers)
|
||||
{
|
||||
GstGLBaseMemoryAllocator *base_allocator;
|
||||
|
@ -1436,12 +1439,12 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
|||
for (i = 0; i < n_mem; i++) {
|
||||
GstGLMemory *gl_mem;
|
||||
|
||||
if (tex_types) {
|
||||
params->tex_type = tex_types[i];
|
||||
if (tex_formats) {
|
||||
params->tex_format = tex_formats[i];
|
||||
} else {
|
||||
params->tex_type =
|
||||
gst_gl_texture_type_from_format (params->parent.context,
|
||||
GST_VIDEO_INFO_FORMAT (params->v_info), i);
|
||||
params->tex_format =
|
||||
gst_gl_format_from_video_info (params->parent.context,
|
||||
params->v_info, i);
|
||||
}
|
||||
|
||||
params->plane = i;
|
||||
|
|
|
@ -68,7 +68,7 @@ struct _GstGLMemory
|
|||
|
||||
guint tex_id;
|
||||
GstGLTextureTarget tex_target;
|
||||
GstVideoGLTextureType tex_type;
|
||||
GstGLFormat tex_format;
|
||||
GstVideoInfo info;
|
||||
GstVideoAlignment valign;
|
||||
guint plane;
|
||||
|
@ -99,7 +99,7 @@ typedef struct _GstGLVideoAllocationParams GstGLVideoAllocationParams;
|
|||
* @plane: the video plane index to allocate
|
||||
* @valign: the #GstVideoAlignment to align the system representation to (may be %NULL for the default)
|
||||
* @target: the #GstGLTextureTarget to allocate
|
||||
* @tex_type: the #GstVideoGLTextureType to allocate
|
||||
* @tex_fomrat: the #GstGLFormat to allocate
|
||||
*/
|
||||
struct _GstGLVideoAllocationParams
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ struct _GstGLVideoAllocationParams
|
|||
guint plane;
|
||||
GstVideoAlignment *valign;
|
||||
GstGLTextureTarget target;
|
||||
GstVideoGLTextureType tex_type;
|
||||
GstGLFormat tex_format;
|
||||
|
||||
/* <private> */
|
||||
gpointer _padding[GST_PADDING];
|
||||
|
@ -127,7 +127,7 @@ gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAlloc
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
gpointer wrapped_data,
|
||||
gpointer gl_handle,
|
||||
gpointer user_data,
|
||||
|
@ -139,7 +139,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext *
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type);
|
||||
GstGLFormat tex_format);
|
||||
GST_EXPORT
|
||||
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params,
|
||||
|
@ -147,7 +147,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
gpointer wrapped_data,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -159,7 +159,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
guint tex_id,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -171,7 +171,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handl
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
gpointer gl_handle,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -237,7 +237,7 @@ void gst_gl_memory_init (GstGLMemory * mem,
|
|||
GstMemory * parent,
|
||||
GstGLContext * context,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
GstAllocationParams *params,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
|
@ -249,14 +249,14 @@ GST_EXPORT
|
|||
gboolean gst_gl_memory_copy_into (GstGLMemory *gl_mem,
|
||||
guint tex_id,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
gint width,
|
||||
gint height);
|
||||
GST_EXPORT
|
||||
gboolean gst_gl_memory_copy_teximage (GstGLMemory * src,
|
||||
guint tex_id,
|
||||
GstGLTextureTarget out_target,
|
||||
GstVideoGLTextureType out_tex_type,
|
||||
GstGLFormat out_tex_format,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
|
@ -273,7 +273,7 @@ gint gst_gl_memory_get_texture_width (GstGLMemory * gl_me
|
|||
GST_EXPORT
|
||||
gint gst_gl_memory_get_texture_height (GstGLMemory * gl_mem);
|
||||
GST_EXPORT
|
||||
GstVideoGLTextureType gst_gl_memory_get_texture_type (GstGLMemory * gl_mem);
|
||||
GstGLFormat gst_gl_memory_get_texture_format (GstGLMemory * gl_mem);
|
||||
GST_EXPORT
|
||||
GstGLTextureTarget gst_gl_memory_get_texture_target (GstGLMemory * gl_mem);
|
||||
GST_EXPORT
|
||||
|
@ -283,7 +283,7 @@ GST_EXPORT
|
|||
gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||
GstBuffer * buffer,
|
||||
GstGLVideoAllocationParams * params,
|
||||
GstVideoGLTextureType *tex_types,
|
||||
GstGLFormat *tex_formats,
|
||||
gpointer *wrapped_data,
|
||||
gsize n_wrapped_pointers);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ typedef struct
|
|||
{
|
||||
/* in */
|
||||
GstGLMemoryPBO *src;
|
||||
GstVideoGLTextureType out_format;
|
||||
GstGLFormat out_format;
|
||||
guint out_width, out_height;
|
||||
guint out_stride;
|
||||
gboolean respecify;
|
||||
|
@ -218,8 +218,8 @@ static gboolean
|
|||
_read_pixels_to_pbo (GstGLMemoryPBO * gl_mem)
|
||||
{
|
||||
if (!gl_mem->pbo || !CONTEXT_SUPPORTS_PBO_DOWNLOAD (gl_mem->mem.mem.context)
|
||||
|| gl_mem->mem.tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| gl_mem->mem.tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA)
|
||||
|| gl_mem->mem.tex_format == GST_GL_LUMINANCE
|
||||
|| gl_mem->mem.tex_format == GST_GL_LUMINANCE_ALPHA)
|
||||
/* unsupported */
|
||||
return FALSE;
|
||||
|
||||
|
@ -416,13 +416,13 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
|
|||
out_stride = copy_params->out_stride;
|
||||
|
||||
gl = context->gl_vtable;
|
||||
out_gl_format = gst_gl_format_from_gl_texture_type (copy_params->out_format);
|
||||
out_gl_format = copy_params->out_format;
|
||||
out_gl_type = GL_UNSIGNED_BYTE;
|
||||
if (copy_params->out_format == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (copy_params->out_format == GST_GL_RGB565)
|
||||
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
in_gl_format = gst_gl_format_from_gl_texture_type (src->mem.tex_type);
|
||||
in_gl_format = src->mem.tex_format;
|
||||
in_gl_type = GL_UNSIGNED_BYTE;
|
||||
if (src->mem.tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (src->mem.tex_format == GST_GL_RGB565)
|
||||
in_gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
if (!gl->GenFramebuffers) {
|
||||
|
@ -448,7 +448,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
|
|||
guint out_gl_type;
|
||||
|
||||
out_gl_type = GL_UNSIGNED_BYTE;
|
||||
if (copy_params->out_format == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (copy_params->out_format == GST_GL_RGB565)
|
||||
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
internal_format =
|
||||
|
@ -572,7 +572,7 @@ _gl_mem_copy (GstGLMemoryPBO * src, gssize offset, gssize size)
|
|||
|
||||
dest = (GstMemory *) g_new0 (GstGLMemoryPBO, 1);
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (dest), allocator, NULL,
|
||||
src->mem.mem.context, src->mem.tex_target, src->mem.tex_type, ¶ms,
|
||||
src->mem.mem.context, src->mem.tex_target, src->mem.tex_format, ¶ms,
|
||||
&src->mem.info, src->mem.plane, &src->mem.valign, NULL, NULL);
|
||||
|
||||
if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
|
@ -588,7 +588,7 @@ _gl_mem_copy (GstGLMemoryPBO * src, gssize offset, gssize size)
|
|||
|
||||
if (!gst_gl_memory_copy_into ((GstGLMemory *) src,
|
||||
((GstGLMemory *) dest)->tex_id, src->mem.tex_target,
|
||||
src->mem.tex_type, src->mem.tex_width, GL_MEM_HEIGHT (src))) {
|
||||
src->mem.tex_format, src->mem.tex_width, GL_MEM_HEIGHT (src))) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
goto memcpy;
|
||||
|
@ -649,7 +649,7 @@ _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
|
|||
}
|
||||
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
|
||||
NULL, params->parent.context, params->target, params->tex_type,
|
||||
NULL, params->parent.context, params->target, params->tex_format,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
|
@ -705,14 +705,14 @@ gst_gl_memory_pbo_allocator_init (GstGLMemoryPBOAllocator * allocator)
|
|||
* @gl_mem:a #GstGLMemoryPBO
|
||||
* @tex_id: the destination texture id
|
||||
* @target: the destination #GstGLTextureTarget
|
||||
* @tex_type: the destination #GstVideoGLTextureType
|
||||
* @tex_format: the destination #GstGLFormat
|
||||
* @width: width of @tex_id
|
||||
* @height: height of @tex_id
|
||||
* @stride: stride of the backing texture data
|
||||
* @respecify: whether to copy the data or copy per texel
|
||||
*
|
||||
* Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
|
||||
* is specified by @tex_type, @width and @height.
|
||||
* is specified by @tex_format, @width and @height.
|
||||
*
|
||||
* If @respecify is %TRUE, then the copy is performed in terms of the texture
|
||||
* data. This is useful for splitting RGBA textures into RG or R textures or
|
||||
|
@ -731,7 +731,7 @@ gst_gl_memory_pbo_allocator_init (GstGLMemoryPBOAllocator * allocator)
|
|||
*/
|
||||
gboolean
|
||||
gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO * gl_mem, guint tex_id,
|
||||
GstGLTextureTarget target, GstVideoGLTextureType tex_type, gint width,
|
||||
GstGLTextureTarget target, GstGLFormat tex_format, gint width,
|
||||
gint height, gint stride, gboolean respecify)
|
||||
{
|
||||
GstGLMemoryPBOCopyParams copy_params;
|
||||
|
@ -739,7 +739,7 @@ gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO * gl_mem, guint tex_id,
|
|||
copy_params.src = gl_mem;
|
||||
copy_params.tex_target = target;
|
||||
copy_params.tex_id = tex_id;
|
||||
copy_params.out_format = tex_type;
|
||||
copy_params.out_format = tex_format;
|
||||
copy_params.out_width = width;
|
||||
copy_params.out_height = height;
|
||||
copy_params.out_stride = stride;
|
||||
|
|
|
@ -78,7 +78,7 @@ GST_EXPORT
|
|||
gboolean gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO *gl_mem,
|
||||
guint tex_id,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
gint width,
|
||||
gint height,
|
||||
gint stride,
|
||||
|
|
|
@ -362,7 +362,7 @@ gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay,
|
|||
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (overlay->context,
|
||||
NULL, &comp_frame->info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, comp_frame->data[0], comp_frame,
|
||||
GST_GL_RGBA, comp_frame->data[0], comp_frame,
|
||||
_video_frame_unmap_and_free);
|
||||
|
||||
comp_gl_memory =
|
||||
|
|
|
@ -83,9 +83,9 @@ _gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
|
|||
GLenum tex_format;
|
||||
GLenum renderbuffer_type;
|
||||
|
||||
tex_format = gst_gl_format_from_gl_texture_type (gl_mem->renderbuffer_type);
|
||||
tex_format = gl_mem->renderbuffer_format;
|
||||
renderbuffer_type = GL_UNSIGNED_BYTE;
|
||||
if (gl_mem->renderbuffer_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
|
||||
if (gl_mem->renderbuffer_format == GST_GL_RGB565)
|
||||
renderbuffer_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
|
||||
internal_format =
|
||||
|
@ -109,12 +109,20 @@ _gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
|
|||
static void
|
||||
gst_gl_renderbuffer_init (GstGLRenderbuffer * mem, GstAllocator * allocator,
|
||||
GstMemory * parent, GstGLContext * context,
|
||||
GstVideoGLTextureType renderbuffer_type, GstAllocationParams * params,
|
||||
GstGLFormat renderbuffer_format, GstAllocationParams * params,
|
||||
guint width, guint height, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
gsize size = gst_gl_texture_type_n_bytes (renderbuffer_type) * width * height;
|
||||
gsize size;
|
||||
guint tex_type;
|
||||
|
||||
mem->renderbuffer_type = renderbuffer_type;
|
||||
tex_type = GL_UNSIGNED_BYTE;
|
||||
if (renderbuffer_format == GST_GL_RGB565)
|
||||
tex_type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
size =
|
||||
gst_gl_format_type_n_bytes (renderbuffer_format,
|
||||
tex_type) * width * height;
|
||||
|
||||
mem->renderbuffer_format = renderbuffer_format;
|
||||
mem->width = width;
|
||||
mem->height = height;
|
||||
|
||||
|
@ -123,7 +131,7 @@ gst_gl_renderbuffer_init (GstGLRenderbuffer * mem, GstAllocator * allocator,
|
|||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_RENDERBUFFER, "new GL renderbuffer context:%"
|
||||
GST_PTR_FORMAT " memory:%p format:%u dimensions:%ux%u ", context, mem,
|
||||
mem->renderbuffer_type, gst_gl_renderbuffer_get_width (mem),
|
||||
mem->renderbuffer_format, gst_gl_renderbuffer_get_width (mem),
|
||||
gst_gl_renderbuffer_get_height (mem));
|
||||
}
|
||||
|
||||
|
@ -184,7 +192,7 @@ _default_gl_rbo_alloc (GstGLRenderbufferAllocator * allocator,
|
|||
}
|
||||
|
||||
gst_gl_renderbuffer_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
|
||||
params->parent.context, params->renderbuffer_type,
|
||||
params->parent.context, params->renderbuffer_format,
|
||||
params->parent.alloc_params, params->width, params->height,
|
||||
params->parent.user_data, params->parent.notify);
|
||||
|
||||
|
@ -256,19 +264,19 @@ gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_gl_renderbuffer_get_type:
|
||||
* gst_gl_renderbuffer_get_format:
|
||||
* @gl_mem: a #GstGLRenderbuffer
|
||||
*
|
||||
* Returns: the #GstVideoGLTextureType of @gl_mem
|
||||
* Returns: the #GstGLFormat of @gl_mem
|
||||
*
|
||||
* Since: 1.10
|
||||
* Since: 1.12
|
||||
*/
|
||||
GstVideoGLTextureType
|
||||
gst_gl_renderbuffer_get_type (GstGLRenderbuffer * gl_mem)
|
||||
GstGLFormat
|
||||
gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem)
|
||||
{
|
||||
g_return_val_if_fail (gst_is_gl_renderbuffer ((GstMemory *) gl_mem), 0);
|
||||
|
||||
return gl_mem->renderbuffer_type;
|
||||
return gl_mem->renderbuffer_format;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -354,7 +362,7 @@ _gst_gl_rb_alloc_params_copy_data (GstGLRenderbufferAllocationParams * src_vid,
|
|||
|
||||
gst_gl_allocation_params_copy_data (src, dest);
|
||||
|
||||
dest_vid->renderbuffer_type = src_vid->renderbuffer_type;
|
||||
dest_vid->renderbuffer_format = src_vid->renderbuffer_format;
|
||||
dest_vid->width = src_vid->width;
|
||||
dest_vid->height = src_vid->height;
|
||||
}
|
||||
|
@ -365,7 +373,7 @@ static gboolean
|
|||
guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
|
||||
GstGLAllocationParamsFreeFunc free, GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, guint width, guint height,
|
||||
GstVideoGLTextureType renderbuffer_type, gpointer wrapped_data,
|
||||
GstGLFormat renderbuffer_format, gpointer wrapped_data,
|
||||
gpointer gl_handle, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
g_return_val_if_fail (params != NULL, FALSE);
|
||||
|
@ -380,7 +388,7 @@ static gboolean
|
|||
wrapped_data, gl_handle, user_data, notify))
|
||||
return FALSE;
|
||||
|
||||
params->renderbuffer_type = renderbuffer_type;
|
||||
params->renderbuffer_format = renderbuffer_format;
|
||||
params->width = width;
|
||||
params->height = height;
|
||||
|
||||
|
@ -393,7 +401,7 @@ static gboolean
|
|||
* @alloc_params: (allow-none): the #GstAllocationParams for sysmem mappings of the texture
|
||||
* @width: the width of the renderbuffer
|
||||
* @height: the height of the renderbuffer
|
||||
* @renderbuffer_type: the #GstVideoGLTextureType for the created textures
|
||||
* @renderbuffer_format: the #GstGLFormat for the created textures
|
||||
*
|
||||
* Returns: a new #GstGLRenderbufferAllocationParams for allocating #GstGLRenderbuffer's
|
||||
*
|
||||
|
@ -401,7 +409,7 @@ static gboolean
|
|||
*/
|
||||
GstGLRenderbufferAllocationParams *
|
||||
gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoGLTextureType renderbuffer_type,
|
||||
GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
|
||||
guint width, guint height)
|
||||
{
|
||||
GstGLRenderbufferAllocationParams *params =
|
||||
|
@ -413,7 +421,7 @@ gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
|
|||
GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
|
||||
(GstGLAllocationParamsCopyFunc) _gst_gl_rb_alloc_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc) _gst_gl_rb_alloc_params_free_data,
|
||||
context, alloc_params, width, height, renderbuffer_type, NULL, 0,
|
||||
context, alloc_params, width, height, renderbuffer_format, NULL, 0,
|
||||
NULL, NULL)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
|
@ -428,7 +436,7 @@ gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
|
|||
* @alloc_params: (allow-none): the #GstAllocationParams for @tex_id
|
||||
* @width: the width of the renderbuffer
|
||||
* @height: the height of the renderbuffer
|
||||
* @renderbuffer_type: the #GstVideoGLTextureType for @tex_id
|
||||
* @renderbuffer_format: the #GstGLFormat for @tex_id
|
||||
* @gl_handle: the GL handle to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -440,7 +448,7 @@ gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
|
|||
*/
|
||||
GstGLRenderbufferAllocationParams *
|
||||
gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoGLTextureType renderbuffer_type,
|
||||
GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
|
||||
guint width, guint height, gpointer gl_handle, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
|
@ -453,7 +461,7 @@ gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
|
|||
GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
|
||||
(GstGLAllocationParamsCopyFunc) _gst_gl_rb_alloc_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc) _gst_gl_rb_alloc_params_free_data,
|
||||
context, alloc_params, width, height, renderbuffer_type, NULL,
|
||||
context, alloc_params, width, height, renderbuffer_format, NULL,
|
||||
gl_handle, user_data, notify)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
|
|
|
@ -63,7 +63,7 @@ struct _GstGLRenderbuffer
|
|||
GstGLBaseMemory mem;
|
||||
|
||||
guint renderbuffer_id;
|
||||
GstVideoGLTextureType renderbuffer_type;
|
||||
GstGLFormat renderbuffer_format;
|
||||
guint width;
|
||||
guint height;
|
||||
|
||||
|
@ -109,7 +109,7 @@ typedef struct
|
|||
{
|
||||
GstGLAllocationParams parent;
|
||||
|
||||
GstVideoGLTextureType renderbuffer_type;
|
||||
GstGLFormat renderbuffer_format;
|
||||
guint width;
|
||||
guint height;
|
||||
|
||||
|
@ -119,13 +119,13 @@ typedef struct
|
|||
|
||||
GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params,
|
||||
GstVideoGLTextureType renderbuffer_type,
|
||||
GstGLFormat renderbuffer_format,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params,
|
||||
GstVideoGLTextureType renderbuffer_type,
|
||||
GstGLFormat renderbuffer_format,
|
||||
guint width,
|
||||
guint height,
|
||||
gpointer gl_handle,
|
||||
|
@ -138,7 +138,7 @@ gboolean gst_is_gl_renderbuffer (GstMemory * mem);
|
|||
/* accessors */
|
||||
gint gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem);
|
||||
gint gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem);
|
||||
GstVideoGLTextureType gst_gl_renderbuffer_get_type (GstGLRenderbuffer * gl_mem);
|
||||
GstGLFormat gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem);
|
||||
guint gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1145,9 +1145,8 @@ _raw_data_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||
|
||||
raw->params->parent.wrapped_data = raw->in_frame->frame.data[i];
|
||||
raw->params->plane = i;
|
||||
raw->params->tex_type =
|
||||
gst_gl_texture_type_from_format (raw->upload->context,
|
||||
GST_VIDEO_INFO_FORMAT (in_info), i);
|
||||
raw->params->tex_format =
|
||||
gst_gl_format_from_video_info (raw->upload->context, in_info, i);
|
||||
|
||||
tex =
|
||||
gst_gl_base_memory_alloc (allocator,
|
||||
|
|
|
@ -2094,8 +2094,8 @@ _do_view_convert (GstGLContext * context, GstGLViewConvert * viewconvert)
|
|||
height = gst_gl_memory_get_texture_height (out_tex);
|
||||
gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, width,
|
||||
height);
|
||||
if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
|
||||
if (out_tex->tex_format == GST_GL_LUMINANCE
|
||||
|| out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
|
||||
|| out_width != width || out_height != height) {
|
||||
/* Luminance formats are not color renderable */
|
||||
/* renderering to a framebuffer only renders the intersection of all
|
||||
|
@ -2113,8 +2113,7 @@ _do_view_convert (GstGLContext * context, GstGLViewConvert * viewconvert)
|
|||
GST_ALLOCATOR (gst_gl_memory_allocator_get_default (context));
|
||||
base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
|
||||
0, NULL, viewconvert->to_texture_target,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
0, NULL, viewconvert->to_texture_target, GST_GL_RGBA);
|
||||
|
||||
priv->out_tex[j] =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
|
||||
|
@ -2172,7 +2171,7 @@ out:
|
|||
continue;
|
||||
}
|
||||
gst_gl_memory_copy_into (priv->out_tex[j], out_tex->tex_id,
|
||||
viewconvert->to_texture_target, out_tex->tex_type, width, height);
|
||||
viewconvert->to_texture_target, out_tex->tex_format, width, height);
|
||||
gst_memory_unmap ((GstMemory *) out_tex, &to_info);
|
||||
}
|
||||
|
||||
|
|
|
@ -1357,7 +1357,7 @@ retry:
|
|||
|
||||
params = gst_gl_video_allocation_params_new (self->gl_context, NULL,
|
||||
&state->info, 0, NULL, GST_GL_TEXTURE_TARGET_EXTERNAL_OES,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
GST_GL_RGBA);
|
||||
|
||||
self->oes_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -107,15 +107,14 @@ _create_glmem (GstAppleCoreVideoPixelBuffer * gpixbuf,
|
|||
return gst_video_texture_cache_create_memory (cache, gpixbuf, plane, size);
|
||||
#else
|
||||
GstIOSurfaceMemory *mem;
|
||||
GstVideoGLTextureType tex_type =
|
||||
gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_INFO_FORMAT (info),
|
||||
plane);
|
||||
GstGLFormat tex_format =
|
||||
gst_gl_format_from_video_info (cache->ctx, info, plane);
|
||||
CVPixelBufferRef pixel_buf = gpixbuf->buf;
|
||||
IOSurfaceRef surface = CVPixelBufferGetIOSurface (pixel_buf);
|
||||
|
||||
CFRetain (pixel_buf);
|
||||
mem = gst_io_surface_memory_wrapped (cache->ctx,
|
||||
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_type,
|
||||
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_format,
|
||||
info, plane, NULL, pixel_buf, (GDestroyNotify) CFRelease);
|
||||
return GST_MEMORY_CAST (mem);
|
||||
#endif
|
||||
|
|
|
@ -132,7 +132,7 @@ static GstIOSGLMemory *
|
|||
_ios_gl_memory_new (GstGLContext * context,
|
||||
GstAppleCoreVideoMemory * cv_mem,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
guint tex_id,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
|
@ -144,7 +144,7 @@ _ios_gl_memory_new (GstGLContext * context,
|
|||
mem->gl_mem.tex_id = tex_id;
|
||||
mem->gl_mem.texture_wrapped = TRUE;
|
||||
gst_gl_memory_init (&mem->gl_mem, _ios_gl_memory_allocator, NULL, context,
|
||||
target, tex_type, NULL, info, plane, valign, NULL, NULL);
|
||||
target, tex_format, NULL, info, plane, valign, NULL, NULL);
|
||||
mem->cv_mem = cv_mem;
|
||||
mem->gl_data = gl_data;
|
||||
mem->gl_notify = gl_notify;
|
||||
|
@ -158,12 +158,12 @@ GstIOSGLMemory *
|
|||
gst_ios_gl_memory_new_wrapped (GstGLContext * context,
|
||||
GstAppleCoreVideoMemory * cv_mem,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
guint tex_id,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign, gpointer gl_data, GDestroyNotify gl_notify)
|
||||
{
|
||||
return _ios_gl_memory_new (context, cv_mem, target, tex_type, tex_id, info,
|
||||
return _ios_gl_memory_new (context, cv_mem, target, tex_format, tex_id, info,
|
||||
plane, valign, gl_data, gl_notify);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ GstIOSGLMemory *
|
|||
gst_ios_gl_memory_new_wrapped (GstGLContext * context,
|
||||
GstAppleCoreVideoMemory *cv_mem,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
guint tex_id,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
|
|
|
@ -166,7 +166,7 @@ static GstIOSurfaceMemory *
|
|||
_io_surface_memory_new (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||
|
@ -177,7 +177,7 @@ _io_surface_memory_new (GstGLContext * context,
|
|||
|
||||
mem = g_new0 (GstIOSurfaceMemory, 1);
|
||||
gst_gl_memory_init (&mem->gl_mem, _io_surface_memory_allocator, NULL, context,
|
||||
target, tex_type, NULL, info, plane, valign, user_data, notify);
|
||||
target, tex_format, NULL, info, plane, valign, user_data, notify);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
||||
|
||||
|
@ -191,7 +191,7 @@ GstIOSurfaceMemory *
|
|||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||
|
@ -214,15 +214,12 @@ _io_surface_memory_set_surface (GstIOSurfaceMemory * memory,
|
|||
if (surface) {
|
||||
GLuint tex_id, tex_target, texifmt, texfmt;
|
||||
guint plane;
|
||||
GstVideoGLTextureType textype;
|
||||
CGLError cglError;
|
||||
|
||||
plane = gl_mem->plane;
|
||||
tex_id = gl_mem->tex_id;
|
||||
tex_target = gst_gl_texture_target_to_gl (gl_mem->tex_target);
|
||||
textype = gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&gl_mem->info), plane);
|
||||
texifmt = gst_gl_format_from_gl_texture_type (textype);
|
||||
texifmt = gst_gl_format_from_video_info (context, &gl_mem->info, plane);
|
||||
texfmt =
|
||||
gst_gl_sized_gl_format_from_gl_format_type (context, texifmt,
|
||||
GL_UNSIGNED_BYTE);
|
||||
|
|
|
@ -53,7 +53,7 @@ GstIOSurfaceMemory *
|
|||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstGLFormat tex_format,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment *valign,
|
||||
|
|
|
@ -159,7 +159,7 @@ _do_create_memory (GstGLContext * context, ContextThreadData * data)
|
|||
GstGLTextureTarget gl_target;
|
||||
GstAppleCoreVideoMemory *memory;
|
||||
GstIOSGLMemory *gl_memory;
|
||||
GstVideoGLTextureType textype;
|
||||
GstGLFormat texformat;
|
||||
|
||||
switch (GST_VIDEO_INFO_FORMAT (&cache->input_info)) {
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
|
@ -170,21 +170,20 @@ _do_create_memory (GstGLContext * context, ContextThreadData * data)
|
|||
GL_RGBA, GL_UNSIGNED_BYTE, 0, &texture) != kCVReturnSuccess)
|
||||
goto error;
|
||||
|
||||
textype = GST_VIDEO_GL_TEXTURE_TYPE_RGBA;
|
||||
texformat = GST_GL_RGBA;
|
||||
plane = 0;
|
||||
goto success;
|
||||
case GST_VIDEO_FORMAT_NV12: {
|
||||
GLenum texifmt, texfmt;
|
||||
GstGLFormat texifmt, texfmt;
|
||||
|
||||
if (plane == 0)
|
||||
textype = GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE;
|
||||
texformat = GST_GL_LUMINANCE;
|
||||
else
|
||||
textype = GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA;
|
||||
texifmt = gst_gl_format_from_gl_texture_type (textype);
|
||||
texfmt = gst_gl_sized_gl_format_from_gl_format_type (cache->ctx, texifmt, GL_UNSIGNED_BYTE);
|
||||
texformat = GST_GL_LUMINANCE_ALPHA;
|
||||
texfmt = gst_gl_sized_gl_format_from_gl_format_type (cache->ctx, texformat, GL_UNSIGNED_BYTE);
|
||||
|
||||
if (CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
|
||||
cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texifmt,
|
||||
cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texformat,
|
||||
GST_VIDEO_INFO_COMP_WIDTH (&cache->input_info, plane),
|
||||
GST_VIDEO_INFO_COMP_HEIGHT (&cache->input_info, plane),
|
||||
texfmt, GL_UNSIGNED_BYTE, plane, &texture) != kCVReturnSuccess)
|
||||
|
@ -205,7 +204,7 @@ success: {
|
|||
gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
|
||||
memory = gst_apple_core_video_memory_new_wrapped (gpixbuf, plane, size);
|
||||
gl_memory = gst_ios_gl_memory_new_wrapped (context, memory,
|
||||
gl_target, textype, CVOpenGLESTextureGetName (texture), &cache->input_info,
|
||||
gl_target, texformat, CVOpenGLESTextureGetName (texture), &cache->input_info,
|
||||
plane, NULL, texture_data, (GDestroyNotify) gst_video_texture_cache_release_texture);
|
||||
|
||||
data->memory = GST_MEMORY_CAST (gl_memory);
|
||||
|
|
|
@ -148,14 +148,14 @@ check_conversion (TestFrame * frames, guint size)
|
|||
/* create GL buffer */
|
||||
inbuf = gst_buffer_new ();
|
||||
for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
|
||||
GstVideoGLTextureType tex_type = gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&in_info), j);
|
||||
GstGLFormat tex_format = gst_gl_format_from_video_info (context,
|
||||
&in_info, j);
|
||||
GstGLVideoAllocationParams *params;
|
||||
GstGLBaseMemory *mem;
|
||||
|
||||
ref_count++;
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, tex_type,
|
||||
&in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, tex_format,
|
||||
frames[i].data[j], &ref_count, _frame_unref);
|
||||
|
||||
mem = gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
|
|
|
@ -72,7 +72,7 @@ init (gpointer data)
|
|||
allocator = gst_gl_memory_allocator_get_default (context);
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (context, NULL, &v_info, 0, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
|
||||
/* has to be called in the thread that is going to use the framebuffer */
|
||||
fbo = gst_gl_framebuffer_new_with_default_depth (context, 320, 240);
|
||||
|
|
|
@ -75,12 +75,12 @@ GST_START_TEST (test_basic)
|
|||
gst_video_info_set_format (&v_info, formats[i], width, height);
|
||||
|
||||
for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&v_info); j++) {
|
||||
GstVideoGLTextureType tex_type = gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&v_info), j);
|
||||
GstGLFormat tex_format = gst_gl_format_from_video_info (context,
|
||||
&v_info, j);
|
||||
GstGLVideoAllocationParams *params;
|
||||
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &v_info, j,
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, tex_type);
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, tex_format);
|
||||
|
||||
mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -135,7 +135,7 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
|
||||
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &v_info, 0,
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
|
||||
|
||||
/* texture creation */
|
||||
mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
|
@ -149,7 +149,7 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
/* test wrapping raw data */
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_pixel, NULL, NULL);
|
||||
GST_GL_RGBA, rgba_pixel, NULL, NULL);
|
||||
mem2 =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -164,8 +164,7 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
/* wrapped texture creation */
|
||||
params = gst_gl_video_allocation_params_new_wrapped_texture (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, ((GstGLMemory *) mem)->tex_id, NULL,
|
||||
NULL);
|
||||
GST_GL_RGBA, ((GstGLMemory *) mem)->tex_id, NULL, NULL);
|
||||
mem3 =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -207,7 +206,7 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
/* test texture copy */
|
||||
fail_unless (gst_gl_memory_copy_into ((GstGLMemory *) mem2,
|
||||
((GstGLMemory *) mem)->tex_id, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, 1, 1));
|
||||
GST_GL_RGBA, 1, 1));
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
|
||||
|
||||
fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
|
||||
|
@ -300,7 +299,7 @@ GST_START_TEST (test_separate_transfer)
|
|||
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_pixel, NULL, NULL);
|
||||
GST_GL_RGBA, rgba_pixel, NULL, NULL);
|
||||
mem =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -50,7 +50,7 @@ static const GLfloat vertices[] = {
|
|||
|
||||
static GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
#define FORMAT GST_VIDEO_GL_TEXTURE_TYPE_RGBA
|
||||
#define FORMAT GST_GL_RGBA
|
||||
#define WIDTH 10
|
||||
#define HEIGHT 10
|
||||
#define RED 0xff, 0x00, 0x00, 0xff
|
||||
|
@ -334,7 +334,7 @@ GST_START_TEST (test_upload_gl_memory)
|
|||
buffer = gst_buffer_new ();
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&in_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_data, NULL, NULL);
|
||||
GST_GL_RGBA, rgba_data, NULL, NULL);
|
||||
gl_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
|
||||
|
|
Loading…
Reference in a new issue