Check for gstreamer-egl

And don't use if not available.

https://bugzilla.gnome.org/show_bug.cgi?id=697574
This commit is contained in:
Tim-Philipp Müller 2013-04-08 17:26:16 +01:00 committed by Tim-Philipp Müller
parent c90a6d47bc
commit a2db76b048
3 changed files with 27 additions and 24 deletions

View file

@ -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_CHECK($GST_API_VERSION, [$GST_REQ], no)
AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_REQ], yes) AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_REQ], yes)
AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes") 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 dnl Check for documentation xrefs
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"

View file

@ -53,13 +53,12 @@ endif
libgstomx_la_CFLAGS = \ libgstomx_la_CFLAGS = \
-DGST_USE_UNSTABLE_API=1 \ -DGST_USE_UNSTABLE_API=1 \
$(OMX_INCLUDEPATH) \ $(OMX_INCLUDEPATH) \
$(GST_PLUGINS_BAD_CFLAGS) \ $(GST_EGL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) $(GST_CFLAGS)
libgstomx_la_LIBADD = \ libgstomx_la_LIBADD = \
$(GST_PLUGINS_BAD_LIBS) \ $(GST_EGL_LIBS) \
-lgstegl-@GST_API_VERSION@ \
$(GST_PLUGINS_BASE_LIBS) \ $(GST_PLUGINS_BASE_LIBS) \
-lgstaudio-@GST_API_VERSION@ \ -lgstaudio-@GST_API_VERSION@ \
-lgstpbutils-@GST_API_VERSION@ \ -lgstpbutils-@GST_API_VERSION@ \

View file

