Warning fixes continued

This commit is contained in:
Andrey Kamaev
2012-06-09 15:00:04 +00:00
parent f6b451c607
commit f2d3b9b4a1
127 changed files with 6298 additions and 6277 deletions
+10 -14
View File
@@ -283,7 +283,7 @@ void CvCapture_GStreamer::newPad(GstElement *uridecodebin,
sinkpad = gst_element_get_static_pad (color, "sink");
// printf("linking dynamic pad to colourconverter %p %p\n", uridecodebin, pad);
gst_pad_link (pad, sinkpad);
@@ -357,13 +357,13 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
if(manualpipeline) {
GstIterator *it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
if(gst_iterator_next(it, (gpointer *)&sink) != GST_ITERATOR_OK) {
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
}
pipeline = uridecodebin;
pipeline = uridecodebin;
} else {
pipeline = gst_pipeline_new (NULL);
pipeline = gst_pipeline_new (NULL);
color = gst_element_factory_make("ffmpegcolorspace", NULL);
sink = gst_element_factory_make("appsink", NULL);
@@ -381,16 +381,12 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
gst_app_sink_set_max_buffers (GST_APP_SINK(sink), 1);
gst_app_sink_set_drop (GST_APP_SINK(sink), stream);
{
GstCaps* caps;
caps = gst_caps_new_simple("video/x-raw-rgb",
"red_mask", G_TYPE_INT, 0x0000FF,
"green_mask", G_TYPE_INT, 0x00FF00,
"blue_mask", G_TYPE_INT, 0xFF0000,
NULL);
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
gst_app_sink_set_caps(GST_APP_SINK(sink), gst_caps_new_simple("video/x-raw-rgb",
"red_mask", G_TYPE_INT, 0x0000FF,
"green_mask", G_TYPE_INT, 0x00FF00,
"blue_mask", G_TYPE_INT, 0xFF0000,
NULL));
gst_caps_unref(caps);
}
if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY) ==
GST_STATE_CHANGE_FAILURE) {
+19 -19
View File
@@ -779,9 +779,9 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
return -1;
} else {
buffer_number--;
fprintf (stderr, "Insufficient buffer memory on %s -- decreaseing buffers\n", deviceName);
fprintf (stderr, "Insufficient buffer memory on %s -- decreaseing buffers\n", deviceName);
goto try_again;
goto try_again;
}
}
@@ -824,8 +824,8 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
if (capture->buffers[MAX_V4L_BUFFERS].start) {
free(capture->buffers[MAX_V4L_BUFFERS].start);
capture->buffers[MAX_V4L_BUFFERS].start = NULL;
}
}
capture->buffers[MAX_V4L_BUFFERS].start = malloc(buf.length);
capture->buffers[MAX_V4L_BUFFERS].length = buf.length;
};
@@ -1080,11 +1080,11 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
#ifdef USE_TEMP_BUFFER
memcpy(capture->buffers[MAX_V4L_BUFFERS].start,
capture->buffers[buf.index].start,
capture->buffers[MAX_V4L_BUFFERS].length );
capture->buffers[buf.index].start,
capture->buffers[MAX_V4L_BUFFERS].length );
capture->bufferIndex = MAX_V4L_BUFFERS;
//printf("got data in buff %d, len=%d, flags=0x%X, seq=%d, used=%d)\n",
// buf.index, buf.length, buf.flags, buf.sequence, buf.bytesused);
// buf.index, buf.length, buf.flags, buf.sequence, buf.bytesused);
#else
capture->bufferIndex = buf.index;
#endif
@@ -1211,9 +1211,9 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
capture->mmaps[capture->bufferIndex].format = capture->imageProperties.palette;
if (v4l1_ioctl (capture->deviceHandle, VIDIOCMCAPTURE,
&capture->mmaps[capture->bufferIndex]) == -1) {
/* capture is on the way, so just exit */
return 1;
&capture->mmaps[capture->bufferIndex]) == -1) {
/* capture is on the way, so just exit */
return 1;
}
++capture->bufferIndex;
@@ -1273,11 +1273,11 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
if (capture->is_v4l2_device == 1)
{
if(capture->buffers[capture->bufferIndex].start){
memcpy((char *)capture->frame.imageData,
(char *)capture->buffers[capture->bufferIndex].start,
capture->frame.imageSize);
}
if(capture->buffers[capture->bufferIndex].start){
memcpy((char *)capture->frame.imageData,
(char *)capture->buffers[capture->bufferIndex].start,
capture->frame.imageSize);
}
} else
#endif /* HAVE_CAMV4L2 */
@@ -1353,7 +1353,7 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
sprintf(name, "<unknown property string>");
capture->control.id = property_id;
}
if(v4l2_ioctl(capture->deviceHandle, VIDIOC_G_CTRL, &capture->control) == 0) {
/* all went well */
is_v4l2_device = 1;
@@ -1519,7 +1519,7 @@ static int icvSetControl (CvCaptureCAM_V4L* capture, int property_id, double val
CLEAR (capture->control);
CLEAR (capture->queryctrl);
/* get current values */
switch (property_id) {
case CV_CAP_PROP_BRIGHTNESS:
@@ -1688,8 +1688,8 @@ static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture ){
if (xioctl(capture->deviceHandle, VIDIOC_STREAMOFF, &capture->type) < 0) {
perror ("Unable to stop the stream.");
}
for (unsigned int n_buffers = 0; n_buffers < capture->req.count; ++n_buffers) {
if (-1 == v4l2_munmap (capture->buffers[n_buffers].start, capture->buffers[n_buffers].length)) {
for (unsigned int n_buffers2 = 0; n_buffers2 < capture->req.count; ++n_buffers2) {
if (-1 == v4l2_munmap (capture->buffers[n_buffers2].start, capture->buffers[n_buffers2].length)) {
perror ("munmap");
}
}
+8 -8
View File
@@ -157,22 +157,22 @@ bool PngDecoder::readHeader()
if( !m_buf.empty() || m_f )
{
png_uint_32 width, height;
png_uint_32 wdth, hght;
int bit_depth, color_type;
png_read_info( png_ptr, info_ptr );
png_get_IHDR( png_ptr, info_ptr, &width, &height,
png_get_IHDR( png_ptr, info_ptr, &wdth, &hght,
&bit_depth, &color_type, 0, 0, 0 );
m_width = (int)width;
m_height = (int)height;
m_width = (int)wdth;
m_height = (int)hght;
m_color_type = color_type;
m_bit_depth = bit_depth;
if( bit_depth <= 8 || bit_depth == 16 )
{
switch(color_type)
switch(color_type)
{
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_PALETTE:
@@ -224,7 +224,7 @@ bool PngDecoder::readData( Mat& img )
else if( !isBigEndian() )
png_set_swap( png_ptr );
if(img.channels() < 4)
if(img.channels() < 4)
{
/* observation: png_read_image() writes 400 bytes beyond
* end of data when reading a 400x118 color png
@@ -247,7 +247,7 @@ bool PngDecoder::readData( Mat& img )
#else
png_set_gray_1_2_4_to_8( png_ptr );
#endif
if( CV_MAT_CN(m_type) > 1 && color )
png_set_bgr( png_ptr ); // convert RGB to BGR
else if( color )
@@ -330,7 +330,7 @@ bool PngEncoder::write( const Mat& img, const vector<int>& params )
if( params[i] == CV_IMWRITE_PNG_STRATEGY )
{
compression_strategy = params[i+1];
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
}
}
+12 -12
View File
@@ -115,19 +115,19 @@ bool TiffDecoder::readHeader()
if( tif )
{
int width = 0, height = 0, photometric = 0;
int wdth = 0, hght = 0, photometric = 0;
m_tif = tif;
if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &width ) &&
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &height ) &&
if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &wdth ) &&
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &hght ) &&
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric ))
{
int bpp=8, ncn = photometric > 1 ? 3 : 1;
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );
m_width = width;
m_height = height;
m_width = wdth;
m_height = hght;
if( bpp > 8 &&
((photometric != 2 && photometric != 1) ||
(ncn != 1 && ncn != 3 && ncn != 4)))
@@ -169,7 +169,7 @@ bool TiffDecoder::readData( Mat& img )
bool color = img.channels() > 1;
uchar* data = img.data;
int step = (int)img.step;
if( img.depth() != CV_8U && img.depth() != CV_16U && img.depth() != CV_32F && img.depth() != CV_64F )
return false;
@@ -422,9 +422,9 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
default:
{
return false;
}
}
}
const int bitsPerByte = 8;
size_t fileStep = (width * channels * bitsPerChannel) / bitsPerByte;
int rowsPerStrip = (int)((1 << 13)/fileStep);
@@ -443,7 +443,7 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
{
return false;
}
// defaults for now, maybe base them on params in the future
int compression = COMPRESSION_LZW;
int predictor = PREDICTOR_HORIZONTAL;
@@ -516,7 +516,7 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
return false;
}
}
TIFFClose(pTiffHandle);
return true;
}
@@ -546,7 +546,7 @@ bool TiffEncoder::write( const Mat& img, const vector<int>& /*params*/)
if( !strm.open(*m_buf) )
return false;
}
else
else
{
#ifdef HAVE_TIFF
return writeLibTiff(img, params);