summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--omx/gstomxvideodec.c54
-rw-r--r--omx/gstomxvideodec.h1
2 files changed, 55 insertions, 0 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index f18df44..4b98989 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -722,6 +722,11 @@ static OMX_ERRORTYPE gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec *
static OMX_ERRORTYPE gst_omx_video_dec_deallocate_output_buffers (GstOMXVideoDec
* self);
+#if defined (USE_OMX_TARGET_RPI)
+static void gst_omx_video_dec_sink_needs_reconfiguration_cb (GstOMXVideoDec *
+ self);
+#endif
+
enum
{
PROP_0
@@ -768,6 +773,15 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
klass->cdata.default_src_template_caps = "video/x-raw, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
+
+#if defined (USE_OMX_TARGET_RPI)
+ g_signal_new ("sink-needs-reconfiguration", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+ g_signal_override_class_handler ("sink-needs-reconfiguration",
+ G_TYPE_FROM_CLASS (klass),
+ (GCallback) gst_omx_video_dec_sink_needs_reconfiguration_cb);
+#endif
}
static void
@@ -2515,8 +2529,39 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
}
if (acq_return == GST_OMX_ACQUIRE_BUFFER_RECONFIGURE) {
+#if defined (USE_OMX_TARGET_RPI)
+ /* clear the old state of sink_needs_reconfigure. we are now reconfiguring,
+ * so we are only interested in it becoming TRUE while this configuration
+ * is in progress */
+ g_atomic_int_set (&self->sink_needs_reconfigure, FALSE);
+#endif
+
/* We have the possibility to reconfigure everything now */
err = gst_omx_video_dec_reconfigure_output_port (self);
+
+#if defined (USE_OMX_TARGET_RPI)
+ /* if the video sink requested reconfiguration while we were configuring,
+ we need to start over and redo the configuration */
+ if (g_atomic_int_compare_and_exchange (&self->sink_needs_reconfigure,
+ TRUE, FALSE)) {
+ GST_DEBUG_OBJECT (self, "re-doing output port reconfiguration");
+
+ /* pick the right port that is going to be our output port
+ * after the last reconfiguration... */
+#if defined (HAVE_GST_EGL)
+ if (self->eglimage)
+ port = self->egl_out_port;
+ else
+#endif
+ if (self->use_resizer)
+ port = self->res_out_port;
+ else
+ port = self->dec_out_port;
+
+ err = gst_omx_port_mark_to_reconfigure (port);
+ }
+#endif
+
if (err != OMX_ErrorNone)
goto reconfigure_error;
} else {
@@ -3644,6 +3689,15 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
return TRUE;
}
+#if defined (USE_OMX_TARGET_RPI)
+static void
+gst_omx_video_dec_sink_needs_reconfiguration_cb (GstOMXVideoDec * self)
+{
+ GST_DEBUG_OBJECT (self, "sink_needs_reconfigure");
+ g_atomic_int_set (&self->sink_needs_reconfigure, TRUE);
+}
+#endif
+
static gboolean
gst_omx_video_dec_src_event (GstVideoDecoder * decoder, GstEvent * event)
{
diff --git a/omx/gstomxvideodec.h b/omx/gstomxvideodec.h
index 44d3db8..34d5e3b 100644
--- a/omx/gstomxvideodec.h
+++ b/omx/gstomxvideodec.h
@@ -95,6 +95,7 @@ struct _GstOMXVideoDec
gint resize_width;
gint resize_height;
gint resizer_padding_bottom;
+ volatile gint sink_needs_reconfigure;
#endif
};