niimaqsrc: remove unused variables

This commit is contained in:
Joshua M. Doe 2010-04-20 14:38:14 -04:00
parent bc1b73b0ee
commit c380bdfd7c
2 changed files with 19 additions and 30 deletions

View File

@ -91,9 +91,7 @@ static GstFlowReturn gst_niimaq_create (GstPushSrc * psrc, GstBuffer ** buffer);
/* GstNiImaq methods */ /* GstNiImaq methods */
static gboolean gst_niimaq_parse_caps (const GstCaps * caps, static gboolean gst_niimaq_parse_caps (const GstCaps * caps,
gint * width, gint * width, gint * height, gint * depth, gint * bpp);
gint * height,
gint * rate_numerator, gint * rate_denominator, gint * depth, gint * bpp);
static gboolean gst_niimaq_set_caps_color (GstStructure * gs, int bpp, int depth); static gboolean gst_niimaq_set_caps_color (GstStructure * gs, int bpp, int depth);
static gboolean gst_niimaq_set_caps_framesize (GstStructure * gs, gint width, static gboolean gst_niimaq_set_caps_framesize (GstStructure * gs, gint width,
@ -509,26 +507,25 @@ gst_niimaq_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
gboolean res = TRUE; gboolean res = TRUE;
GstNiImaq *niimaq; GstNiImaq *niimaq;
gint width, height, rate_denominator, rate_numerator; gint width, height;
gint bpp, depth; gint bpp, depth;
niimaq = GST_NIIMAQ (bsrc); niimaq = GST_NIIMAQ (bsrc);
GST_DEBUG_OBJECT (caps, "are the caps being set");
if (niimaq->caps) { if (niimaq->caps) {
gst_caps_unref (niimaq->caps); gst_caps_unref (niimaq->caps);
} }
niimaq->caps = gst_niimaq_get_cam_caps(niimaq); niimaq->caps = gst_niimaq_get_cam_caps(niimaq);
res = gst_niimaq_parse_caps (niimaq->caps, &width, &height, res = gst_niimaq_parse_caps (niimaq->caps, &width, &height, &depth, &bpp);
&rate_numerator, &rate_denominator, &depth, &bpp);
if (res) { if (res) {
/* looks ok here */ /* looks ok here */
niimaq->width = width; niimaq->width = width;
niimaq->height = height; niimaq->height = height;
niimaq->rate_numerator = rate_numerator;
niimaq->rate_denominator = rate_denominator;
niimaq->depth = depth; niimaq->depth = depth;
niimaq->bpp = bpp; niimaq->bpp = bpp;
niimaq->framesize = width * height * (depth/8); niimaq->framesize = width * height * (depth/8);
@ -647,14 +644,11 @@ error:
* Returns: TRUE on success * Returns: TRUE on success
*/ */
static gboolean static gboolean
gst_niimaq_parse_caps (const GstCaps * caps, gst_niimaq_parse_caps (const GstCaps * caps, gint * width, gint * height,
gint * width, gint * depth, gint * bpp)
gint * height,
gint * rate_numerator, gint * rate_denominator, gint * depth, gint * bpp)
{ {
const GstStructure *structure; const GstStructure *structure;
GstPadLinkReturn ret; gboolean ret;
const GValue *framerate;
if (gst_caps_get_size (caps) < 1) if (gst_caps_get_size (caps) < 1)
return FALSE; return FALSE;
@ -664,20 +658,16 @@ gst_niimaq_parse_caps (const GstCaps * caps,
ret = gst_structure_get (structure, ret = gst_structure_get (structure,
"width", G_TYPE_INT, width, "width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "height", G_TYPE_INT, height,
"framerate", G_TYPE_VALUE, framerate,
"depth", G_TYPE_INT, depth, "depth", G_TYPE_INT, depth,
"bpp", G_TYPE_INT, bpp, "bpp", G_TYPE_INT, bpp,
NULL); NULL);
if (framerate) { if (!ret) {
*rate_numerator = gst_value_get_fraction_numerator (framerate); GST_DEBUG ("Failed to retrieve width, height, depth, or bpp");
*rate_denominator = gst_value_get_fraction_denominator (framerate); return FALSE;
}
else {
ret = FALSE;
} }
return ret; return TRUE;
} }
/* Set color on caps */ /* Set color on caps */
@ -784,8 +774,6 @@ gst_niimaq_get_cam_caps (GstNiImaq * src)
rval &= imgGetAttribute(src->iid, IMG_ATTR_ROI_HEIGHT, &val); rval &= imgGetAttribute(src->iid, IMG_ATTR_ROI_HEIGHT, &val);
height = val; height = val;
GST_DEBUG_OBJECT (src, "width=%d, height=%d", width, height);
if (rval) { if (rval) {
GST_ELEMENT_ERROR (src, STREAM, FAILED, GST_ELEMENT_ERROR (src, STREAM, FAILED,
("attempt to read attributes failed"), ("attempt to read attributes failed"),
@ -806,6 +794,8 @@ gst_niimaq_get_cam_caps (GstNiImaq * src)
gst_caps_append_structure (gcaps, gs); gst_caps_append_structure (gcaps, gs);
GST_DEBUG_OBJECT (gcaps, "are the camera caps");
return gcaps; return gcaps;
error: error:
@ -912,10 +902,12 @@ gboolean gst_niimaq_stop( GstBaseSrc * src )
rval=imgSessionStopAcquisition(filter->sid); rval=imgSessionStopAcquisition(filter->sid);
if (rval) { if (rval) {
GST_ELEMENT_ERROR (filter, RESOURCE, FAILED, ("Unable to stop transmision"), GST_ELEMENT_ERROR (filter, RESOURCE, FAILED, ("Unable to stop acquisition"),
("Unable to stop transmision")); ("Unable to stop acquisition"));
} }
GST_DEBUG_OBJECT (filter, "Acquisition stopped");
if(filter->sid) if(filter->sid)
imgClose(filter->sid,TRUE); imgClose(filter->sid,TRUE);
filter->sid = 0; filter->sid = 0;
@ -923,7 +915,7 @@ gboolean gst_niimaq_stop( GstBaseSrc * src )
imgClose(filter->iid,TRUE); imgClose(filter->iid,TRUE);
filter->iid = 0; filter->iid = 0;
GST_DEBUG_OBJECT (filter, "Capture stoped"); GST_DEBUG_OBJECT (filter, "IMAQ interface closed");
return TRUE; return TRUE;
} }

View File

@ -54,9 +54,6 @@ struct _GstNiImaq {
gint bpp; gint bpp;
gint framesize; gint framesize;
gint rate_numerator;
gint rate_denominator;
/* private */ /* private */
gint64 timestamp_offset; /* base offset */ gint64 timestamp_offset; /* base offset */
GstClockTime running_time; /* total running time */ GstClockTime running_time; /* total running time */