summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2013-04-19 16:45:43 +0200
committerJosep Torra <n770galaxy@gmail.com>2013-05-10 09:43:19 +0200
commit83e2a07e6d6f103c5e3661028409c9f4e866005d (patch)
tree307f5d307547d76a9be24ddcfb40301b7f443e3d
parent53cfad521218d0ba36316038f6117279bde96dbb (diff)
downloadgst-omx-83e2a07e6d6f103c5e3661028409c9f4e866005d.tar.gz
omxvideodec: support video size changes again
-rw-r--r--examples/egl/testegl.c7
-rw-r--r--omx/gstomxvideodec.c106
2 files changed, 57 insertions, 56 deletions
diff --git a/examples/egl/testegl.c b/examples/egl/testegl.c
index 6887638..ea82141 100644
--- a/examples/egl/testegl.c
+++ b/examples/egl/testegl.c
@@ -767,7 +767,12 @@ handle_queued_objects (APP_STATE_T * state)
if (GST_IS_BUFFER (object)) {
GstBuffer *buffer = GST_BUFFER_CAST (object);
- update_image (state, buffer);
+ if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_PREROLL)) {
+ g_print ("got a reclaim buffer\n");
+ flush_internal (state);
+ } else {
+ update_image (state, buffer);
+ }
gst_buffer_unref (buffer);
} else if (GST_IS_MESSAGE (object)) {
GstMessage *message = GST_MESSAGE_CAST (object);
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index e91413b..b672107 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -1451,6 +1451,14 @@ eos:
{
g_mutex_lock (self->drain_lock);
if (self->draining) {
+#ifdef USE_EGL_RPI
+ if (self->egl_transport_active) {
+ GstBuffer *reclaim = gst_buffer_new ();
+ GST_BUFFER_FLAG_SET (reclaim, GST_BUFFER_FLAG_PREROLL);
+ GST_DEBUG_OBJECT (self, "pushing a reclaim buffer");
+ flow_ret = gst_pad_push (GST_VIDEO_DECODER_SRC_PAD (self), reclaim);
+ }
+#endif
GST_DEBUG_OBJECT (self, "Drained");
self->draining = FALSE;
g_cond_broadcast (self->drain_cond);
@@ -1929,80 +1937,68 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
} else {
#ifdef USE_EGL_RPI
if (self->egl_transport_active) {
- OMX_STATETYPE egl_state;
-
- if (gst_omx_port_set_enabled (self->dec_in_port,
- FALSE) != OMX_ErrorNone)
- return FALSE;
-
- if (gst_omx_port_set_enabled (self->dec_out_port,
- FALSE) != OMX_ErrorNone)
- return FALSE;
-
- if (gst_omx_port_wait_buffers_released (self->dec_in_port,
- 5 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
-
- if (gst_omx_port_wait_buffers_released (self->dec_out_port,
- 5 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
-
- if (gst_omx_port_deallocate_buffers (self->dec_in_port) !=
- OMX_ErrorNone)
- return FALSE;
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE);
+ }
+#endif
- if (gst_omx_port_wait_enabled (self->dec_in_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
+ if (gst_omx_port_set_enabled (self->dec_in_port, FALSE) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_wait_buffers_released (self->dec_in_port,
+ 5 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_wait_buffers_released (out_port,
+ 1 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_wait_enabled (self->dec_in_port,
+ 1 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
- if (gst_omx_port_wait_enabled (self->dec_out_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
+#ifdef USE_EGL_RPI
+ if (self->egl_transport_active) {
+ OMX_STATETYPE egl_state;
+ GST_DEBUG_OBJECT (self, "deactivating EGL transport");
egl_state = gst_omx_component_get_state (self->egl_render, 0);
if (egl_state > OMX_StateLoaded || egl_state == OMX_StateInvalid) {
+
if (egl_state > OMX_StateIdle) {
gst_omx_component_set_state (self->egl_render, OMX_StateIdle);
- gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND);
+ gst_omx_component_set_state (self->dec, OMX_StateIdle);
+ egl_state = gst_omx_component_get_state (self->egl_render,
+ 5 * GST_SECOND);
+ gst_omx_component_get_state (self->dec, 1 * GST_SECOND);
}
gst_omx_component_set_state (self->egl_render, OMX_StateLoaded);
+ gst_omx_component_set_state (self->dec, OMX_StateLoaded);
- gst_omx_video_dec_deallocate_output_buffers (self);
gst_omx_component_close_tunnel (self->dec, self->dec_out_port,
self->egl_render, self->egl_in_port);
if (egl_state > OMX_StateLoaded) {
gst_omx_component_get_state (self->egl_render, 5 * GST_SECOND);
}
+
+ gst_omx_component_set_state (self->dec, OMX_StateIdle);
+
+ gst_omx_component_set_state (self->dec, OMX_StateExecuting);
+ gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE);
}
self->egl_transport_active = FALSE;
- } else {
-#else
- {
- if (gst_omx_port_set_enabled (self->dec_in_port,
- FALSE) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_wait_buffers_released (self->dec_in_port,
- 5 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_wait_buffers_released (out_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_deallocate_buffers (self->dec_in_port) !=
- OMX_ErrorNone)
- return FALSE;
- if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_wait_enabled (self->dec_in_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
- if (gst_omx_port_wait_enabled (out_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
-#endif
+ GST_DEBUG_OBJECT (self, "EGL transport deactivated");
}
+#endif
+
}
if (self->input_state)
gst_video_codec_state_unref (self->input_state);