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/buffer/pointer.h> 00020 #include <libexplain/buffer/v4l2_std_id.h> 00021 #include <libexplain/parse_bits.h> 00022 #include <libexplain/is_efault.h> 00023 00024 00025 #ifdef HAVE_LINUX_VIDEODEV2_H 00026 00027 void 00028 explain_buffer_v4l2_std_id(explain_string_buffer_t *sb, 00029 unsigned long long value) 00030 { 00031 /* 00032 * awk '/#define V4L2_STD_/ { 00033 * print "#ifdef " $2 00034 * print " { \"" $2 "\", " $2 " }," 00035 * print "#endif" 00036 * } ' /usr/include/linux/videodev2.h 00037 */ 00038 static const explain_parse_bits_table_t table[] = 00039 { 00040 #ifdef V4L2_STD_PAL_B 00041 { "V4L2_STD_PAL_B", V4L2_STD_PAL_B }, 00042 #endif 00043 #ifdef V4L2_STD_PAL_B1 00044 { "V4L2_STD_PAL_B1", V4L2_STD_PAL_B1 }, 00045 #endif 00046 #ifdef V4L2_STD_PAL_G 00047 { "V4L2_STD_PAL_G", V4L2_STD_PAL_G }, 00048 #endif 00049 #ifdef V4L2_STD_PAL_H 00050 { "V4L2_STD_PAL_H", V4L2_STD_PAL_H }, 00051 #endif 00052 #ifdef V4L2_STD_PAL_I 00053 { "V4L2_STD_PAL_I", V4L2_STD_PAL_I }, 00054 #endif 00055 #ifdef V4L2_STD_PAL_D 00056 { "V4L2_STD_PAL_D", V4L2_STD_PAL_D }, 00057 #endif 00058 #ifdef V4L2_STD_PAL_D1 00059 { "V4L2_STD_PAL_D1", V4L2_STD_PAL_D1 }, 00060 #endif 00061 #ifdef V4L2_STD_PAL_K 00062 { "V4L2_STD_PAL_K", V4L2_STD_PAL_K }, 00063 #endif 00064 #ifdef V4L2_STD_PAL_M 00065 { "V4L2_STD_PAL_M", V4L2_STD_PAL_M }, 00066 #endif 00067 #ifdef V4L2_STD_PAL_N 00068 { "V4L2_STD_PAL_N", V4L2_STD_PAL_N }, 00069 #endif 00070 #ifdef V4L2_STD_PAL_Nc 00071 { "V4L2_STD_PAL_Nc", V4L2_STD_PAL_Nc }, 00072 #endif 00073 #ifdef V4L2_STD_PAL_60 00074 { "V4L2_STD_PAL_60", V4L2_STD_PAL_60 }, 00075 #endif 00076 #ifdef V4L2_STD_NTSC_M 00077 { "V4L2_STD_NTSC_M", V4L2_STD_NTSC_M }, 00078 #endif 00079 #ifdef V4L2_STD_NTSC_M_JP 00080 { "V4L2_STD_NTSC_M_JP", V4L2_STD_NTSC_M_JP }, 00081 #endif 00082 #ifdef V4L2_STD_NTSC_443 00083 { "V4L2_STD_NTSC_443", V4L2_STD_NTSC_443 }, 00084 #endif 00085 #ifdef V4L2_STD_NTSC_M_KR 00086 { "V4L2_STD_NTSC_M_KR", V4L2_STD_NTSC_M_KR }, 00087 #endif 00088 #ifdef V4L2_STD_SECAM_B 00089 { "V4L2_STD_SECAM_B", V4L2_STD_SECAM_B }, 00090 #endif 00091 #ifdef V4L2_STD_SECAM_D 00092 { "V4L2_STD_SECAM_D", V4L2_STD_SECAM_D }, 00093 #endif 00094 #ifdef V4L2_STD_SECAM_G 00095 { "V4L2_STD_SECAM_G", V4L2_STD_SECAM_G }, 00096 #endif 00097 #ifdef V4L2_STD_SECAM_H 00098 { "V4L2_STD_SECAM_H", V4L2_STD_SECAM_H }, 00099 #endif 00100 #ifdef V4L2_STD_SECAM_K 00101 { "V4L2_STD_SECAM_K", V4L2_STD_SECAM_K }, 00102 #endif 00103 #ifdef V4L2_STD_SECAM_K1 00104 { "V4L2_STD_SECAM_K1", V4L2_STD_SECAM_K1 }, 00105 #endif 00106 #ifdef V4L2_STD_SECAM_L 00107 { "V4L2_STD_SECAM_L", V4L2_STD_SECAM_L }, 00108 #endif 00109 #ifdef V4L2_STD_SECAM_LC 00110 { "V4L2_STD_SECAM_LC", V4L2_STD_SECAM_LC }, 00111 #endif 00112 #ifdef V4L2_STD_ATSC_8_VSB 00113 { "V4L2_STD_ATSC_8_VSB", V4L2_STD_ATSC_8_VSB }, 00114 #endif 00115 #ifdef V4L2_STD_ATSC_16_VSB 00116 { "V4L2_STD_ATSC_16_VSB", V4L2_STD_ATSC_16_VSB }, 00117 #endif 00118 #ifdef V4L2_STD_MN 00119 { "V4L2_STD_MN", V4L2_STD_MN }, 00120 #endif 00121 #ifdef V4L2_STD_B 00122 { "V4L2_STD_B", V4L2_STD_B }, 00123 #endif 00124 #ifdef V4L2_STD_GH 00125 { "V4L2_STD_GH", V4L2_STD_GH }, 00126 #endif 00127 #ifdef V4L2_STD_DK 00128 { "V4L2_STD_DK", V4L2_STD_DK }, 00129 #endif 00130 #ifdef V4L2_STD_PAL_BG 00131 { "V4L2_STD_PAL_BG", V4L2_STD_PAL_BG }, 00132 #endif 00133 #ifdef V4L2_STD_PAL_DK 00134 { "V4L2_STD_PAL_DK", V4L2_STD_PAL_DK }, 00135 #endif 00136 #ifdef V4L2_STD_PAL 00137 { "V4L2_STD_PAL", V4L2_STD_PAL }, 00138 #endif 00139 #ifdef V4L2_STD_NTSC 00140 { "V4L2_STD_NTSC", V4L2_STD_NTSC }, 00141 #endif 00142 #ifdef V4L2_STD_SECAM_DK 00143 { "V4L2_STD_SECAM_DK", V4L2_STD_SECAM_DK }, 00144 #endif 00145 #ifdef V4L2_STD_SECAM 00146 { "V4L2_STD_SECAM", V4L2_STD_SECAM }, 00147 #endif 00148 #ifdef V4L2_STD_525_60 00149 { "V4L2_STD_525_60", V4L2_STD_525_60 }, 00150 #endif 00151 #ifdef V4L2_STD_625_50 00152 { "V4L2_STD_625_50", V4L2_STD_625_50 }, 00153 #endif 00154 #ifdef V4L2_STD_ATSC 00155 { "V4L2_STD_ATSC", V4L2_STD_ATSC }, 00156 #endif 00157 #ifdef V4L2_STD_UNKNOWN 00158 { "V4L2_STD_UNKNOWN", V4L2_STD_UNKNOWN }, 00159 #endif 00160 #ifdef V4L2_STD_ALL 00161 { "V4L2_STD_ALL", V4L2_STD_ALL }, 00162 #endif 00163 }; 00164 if (value >= (1uLL << 32)) 00165 { 00166 explain_string_buffer_printf(sb, "0x%LX", value); 00167 return; 00168 } 00169 00170 explain_parse_bits_print(sb, value, table, SIZEOF(table)); 00171 } 00172 00173 00174 void 00175 explain_buffer_v4l2_std_id_ptr(explain_string_buffer_t *sb, 00176 const unsigned long long *data) 00177 { 00178 if (explain_is_efault_pointer(data, sizeof(data))) 00179 { 00180 explain_buffer_pointer(sb, data); 00181 return; 00182 } 00183 00184 explain_string_buffer_puts(sb, "{ "); 00185 explain_buffer_v4l2_std_id(sb, *data); 00186 explain_string_buffer_puts(sb, " }"); 00187 } 00188 00189 #endif 00190 00191 /* vim: set ts=8 sw=4 et : */