libexplain  1.4.D001
libexplain/buffer/v4l2_bt_timings.c
Go to the documentation of this file.
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/linux/videodev2.h>
00020 
00021 #include <libexplain/buffer/int32_t.h>
00022 #include <libexplain/buffer/int64_t.h>
00023 #include <libexplain/buffer/v4l2_bt_timings.h>
00024 #include <libexplain/buffer/v4l2_bt_timings_interlaced.h>
00025 #include <libexplain/buffer/v4l2_bt_timings_polarities.h>
00026 #include <libexplain/buffer/pointer.h>
00027 #include <libexplain/is_efault.h>
00028 #include <libexplain/sizeof.h>
00029 
00030 
00031 #ifdef HAVE_LINUX_VIDEODEV2_H
00032 #if defined(VIDIOC_G_DV_TIMINGS) || defined(VIDIOC_S_DV_TIMINGS)
00033 
00034 void
00035 explain_buffer_v4l2_bt_timings(explain_string_buffer_t *sb,
00036     const struct v4l2_bt_timings *data)
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, "{ width = ");
00045     explain_buffer_uint32_t(sb, data->width);
00046     explain_string_buffer_puts(sb, ", height = ");
00047     explain_buffer_uint32_t(sb, data->height);
00048     explain_string_buffer_puts(sb, ", interlaced = ");
00049     explain_buffer_v4l2_bt_timings_interlaced(sb, data->interlaced);
00050     explain_string_buffer_puts(sb, ", polarities = ");
00051     explain_buffer_v4l2_bt_timings_polarities(sb, data->polarities);
00052     if (data->pixelclock)
00053     {
00054         explain_string_buffer_puts(sb, ", pixelclock = ");
00055         explain_buffer_uint64_t(sb, data->pixelclock);
00056     }
00057     if (data->hfrontporch)
00058     {
00059         explain_string_buffer_puts(sb, ", hfrontporch = ");
00060         explain_buffer_uint32_t(sb, data->hfrontporch);
00061     }
00062     if (data->hsync)
00063     {
00064         explain_string_buffer_puts(sb, ", hsync = ");
00065         explain_buffer_uint32_t(sb, data->hsync);
00066     }
00067     if (data->hbackporch)
00068     {
00069         explain_string_buffer_puts(sb, ", hbackporch = ");
00070         explain_buffer_uint32_t(sb, data->hbackporch);
00071     }
00072     if (data->vfrontporch)
00073     {
00074         explain_string_buffer_puts(sb, ", vfrontporch = ");
00075         explain_buffer_uint32_t(sb, data->vfrontporch);
00076     }
00077     if (data->vsync)
00078     {
00079         explain_string_buffer_puts(sb, ", vsync = ");
00080         explain_buffer_uint32_t(sb, data->vsync);
00081     }
00082     if (data->vbackporch)
00083     {
00084         explain_string_buffer_puts(sb, ", vfrontporch = ");
00085         explain_buffer_uint32_t(sb, data->vbackporch);
00086     }
00087     if (data->il_vfrontporch)
00088     {
00089         explain_string_buffer_puts(sb, ", il_vfrontporch = ");
00090         explain_buffer_uint32_t(sb, data->il_vfrontporch);
00091     }
00092     if (data->il_vsync)
00093     {
00094         explain_string_buffer_puts(sb, ", il_vsync = ");
00095         explain_buffer_uint32_t(sb, data->il_vsync);
00096     }
00097     if (data->il_vbackporch)
00098     {
00099         explain_string_buffer_puts(sb, ", il_vbackporch = ");
00100         explain_buffer_uint32_t(sb, data->il_vbackporch);
00101     }
00102     if (!explain_uint32_array_all_zero(data->reserved, SIZEOF(data->reserved)))
00103     {
00104         explain_string_buffer_puts(sb, ", reserved = ");
00105         explain_buffer_uint32_array(sb, data->reserved, SIZEOF(data->reserved));
00106     }
00107     explain_string_buffer_puts(sb, " }");
00108 }
00109 
00110 #endif
00111 #endif
00112 
00113 
00114 /* vim: set ts=8 sw=4 et : */