summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2014-10-27 10:41:51 (GMT)
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2014-10-27 10:41:51 (GMT)
commitd83cbc317cd97fcc4ea612e0fdabc78f04c3f9b0 (patch)
treea9cae58517be8ae139befa06cd15d514041e64f9
parenta7434dec3dc4f1f5cb02d81d4678513ed37675f0 (diff)
downloadgst-omx-gkiagia/RPI-440.tar.gz
gst-omx-gkiagia/RPI-440.tar.xz
omxvideodec: HACK: add a signal for the video sink to request directly reconfigurationgkiagia/RPI-440
This is needed for webkitvideosink to request resize in case omxvideodec is in the process of reconfiguring itself while the video sink changes size. Otherwise, the new size is ignored.
-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
};