v4l2-mediabus.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Media Bus API header
  3. *
  4. * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef V4L2_MEDIABUS_H
  11. #define V4L2_MEDIABUS_H
  12. /*
  13. * These pixel codes uniquely identify data formats on the media bus. Mostly
  14. * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
  15. * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
  16. * data format is fixed. Additionally, "2X8" means that one pixel is transferred
  17. * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
  18. * transferred over the bus: "LE" means that the least significant bits are
  19. * transferred first, "BE" means that the most significant bits are transferred
  20. * first, and "PADHI" and "PADLO" define which bits - low or high, in the
  21. * incomplete high byte, are filled with padding bits.
  22. */
  23. enum v4l2_mbus_pixelcode {
  24. V4L2_MBUS_FMT_FIXED = 1,
  25. V4L2_MBUS_FMT_YUYV8_2X8,
  26. V4L2_MBUS_FMT_YVYU8_2X8,
  27. V4L2_MBUS_FMT_UYVY8_2X8,
  28. V4L2_MBUS_FMT_VYUY8_2X8,
  29. V4L2_MBUS_FMT_YVYU10_2X10,
  30. V4L2_MBUS_FMT_YUYV10_2X10,
  31. V4L2_MBUS_FMT_YVYU10_1X20,
  32. V4L2_MBUS_FMT_YUYV10_1X20,
  33. V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
  34. V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE,
  35. V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
  36. V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
  37. V4L2_MBUS_FMT_RGB565_2X8_LE,
  38. V4L2_MBUS_FMT_RGB565_2X8_BE,
  39. V4L2_MBUS_FMT_BGR565_2X8_LE,
  40. V4L2_MBUS_FMT_BGR565_2X8_BE,
  41. V4L2_MBUS_FMT_SBGGR8_1X8,
  42. V4L2_MBUS_FMT_SBGGR10_1X10,
  43. V4L2_MBUS_FMT_GREY8_1X8,
  44. V4L2_MBUS_FMT_Y10_1X10,
  45. V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
  46. V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
  47. V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
  48. V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
  49. V4L2_MBUS_FMT_SGRBG8_1X8,
  50. V4L2_MBUS_FMT_SBGGR12_1X12,
  51. V4L2_MBUS_FMT_YUYV8_1_5X8,
  52. V4L2_MBUS_FMT_YVYU8_1_5X8,
  53. V4L2_MBUS_FMT_UYVY8_1_5X8,
  54. V4L2_MBUS_FMT_VYUY8_1_5X8,
  55. };
  56. /**
  57. * struct v4l2_mbus_framefmt - frame format on the media bus
  58. * @width: frame width
  59. * @height: frame height
  60. * @code: data format code
  61. * @field: used interlacing type
  62. * @colorspace: colorspace of the data
  63. */
  64. struct v4l2_mbus_framefmt {
  65. __u32 width;
  66. __u32 height;
  67. enum v4l2_mbus_pixelcode code;
  68. enum v4l2_field field;
  69. enum v4l2_colorspace colorspace;
  70. };
  71. static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
  72. const struct v4l2_mbus_framefmt *mbus_fmt)
  73. {
  74. pix_fmt->width = mbus_fmt->width;
  75. pix_fmt->height = mbus_fmt->height;
  76. pix_fmt->field = mbus_fmt->field;
  77. pix_fmt->colorspace = mbus_fmt->colorspace;
  78. }
  79. static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
  80. const struct v4l2_pix_format *pix_fmt,
  81. enum v4l2_mbus_pixelcode code)
  82. {
  83. mbus_fmt->width = pix_fmt->width;
  84. mbus_fmt->height = pix_fmt->height;
  85. mbus_fmt->field = pix_fmt->field;
  86. mbus_fmt->colorspace = pix_fmt->colorspace;
  87. mbus_fmt->code = code;
  88. }
  89. #endif