[2/2] media-ctl: Re-order setting format and routes
Commit Message
Currently media-ctl attempts to set formats that are passed to it
with -V _before_ setting routes passed to it with -R. This is a
problem, because the formats that one wants may not be valid until
routing has been configured (for example, if the format is for a
route that is inactive by default).
Reorder things so that setting routes comes before setting formats.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
utils/media-ctl/media-ctl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Comments
Hi Dan,
Thank you for the patch.
On Wed, Jan 17, 2024 at 01:08:05PM +0000, Daniel Scally wrote:
> Currently media-ctl attempts to set formats that are passed to it
> with -V _before_ setting routes passed to it with -R. This is a
> problem, because the formats that one wants may not be valid until
> routing has been configured (for example, if the format is for a
> route that is inactive by default).
>
> Reorder things so that setting routes comes before setting formats.
>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> utils/media-ctl/media-ctl.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
> index 961d10c8..2081f111 100644
> --- a/utils/media-ctl/media-ctl.c
> +++ b/utils/media-ctl/media-ctl.c
> @@ -751,20 +751,20 @@ int main(int argc, char **argv)
> }
> }
>
> - if (media_opts.formats) {
> - ret = v4l2_subdev_parse_setup_formats(media,
> - media_opts.formats);
> + if (media_opts.routes) {
> + ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
> if (ret) {
> - printf("Unable to setup formats: %s (%d)\n",
> + printf("Unable to setup routes: %s (%d)\n",
> strerror(-ret), -ret);
> goto out;
> }
> }
>
> - if (media_opts.routes) {
> - ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
> + if (media_opts.formats) {
> + ret = v4l2_subdev_parse_setup_formats(media,
> + media_opts.formats);
> if (ret) {
> - printf("Unable to setup routes: %s (%d)\n",
> + printf("Unable to setup formats: %s (%d)\n",
> strerror(-ret), -ret);
> goto out;
> }
On Wed, Jan 17, 2024 at 01:08:05PM +0000, Daniel Scally wrote:
> Currently media-ctl attempts to set formats that are passed to it
> with -V _before_ setting routes passed to it with -R. This is a
> problem, because the formats that one wants may not be valid until
> routing has been configured (for example, if the format is for a
> route that is inactive by default).
>
> Reorder things so that setting routes comes before setting formats.
>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Thanks!
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
@@ -751,20 +751,20 @@ int main(int argc, char **argv)
}
}
- if (media_opts.formats) {
- ret = v4l2_subdev_parse_setup_formats(media,
- media_opts.formats);
+ if (media_opts.routes) {
+ ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
if (ret) {
- printf("Unable to setup formats: %s (%d)\n",
+ printf("Unable to setup routes: %s (%d)\n",
strerror(-ret), -ret);
goto out;
}
}
- if (media_opts.routes) {
- ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
+ if (media_opts.formats) {
+ ret = v4l2_subdev_parse_setup_formats(media,
+ media_opts.formats);
if (ret) {
- printf("Unable to setup routes: %s (%d)\n",
+ printf("Unable to setup formats: %s (%d)\n",
strerror(-ret), -ret);
goto out;
}