New selection format and compose support
v3 cover New selection format and compose support
Hi Laurent,
Update: since v2:
- Use parenthesis in crop display
I've updated the two first patches from the previous set as discussed. There are two new that change the selection target names to correspond the latest developments.
Cheers,
Signature · 2 lines
Sakari Ailus e-mail: [email protected] jabber/XMPP/Gmail: [email protected]
PATCH v3 1/4 New, more flexible syntax for format
More flexible and extensible syntax for format which allows better usage of the selection API.
Continue supporting the old syntax but remove the documentation for it. It was not supported in an official release and its use is thus deprecated.
--- src/main.c | 17 +++++++-- src/options.c | 27 +++++++++----- src/v4l2subdev.c | 97 ++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 95 insertions(+), 46 deletions(-)
src/main.c +13 -4
@@ -59,15 +59,24 @@ static void v4l2_subdev_print_format(struct media_entity *entity,if (ret !=0 )return ; -printf ("[%s %ux%u" ,v4l2_subdev_pixelcode_to_string (format.code), - format.width, format.height); +printf ("\t\t[fmt:%s/%ux%u" , +v4l2_subdev_pixelcode_to_string (format.code), + format.width, format.height); + + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS , + which); +if (ret ==0 ) +printf ("\n\t\t crop.bounds:(%u,%u)/%ux%u" , rect.left, rect.top, + rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , which);if (ret ==0 ) -printf (" (%u,%u)/%ux%u" , rect.left, rect.top, +printf ("\n\t\t crop:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); +printf ("]" ); }
@@ -252,7 +261,7 @@ static void media_print_topology_text(struct media_device *media)for (j =0 ; j < entity->info.pads; j++) {struct media_pad *pad = &entity->pads[j]; -printf ("\tpad%u: %s " , j,media_pad_type_to_string (pad->flags)); +printf ("\tpad%u: %s\n" , j,media_pad_type_to_string (pad->flags));if (media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV )v4l2_subdev_print_format (entity, j,V4L2_SUBDEV_FORMAT_ACTIVE );
src/options.c +17 -10
@@ -37,8 +37,8 @@ static void usage(const char *argv0, int verbose)printf ("%s [options] device\n" , argv0);printf ("-d, --device dev Media device name (default: %s)\n" ,MEDIA_DEVNAME_DEFAULT );printf ("-e, --entity name Print the device name associated with the given entity\n" ); -printf ("-f, --set-format Comma-separated list of formats to setup\n" ); -printf (" --get-format pad Print the active format on a given pad\n" ); +printf ("-V, --set-v4l2 v4l2 Comma-separated list of formats to setup\n" ); +printf (" --get-v4l2 pad Print the active format on a given pad\n" );printf ("-h, --help Show verbose help and exit\n" );printf ("-i, --interactive Modify links interactively\n" );printf ("-l, --links Comma-separated list of links descriptors to setup\n" );
@@ -52,13 +52,17 @@ static void usage(const char *argv0, int verbose)printf ("\n" );printf ("Links and formats are defined as\n" ); -printf ("\tlink = pad, '->', pad, '[', flags, ']' ;\n" ); -printf ("\tformat = pad, '[', fcc, ' ', size, [ ' ', crop ], [ ' ', '@', frame interval ], ']' ;\n" ); -printf ("\tpad = entity, ':', pad number ;\n" ); -printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" ); -printf ("\tsize = width, 'x', height ;\n" ); -printf ("\tcrop = '(', left, ',', top, ')', '/', size ;\n" ); -printf ("\tframe interval = numerator, '/', denominator ;\n" ); +printf ("\tlink = pad, '->', pad, '[', flags, ']' ;\n" ); +printf ("\tv4l2 = pad, '[', v4l2-cfgs ']' ;\n" ); +printf ("\tv4l2-cfgs = v4l2-cfg [ ',' v4l2-cfg ] ;\n" ); +printf ("\tv4l2-cfg = v4l2-mbusfmt | v4l2-crop\n" ); +printf ("\t | v4l2 frame interval ;\n" ); +printf ("\tv4l2-mbusfmt = 'fmt:', fcc, '/', size ;\n" ); +printf ("\tpad = entity, ':', pad number ;\n" ); +printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" ); +printf ("\tsize = width, 'x', height ;\n" ); +printf ("\tv4l2-crop = 'crop:(', left, ',', top, ')/', size ;\n" ); +printf ("\tv4l2 frame interval = '@', numerator, '/', denominator ;\n" );printf ("where the fields are\n" );printf ("\tentity number Entity numeric identifier\n" );printf ("\tentity name Entity name (string) \n" );
@@ -77,7 +81,9 @@ static void usage(const char *argv0, int verbose)static struct option opts[] = { {"device" ,1 ,0 ,'d' }, {"entity" ,1 ,0 ,'e' }, + {"set-v4l2" ,1 ,0 ,'V' }, {"set-format" ,1 ,0 ,'f' }, + {"get-v4l2" ,1 ,0 ,OPT_GET_FORMAT }, {"get-format" ,1 ,0 ,OPT_GET_FORMAT }, {"help" ,0 ,0 ,'h' }, {"interactive" ,0 ,0 ,'i' },
@@ -98,7 +104,7 @@ int parse_cmdline(int argc, char **argv) }/* parse options */ -while ((opt =getopt_long (argc, argv,"d:e:f:hil:prv" , opts,NULL )) !=-1 ) { +while ((opt =getopt_long (argc, argv,"d:e:V:f:hil:prv" , opts,NULL )) !=-1 ) {switch (opt) {case 'd' : media_opts.devname = optarg;
@@ -108,6 +114,7 @@ int parse_cmdline(int argc, char **argv) media_opts.entity = optarg;break ; +case 'V' :case 'f' : media_opts.formats = optarg;break ;
src/v4l2subdev.c +59 -26
141 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v3 1/4 New, more flexible syntax for format
More flexible and extensible syntax for format which allows better usage of the selection API.
Continue supporting the old syntax but remove the documentation for it. It was not supported in an official release and its use is thus deprecated.
---
Changes since v3:
Renamed strhazit() to better reflect its purpose and meaning.
src/main.c | 17 +++++++-- src/options.c | 27 +++++++++----- src/v4l2subdev.c | 97 ++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 95 insertions(+), 46 deletions(-)
src/main.c +13 -4
@@ -59,15 +59,24 @@ static void v4l2_subdev_print_format(struct media_entity *entity,if (ret !=0 )return ; -printf ("[%s %ux%u" ,v4l2_subdev_pixelcode_to_string (format.code), - format.width, format.height); +printf ("\t\t[fmt:%s/%ux%u" , +v4l2_subdev_pixelcode_to_string (format.code), + format.width, format.height); + + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS , + which); +if (ret ==0 ) +printf ("\n\t\t crop.bounds:(%u,%u)/%ux%u" , rect.left, rect.top, + rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , which);if (ret ==0 ) -printf (" (%u,%u)/%ux%u" , rect.left, rect.top, +printf ("\n\t\t crop:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); +printf ("]" ); }
@@ -252,7 +261,7 @@ static void media_print_topology_text(struct media_device *media)for (j =0 ; j < entity->info.pads; j++) {struct media_pad *pad = &entity->pads[j]; -printf ("\tpad%u: %s " , j,media_pad_type_to_string (pad->flags)); +printf ("\tpad%u: %s\n" , j,media_pad_type_to_string (pad->flags));if (media_entity_type (entity) ==MEDIA_ENT_T_V4L2_SUBDEV )v4l2_subdev_print_format (entity, j,V4L2_SUBDEV_FORMAT_ACTIVE );
src/options.c +17 -10
@@ -37,8 +37,8 @@ static void usage(const char *argv0, int verbose)printf ("%s [options] device\n" , argv0);printf ("-d, --device dev Media device name (default: %s)\n" ,MEDIA_DEVNAME_DEFAULT );printf ("-e, --entity name Print the device name associated with the given entity\n" ); -printf ("-f, --set-format Comma-separated list of formats to setup\n" ); -printf (" --get-format pad Print the active format on a given pad\n" ); +printf ("-V, --set-v4l2 v4l2 Comma-separated list of formats to setup\n" ); +printf (" --get-v4l2 pad Print the active format on a given pad\n" );printf ("-h, --help Show verbose help and exit\n" );printf ("-i, --interactive Modify links interactively\n" );printf ("-l, --links Comma-separated list of links descriptors to setup\n" );
@@ -52,13 +52,17 @@ static void usage(const char *argv0, int verbose)printf ("\n" );printf ("Links and formats are defined as\n" ); -printf ("\tlink = pad, '->', pad, '[', flags, ']' ;\n" ); -printf ("\tformat = pad, '[', fcc, ' ', size, [ ' ', crop ], [ ' ', '@', frame interval ], ']' ;\n" ); -printf ("\tpad = entity, ':', pad number ;\n" ); -printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" ); -printf ("\tsize = width, 'x', height ;\n" ); -printf ("\tcrop = '(', left, ',', top, ')', '/', size ;\n" ); -printf ("\tframe interval = numerator, '/', denominator ;\n" ); +printf ("\tlink = pad, '->', pad, '[', flags, ']' ;\n" ); +printf ("\tv4l2 = pad, '[', v4l2-cfgs ']' ;\n" ); +printf ("\tv4l2-cfgs = v4l2-cfg [ ',' v4l2-cfg ] ;\n" ); +printf ("\tv4l2-cfg = v4l2-mbusfmt | v4l2-crop\n" ); +printf ("\t | v4l2 frame interval ;\n" ); +printf ("\tv4l2-mbusfmt = 'fmt:', fcc, '/', size ;\n" ); +printf ("\tpad = entity, ':', pad number ;\n" ); +printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" ); +printf ("\tsize = width, 'x', height ;\n" ); +printf ("\tv4l2-crop = 'crop:(', left, ',', top, ')/', size ;\n" ); +printf ("\tv4l2 frame interval = '@', numerator, '/', denominator ;\n" );printf ("where the fields are\n" );printf ("\tentity number Entity numeric identifier\n" );printf ("\tentity name Entity name (string) \n" );
@@ -77,7 +81,9 @@ static void usage(const char *argv0, int verbose)static struct option opts[] = { {"device" ,1 ,0 ,'d' }, {"entity" ,1 ,0 ,'e' }, + {"set-v4l2" ,1 ,0 ,'V' }, {"set-format" ,1 ,0 ,'f' }, + {"get-v4l2" ,1 ,0 ,OPT_GET_FORMAT }, {"get-format" ,1 ,0 ,OPT_GET_FORMAT }, {"help" ,0 ,0 ,'h' }, {"interactive" ,0 ,0 ,'i' },
@@ -98,7 +104,7 @@ int parse_cmdline(int argc, char **argv) }/* parse options */ -while ((opt =getopt_long (argc, argv,"d:e:f:hil:prv" , opts,NULL )) !=-1 ) { +while ((opt =getopt_long (argc, argv,"d:e:V:f:hil:prv" , opts,NULL )) !=-1 ) {switch (opt) {case 'd' : media_opts.devname = optarg;
@@ -108,6 +114,7 @@ int parse_cmdline(int argc, char **argv) media_opts.entity = optarg;break ; +case 'V' :case 'f' : media_opts.formats = optarg;break ;
src/v4l2subdev.c +59 -26
141 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v3 2/4 Compose rectangle support for libv4l2subdev
In reply to Sakari Ailus--- src/main.c | 14 ++++++++++++++ src/options.c | 6 ++++-- src/v4l2subdev.c | 32 +++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-)
src/main.c +14 -0
@@ -77,6 +77,20 @@ static void v4l2_subdev_print_format(struct media_entity *entity,printf ("\n\t\t crop:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS , + which); +if (ret ==0 ) +printf ("\n\t\t compose.bounds:%u,%u/%ux%u" , + rect.left, rect.top, rect.width, rect.height); + + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , + which); +if (ret ==0 ) +printf ("\n\t\t compose:%u,%u/%ux%u" , + rect.left, rect.top, rect.width, rect.height); +printf ("]" ); }
src/options.c +4 -2
@@ -56,12 +56,14 @@ static void usage(const char *argv0, int verbose)printf ("\tv4l2 = pad, '[', v4l2-cfgs ']' ;\n" );printf ("\tv4l2-cfgs = v4l2-cfg [ ',' v4l2-cfg ] ;\n" );printf ("\tv4l2-cfg = v4l2-mbusfmt | v4l2-crop\n" ); -printf ("\t | v4l2 frame interval ;\n" ); +printf ("\t | v4l2-compose | v4l2 frame interval ;\n" );printf ("\tv4l2-mbusfmt = 'fmt:', fcc, '/', size ;\n" );printf ("\tpad = entity, ':', pad number ;\n" );printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" );printf ("\tsize = width, 'x', height ;\n" ); -printf ("\tv4l2-crop = 'crop:(', left, ',', top, ')/', size ;\n" ); +printf ("\tv4l2-crop = 'crop:', v4l2-rectangle ;\n" ); +printf ("\tv4l2-compose = 'compose:', v4l2-rectangle ;\n" ); +printf ("\tv4l2-rectangle = '(', left, ',', top, ')/', size ;\n" );printf ("\tv4l2 frame interval = '@', numerator, '/', denominator ;\n" );printf ("where the fields are\n" );printf ("\tentity number Entity numeric identifier\n" );
src/v4l2subdev.c +23 -9
@@ -325,8 +325,8 @@ static int strhazit(const char *str, const char **p)static struct media_pad *v4l2_subdev_parse_pad_format (struct media_device *media,struct v4l2_mbus_framefmt *format, -struct v4l2_rect *crop,struct v4l2_fract *interval,const char *p, -char **endp) +struct v4l2_rect *crop,struct v4l2_rect *compose, +struct v4l2_fract *interval,const char *p,char **endp) {struct media_pad *pad;char *end;
@@ -373,6 +373,15 @@ static struct media_pad *v4l2_subdev_parse_pad_format(continue ; } +if (!strhazit ("compose:" , &p)) { + ret =v4l2_subdev_parse_rectangle (compose, p, &end); +if (ret <0 ) +return NULL ; + +for (p = end;isspace (*p); p++); +continue ; + } +if (*p =='@' ) { ret =v4l2_subdev_parse_frame_interval (interval, ++p, &end);if (ret <0 )
@@ -486,30 +495,35 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,struct v4l2_mbus_framefmt format = {0 ,0 ,0 };struct media_pad *pad;struct v4l2_rect crop = {-1 ,-1 ,-1 ,-1 }; +struct v4l2_rect compose = crop;struct v4l2_fract interval = {0 ,0 };unsigned int i;char *end;int ret; - pad =v4l2_subdev_parse_pad_format (media, &format, &crop, &interval, - p, &end); + pad =v4l2_subdev_parse_pad_format (media, &format, &crop, &compose, + &interval, p, &end);if (pad ==NULL ) {media_dbg (media,"Unable to parse format\n" );return -EINVAL ; } -if (pad->flags &MEDIA_PAD_FL_SOURCE ) { - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop); +if (pad->flags &MEDIA_PAD_FL_SINK ) { + ret =set_format (pad, &format);if (ret <0 )return ret; } - ret =set_format (pad, &format); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop);if (ret <0 )return ret; -if (pad->flags &MEDIA_PAD_FL_SINK ) { - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , &compose); +if (ret <0 ) +return ret; + +if (pad->flags &MEDIA_PAD_FL_SOURCE ) { + ret =set_format (pad, &format);if (ret <0 )return ret; }
Signature · 1 line
1.7.2.5
PATCH v3 2/4 Compose rectangle support for libv4l2subdev
--- src/main.c | 14 ++++++++++++++ src/options.c | 6 ++++-- src/v4l2subdev.c | 32 +++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-)
src/main.c +14 -0
@@ -77,6 +77,20 @@ static void v4l2_subdev_print_format(struct media_entity *entity,printf ("\n\t\t crop:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS , + which); +if (ret ==0 ) +printf ("\n\t\t compose.bounds:%u,%u/%ux%u" , + rect.left, rect.top, rect.width, rect.height); + + ret =v4l2_subdev_get_selection (entity, &rect, pad, +V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , + which); +if (ret ==0 ) +printf ("\n\t\t compose:%u,%u/%ux%u" , + rect.left, rect.top, rect.width, rect.height); +printf ("]" ); }
src/options.c +4 -2
@@ -56,12 +56,14 @@ static void usage(const char *argv0, int verbose)printf ("\tv4l2 = pad, '[', v4l2-cfgs ']' ;\n" );printf ("\tv4l2-cfgs = v4l2-cfg [ ',' v4l2-cfg ] ;\n" );printf ("\tv4l2-cfg = v4l2-mbusfmt | v4l2-crop\n" ); -printf ("\t | v4l2 frame interval ;\n" ); +printf ("\t | v4l2-compose | v4l2 frame interval ;\n" );printf ("\tv4l2-mbusfmt = 'fmt:', fcc, '/', size ;\n" );printf ("\tpad = entity, ':', pad number ;\n" );printf ("\tentity = entity number | ( '\"', entity name, '\"' ) ;\n" );printf ("\tsize = width, 'x', height ;\n" ); -printf ("\tv4l2-crop = 'crop:(', left, ',', top, ')/', size ;\n" ); +printf ("\tv4l2-crop = 'crop:', v4l2-rectangle ;\n" ); +printf ("\tv4l2-compose = 'compose:', v4l2-rectangle ;\n" ); +printf ("\tv4l2-rectangle = '(', left, ',', top, ')/', size ;\n" );printf ("\tv4l2 frame interval = '@', numerator, '/', denominator ;\n" );printf ("where the fields are\n" );printf ("\tentity number Entity numeric identifier\n" );
src/v4l2subdev.c +23 -9
@@ -325,8 +325,8 @@ static int icanhasstr(const char *str, const char **p)static struct media_pad *v4l2_subdev_parse_pad_format (struct media_device *media,struct v4l2_mbus_framefmt *format, -struct v4l2_rect *crop,struct v4l2_fract *interval,const char *p, -char **endp) +struct v4l2_rect *crop,struct v4l2_rect *compose, +struct v4l2_fract *interval,const char *p,char **endp) {struct media_pad *pad;char *end;
@@ -373,6 +373,15 @@ static struct media_pad *v4l2_subdev_parse_pad_format(continue ; } +if (!icanhasstr ("compose:" , &p)) { + ret =v4l2_subdev_parse_rectangle (compose, p, &end); +if (ret <0 ) +return NULL ; + +for (p = end;isspace (*p); p++); +continue ; + } +if (*p =='@' ) { ret =v4l2_subdev_parse_frame_interval (interval, ++p, &end);if (ret <0 )
@@ -486,30 +495,35 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,struct v4l2_mbus_framefmt format = {0 ,0 ,0 };struct media_pad *pad;struct v4l2_rect crop = {-1 ,-1 ,-1 ,-1 }; +struct v4l2_rect compose = crop;struct v4l2_fract interval = {0 ,0 };unsigned int i;char *end;int ret; - pad =v4l2_subdev_parse_pad_format (media, &format, &crop, &interval, - p, &end); + pad =v4l2_subdev_parse_pad_format (media, &format, &crop, &compose, + &interval, p, &end);if (pad ==NULL ) {media_dbg (media,"Unable to parse format\n" );return -EINVAL ; } -if (pad->flags &MEDIA_PAD_FL_SOURCE ) { - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop); +if (pad->flags &MEDIA_PAD_FL_SINK ) { + ret =set_format (pad, &format);if (ret <0 )return ret; } - ret =set_format (pad, &format); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop);if (ret <0 )return ret; -if (pad->flags &MEDIA_PAD_FL_SINK ) { - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , &compose); +if (ret <0 ) +return ret; + +if (pad->flags &MEDIA_PAD_FL_SOURCE ) { + ret =set_format (pad, &format);if (ret <0 )return ret; }
Signature · 1 line
1.7.2.5
PATCH v3 3/4 Drop _ACTUAL from selection target names
In reply to Sakari Ailus--- src/main.c | 4 ++-- src/v4l2subdev.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
src/main.c +2 -2
@@ -71,7 +71,7 @@ static void v4l2_subdev_print_format(struct media_entity *entity, rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , +V4L2_SUBDEV_SEL_TGT_CROP , which);if (ret ==0 ) printf("\n\t\t crop:(%u,%u)/%ux%u", rect.left, rect.top,
@@ -85,7 +85,7 @@ static void v4l2_subdev_print_format(struct media_entity *entity, rect.left, rect.top, rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , +V4L2_SUBDEV_SEL_TGT_COMPOSE , which);if (ret ==0 ) printf("\n\t\t compose:%u,%u/%ux%u",
src/v4l2subdev.c +4 -4
@@ -128,7 +128,7 @@ int v4l2_subdev_get_selection(struct media_entity *entity, *rect = u.sel.r;return 0 ; } -if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ) +if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP )return -errno;memset (&u.crop,0 ,sizeof (u.crop));
@@ -168,7 +168,7 @@ int v4l2_subdev_set_selection(struct media_entity *entity, *rect = u.sel.r;return 0 ; } -if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ) +if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP )return -errno;memset (&u.crop,0 ,sizeof (u.crop));
@@ -514,11 +514,11 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,return ret; } - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL , &crop); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP , &crop);if (ret <0 )return ret; - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL , &compose); + ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_COMPOSE , &compose);if (ret <0 )return ret;
Signature · 1 line
1.7.2.5
PATCH v3 4/4 Replace V4L2 subdev selection targets with the V4L2 ones
In reply to Sakari AilusV4L2 selection targets will replace V4L2 subdev selection targets in the near future. As the targets are guaranteed to be the same and the chance is anticipated very soon, replace the subdev targets with more future-proof V4L2 targets.
--- src/main.c | 8 ++++---- src/v4l2subdev.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
src/main.c +4 -4
@@ -64,28 +64,28 @@ static void v4l2_subdev_print_format(struct media_entity *entity, format.width, format.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS , +V4L2_SEL_TGT_CROP_BOUNDS , which);if (ret ==0 )printf ("\n\t\t crop.bounds:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_CROP , +V4L2_SEL_TGT_CROP , which);if (ret ==0 )printf ("\n\t\t crop:(%u,%u)/%ux%u" , rect.left, rect.top, rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS , +V4L2_SEL_TGT_COMPOSE_BOUNDS , which);if (ret ==0 )printf ("\n\t\t compose.bounds:%u,%u/%ux%u" , rect.left, rect.top, rect.width, rect.height); ret =v4l2_subdev_get_selection (entity, &rect, pad, -V4L2_SUBDEV_SEL_TGT_COMPOSE , +V4L2_SEL_TGT_COMPOSE , which);if (ret ==0 ) printf("\n\t\t compose:%u,%u/%ux%u",
src/v4l2subdev.c +4 -4
@@ -128,7 +128,7 @@ int v4l2_subdev_get_selection(struct media_entity *entity, *rect = u.sel.r;return 0 ; } -if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP ) +if (errno !=ENOTTY || target !=V4L2_SEL_TGT_CROP )return -errno;memset (&u.crop,0 ,sizeof (u.crop));
@@ -168,7 +168,7 @@ int v4l2_subdev_set_selection(struct media_entity *entity, *rect = u.sel.r;return 0 ; } -if (errno !=ENOTTY || target !=V4L2_SUBDEV_SEL_TGT_CROP ) +if (errno !=ENOTTY || target !=V4L2_SEL_TGT_CROP )return -errno;memset (&u.crop,0 ,sizeof (u.crop));
@@ -514,11 +514,11 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media,return ret; } - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_CROP , &crop); + ret =set_selection (pad,V4L2_SEL_TGT_CROP , &crop);if (ret <0 )return ret; - ret =set_selection (pad,V4L2_SUBDEV_SEL_TGT_COMPOSE , &compose); + ret =set_selection (pad,V4L2_SEL_TGT_COMPOSE , &compose);if (ret <0 )return ret;
Signature · 1 line
1.7.2.5
Hi Sakari,
Thanks for the patches.
Quoted 10 lines · On Wednesday 23 May 2012 01:30:46 Sakari Ailus wrote:
Hi Laurent,
Update: since v2:
- Use parenthesis in crop display
I've updated the two first patches from the previous set as discussed. There are two new that change the selection target names to correspond the latest developments.
Applied with some small modifications. I've pushed the first two patches to the repository and queued the last two. I will push them when the kernel changes they depend on reach upstream.
Signature · 3 lines
Regards, Laurent Pinchart