diff options
Diffstat (limited to 'ext/gl')
-rw-r--r-- | ext/gl/gstglimagesink.c | 29 | ||||
-rw-r--r-- | ext/gl/gstglimagesink.h | 1 | ||||
-rw-r--r-- | ext/gl/gstglstereomix.c | 12 |
3 files changed, 33 insertions, 9 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index fa3c89411..92a8a327c 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -1005,6 +1005,10 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition) gst_caps_unref (glimage_sink->out_caps); glimage_sink->out_caps = NULL; } + if (glimage_sink->in_caps) { + gst_caps_unref (glimage_sink->in_caps); + glimage_sink->in_caps = NULL; + } break; } case GST_STATE_CHANGE_READY_TO_NULL: @@ -1172,6 +1176,7 @@ update_output_format (GstGLImageSink * glimage_sink) gboolean input_is_mono = FALSE; GstVideoMultiviewMode mv_mode; GstGLWindow *window = NULL; + GstCaps *out_caps; gboolean ret; *out_info = glimage_sink->in_info; @@ -1213,15 +1218,28 @@ update_output_format (GstGLImageSink * glimage_sink) glimage_sink->out_info.height = MAX (1, glimage_sink->display_rect.h); GST_LOG_OBJECT (glimage_sink, "Set 3D output scale to %d,%d", glimage_sink->display_rect.w, glimage_sink->display_rect.h); + } + + out_caps = gst_video_info_to_caps (out_info); + gst_caps_set_features (out_caps, 0, + gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY)); + + if (glimage_sink->convert_views) { + gst_caps_set_simple (out_caps, "texture-target", G_TYPE_STRING, + GST_GL_TEXTURE_TARGET_2D_STR, NULL); GST_GLIMAGE_SINK_UNLOCK (glimage_sink); - gst_gl_view_convert_set_format (glimage_sink->convert_views, - &glimage_sink->in_info, &glimage_sink->out_info); + gst_gl_view_convert_set_caps (glimage_sink->convert_views, + glimage_sink->in_caps, out_caps); g_object_set (glimage_sink->convert_views, "downmix-mode", glimage_sink->mview_downmix_mode, NULL); GST_GLIMAGE_SINK_LOCK (glimage_sink); } + if (glimage_sink->out_caps) + gst_caps_unref (glimage_sink->out_caps); + glimage_sink->out_caps = out_caps; + glimage_sink->output_mode_changed = FALSE; if (glimage_sink->context) @@ -1231,10 +1249,6 @@ update_output_format (GstGLImageSink * glimage_sink) gst_object_unref (window); } - if (glimage_sink->out_caps) - gst_caps_unref (glimage_sink->out_caps); - glimage_sink->out_caps = gst_video_info_to_caps (out_info); - return ret; } @@ -1257,6 +1271,9 @@ gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) return FALSE; GST_GLIMAGE_SINK_LOCK (glimage_sink); + if (glimage_sink->in_caps) + gst_caps_unref (glimage_sink->in_caps); + glimage_sink->in_caps = gst_caps_ref (caps); glimage_sink->in_info = vinfo; ok = update_output_format (glimage_sink); diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h index f7b3bfb03..139c04acc 100644 --- a/ext/gl/gstglimagesink.h +++ b/ext/gl/gstglimagesink.h @@ -64,6 +64,7 @@ struct _GstGLImageSink /* Input info before 3d stereo output conversion, if any */ GstVideoInfo in_info; + GstCaps *in_caps; /* format/caps we actually hand off to the app */ GstVideoInfo out_info; diff --git a/ext/gl/gstglstereomix.c b/ext/gl/gstglstereomix.c index 7b247395d..c342a2341 100644 --- a/ext/gl/gstglstereomix.c +++ b/ext/gl/gstglstereomix.c @@ -483,6 +483,7 @@ static gboolean _negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps) { GstGLStereoMix *mix = GST_GL_STEREO_MIX (vagg); + GstCaps *in_caps; GST_LOG_OBJECT (mix, "Configured output caps %" GST_PTR_FORMAT, caps); @@ -498,11 +499,16 @@ _negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps) /* We can configure the view_converter now */ gst_gl_view_convert_set_context (mix->viewconvert, GST_GL_BASE_MIXER (mix)->context); - gst_gl_view_convert_set_format (mix->viewconvert, &mix->mix_info, - &mix->out_info); - return TRUE; + in_caps = gst_video_info_to_caps (&mix->mix_info); + gst_caps_set_features (in_caps, 0, + gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY)); + gst_caps_set_simple (in_caps, "texture-target", G_TYPE_STRING, + GST_GL_TEXTURE_TARGET_2D_STR, NULL); + gst_gl_view_convert_set_caps (mix->viewconvert, in_caps, caps); + + return TRUE; } static gboolean |