Message ID | 20190619105047.15380-1-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 20807a8c17e629b93d293ef0a0bdbd686ce84823 |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2019-06-19 13:50:47 +0300, Laurent Pinchart wrote: > Integer options have to use base 10. This isn't user-friendly when > specifying pixel formats. Detect the base automatically to support base > 16. As a side effect, integer values starting with 0 will be interpreted > in base 8. I wonder if we should not use cam to experiment on how libcamera should express pixel formats. As a first step maybe we could translate the v4l2 integer value to/from its string representation inside cam and if that proves to be useful move it to libcamera? I might not be the representation we choose in the end but by doing so we would have a central place to change translation method. That being said this patch in itself adds value to cam so, Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/cam/options.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp > index bea4a600d1d5..7c3948df3b5c 100644 > --- a/src/cam/options.cpp > +++ b/src/cam/options.cpp > @@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option, > > if (optarg) { > char *endptr; > - integer = strtoul(optarg, &endptr, 10); > + integer = strtoul(optarg, &endptr, 0); > if (*endptr != '\0') > return false; > } else { > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Niklas, On Wed, Jun 19, 2019 at 01:00:11PM +0200, Niklas Söderlund wrote: > On 2019-06-19 13:50:47 +0300, Laurent Pinchart wrote: > > Integer options have to use base 10. This isn't user-friendly when > > specifying pixel formats. Detect the base automatically to support base > > 16. As a side effect, integer values starting with 0 will be interpreted > > in base 8. > > I wonder if we should not use cam to experiment on how libcamera should > express pixel formats. As a first step maybe we could translate the v4l2 > integer value to/from its string representation inside cam and if that > proves to be useful move it to libcamera? It's a good idea. We still have to decide on how to represent formats, but the two problems can be tackled independently. I'm more and more tempted to use DRM 4CCs... > I might not be the representation we choose in the end but by doing so > we would have a central place to change translation method. > > That being said this patch in itself adds value to cam so, > > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > src/cam/options.cpp | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp > > index bea4a600d1d5..7c3948df3b5c 100644 > > --- a/src/cam/options.cpp > > +++ b/src/cam/options.cpp > > @@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option, > > > > if (optarg) { > > char *endptr; > > - integer = strtoul(optarg, &endptr, 10); > > + integer = strtoul(optarg, &endptr, 0); > > if (*endptr != '\0') > > return false; > > } else {
diff --git a/src/cam/options.cpp b/src/cam/options.cpp index bea4a600d1d5..7c3948df3b5c 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option, if (optarg) { char *endptr; - integer = strtoul(optarg, &endptr, 10); + integer = strtoul(optarg, &endptr, 0); if (*endptr != '\0') return false; } else {
Integer options have to use base 10. This isn't user-friendly when specifying pixel formats. Detect the base automatically to support base 16. As a side effect, integer values starting with 0 will be interpreted in base 8. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/cam/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)