While there is already a comment about the always_needs_conversion
logic at libv4lconvert, the comment is not clear enough. Also,
the decision of needing a conversion or not is actually at the
supported_src_pixfmts[] table.

Improve the comments to make it clearer about what criteria should be
used with regards to exposing formats to userspace.

Suggested-by: Sakari Ailus <sakari.ai...@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>
---
 lib/libv4lconvert/libv4lconvert.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/libv4lconvert/libv4lconvert.c 
b/lib/libv4lconvert/libv4lconvert.c
index d87d6b91a838..5cb852fc7169 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -74,8 +74,15 @@ const struct libv4l_dev_ops *v4lconvert_get_default_dev_ops()
 static void v4lconvert_get_framesizes(struct v4lconvert_data *data,
                unsigned int pixelformat, int index);
 
-/* Note for proper functioning of v4lconvert_enum_fmt the first entries in
-   supported_src_pixfmts must match with the entries in supported_dst_pixfmts 
*/
+/*
+ * Notes:
+ * 1) for proper functioning of v4lconvert_enum_fmt the first entries in
+ *    supported_src_pixfmts must match with the entries in
+ *    supported_dst_pixfmts.
+ * 2) The field needs_conversion should be zero, *except* for device-specific
+ *    formats, where it doesn't make sense for applications to have their
+ *    own decoders.
+ */
 #define SUPPORTED_DST_PIXFMTS \
        /* fourcc                       bpp     rgb     yuv     needs      */ \
        /*                                      rank    rank    conversion */ \
@@ -175,9 +182,11 @@ struct v4lconvert_data *v4lconvert_create_with_dev_ops(int 
fd, void *dev_ops_pri
        int i, j;
        struct v4lconvert_data *data = calloc(1, sizeof(struct 
v4lconvert_data));
        struct v4l2_capability cap;
-       /* This keeps tracks of devices which have only formats for which apps
-          most likely will need conversion and we can thus safely add software
-          processing controls without a performance impact. */
+       /*
+        * This keeps tracks of device-specific formats for which apps most
+        * likely don't know. We can thus safely add software processing
+        * controls without much concern about a performance impact.
+        */
        int always_needs_conversion = 0;
 
        if (!data) {
-- 
2.9.3

Reply via email to