From 4ea4487d2f528c3abc456bebf931e35662be49bc Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Tue, 15 Sep 2015 15:33:09 -0400 Subject: [PATCH] niimaqdxsrc: send error msg on unsupported pixel formats, not assert --- sys/niimaqdx/gstniimaqdx.c | 11 +++++++++-- sys/niimaqdx/gstniimaqdx.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/niimaqdx/gstniimaqdx.c b/sys/niimaqdx/gstniimaqdx.c index e976d81..c0ef47c 100644 --- a/sys/niimaqdx/gstniimaqdx.c +++ b/sys/niimaqdx/gstniimaqdx.c @@ -581,6 +581,8 @@ gst_niimaqdxsrc_reset (GstNiImaqDxSrc * niimaqdxsrc) niimaqdxsrc->width = 0; niimaqdxsrc->height = 0; niimaqdxsrc->dx_row_stride = 0; + niimaqdxsrc->caps_info = NULL; + niimaqdxsrc->pixel_format[0] = 0; niimaqdxsrc->start_time = NULL; niimaqdxsrc->start_time_sent = FALSE; niimaqdxsrc->base_time = GST_CLOCK_TIME_NONE; @@ -662,11 +664,16 @@ gst_niimaqdxsrc_fill (GstPushSrc * src, GstBuffer * buf) } } + if (niimaqdxsrc->caps_info == NULL) { + GST_ELEMENT_ERROR (niimaqdxsrc, RESOURCE, FAILED, + ("Failed to create caps, possibly unsupported format (%s).", + niimaqdxsrc->pixel_format), (NULL)); + return GST_FLOW_ERROR; + } + GST_LOG_OBJECT (niimaqdxsrc, "Copying IMAQ buffer #%d, buffersize %d", niimaqdxsrc->cumbufnum, gst_buffer_get_size (buf)); - g_assert (niimaqdxsrc->caps_info != NULL); - do_align_stride = (niimaqdxsrc->dx_row_stride % niimaqdxsrc->caps_info->row_multiple) != 0; diff --git a/sys/niimaqdx/gstniimaqdx.h b/sys/niimaqdx/gstniimaqdx.h index a1c3b11..866068d 100644 --- a/sys/niimaqdx/gstniimaqdx.h +++ b/sys/niimaqdx/gstniimaqdx.h @@ -66,6 +66,7 @@ struct _GstNiImaqDxSrc { gboolean bayer_as_gray; /* image info */ + char pixel_format[IMAQDX_MAX_API_STRING_LENGTH]; int width; int height; int dx_row_stride;