From 7f3f7f9d4fbcc7fcf24fda575d32673521129b7e Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Wed, 2 Aug 2017 15:50:12 +0200 Subject: [PATCH] fix gstomx compilation issues Compilation issues due to updated glibc and new gcc warn to errors --- omx/Makefile.am | 3 ++ omx/gstbin_videosink.c | 2 -- omx/gstomx-camera2.c | 83 ++++++++++++++++++++++------------------------ omx/gstomx-camera2.h | 6 ++-- omx/gstomx.h | 1 + omx/gstomx_aacdec.c | 13 ++------ omx/gstomx_aacenc.c | 7 ---- omx/gstomx_base_filter.c | 14 ++++---- omx/gstomx_base_filter.h | 2 +- omx/gstomx_base_videoenc.c | 5 +-- omx/gstomx_camera.c | 21 ++---------- omx/gstomx_h264dec.c | 2 +- omx/gstomx_h264enc.c | 6 +--- omx/gstomx_util.c | 73 +++++++++++++++++++++------------------- omx/gstomx_util.h | 8 ++--- omx/gstomx_vip.c | 10 ------ omx/gstomx_vp8enc.c | 2 -- omx/gstomx_wmadec.c | 4 +-- omx/gstomx_wmvdec.c | 2 -- omx/gstomx_x11eglutils.c | 37 ++++++++++----------- 20 files changed, 126 insertions(+), 175 deletions(-) diff --git a/omx/Makefile.am b/omx/Makefile.am index 48f95d9..f7f65ad 100644 --- a/omx/Makefile.am +++ b/omx/Makefile.am @@ -67,6 +67,9 @@ libgstomx_la_SOURCES += \ gstomx_h264enc.c gstomx_h264enc.h \ gstomx_h263enc.c gstomx_h263enc.h \ gstomx_vorbisdec.c gstomx_vorbisdec.h \ + gstomx_vp8dec.c gstomx_vp8dec.h \ + gstomx_vp8enc.c gstomx_vp8enc.h \ + gstomx_hdmi_videosink.c gstomx_hdmi_videosink.h \ gstomx_camera.c gstomx_camera.h endif diff --git a/omx/gstbin_videosink.c b/omx/gstbin_videosink.c index d4e0f65..ef097cc 100644 --- a/omx/gstbin_videosink.c +++ b/omx/gstbin_videosink.c @@ -483,10 +483,8 @@ static void type_class_init (gpointer g_class, gpointer class_data) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) g_class; - gstelement_class = (GstElementClass *) g_class; parent_class = g_type_class_ref (GST_TYPE_BIN); diff --git a/omx/gstomx-camera2.c b/omx/gstomx-camera2.c index 75bc1e2..201111f 100644 --- a/omx/gstomx-camera2.c +++ b/omx/gstomx-camera2.c @@ -552,11 +552,10 @@ send_release_event_thread (GstPad * pad) static void buffer_return_fhandler (GOmxPort * port, gpointer data, gpointer spad) { - GstOmxCamera2 *self = data; GstPad *pad = spad; if (port->num_buffers - port->squeue->length == 1) - g_thread_create ((GThreadFunc) send_release_event_thread, pad, FALSE, NULL); + g_thread_new ("send_release_event_thread",(GThreadFunc) send_release_event_thread, pad); else if (port->num_buffers == port->squeue->length) g_sem_up (port->core->port_sem); } @@ -604,9 +603,9 @@ gst_omx_camera_init (GstOmxCamera2 * self, gpointer g_class) port = g_omx_core_new_port (self->gomx, GST_OMX_CAMERA_VIDEO_PORT); gst_pad_set_element_private (self->vid_pad, port); - self->capture_lock = g_mutex_new (); - self->eos_cond = g_cond_new (); - self->image_capture_cond = g_cond_new (); + g_mutex_init (&self->capture_lock); + g_cond_init (&self->eos_cond); + g_cond_init (&self->image_capture_cond); gst_omx_camera_init_params (self); } @@ -623,9 +622,9 @@ gst_omx_camera_finalize (GObject * object) g_omx_core_free (src->gomx); src->gomx = NULL; - g_mutex_free (src->capture_lock); - g_cond_free (src->eos_cond); - g_cond_free (src->image_capture_cond); + g_mutex_clear (&src->capture_lock); + g_cond_clear (&src->eos_cond); + g_cond_clear (&src->image_capture_cond); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -694,7 +693,7 @@ gst_omx_camera_prepare_for_capture (GstOmxCamera2 * src, { gboolean result = FALSE; - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); if (src->capturing == NvGstCapturingStopped && capture_caps && !gst_caps_is_empty (capture_caps) && @@ -725,7 +724,7 @@ gst_omx_camera_prepare_for_capture (GstOmxCamera2 * src, } } - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); /* FIXME: should this be called from a diff thread?? */ if (result) @@ -827,7 +826,9 @@ gst_omx_camera_change_mode (GstOmxCamera2 * src, GstNvCameraMode new) if (old != new) { if (gomx->omx_state == OMX_StateExecuting) { - GOmxPort *cap_port, *vf_port; +#ifdef GST_KPI_MEASURE + GOmxPort *vf_port; +#endif GOmxPort *port; #ifdef GST_KPI_MEASURE @@ -847,9 +848,6 @@ gst_omx_camera_change_mode (GstOmxCamera2 * src, GstNvCameraMode new) if (src->capturing) gst_omx_camera_stop_capture (src); - vf_port = (GOmxPort *) gst_pad_get_element_private (src->vf_pad); - cap_port = (GOmxPort *) gst_pad_get_element_private (src->img_pad); - gst_pad_set_active (src->vf_pad, FALSE); gst_pad_set_active (src->img_pad, FALSE); gst_pad_set_active (src->vid_pad, FALSE); @@ -1100,8 +1098,8 @@ gst_omx_camera_set_property (GObject * object, guint prop_id, gboolean rotation_required = FALSE; GstNvRotation current_rt; GstNvRotation new_rt; - new_rt = g_value_get_enum (value); GOmxPort *port = gst_pad_get_element_private (src->vf_pad); + new_rt = g_value_get_enum (value); gst_omx_camera_get_rotation (src->gomx->omx_handle, 0, ¤t_rt); if (abs (current_rt - new_rt) == 90 || abs (current_rt - new_rt) == 270) rotation_required = TRUE; @@ -1114,7 +1112,6 @@ gst_omx_camera_set_property (GObject * object, guint prop_id, GstStructure *str = gst_caps_get_structure (ccaps, 0); gint width = 0; gint height = 0; - gint i = 0; port->keep_buffers = TRUE; @@ -1472,11 +1469,9 @@ gst_omx_camera_activate_push (GstPad * pad, gboolean active) GstOmxCamera2 *src; GOmxPort *port = gst_pad_get_element_private (pad); gboolean result = TRUE, is_active = TRUE; - GOmxCore *core; GstNvCameraMode mode; src = GST_OMX_CAMERA2 (GST_OBJECT_PARENT (pad)); - core = src->gomx; if (pad == src->vid_pad) { gst_omx_camera_get_mode (src->gomx->omx_handle, &mode); @@ -1570,10 +1565,10 @@ gst_omx_camera_omxevent_handler (GstElement * element, OMX_EVENTTYPE eEvent, case NVX_EventCamera_StillCaptureReady: g_print ("NVX CAMERA2: NVX_EventCamera_StillCaptureReady:\n"); - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); src->image_capture_phase |= IMAGE_CAPTURE_READY; - g_cond_signal (src->image_capture_cond); - g_mutex_unlock (src->capture_lock); + g_cond_signal (&src->image_capture_cond); + g_mutex_unlock (&src->capture_lock); break; #ifndef WAR_BUG_1322345 case NVX_EventCamera_PreviewPausedAfterStillCapture:{ @@ -1584,10 +1579,10 @@ gst_omx_camera_omxevent_handler (GstElement * element, OMX_EVENTTYPE eEvent, ppc); if (ppc) { - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); src->image_capture_phase |= IMAGE_CAPTURE_AFTERPAUSE; - g_cond_signal (src->image_capture_cond); - g_mutex_unlock (src->capture_lock); + g_cond_signal (&src->image_capture_cond); + g_mutex_unlock (&src->capture_lock); } } break; @@ -1823,13 +1818,13 @@ gst_omx_camera_loop (GstPad * pad) } if (G_UNLIKELY (eos && pad != src->vf_pad && src->capturing)) { - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); if (pad == src->vid_pad) { gst_pad_push_event (pad, gst_event_new_eos ()); } src->eos_handled = TRUE; - g_cond_signal (src->eos_cond); - g_mutex_unlock (src->capture_lock); + g_cond_signal (&src->eos_cond); + g_mutex_unlock (&src->capture_lock); g_print ("@@@@@@@@@@@@@@@@@@@@@@ EOS handled\n"); } @@ -1859,12 +1854,12 @@ static void gst_omx_camera_start_auto_focus (GstOmxCamera2 * src) { GstWhiteBalanceMode wb; - gint exp; + guint exp; gboolean ret = TRUE; gboolean af = FALSE, awb = FALSE, ae = FALSE; gboolean converged = FALSE; - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); #ifdef GST_KPI_MEASURE if (src->enable_kpi_measure) @@ -1936,20 +1931,20 @@ gst_omx_camera_start_auto_focus (GstOmxCamera2 * src) g_print ("Unsupported focus mode\n"); break; } - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); } static void gst_omx_camera_stop_auto_focus (GstOmxCamera2 * src) { - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); gst_omx_camera_set_auto_focus (src->gomx->omx_handle, FALSE, FALSE, FALSE, FALSE, -1, AFNone); src->focus_status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE; - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); } @@ -1979,11 +1974,11 @@ gst_omx_camera_start_capture (GstOmxCamera2 * src) return; } - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); if (src->capturing == NvGstCapturingStarted) { g_print ("already in capturing mode\n"); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); return; } @@ -2009,7 +2004,7 @@ gst_omx_camera_start_capture (GstOmxCamera2 * src) src->capturing = NvGstCapturingStarted; gst_omx_camera_set_capture_paused (src->gomx->omx_handle, FALSE); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); } else { gst_omx_camera_get_mode (src->gomx->omx_handle, &mode); @@ -2025,7 +2020,7 @@ gst_omx_camera_start_capture (GstOmxCamera2 * src) g_object_notify (G_OBJECT (src), "ready-for-capture"); gst_omx_camera_set_capture (src->gomx->omx_handle, TRUE); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); if (mode == GST_NV_MODE_IMAGE) { gst_omx_camera_stop_capture (src); @@ -2042,17 +2037,17 @@ gst_omx_camera_pause_capture (GstOmxCamera2 * src) return; } - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); if (src->capturing == NvGstCapturingPaused) { g_print ("already in paused capturing mode\n"); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); return; } gst_omx_camera_set_capture_paused (src->gomx->omx_handle, TRUE); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); } @@ -2066,11 +2061,11 @@ gst_omx_camera_stop_capture (GstOmxCamera2 * src) return; } - g_mutex_lock (src->capture_lock); + g_mutex_lock (&src->capture_lock); if (src->capturing == NvGstCapturingStopped) { g_print ("not in capturing mode\n"); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); return; } @@ -2095,7 +2090,7 @@ gst_omx_camera_stop_capture (GstOmxCamera2 * src) while (src->image_capture_phase != (IMAGE_CAPTURE_READY | pause_after_capture)) - g_cond_wait (src->image_capture_cond, src->capture_lock); + g_cond_wait (&src->image_capture_cond, &src->capture_lock); g_omx_core_wait_for_done (src->gomx); } else { @@ -2104,7 +2099,7 @@ gst_omx_camera_stop_capture (GstOmxCamera2 * src) } while (!src->eos_handled) - g_cond_wait (src->eos_cond, src->capture_lock); + g_cond_wait (&src->eos_cond, &src->capture_lock); src->eos_handled = FALSE; if (mode == GST_NV_MODE_IMAGE) { @@ -2123,7 +2118,7 @@ gst_omx_camera_stop_capture (GstOmxCamera2 * src) src->capturing = NvGstCapturingStopped; g_object_notify (G_OBJECT (src), "ready-for-capture"); - g_mutex_unlock (src->capture_lock); + g_mutex_unlock (&src->capture_lock); } diff --git a/omx/gstomx-camera2.h b/omx/gstomx-camera2.h index 1488c8a..6fb6a76 100644 --- a/omx/gstomx-camera2.h +++ b/omx/gstomx-camera2.h @@ -60,9 +60,9 @@ struct GstOmxCamera2 GstPad *vid_pad; GstClockTime duration; - GMutex *capture_lock; - GCond *eos_cond; - GCond *image_capture_cond; + GMutex capture_lock; + GCond eos_cond; + GCond image_capture_cond; gint r_width; gint r_height; diff --git a/omx/gstomx.h b/omx/gstomx.h index e36ae32..d69657c 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -26,6 +26,7 @@ #define GSTOMX_H #include +#include G_BEGIN_DECLS GST_DEBUG_CATEGORY_EXTERN (gstomx_debug); GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug); diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c index 34fbbe0..2f54cac 100644 --- a/omx/gstomx_aacdec.c +++ b/omx/gstomx_aacdec.c @@ -159,22 +159,17 @@ gst_omx_aacdec_pad_chain (GstPad * pad, GstBuffer * buf) GstOmxBaseFilter *omx_base; GstOmxAacDec *omx_aacdec; GstFlowReturn result = GST_FLOW_ERROR; - int ID, object_type, index, protection_absent; - unsigned int frame_length; + int object_type, index, protection_absent; int skip_bytes = 0; GstBuffer *temp; omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); omx_aacdec = GST_OMX_AACDEC (gst_pad_get_parent (pad)); if (omx_aacdec->base_chain_func && omx_base->codec_data == NULL) { /* Parse and remove the ADTS header */ - if ((buf->data[0] = 0xff && (buf->data[1] & 0xf6) == 0xf0)) { - ID = buf->data[1] & 0x08; + if ((buf->data[0] == 0xff && (buf->data[1] & 0xf6) == 0xf0)) { protection_absent = buf->data[1] & 1; object_type = (buf->data[2] & 0xc0) >> 6; index = (buf->data[2] & 0x3c) >> 2; - frame_length = - ((buf->data[3] & 3) << 11) | buf->data[4] << 3 | (buf-> - data[5] & 0xe0 >> 5); if (protection_absent == 1) { skip_bytes += ADTS_PROTECTION_ON_SKIP_BYTES; } else { @@ -229,13 +224,11 @@ gst_omx_aacdec_pad_chain (GstPad * pad, GstBuffer * buf) static void omx_config (GstOmxBaseFilter * omx_base) { - GstOmxAacDec *self; +#ifdef AUTOMOTIVE GOmxCore *gomx; - self = GST_OMX_AACDEC (omx_base); gomx = (GOmxCore *) omx_base->gomx; -#ifdef AUTOMOTIVE gstomx_set_audiodecoder_max_channels_supported (gomx->omx_handle, AAC_MAX_CHANNELS_SUPPORTED); #endif diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c index 84c43ed..c57e6c6 100644 --- a/omx/gstomx_aacenc.c +++ b/omx/gstomx_aacenc.c @@ -71,13 +71,6 @@ gst_omx_aacenc_profile_get_type (void) static void setup_ports (GstOmxBaseFilter * self) { - - GstOmxAacEnc *aacenc; - //GValue *tmp_value; - //int i=0, index; - - aacenc = GST_OMX_AACENC (self); - /* Input port configuration. */ g_omx_port_setup (self->in_port); gst_pad_set_element_private (self->sinkpad, self->in_port); diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c index e942829..22f5dad 100644 --- a/omx/gstomx_base_filter.c +++ b/omx/gstomx_base_filter.c @@ -167,7 +167,7 @@ change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: - g_mutex_lock (self->ready_lock); + g_mutex_lock (&self->ready_lock); if (self->ready) { /* unlock */ g_omx_port_finish (self->in_port); @@ -177,7 +177,7 @@ change_state (GstElement * element, GstStateChange transition) g_omx_core_finish (core); self->ready = FALSE; } - g_mutex_unlock (self->ready_lock); + g_mutex_unlock (&self->ready_lock); if (core->omx_state != OMX_StateLoaded && core->omx_state != OMX_StateInvalid) { ret = GST_STATE_CHANGE_FAILURE; @@ -210,7 +210,7 @@ finalize (GObject * obj) g_omx_core_ports_free (self->gomx); g_omx_core_free (self->gomx); - g_mutex_free (self->ready_lock); + g_mutex_clear (&self->ready_lock); G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -802,7 +802,7 @@ pad_chain (GstPad * pad, GstBuffer * buf) return GST_FLOW_OK; } - g_mutex_lock (self->ready_lock); + g_mutex_lock (&self->ready_lock); GST_INFO_OBJECT (self, "omx: prepare"); @@ -830,7 +830,7 @@ pad_chain (GstPad * pad, GstBuffer * buf) gst_pad_start_task (self->srcpad, output_loop, self->srcpad); } - g_mutex_unlock (self->ready_lock); + g_mutex_unlock (&self->ready_lock); if (gomx->omx_state != OMX_StateIdle) goto out_flushing; @@ -1008,12 +1008,10 @@ static gboolean pad_event (GstPad * pad, GstEvent * event) { GstOmxBaseFilter *self; - GOmxCore *gomx; GOmxPort *in_port; gboolean ret = TRUE; self = GST_OMX_BASE_FILTER (GST_OBJECT_PARENT (pad)); - gomx = self->gomx; in_port = self->in_port; GST_LOG_OBJECT (self, "begin"); @@ -1189,7 +1187,7 @@ type_instance_init (GTypeInstance * instance, gpointer g_class) self->out_port = g_omx_core_new_port (self->gomx, 1); self->omx_config = NULL; - self->ready_lock = g_mutex_new (); + g_mutex_init(&self->ready_lock); self->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template diff --git a/omx/gstomx_base_filter.h b/omx/gstomx_base_filter.h index a80fd97..4e49462 100644 --- a/omx/gstomx_base_filter.h +++ b/omx/gstomx_base_filter.h @@ -50,7 +50,7 @@ struct GstOmxBaseFilter gboolean use_timestamps; /** @todo remove; timestamps should always be used */ gboolean ready; - GMutex *ready_lock; + GMutex ready_lock; GstClockTime duration; /*Keep this field now since we are using this to populate output Buffer duration */ GstClockTime prev_timestamp; diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c index 227a9a6..38c81b6 100644 --- a/omx/gstomx_base_videoenc.c +++ b/omx/gstomx_base_videoenc.c @@ -492,6 +492,7 @@ sink_setcaps (GstPad * pad, GstCaps * caps) gint width = 0; gint height = 0; const GValue *framerate = NULL; + OMX_PARAM_PORTDEFINITIONTYPE param; self = GST_OMX_BASE_VIDEOENC (GST_PAD_PARENT (pad)); omx_base = GST_OMX_BASE_FILTER (self); @@ -560,7 +561,6 @@ sink_setcaps (GstPad * pad, GstCaps * caps) } - OMX_PARAM_PORTDEFINITIONTYPE param; G_OMX_INIT_PARAM (param); /* Input port configuration. */ @@ -621,6 +621,7 @@ omx_setup (GstOmxBaseFilter * omx_base) OMX_IMAGE_PARAM_QFACTORTYPE oQFactor; OMX_PARAM_PORTDEFINITIONTYPE param; + gchar *location; self = GST_OMX_BASE_VIDEOENC (omx_base); gomx = (GOmxCore *) omx_base->gomx; @@ -630,7 +631,7 @@ omx_setup (GstOmxBaseFilter * omx_base) G_OMX_INIT_PARAM (param); //Sets OMX Encoder's Conf File Location - gchar *location = g_strdup (ENCODER_CONF_LOCATION); + location = g_strdup (ENCODER_CONF_LOCATION); status = gstomx_set_EncConfLocation (gomx->omx_handle, location); if (status != OMX_ErrorNone) g_print ("\n%s error while setting EncConfLocation\n", __FUNCTION__); diff --git a/omx/gstomx_camera.c b/omx/gstomx_camera.c index 9099f16..cd21cf3 100644 --- a/omx/gstomx_camera.c +++ b/omx/gstomx_camera.c @@ -207,11 +207,6 @@ type_base_init (gpointer g_class) static gboolean setcaps (GstBaseSrc * gst_src, GstCaps * caps) { - GstOmxBaseSrc *self; - - self = GST_OMX_BASE_SRC (gst_src); - - //GST_INFO_OBJECT (self, "setcaps (src): %" GST_PTR_FORMAT, caps); g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); @@ -221,10 +216,6 @@ setcaps (GstBaseSrc * gst_src, GstCaps * caps) static void settings_changed_cb (GOmxCore * core) { - GstOmxBaseSrc *omx_base; - - omx_base = core->object; - /** @todo properly set the capabilities */ } @@ -236,7 +227,6 @@ setup_ports (GstOmxBaseSrc * base_src) OMX_PARAM_PORTDEFINITIONTYPE param; OMX_PARAM_U32TYPE oSensorIdParam; OMX_INDEXTYPE eIndexSensorId; - OMX_ERRORTYPE err; OMX_IMAGE_PARAM_FLASHCONTROLTYPE oFlashControl; OMX_PARAM_SENSORMODETYPE oSensorMode; @@ -271,10 +261,10 @@ setup_ports (GstOmxBaseSrc * base_src) oSensorIdParam.nU32 = g_cameraParam.SensorId; - err = OMX_GetExtensionIndex (core->omx_handle, NVX_INDEX_PARAM_SENSORID, + OMX_GetExtensionIndex (core->omx_handle, NVX_INDEX_PARAM_SENSORID, &eIndexSensorId); - err = OMX_SetParameter (core->omx_handle, eIndexSensorId, &oSensorIdParam); + OMX_SetParameter (core->omx_handle, eIndexSensorId, &oSensorIdParam); memset (&oSensorMode, 0xDE, sizeof (oSensorMode)); oSensorMode.nPortIndex = CAPTURE_PORT; @@ -435,12 +425,10 @@ create (GstBaseSrc * gst_base, if ((core->omx_state == OMX_StateExecuting) && (CAMERA_PORT == PREVIEW_PORT)) { OMX_CONFIG_BOOLEANTYPE cc; OMX_INDEXTYPE eIndexPreviewEnable; - OMX_ERRORTYPE err; // start preview - err = - OMX_GetExtensionIndex (core->omx_handle, NVX_INDEX_CONFIG_PREVIEWENABLE, + OMX_GetExtensionIndex (core->omx_handle, NVX_INDEX_CONFIG_PREVIEWENABLE, &eIndexPreviewEnable); cc.bEnabled = OMX_TRUE; OMX_SetConfig (core->omx_handle, eIndexPreviewEnable, &cc); @@ -498,9 +486,6 @@ static void type_instance_init (GTypeInstance * instance, gpointer g_class) { GstOmxBaseSrc *omx_base; - GstOmxCamera *gstcamera; - - gstcamera = GST_OMX_CAMERA (instance); omx_base = GST_OMX_BASE_SRC (instance); diff --git a/omx/gstomx_h264dec.c b/omx/gstomx_h264dec.c index ae95bdc..d1f46c8 100644 --- a/omx/gstomx_h264dec.c +++ b/omx/gstomx_h264dec.c @@ -263,7 +263,7 @@ gst_omx_h264dec_pad_chain (GstPad * pad, GstBuffer * buf) int index = 0; guint size; guint8 *data; - guint8 *tmp; + guint8 *tmp = NULL; guint8 unit_type; guint nal_size; gint access_unit_delimiter_bytes = 0; diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c index 56c2f56..a959d50 100644 --- a/omx/gstomx_h264enc.c +++ b/omx/gstomx_h264enc.c @@ -307,17 +307,14 @@ ifi_setup (GstOmxBaseFilter * omx_base) static void h264enc_configure_output_format (GstOmxBaseFilter * omx_base) { - GstOmxBaseVideoEnc *self; GOmxCore *gomx; GstOmxH264Enc *h264enc; - OMX_ERRORTYPE ret_val; GstCaps *icaps = NULL; const gchar *format = NULL; OMX_VIDEO_CONFIG_NALSIZE OMXNalSize; - self = GST_OMX_BASE_VIDEOENC (omx_base); h264enc = GST_OMX_H264ENC (omx_base); gomx = (GOmxCore *) omx_base->gomx; @@ -340,8 +337,7 @@ h264enc_configure_output_format (GstOmxBaseFilter * omx_base) if (omx_base->out_port) OMXNalSize.nPortIndex = omx_base->out_port->port_index; - ret_val = - OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigVideoNalSize, + OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigVideoNalSize, &OMXNalSize); #ifdef DEBUG_LEVEL1 diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c index 11dc5b0..e74521a 100644 --- a/omx/gstomx_util.c +++ b/omx/gstomx_util.c @@ -21,12 +21,11 @@ * */ +#include "gstomx.h" #include "gstomx_util.h" #include "config.h" #include -#include "gstomx.h" - GST_DEBUG_CATEGORY (gstomx_util_debug); /* @@ -78,7 +77,7 @@ static OMX_CALLBACKTYPE callbacks = { EventHandler, EmptyBufferDone, FillBufferDone }; /* protect implementations hash_table */ -static GMutex *imp_mutex; +static GMutex imp_mutex; static GHashTable *implementations; static gboolean initialized; @@ -94,6 +93,7 @@ g_ptr_array_clear (GPtrArray * array) array->pdata[index] = NULL; } +#if 0 static void g_ptr_array_insert (GPtrArray * array, guint index, gpointer data) { @@ -103,6 +103,7 @@ g_ptr_array_insert (GPtrArray * array, guint index, gpointer data) array->pdata[index] = data; } +#endif typedef void (*GOmxPortFunc) (GOmxPort * port); @@ -151,7 +152,7 @@ imp_new (const gchar * name) return NULL; } - imp->mutex = g_mutex_new (); + g_mutex_init(&imp->mutex); imp->sym_table.init = dlsym (handle, "OMX_Init"); imp->sym_table.deinit = dlsym (handle, "OMX_Deinit"); imp->sym_table.get_handle = dlsym (handle, "OMX_GetHandle"); @@ -167,7 +168,7 @@ imp_free (GOmxImp * imp) if (imp->dl_handle) { dlclose (imp->dl_handle); } - g_mutex_free (imp->mutex); + g_mutex_clear (&imp->mutex); g_free (imp); } @@ -176,29 +177,29 @@ request_imp (const gchar * name) { GOmxImp *imp = NULL; - g_mutex_lock (imp_mutex); + g_mutex_lock (&imp_mutex); imp = g_hash_table_lookup (implementations, name); if (!imp) { imp = imp_new (name); if (imp) g_hash_table_insert (implementations, g_strdup (name), imp); } - g_mutex_unlock (imp_mutex); + g_mutex_unlock (&imp_mutex); if (!imp) return NULL; - g_mutex_lock (imp->mutex); + g_mutex_lock (&imp->mutex); if (imp->client_count == 0) { OMX_ERRORTYPE omx_error; omx_error = imp->sym_table.init (); if (omx_error) { - g_mutex_unlock (imp->mutex); + g_mutex_unlock (&imp->mutex); return NULL; } } imp->client_count++; - g_mutex_unlock (imp->mutex); + g_mutex_unlock (&imp->mutex); return imp; } @@ -206,12 +207,12 @@ request_imp (const gchar * name) static inline void release_imp (GOmxImp * imp) { - g_mutex_lock (imp->mutex); + g_mutex_lock (&imp->mutex); imp->client_count--; if (imp->client_count == 0) { imp->sym_table.deinit (); } - g_mutex_unlock (imp->mutex); + g_mutex_unlock (&imp->mutex); } void @@ -219,7 +220,7 @@ g_omx_init (void) { if (!initialized) { /* safe as plugin_init is safe */ - imp_mutex = g_mutex_new (); + g_mutex_init(&imp_mutex); #ifdef USE_EGLIMAGE egl_init (); #endif @@ -234,7 +235,7 @@ g_omx_deinit (void) { if (initialized) { g_hash_table_destroy (implementations); - g_mutex_free (imp_mutex); + g_mutex_clear (&imp_mutex); #ifdef USE_EGLIMAGE egl_destroy (); #endif @@ -256,8 +257,8 @@ g_omx_core_new (void *object) core->object = object; core->ports = g_ptr_array_new (); - core->omx_state_condition = g_cond_new (); - core->omx_state_mutex = g_mutex_new (); + g_cond_init(&core->omx_state_condition); + g_mutex_init (&core->omx_state_mutex); core->done_sem = g_sem_new (); core->flush_sem = g_sem_new (); @@ -288,8 +289,8 @@ g_omx_core_free (GOmxCore * core) g_sem_free (core->flush_sem); g_sem_free (core->done_sem); - g_mutex_free (core->omx_state_mutex); - g_cond_free (core->omx_state_condition); + g_mutex_clear (&core->omx_state_mutex); + g_cond_clear (&core->omx_state_condition); g_ptr_array_free (core->ports, TRUE); @@ -527,7 +528,7 @@ g_omx_port_new (GOmxCore * core, guint index) port->enabled = TRUE; port->queue = async_queue_new (); port->squeue = async_queue_new (); - port->mutex = g_mutex_new (); + g_mutex_init(&port->mutex); port->buffer_type = BUFFER_TYPE_RAW; #ifdef USE_EGLIMAGE port->eglbuffers = NULL; @@ -542,7 +543,7 @@ g_omx_port_new (GOmxCore * core, guint index) void g_omx_port_free (GOmxPort * port) { - g_mutex_free (port->mutex); + g_mutex_clear (&port->mutex); async_queue_free (port->queue); async_queue_free (port->squeue); if (port->buffers) @@ -914,29 +915,29 @@ change_state (GOmxCore * core, OMX_STATETYPE state) static inline void complete_change_state (GOmxCore * core, OMX_STATETYPE state) { - g_mutex_lock (core->omx_state_mutex); + g_mutex_lock (&core->omx_state_mutex); core->omx_state = state; - g_cond_signal (core->omx_state_condition); + g_cond_signal (&core->omx_state_condition); GST_DEBUG_OBJECT (core->object, "state=%d", state); - g_mutex_unlock (core->omx_state_mutex); + g_mutex_unlock (&core->omx_state_mutex); } static inline void wait_for_state (GOmxCore * core, OMX_STATETYPE state) { - GTimeVal tv; + gint64 tv; gboolean signaled; - g_mutex_lock (core->omx_state_mutex); + g_mutex_lock (&core->omx_state_mutex); if (core->omx_error != OMX_ErrorNone) { OMX_STATETYPE curstate; int numtries = 0; /* Unlock the mutex First, Or else it may hang inside EventHandler */ - g_mutex_unlock (core->omx_state_mutex); + g_mutex_unlock (&core->omx_state_mutex); OMX_GetState (core->omx_handle, &curstate); @@ -962,14 +963,14 @@ wait_for_state (GOmxCore * core, OMX_STATETYPE state) return; } - g_get_current_time (&tv); - g_time_val_add (&tv, 15 * G_USEC_PER_SEC); + tv = g_get_real_time(); + tv += 15 * G_USEC_PER_SEC; /* try once */ if (core->omx_state != state) { signaled = - g_cond_timed_wait (core->omx_state_condition, core->omx_state_mutex, - &tv); + g_cond_wait_until (&core->omx_state_condition, &core->omx_state_mutex, + tv); if (!signaled) { GST_ERROR_OBJECT (core->object, "timed out switching from '%s' to '%s'", @@ -986,7 +987,7 @@ wait_for_state (GOmxCore * core, OMX_STATETYPE state) } leave: - g_mutex_unlock (core->omx_state_mutex); + g_mutex_unlock (&core->omx_state_mutex); } /* @@ -1287,7 +1288,11 @@ EventHandler (OMX_HANDLETYPE omx_handle, OMX_PARAM_PORTDEFINITIONTYPE param; port = ((GOmxPort *) g_ptr_array_index (core->ports, 1)); +#ifdef USE_EGLIMAGE if (data_2 == OMX_IndexParamPortDefinition && !port->eglbuffers) { +#else + if (data_2 == OMX_IndexParamPortDefinition) { +#endif port->reconfigure_buffers = TRUE; g_omx_port_pause (port); @@ -1347,9 +1352,9 @@ EventHandler (OMX_HANDLETYPE omx_handle, g_omx_core_flush_start (core); /* unlock wait_for_state */ - g_mutex_lock (core->omx_state_mutex); - g_cond_signal (core->omx_state_condition); - g_mutex_unlock (core->omx_state_mutex); + g_mutex_lock (&core->omx_state_mutex); + g_cond_signal (&core->omx_state_condition); + g_mutex_unlock (&core->omx_state_mutex); break; } default: diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h index 01993f4..34b661b 100644 --- a/omx/gstomx_util.h +++ b/omx/gstomx_util.h @@ -105,7 +105,7 @@ struct GOmxImp guint client_count; void *dl_handle; GOmxSymbolTable sym_table; - GMutex *mutex; + GMutex mutex; }; struct GOmxCore @@ -116,8 +116,8 @@ struct GOmxCore OMX_ERRORTYPE omx_error; OMX_STATETYPE omx_state; - GCond *omx_state_condition; - GMutex *omx_state_mutex; + GCond omx_state_condition; + GMutex omx_state_mutex; GPtrArray *ports; @@ -173,7 +173,7 @@ struct GOmxPort guint port_index; OMX_BUFFERHEADERTYPE **buffers; - GMutex *mutex; + GMutex mutex; gboolean enabled; gboolean omx_allocate; /**< Setup with OMX_AllocateBuffer rather than OMX_UseBuffer */ AsyncQueue *queue; diff --git a/omx/gstomx_vip.c b/omx/gstomx_vip.c index 634ccab..4a7e3c3 100644 --- a/omx/gstomx_vip.c +++ b/omx/gstomx_vip.c @@ -137,10 +137,8 @@ type_base_init (gpointer g_class) static gboolean setcaps (GstBaseSrc * gst_src, GstCaps * caps) { - GstOmxBaseSrc *self; guint32 format = 0; - self = GST_OMX_BASE_SRC (gst_src); g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); { @@ -184,10 +182,6 @@ setcaps (GstBaseSrc * gst_src, GstCaps * caps) static void settings_changed_cb (GOmxCore * core) { - GstOmxBaseSrc *omx_base; - - omx_base = core->object; - /** @todo properly set the capabilities */ } @@ -407,10 +401,6 @@ static void type_instance_init (GTypeInstance * instance, gpointer g_class) { GstOmxBaseSrc *omx_base; - GstOmxVip *gstvip; - - - gstvip = GST_OMX_VIP (instance); omx_base = GST_OMX_BASE_SRC (instance); diff --git a/omx/gstomx_vp8enc.c b/omx/gstomx_vp8enc.c index d434cdb..5d90b54 100644 --- a/omx/gstomx_vp8enc.c +++ b/omx/gstomx_vp8enc.c @@ -109,9 +109,7 @@ static void type_instance_init (GTypeInstance * instance, gpointer g_class) { GstOmxBaseFilter *omx_base_filter; - GstOmxBaseVideoEnc *omx_base; omx_base_filter = GST_OMX_BASE_FILTER (instance); - omx_base = GST_OMX_BASE_VIDEOENC (instance); omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; } diff --git a/omx/gstomx_wmadec.c b/omx/gstomx_wmadec.c index 02d43b3..b5a86e3 100644 --- a/omx/gstomx_wmadec.c +++ b/omx/gstomx_wmadec.c @@ -375,13 +375,11 @@ sink_setcaps (GstPad * pad, GstCaps * caps) static void omx_config (GstOmxBaseFilter * omx_base) { - GstOmxWmaDec *self; +#ifdef AUTOMOTIVE GOmxCore *gomx; - self = GST_OMX_WMADEC (omx_base); gomx = (GOmxCore *) omx_base->gomx; -#ifdef AUTOMOTIVE gstomx_set_audiodecoder_max_channels_supported (gomx->omx_handle, WMA_MAX_CHANNELS_SUPPORTED); #endif diff --git a/omx/gstomx_wmvdec.c b/omx/gstomx_wmvdec.c index cf4a500..3cf1eac 100644 --- a/omx/gstomx_wmvdec.c +++ b/omx/gstomx_wmvdec.c @@ -453,9 +453,7 @@ static void type_class_init (gpointer g_class, gpointer class_data) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) g_class; - gstelement_class = (GstElementClass *) g_class; parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE); gobject_class->finalize = gst_omx_vc1dec_finalize; diff --git a/omx/gstomx_x11eglutils.c b/omx/gstomx_x11eglutils.c index 9619218..9fb5384 100644 --- a/omx/gstomx_x11eglutils.c +++ b/omx/gstomx_x11eglutils.c @@ -34,7 +34,7 @@ static void disown_thread_context (GSTGL_DISPLAY_DATA_PTR); static void own_thread_context (GSTGL_DISPLAY_DATA_PTR); -static GMutex *gl_mutex; +static GMutex gl_mutex; static int FrameCnt = 0; static gboolean eglInitialized = FALSE; extern char dumpfilename[256]; @@ -414,9 +414,9 @@ resizeCB (int width, int height) void nvomx_x11egl_setwindowid (GSTGL_DISPLAY_DATA_PTR gfx_display, XID windowid) { - g_mutex_lock (gl_mutex); + g_mutex_lock (&gl_mutex); gfx_display->nativeWindow = windowid; - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); } void @@ -433,11 +433,11 @@ void nvomx_x11egl_destroy (GSTGL_DISPLAY_DATA_PTR gfx_display) { EGLBoolean eglStatus; - g_mutex_lock (gl_mutex); + g_mutex_lock (&gl_mutex); FrameCnt = 0; if (!eglInitialized) { - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return; } @@ -488,20 +488,19 @@ nvomx_x11egl_destroy (GSTGL_DISPLAY_DATA_PTR gfx_display) g_free (gfx_display->platformspecific); } eglInitialized = FALSE; - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); } void egl_init (void) { - gl_mutex = g_mutex_new (); + g_mutex_init(&gl_mutex); } void egl_destroy (void) { - g_mutex_free (gl_mutex); - gl_mutex = NULL; + g_mutex_clear (&gl_mutex); } /* Initialize native window system and EGL */ @@ -538,12 +537,12 @@ nvomx_x11egl_initialize (GSTGL_DISPLAY_DATA_PTR gfx_display) XSizeHints size_hints; XWindowAttributes attr; - g_mutex_lock (gl_mutex); + g_mutex_lock (&gl_mutex); if (!eglInitialized) { nvomx_init_eglimagepointers (); } else { - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return OMX_ErrorNone; } @@ -760,7 +759,7 @@ nvomx_x11egl_initialize (GSTGL_DISPLAY_DATA_PTR gfx_display) nvomx_setupgl (); disown_thread_context (gfx_display); eglInitialized = TRUE; - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return OMX_ErrorNone; @@ -768,7 +767,7 @@ fail: if (configList) free (configList); - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); nvomx_x11egl_destroy (gfx_display); return OMX_ErrorInsufficientResources; } @@ -799,7 +798,7 @@ nvomx_allocate_eglimages (void *display_data, nvomx_eglbuffer ** eglbuffer, if (height > gfx_display->maxTextureSize) height = gfx_display->maxTextureSize; - g_mutex_lock (gl_mutex); + g_mutex_lock (&gl_mutex); own_thread_context (gfx_display); glActiveTexture (GL_TEXTURE0); @@ -836,13 +835,13 @@ nvomx_allocate_eglimages (void *display_data, nvomx_eglbuffer ** eglbuffer, clearBackGround (); disown_thread_context (gfx_display); - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return OMX_ErrorNone; fail: if (!err) err = OMX_ErrorUndefined; - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return err; } @@ -854,10 +853,10 @@ void nvomx_destroy_eglimages (void *display_data, nvomx_eglbuffer * eglbuffer) { GstGl_DisplayData *gfx_display = (GstGl_DisplayData *) display_data; - g_mutex_lock (gl_mutex); + g_mutex_lock (&gl_mutex); if (!eglInitialized) { - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); return; } @@ -872,7 +871,7 @@ nvomx_destroy_eglimages (void *display_data, nvomx_eglbuffer * eglbuffer) g_free (eglbuffer); disown_thread_context (gfx_display); - g_mutex_unlock (gl_mutex); + g_mutex_unlock (&gl_mutex); } void -- 2.9.4