From a2db76b048db278ef0aa798e106b7594264e06c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 8 Apr 2013 17:26:16 +0100 Subject: [PATCH] Check for gstreamer-egl And don't use if not available. https://bugzilla.gnome.org/show_bug.cgi?id=697574 --- configure.ac | 4 +++- omx/Makefile.am | 5 ++--- omx/gstomxvideodec.c | 42 ++++++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index e132a02..21227c6 100644 --- a/configure.ac +++ b/configure.ac @@ -147,7 +147,9 @@ AG_GST_CHECK_GST_CONTROLLER($GST_API_VERSION, [$GST_REQ], yes) AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no) AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_REQ], yes) AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes") -PKG_CHECK_MODULES([GST_PLUGINS_BAD], [gstreamer-plugins-bad-1.0]) +PKG_CHECK_MODULES([GST_EGL], [gstreamer-egl-1.0], [ + AC_DEFINE(HAVE_GST_EGL, 1, [Have gstreamer-egl]) +]) dnl Check for documentation xrefs GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" diff --git a/omx/Makefile.am b/omx/Makefile.am index 9c7bed1..dbe2f54 100644 --- a/omx/Makefile.am +++ b/omx/Makefile.am @@ -53,13 +53,12 @@ endif libgstomx_la_CFLAGS = \ -DGST_USE_UNSTABLE_API=1 \ $(OMX_INCLUDEPATH) \ - $(GST_PLUGINS_BAD_CFLAGS) \ + $(GST_EGL_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \ $(GST_CFLAGS) libgstomx_la_LIBADD = \ - $(GST_PLUGINS_BAD_LIBS) \ - -lgstegl-@GST_API_VERSION@ \ + $(GST_EGL_LIBS) \ $(GST_PLUGINS_BASE_LIBS) \ -lgstaudio-@GST_API_VERSION@ \ -lgstpbutils-@GST_API_VERSION@ \ diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 51ecd53..1d3f395 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -38,7 +38,9 @@ #pragma GCC optimize ("gnu89-inline") #endif +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) #include +#endif #if defined (USE_OMX_TARGET_RPI) && defined(__GNUC__) #pragma GCC reset_options @@ -794,7 +796,7 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder) GST_DEBUG_OBJECT (self, "Opened decoder"); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) GST_DEBUG_OBJECT (self, "Opening EGL renderer"); self->egl_render = gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, @@ -851,7 +853,7 @@ gst_omx_video_dec_shutdown (GstOMXVideoDec * self) GST_DEBUG_OBJECT (self, "Shutting down decoder"); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) state = gst_omx_component_get_state (self->egl_render, 0); if (state > OMX_StateLoaded || state == OMX_StateInvalid) { if (state > OMX_StateIdle) { @@ -909,7 +911,7 @@ gst_omx_video_dec_close (GstVideoDecoder * decoder) gst_omx_component_free (self->dec); self->dec = NULL; -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) self->egl_in_port = NULL; self->egl_out_port = NULL; if (self->egl_render) @@ -960,7 +962,7 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition) gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE); if (self->dec_out_port) gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) if (self->egl_in_port) gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE); if (self->egl_out_port) @@ -1261,7 +1263,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self) GstVideoCodecState *state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (self)); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) port = self->eglimage ? self->egl_out_port : self->dec_out_port; #else port = self->dec_out_port; @@ -1289,7 +1291,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self) add_videometa = gst_buffer_pool_config_has_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) eglimage = self->eglimage && (allocator && g_strcmp0 (allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0); #else @@ -1307,7 +1309,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self) GST_DEBUG_OBJECT (self, "No pool available, not negotiated yet"); } -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) /* Will retry without EGLImage */ if (self->eglimage && !eglimage) { GST_DEBUG_OBJECT (self, @@ -1321,7 +1323,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self) self->out_port_pool = gst_omx_buffer_pool_new (GST_ELEMENT_CAST (self), self->dec, port); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) if (eglimage) { GList *buffers = NULL; GList *images = NULL; @@ -1601,7 +1603,7 @@ gst_omx_video_dec_deallocate_output_buffers (GstOMXVideoDec * self) gst_object_unref (self->out_port_pool); self->out_port_pool = NULL; } -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) err = gst_omx_port_deallocate_buffers (self-> eglimage ? self->egl_out_port : self->dec_out_port); @@ -1623,7 +1625,7 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self) /* At this point the decoder output port is disabled */ -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) { OMX_STATETYPE egl_state; @@ -1835,7 +1837,7 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self) GST_VIDEO_DECODER_STREAM_UNLOCK (self); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) enable_port: #endif err = gst_omx_video_dec_allocate_output_buffers (self); @@ -1866,7 +1868,7 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) GstClockTimeDiff deadline; OMX_ERRORTYPE err; -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) port = self->eglimage ? self->egl_out_port : self->dec_out_port; #else port = self->dec_out_port; @@ -2259,7 +2261,7 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder) 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); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) 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 @@ -2268,7 +2270,7 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder) if (gst_omx_component_get_state (self->dec, 0) > OMX_StateIdle) gst_omx_component_set_state (self->dec, OMX_StateIdle); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) if (gst_omx_component_get_state (self->egl_render, 0) > OMX_StateIdle) gst_omx_component_set_state (self->egl_render, OMX_StateIdle); #endif @@ -2283,7 +2285,7 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder) g_mutex_unlock (&self->drain_lock); gst_omx_component_get_state (self->dec, 5 * GST_SECOND); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) gst_omx_component_get_state (self->egl_render, 1 * GST_SECOND); #endif @@ -2523,7 +2525,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, } if (needs_disable && is_format_change) { -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) GstOMXPort *out_port = self->eglimage ? self->egl_out_port : self->dec_out_port; #else @@ -2552,7 +2554,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, return FALSE; needs_disable = FALSE; } else { -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) if (self->eglimage) { OMX_STATETYPE egl_state; @@ -2743,7 +2745,7 @@ gst_omx_video_dec_reset (GstVideoDecoder * decoder, gboolean hard) 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); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) 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 @@ -2760,7 +2762,7 @@ gst_omx_video_dec_reset (GstVideoDecoder * decoder, gboolean hard) gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, FALSE); gst_omx_port_populate (self->dec_out_port); -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, FALSE); gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, FALSE); #endif @@ -3166,7 +3168,7 @@ gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query) GstBufferPool *pool; GstStructure *config; -#ifdef USE_OMX_TARGET_RPI +#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) { GstCaps *caps; gint i, n; -- 2.7.4