From afd3624b28a969bf174e0bcba90407b9b6c68547 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 3 Feb 2016 10:59:23 +1100 Subject: [PATCH] gltransformation: reconfigure the src when changing to/from passthrough Otherwise it's very possible that any GL resources have not been created yet. --- ext/gl/gstgltransformation.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ext/gl/gstgltransformation.c b/ext/gl/gstgltransformation.c index 4b1c215d6c..779447c58a 100644 --- a/ext/gl/gstgltransformation.c +++ b/ext/gl/gstgltransformation.c @@ -290,6 +290,7 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation) graphene_vec3_t center; graphene_vec3_t up; + gboolean current_passthrough; gboolean passthrough; graphene_vec3_init (&eye, 0.f, 0.f, 1.f); @@ -297,13 +298,14 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation) graphene_vec3_init (&up, 0.f, 1.f, 0.f); /* Translate into pivot origin */ - graphene_matrix_init_translate (&transformation->model_matrix, &pivot_vector); + graphene_matrix_init_translate (&transformation->model_matrix, + &pivot_vector); /* Scale */ graphene_matrix_scale (&transformation->model_matrix, transformation->xscale, transformation->yscale, 1.0f); - /* Rotation */ + /* Rotation */ graphene_matrix_rotate (&transformation->model_matrix, transformation->xrotation, graphene_vec3_x_axis ()); graphene_matrix_rotate (&transformation->model_matrix, @@ -311,7 +313,7 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation) graphene_matrix_rotate (&transformation->model_matrix, transformation->zrotation, graphene_vec3_z_axis ()); - /* Translate back from pivot origin */ + /* Translate back from pivot origin */ graphene_point3d_scale (&pivot_vector, -1.0, &negative_pivot_vector); graphene_matrix_translate (&transformation->model_matrix, &negative_pivot_vector); @@ -333,17 +335,19 @@ gst_gl_transformation_build_mvp (GstGLTransformation * transformation) graphene_matrix_init_look_at (&transformation->view_matrix, &eye, ¢er, &up); + current_passthrough = + gst_base_transform_is_passthrough (GST_BASE_TRANSFORM (transformation)); passthrough = transformation->xtranslation == 0. && transformation->ytranslation == 0. - && transformation->ztranslation == 0. - && transformation->xrotation == 0. - && transformation->yrotation == 0. - && transformation->zrotation == 0. - && transformation->xscale == 1. - && transformation->yscale == 1. + && transformation->ztranslation == 0. && transformation->xrotation == 0. + && transformation->yrotation == 0. && transformation->zrotation == 0. + && transformation->xscale == 1. && transformation->yscale == 1. && gst_video_info_is_equal (&filter->in_info, &filter->out_info); gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (transformation), passthrough); + if (current_passthrough != passthrough) { + gst_base_transform_reconfigure_src (GST_BASE_TRANSFORM (transformation)); + } } graphene_matrix_multiply (&transformation->model_matrix,