libexplain
1.4.D001
|
00001 /* 00002 * libexplain - a library of system-call-specific strerror replacements 00003 * Copyright (C) 2011, 2013 Peter Miller 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as 00007 * published by the Free Software Foundation; either version 3 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include <libexplain/ac/ctype.h> 00020 #include <libexplain/ac/linux/videodev2.h> 00021 00022 #include <libexplain/buffer/hexdump.h> 00023 #include <libexplain/buffer/int.h> 00024 #include <libexplain/buffer/v4l2_jpegcompression.h> 00025 #include <libexplain/buffer/v4l2_jpeg_markers.h> 00026 #include <libexplain/buffer/pointer.h> 00027 #include <libexplain/is_efault.h> 00028 00029 00030 #ifdef HAVE_LINUX_VIDEODEV2_H 00031 00032 void 00033 explain_buffer_v4l2_jpegcompression(explain_string_buffer_t *sb, 00034 const struct v4l2_jpegcompression *data) 00035 { 00036 int size; 00037 00038 if (explain_is_efault_pointer(data, sizeof(*data))) 00039 { 00040 explain_buffer_pointer(sb, data); 00041 return; 00042 } 00043 00044 explain_string_buffer_puts(sb, "{ quality = "); 00045 explain_buffer_int(sb, data->quality); 00046 explain_string_buffer_puts(sb, ", APPn = "); 00047 explain_buffer_int(sb, data->APPn); 00048 explain_string_buffer_puts(sb, ", APP_len = "); 00049 explain_buffer_int(sb, data->APP_len); 00050 00051 size = data->APP_len; 00052 if (size < 0) 00053 size = 0; 00054 else if ((unsigned)size > sizeof(data->APP_data)) 00055 size = sizeof(data->APP_data); 00056 if (size > 0) 00057 { 00058 explain_string_buffer_puts(sb, ", APP_data = "); 00059 explain_buffer_mostly_text(sb, data->APP_data, size); 00060 } 00061 00062 explain_string_buffer_puts(sb, ", COM_len = "); 00063 explain_buffer_int(sb, data->COM_len); 00064 00065 size = data->COM_len; 00066 if (size < 0) 00067 size = 0; 00068 else if ((unsigned)size > sizeof(data->COM_data)) 00069 size = sizeof(data->COM_data); 00070 if (size > 0) 00071 { 00072 explain_string_buffer_puts(sb, ", COM_data = "); 00073 explain_buffer_mostly_text(sb, data->COM_data, size); 00074 } 00075 00076 explain_string_buffer_puts(sb, ", jpeg_markers = "); 00077 explain_buffer_v4l2_jpeg_markers(sb, data->jpeg_markers); 00078 explain_string_buffer_puts(sb, " }"); 00079 } 00080 00081 #endif 00082 00083 /* vim: set ts=8 sw=4 et : */