eglglessink: Update for GLTextureUploadMeta and EGL API changes
This commit is contained in:
parent
a6e50140b7
commit
e8ad67f2b4
@ -104,18 +104,6 @@ static const char *frag_COPY_prog = {
|
|||||||
"}"
|
"}"
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Direct fragments copy without stride-scaling */
|
|
||||||
static const char *frag_COPY_DIRECT_prog = {
|
|
||||||
"precision mediump float;"
|
|
||||||
"varying vec2 opos;"
|
|
||||||
"uniform sampler2D tex;"
|
|
||||||
"void main(void)"
|
|
||||||
"{"
|
|
||||||
" vec4 t = texture2D(tex, opos);"
|
|
||||||
" gl_FragColor = vec4(t.rgb, 1.0);"
|
|
||||||
"}"
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Channel reordering for XYZ <-> ZYX conversion */
|
/* Channel reordering for XYZ <-> ZYX conversion */
|
||||||
static const char *frag_REORDER_prog = {
|
static const char *frag_REORDER_prog = {
|
||||||
"precision mediump float;"
|
"precision mediump float;"
|
||||||
@ -323,12 +311,12 @@ gst_egl_adaptation_cleanup (GstEglAdaptationContext * ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->have_texture) {
|
if (ctx->have_texture) {
|
||||||
glDeleteTextures (ctx->n_textures + 1, ctx->texture);
|
glDeleteTextures (ctx->n_textures, ctx->texture);
|
||||||
ctx->have_texture = FALSE;
|
ctx->have_texture = FALSE;
|
||||||
ctx->n_textures = 0;
|
ctx->n_textures = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (ctx->glslprogram[i]) {
|
if (ctx->glslprogram[i]) {
|
||||||
glDetachShader (ctx->glslprogram[i], ctx->fragshader[i]);
|
glDetachShader (ctx->glslprogram[i], ctx->fragshader[i]);
|
||||||
glDetachShader (ctx->glslprogram[i], ctx->vertshader[i]);
|
glDetachShader (ctx->glslprogram[i], ctx->vertshader[i]);
|
||||||
@ -611,30 +599,6 @@ gst_egl_adaptation_init_egl_surface (GstEglAdaptationContext * ctx,
|
|||||||
glGetUniformLocation (ctx->glslprogram[0], texnames[i]);
|
glGetUniformLocation (ctx->glslprogram[0], texnames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* custom rendering shader */
|
|
||||||
|
|
||||||
if (!create_shader_program (ctx,
|
|
||||||
&ctx->glslprogram[2],
|
|
||||||
&ctx->vertshader[2],
|
|
||||||
&ctx->fragshader[2], vert_COPY_prog, frag_COPY_DIRECT_prog)) {
|
|
||||||
if (free_frag_prog)
|
|
||||||
g_free (frag_prog);
|
|
||||||
frag_prog = NULL;
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
}
|
|
||||||
if (free_frag_prog)
|
|
||||||
g_free (frag_prog);
|
|
||||||
frag_prog = NULL;
|
|
||||||
|
|
||||||
ctx->position_loc[2] = glGetAttribLocation (ctx->glslprogram[2], "position");
|
|
||||||
ctx->texpos_loc[1] = glGetAttribLocation (ctx->glslprogram[2], "texpos");
|
|
||||||
|
|
||||||
glEnableVertexAttribArray (ctx->position_loc[2]);
|
|
||||||
if (got_gl_error ("glEnableVertexAttribArray"))
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
|
|
||||||
ctx->tex_loc[1][0] = glGetUniformLocation (ctx->glslprogram[2], "tex");
|
|
||||||
|
|
||||||
if (!ctx->buffer_preserved) {
|
if (!ctx->buffer_preserved) {
|
||||||
/* Build shader program for black borders */
|
/* Build shader program for black borders */
|
||||||
if (!create_shader_program (ctx,
|
if (!create_shader_program (ctx,
|
||||||
@ -655,11 +619,11 @@ gst_egl_adaptation_init_egl_surface (GstEglAdaptationContext * ctx,
|
|||||||
if (!ctx->have_texture) {
|
if (!ctx->have_texture) {
|
||||||
GST_INFO_OBJECT (ctx->element, "Performing initial texture setup");
|
GST_INFO_OBJECT (ctx->element, "Performing initial texture setup");
|
||||||
|
|
||||||
glGenTextures (ctx->n_textures + 1, ctx->texture);
|
glGenTextures (ctx->n_textures, ctx->texture);
|
||||||
if (got_gl_error ("glGenTextures"))
|
if (got_gl_error ("glGenTextures"))
|
||||||
goto HANDLE_ERROR_LOCKED;
|
goto HANDLE_ERROR_LOCKED;
|
||||||
|
|
||||||
for (i = 0; i < ctx->n_textures + 1; i++) {
|
for (i = 0; i < ctx->n_textures; i++) {
|
||||||
glBindTexture (GL_TEXTURE_2D, ctx->texture[i]);
|
glBindTexture (GL_TEXTURE_2D, ctx->texture[i]);
|
||||||
if (got_gl_error ("glBindTexture"))
|
if (got_gl_error ("glBindTexture"))
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
|
@ -126,15 +126,15 @@ struct _GstEglAdaptationContext
|
|||||||
GstEGLDisplay *display, *set_display;
|
GstEGLDisplay *display, *set_display;
|
||||||
EGLNativeWindowType window, used_window;
|
EGLNativeWindowType window, used_window;
|
||||||
|
|
||||||
GLuint fragshader[3]; /* frame, border, frame-custom */
|
GLuint fragshader[2]; /* frame, border */
|
||||||
GLuint vertshader[3]; /* frame, border, frame-custom */
|
GLuint vertshader[2]; /* frame, border */
|
||||||
GLuint glslprogram[3]; /* frame, border, frame-custom */
|
GLuint glslprogram[2]; /* frame, border */
|
||||||
GLuint texture[4]; /* RGB/Y, U/UV, V, custom */
|
GLuint texture[3]; /* RGB/Y, U/UV, V */
|
||||||
/* shader vars */
|
/* shader vars */
|
||||||
GLuint position_loc[3]; /* frame, border, frame-custom */
|
GLuint position_loc[2]; /* frame, border */
|
||||||
GLuint texpos_loc[2]; /* frame, frame-custom */
|
GLuint texpos_loc[1]; /* frame */
|
||||||
GLuint tex_scale_loc[1][3]; /* [frame] RGB/Y, U/UV, V */
|
GLuint tex_scale_loc[1][3]; /* [frame] RGB/Y, U/UV, V */
|
||||||
GLuint tex_loc[2][3]; /* [frame,frame-custom] RGB/Y, U/UV, V */
|
GLuint tex_loc[1][3]; /* [frame] RGB/Y, U/UV, V */
|
||||||
coord5 position_array[16]; /* 4 x Frame x-normal,y-normal, 4x Frame x-normal,y-flip, 4 x Border1, 4 x Border2 */
|
coord5 position_array[16]; /* 4 x Frame x-normal,y-normal, 4x Frame x-normal,y-flip, 4 x Border1, 4 x Border2 */
|
||||||
unsigned short index_array[4];
|
unsigned short index_array[4];
|
||||||
unsigned int position_buffer, index_buffer;
|
unsigned int position_buffer, index_buffer;
|
||||||
|
@ -440,7 +440,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_RGB, GST_VIDEO_INFO_WIDTH (&info),
|
GST_VIDEO_GL_TEXTURE_TYPE_RGB, GST_VIDEO_INFO_WIDTH (&info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
||||||
if (mem[0]) {
|
if (mem[0]) {
|
||||||
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
||||||
@ -488,7 +488,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
image, GST_VIDEO_GL_TEXTURE_TYPE_RGB,
|
||||||
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_RGB, GST_VIDEO_INFO_WIDTH (&info),
|
GST_VIDEO_GL_TEXTURE_TYPE_RGB, GST_VIDEO_INFO_WIDTH (&info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
||||||
if (mem[0]) {
|
if (mem[0]) {
|
||||||
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
||||||
@ -549,7 +549,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
image, GST_VIDEO_GL_TEXTURE_TYPE_RGB,
|
||||||
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
}
|
}
|
||||||
@ -562,11 +562,11 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
||||||
0), GST_VIDEO_INFO_COMP_HEIGHT (&info, 0), &size[0]);
|
0), GST_VIDEO_INFO_COMP_HEIGHT (&info, 0), &size[0]);
|
||||||
mem[1] =
|
mem[1] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA,
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
|
||||||
GST_VIDEO_INFO_COMP_WIDTH (&info, 1),
|
GST_VIDEO_INFO_COMP_WIDTH (&info, 1),
|
||||||
GST_VIDEO_INFO_COMP_HEIGHT (&info, 1), &size[1]);
|
GST_VIDEO_INFO_COMP_HEIGHT (&info, 1), &size[1]);
|
||||||
|
|
||||||
@ -639,8 +639,8 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
||||||
image,
|
image,
|
||||||
(i ==
|
(i ==
|
||||||
0 ? GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE :
|
0 ? GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE :
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA),
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA),
|
||||||
flags, size[i], data,
|
flags, size[i], data,
|
||||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
}
|
}
|
||||||
@ -659,15 +659,15 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
||||||
0), GST_VIDEO_INFO_COMP_HEIGHT (&info, 0), &size[0]);
|
0), GST_VIDEO_INFO_COMP_HEIGHT (&info, 0), &size[0]);
|
||||||
mem[1] =
|
mem[1] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
||||||
1), GST_VIDEO_INFO_COMP_HEIGHT (&info, 1), &size[1]);
|
1), GST_VIDEO_INFO_COMP_HEIGHT (&info, 1), &size[1]);
|
||||||
mem[2] =
|
mem[2] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE, GST_VIDEO_INFO_COMP_WIDTH (&info,
|
||||||
2), GST_VIDEO_INFO_COMP_HEIGHT (&info, 2), &size[2]);
|
2), GST_VIDEO_INFO_COMP_HEIGHT (&info, 2), &size[2]);
|
||||||
|
|
||||||
if (mem[0] && mem[1] && mem[2]) {
|
if (mem[0] && mem[1] && mem[2]) {
|
||||||
@ -740,7 +740,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[i] =
|
mem[i] =
|
||||||
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE,
|
image, GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE,
|
||||||
flags, size[i], data,
|
flags, size[i], data,
|
||||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
}
|
}
|
||||||
@ -763,7 +763,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
gst_egl_image_allocator_alloc (allocator, ctx->display,
|
||||||
GST_EGL_IMAGE_MEMORY_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&info),
|
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
GST_VIDEO_INFO_HEIGHT (&info), &size);
|
||||||
if (mem[0]) {
|
if (mem[0]) {
|
||||||
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
stride[0] = size / GST_VIDEO_INFO_HEIGHT (&info);
|
||||||
@ -811,7 +811,7 @@ gst_egl_adaptation_allocate_eglimage (GstEglAdaptationContext * ctx,
|
|||||||
|
|
||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
gst_egl_image_allocator_wrap (allocator, ctx->display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA,
|
image, GST_VIDEO_GL_TEXTURE_TYPE_RGBA,
|
||||||
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
flags, size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
|
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
|
@ -1513,24 +1513,35 @@ gst_eglglessink_upload (GstEglGlesSink * eglglessink, GstBuffer * buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (upload_meta) {
|
if (upload_meta) {
|
||||||
glActiveTexture (GL_TEXTURE0);
|
gint i;
|
||||||
glBindTexture (GL_TEXTURE_2D,
|
|
||||||
eglglessink->egl_context->texture[eglglessink->
|
if (upload_meta->n_textures != eglglessink->egl_context->n_textures)
|
||||||
egl_context->n_textures]);
|
|
||||||
if (!gst_video_gl_texture_upload_meta_upload (upload_meta, GL_RGBA,
|
|
||||||
eglglessink->egl_context->texture[eglglessink->
|
|
||||||
egl_context->n_textures]))
|
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
|
|
||||||
eglglessink->orientation = GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL;
|
for (i = 0; i < eglglessink->egl_context->n_textures; i++) {
|
||||||
eglglessink->custom_format = TRUE;
|
if (i == 0)
|
||||||
|
glActiveTexture (GL_TEXTURE0);
|
||||||
|
else if (i == 1)
|
||||||
|
glActiveTexture (GL_TEXTURE1);
|
||||||
|
else if (i == 2)
|
||||||
|
glActiveTexture (GL_TEXTURE2);
|
||||||
|
|
||||||
|
glBindTexture (GL_TEXTURE_2D, eglglessink->egl_context->texture[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gst_video_gl_texture_upload_meta_upload (upload_meta,
|
||||||
|
eglglessink->egl_context->texture))
|
||||||
|
goto HANDLE_ERROR;
|
||||||
|
|
||||||
|
eglglessink->orientation = upload_meta->texture_orientation;
|
||||||
|
eglglessink->stride[0] = 1;
|
||||||
|
eglglessink->stride[1] = 1;
|
||||||
|
eglglessink->stride[2] = 1;
|
||||||
} else if (gst_buffer_n_memory (buf) >= 1 &&
|
} else if (gst_buffer_n_memory (buf) >= 1 &&
|
||||||
(mem = gst_buffer_peek_memory (buf, 0))
|
(mem = gst_buffer_peek_memory (buf, 0))
|
||||||
&& gst_is_egl_image_memory (mem)) {
|
&& gst_is_egl_image_memory (mem)) {
|
||||||
guint n, i;
|
guint n, i;
|
||||||
|
|
||||||
eglglessink->custom_format = FALSE;
|
|
||||||
|
|
||||||
n = gst_buffer_n_memory (buf);
|
n = gst_buffer_n_memory (buf);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -1552,9 +1563,9 @@ gst_eglglessink_upload (GstEglGlesSink * eglglessink, GstBuffer * buf)
|
|||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
eglglessink->orientation = gst_egl_image_memory_get_orientation (mem);
|
eglglessink->orientation = gst_egl_image_memory_get_orientation (mem);
|
||||||
if (eglglessink->orientation !=
|
if (eglglessink->orientation !=
|
||||||
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL
|
||||||
&& eglglessink->orientation !=
|
&& eglglessink->orientation !=
|
||||||
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_FLIP) {
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP) {
|
||||||
GST_ERROR_OBJECT (eglglessink, "Unsupported EGLImage orientation");
|
GST_ERROR_OBJECT (eglglessink, "Unsupported EGLImage orientation");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
@ -1564,9 +1575,8 @@ gst_eglglessink_upload (GstEglGlesSink * eglglessink, GstBuffer * buf)
|
|||||||
eglglessink->stride[1] = 1;
|
eglglessink->stride[1] = 1;
|
||||||
eglglessink->stride[2] = 1;
|
eglglessink->stride[2] = 1;
|
||||||
} else {
|
} else {
|
||||||
eglglessink->custom_format = FALSE;
|
eglglessink->orientation =
|
||||||
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL;
|
||||||
eglglessink->orientation = GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL;
|
|
||||||
if (!gst_eglglessink_fill_texture (eglglessink, buf))
|
if (!gst_eglglessink_fill_texture (eglglessink, buf))
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
}
|
}
|
||||||
@ -1706,23 +1716,6 @@ gst_eglglessink_render (GstEglGlesSink * eglglessink)
|
|||||||
/* Draw video frame */
|
/* Draw video frame */
|
||||||
GST_DEBUG_OBJECT (eglglessink, "Drawing video frame");
|
GST_DEBUG_OBJECT (eglglessink, "Drawing video frame");
|
||||||
|
|
||||||
if (eglglessink->custom_format) {
|
|
||||||
glUseProgram (eglglessink->egl_context->glslprogram[2]);
|
|
||||||
|
|
||||||
glUniform1i (eglglessink->egl_context->tex_loc[1][0], 0);
|
|
||||||
if (got_gl_error ("glUniform1i"))
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
|
|
||||||
glVertexAttribPointer (eglglessink->egl_context->position_loc[2], 3,
|
|
||||||
GL_FLOAT, GL_FALSE, sizeof (coord5), (gpointer) (0));
|
|
||||||
if (got_gl_error ("glVertexAttribPointer"))
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
|
|
||||||
glVertexAttribPointer (eglglessink->egl_context->texpos_loc[1], 2,
|
|
||||||
GL_FLOAT, GL_FALSE, sizeof (coord5), (gpointer) (3 * sizeof (gfloat)));
|
|
||||||
if (got_gl_error ("glVertexAttribPointer"))
|
|
||||||
goto HANDLE_ERROR;
|
|
||||||
} else {
|
|
||||||
glUseProgram (eglglessink->egl_context->glslprogram[0]);
|
glUseProgram (eglglessink->egl_context->glslprogram[0]);
|
||||||
|
|
||||||
glUniform2f (eglglessink->egl_context->tex_scale_loc[0][0],
|
glUniform2f (eglglessink->egl_context->tex_scale_loc[0][0],
|
||||||
@ -1738,23 +1731,21 @@ gst_eglglessink_render (GstEglGlesSink * eglglessink)
|
|||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eglglessink->orientation == GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL) {
|
if (eglglessink->orientation ==
|
||||||
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL) {
|
||||||
glVertexAttribPointer (eglglessink->egl_context->position_loc[0], 3,
|
glVertexAttribPointer (eglglessink->egl_context->position_loc[0], 3,
|
||||||
GL_FLOAT, GL_FALSE, sizeof (coord5),
|
GL_FLOAT, GL_FALSE, sizeof (coord5), (gpointer) (0 * sizeof (coord5)));
|
||||||
(gpointer) (0 * sizeof (coord5)));
|
|
||||||
if (got_gl_error ("glVertexAttribPointer"))
|
if (got_gl_error ("glVertexAttribPointer"))
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
|
|
||||||
glVertexAttribPointer (eglglessink->egl_context->texpos_loc[0], 2,
|
glVertexAttribPointer (eglglessink->egl_context->texpos_loc[0], 2,
|
||||||
GL_FLOAT, GL_FALSE, sizeof (coord5),
|
GL_FLOAT, GL_FALSE, sizeof (coord5), (gpointer) (3 * sizeof (gfloat)));
|
||||||
(gpointer) (3 * sizeof (gfloat)));
|
|
||||||
if (got_gl_error ("glVertexAttribPointer"))
|
if (got_gl_error ("glVertexAttribPointer"))
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
} else if (eglglessink->orientation ==
|
} else if (eglglessink->orientation ==
|
||||||
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_FLIP) {
|
GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP) {
|
||||||
glVertexAttribPointer (eglglessink->egl_context->position_loc[0], 3,
|
glVertexAttribPointer (eglglessink->egl_context->position_loc[0], 3,
|
||||||
GL_FLOAT, GL_FALSE, sizeof (coord5),
|
GL_FLOAT, GL_FALSE, sizeof (coord5), (gpointer) (4 * sizeof (coord5)));
|
||||||
(gpointer) (4 * sizeof (coord5)));
|
|
||||||
if (got_gl_error ("glVertexAttribPointer"))
|
if (got_gl_error ("glVertexAttribPointer"))
|
||||||
goto HANDLE_ERROR;
|
goto HANDLE_ERROR;
|
||||||
|
|
||||||
@ -1766,7 +1757,6 @@ gst_eglglessink_render (GstEglGlesSink * eglglessink)
|
|||||||
} else {
|
} else {
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
glDrawElements (GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, 0);
|
glDrawElements (GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, 0);
|
||||||
if (got_gl_error ("glDrawElements"))
|
if (got_gl_error ("glDrawElements"))
|
||||||
|
@ -106,8 +106,7 @@ struct _GstEglGlesSink
|
|||||||
GstCaps *current_caps, *configured_caps;
|
GstCaps *current_caps, *configured_caps;
|
||||||
GstVideoInfo configured_info;
|
GstVideoInfo configured_info;
|
||||||
gfloat stride[3];
|
gfloat stride[3];
|
||||||
GstEGLImageOrientation orientation;
|
GstVideoGLTextureOrientation orientation;
|
||||||
gboolean custom_format; /* If it's a single texture that is just copied */
|
|
||||||
GstBufferPool *pool;
|
GstBufferPool *pool;
|
||||||
|
|
||||||
GstEglAdaptationContext *egl_context;
|
GstEglAdaptationContext *egl_context;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user