@ -38,7 +38,9 @@
#pragma GCC optimize ("gnu89-inline") #pragma GCC optimize ("gnu89-inline")
#endif #endif
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
#include <gst/egl/egl.h> #include <gst/egl/egl.h>
#endif
#if defined (USE_OMX_TARGET_RPI) && defined(__GNUC__) #if defined (USE_OMX_TARGET_RPI) && defined(__GNUC__)
#pragma GCC reset_options #pragma GCC reset_options
@ -794,7 +796,7 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Opened 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"); GST_DEBUG_OBJECT (self, "Opening EGL renderer");
self->egl_render = self->egl_render =
gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, 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"); 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); state = gst_omx_component_get_state (self->egl_render, 0);
if (state > OMX_StateLoaded || state == OMX_StateInvalid) { if (state > OMX_StateLoaded || state == OMX_StateInvalid) {
if (state > OMX_StateIdle) { if (state > OMX_StateIdle) {
@ -909,7 +911,7 @@ gst_omx_video_dec_close (GstVideoDecoder * decoder)
gst_omx_component_free (self->dec); gst_omx_component_free (self->dec);
self->dec = NULL; 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_in_port = NULL;
self->egl_out_port = NULL; self->egl_out_port = NULL;
if (self->egl_render) 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); gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
if (self->dec_out_port) if (self->dec_out_port)
gst_omx_port_set_flushing (self->dec_out_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)
if (self->egl_in_port) if (self->egl_in_port)
gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE); gst_omx_port_set_flushing (self->egl_in_port, 5 * GST_SECOND, TRUE);
if (self->egl_out_port) if (self->egl_out_port)
@ -1261,7 +1263,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
GstVideoCodecState *state = GstVideoCodecState *state =
gst_video_decoder_get_output_state (GST_VIDEO_DECODER (self)); 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; port = self->eglimage ? self->egl_out_port : self->dec_out_port;
#else #else
port = self->dec_out_port; 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, add_videometa = gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META); 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 eglimage = self->eglimage && (allocator
&& g_strcmp0 (allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0); && g_strcmp0 (allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
#else #else
@ -1307,7 +1309,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
GST_DEBUG_OBJECT (self, "No pool available, not negotiated yet"); 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 */ /* Will retry without EGLImage */
if (self->eglimage && !eglimage) { if (self->eglimage && !eglimage) {
GST_DEBUG_OBJECT (self, GST_DEBUG_OBJECT (self,
@ -1321,7 +1323,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
self->out_port_pool = self->out_port_pool =
gst_omx_buffer_pool_new (GST_ELEMENT_CAST (self), self->dec, port); 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) { if (eglimage) {
GList *buffers = NULL; GList *buffers = NULL;
GList *images = NULL; GList *images = NULL;
@ -1601,7 +1603,7 @@ gst_omx_video_dec_deallocate_output_buffers (GstOMXVideoDec * self)
gst_object_unref (self->out_port_pool); gst_object_unref (self->out_port_pool);
self->out_port_pool = NULL; self->out_port_pool = NULL;
} }
#ifdef USE_OMX_TARGET_RPI #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
err = err =
gst_omx_port_deallocate_buffers (self-> gst_omx_port_deallocate_buffers (self->
eglimage ? self->egl_out_port : self->dec_out_port); 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 */ /* 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; OMX_STATETYPE egl_state;
@ -1835,7 +1837,7 @@ gst_omx_video_dec_reconfigure_output_port (GstOMXVideoDec * self)
GST_VIDEO_DECODER_STREAM_UNLOCK (self); GST_VIDEO_DECODER_STREAM_UNLOCK (self);
#ifdef USE_OMX_TARGET_RPI #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
enable_port: enable_port:
#endif #endif
err = gst_omx_video_dec_allocate_output_buffers (self); err = gst_omx_video_dec_allocate_output_buffers (self);
@ -1866,7 +1868,7 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
GstClockTimeDiff deadline; GstClockTimeDiff deadline;
OMX_ERRORTYPE err; 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; port = self->eglimage ? self->egl_out_port : self->dec_out_port;
#else #else
port = self->dec_out_port; 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_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->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_in_port, 5 * GST_SECOND, TRUE);
gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE); gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE);
#endif #endif
@ -2268,7 +2270,7 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
if (gst_omx_component_get_state (self->dec, 0) > OMX_StateIdle) if (gst_omx_component_get_state (self->dec, 0) > OMX_StateIdle)
gst_omx_component_set_state (self->dec, 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) if (gst_omx_component_get_state (self->egl_render, 0) > OMX_StateIdle)
gst_omx_component_set_state (self->egl_render, OMX_StateIdle); gst_omx_component_set_state (self->egl_render, OMX_StateIdle);
#endif #endif
@ -2283,7 +2285,7 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
g_mutex_unlock (&self->drain_lock); g_mutex_unlock (&self->drain_lock);
gst_omx_component_get_state (self->dec, 5 * GST_SECOND); 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); gst_omx_component_get_state (self->egl_render, 1 * GST_SECOND);
#endif #endif
@ -2523,7 +2525,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
} }
if (needs_disable && is_format_change) { if (needs_disable && is_format_change) {
#ifdef USE_OMX_TARGET_RPI #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
GstOMXPort *out_port = GstOMXPort *out_port =
self->eglimage ? self->egl_out_port : self->dec_out_port; self->eglimage ? self->egl_out_port : self->dec_out_port;
#else #else
@ -2552,7 +2554,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
return FALSE; return FALSE;
needs_disable = FALSE; needs_disable = FALSE;
} else { } else {
#ifdef USE_OMX_TARGET_RPI #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
if (self->eglimage) { if (self->eglimage) {
OMX_STATETYPE egl_state; 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_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->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_in_port, 5 * GST_SECOND, TRUE);
gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE); gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, TRUE);
#endif #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_set_flushing (self->dec_out_port, 5 * GST_SECOND, FALSE);
gst_omx_port_populate (self->dec_out_port); 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_in_port, 5 * GST_SECOND, FALSE);
gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, FALSE); gst_omx_port_set_flushing (self->egl_out_port, 5 * GST_SECOND, FALSE);
#endif #endif
@ -3166,7 +3168,7 @@ gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
GstBufferPool *pool; GstBufferPool *pool;
GstStructure *config; GstStructure *config;
#ifdef USE_OMX_TARGET_RPI #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL)
{ {
GstCaps *caps; GstCaps *caps;
gint i, n; gint i, n;