Re: [PATCH/RFC v2 1/4] Add a media device configuration file parser.
Hi Sakari, On 10/20/2014 11:44 PM, Sakari Ailus wrote: Hi Jacek, On Fri, Oct 17, 2014 at 04:54:39PM +0200, Jacek Anaszewski wrote: This patch adds a parser for a media device configuration file. The parser expects the configuration file containing links end v4l2-controls definitions as described in the header file being added. The links describe connections between media entities and v4l2-controls define the target sub-devices for particular user controls related ioctl calls. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Mauro Carvalho Chehab mche...@osg.samsung.com Cc: Hans Verkuil hans.verk...@cisco.com --- lib/include/libv4l2-media-conf-parser.h | 148 +++ lib/libv4l2/libv4l2-media-conf-parser.c | 441 +++ 2 files changed, 589 insertions(+) create mode 100644 lib/include/libv4l2-media-conf-parser.h create mode 100644 lib/libv4l2/libv4l2-media-conf-parser.c diff --git a/lib/include/libv4l2-media-conf-parser.h b/lib/include/libv4l2-media-conf-parser.h new file mode 100644 index 000..b2dba3a --- /dev/null +++ b/lib/include/libv4l2-media-conf-parser.h @@ -0,0 +1,148 @@ +/* + * Parser of media device configuration file. + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Author: Jacek Anaszewski j.anaszew...@samsung.com + * + * The configuration file has to comply with following format: + * + * Link description entry format: + * + * link { + * TABsource_entity: entity_nameLF + * TABsource_pad: pad_idLF + * TABsink_entity: entity_nameLF + * TABsink_pad: pad_idLF + * } Could you use the existing libmediactl format? The parser exists as well. Of course, I will switch to using it. As a matter of fact, I have a few patches to make it easier to user in a library. libmediactl appears to be located under utils/media-ctl. Perhaps it's be better placed under lib. Cc Laurent. + * The V4L2 control group format: + * + * v4l2-controls { + * TABcontrol1_name: entity_nameLF + * TABcontrol2_name: entity_nameLF + * ... + * TABcontrolN_name: entity_nameLF + * } I didn't know you were working on this. Actually I did the main part of work around 1,5 year ago as a part of familiarizing myself with V4L2 media controller API. I have a small library which does essentially the same. The implementation is incomplete, that's why I hadn't posted it to the list. We could perhaps discuss this a little bit tomorrow. When would you be available, in case you are? I will be available around 8 hours from now on. What would you think of using a little bit more condensed format for this, similar to that of libmediactl? Could you spot a place where the format is defined? Best Regards, Jacek Anaszewski -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v2 1/4] Add a media device configuration file parser.
Hi Jacek, On Tue, Oct 21, 2014 at 09:17:00AM +0200, Jacek Anaszewski wrote: ... + * The V4L2 control group format: + * + * v4l2-controls { + * TABcontrol1_name: entity_nameLF + * TABcontrol2_name: entity_nameLF + * ... + * TABcontrolN_name: entity_nameLF + * } I didn't know you were working on this. Actually I did the main part of work around 1,5 year ago as a part of familiarizing myself with V4L2 media controller API. :-D I think it's about time we get things like this to libv4l. I have a small library which does essentially the same. The implementation is incomplete, that's why I hadn't posted it to the list. We could perhaps discuss this a little bit tomorrow. When would you be available, in case you are? I will be available around 8 hours from now on. I couldn't see you on #v4l, would an hour from now (13:30 Finnish time) be ok for you? What would you think of using a little bit more condensed format for this, similar to that of libmediactl? Could you spot a place where the format is defined? At the moment there's none, but I thought of a similar format used by libmediactl. -- Cheers, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v2 1/4] Add a media device configuration file parser.
Hi Sakari, On 10/21/2014 11:26 AM, Sakari Ailus wrote: Hi Jacek, On Tue, Oct 21, 2014 at 09:17:00AM +0200, Jacek Anaszewski wrote: ... + * The V4L2 control group format: + * + * v4l2-controls { + * TABcontrol1_name: entity_nameLF + * TABcontrol2_name: entity_nameLF + * ... + * TABcontrolN_name: entity_nameLF + * } I didn't know you were working on this. Actually I did the main part of work around 1,5 year ago as a part of familiarizing myself with V4L2 media controller API. :-D I think it's about time we get things like this to libv4l. Definitely :) I have a small library which does essentially the same. The implementation is incomplete, that's why I hadn't posted it to the list. We could perhaps discuss this a little bit tomorrow. When would you be available, in case you are? I will be available around 8 hours from now on. I couldn't see you on #v4l, would an hour from now (13:30 Finnish time) be ok for you? What about 14:00 Finnish time? What would you think of using a little bit more condensed format for this, similar to that of libmediactl? Could you spot a place where the format is defined? At the moment there's none, but I thought of a similar format used by libmediactl. OK, to be discussed. Best Regards, Jacek Anaszewski -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v2 1/4] Add a media device configuration file parser.
Hi Jacek, On Fri, Oct 17, 2014 at 04:54:39PM +0200, Jacek Anaszewski wrote: This patch adds a parser for a media device configuration file. The parser expects the configuration file containing links end v4l2-controls definitions as described in the header file being added. The links describe connections between media entities and v4l2-controls define the target sub-devices for particular user controls related ioctl calls. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Mauro Carvalho Chehab mche...@osg.samsung.com Cc: Hans Verkuil hans.verk...@cisco.com --- lib/include/libv4l2-media-conf-parser.h | 148 +++ lib/libv4l2/libv4l2-media-conf-parser.c | 441 +++ 2 files changed, 589 insertions(+) create mode 100644 lib/include/libv4l2-media-conf-parser.h create mode 100644 lib/libv4l2/libv4l2-media-conf-parser.c diff --git a/lib/include/libv4l2-media-conf-parser.h b/lib/include/libv4l2-media-conf-parser.h new file mode 100644 index 000..b2dba3a --- /dev/null +++ b/lib/include/libv4l2-media-conf-parser.h @@ -0,0 +1,148 @@ +/* + * Parser of media device configuration file. + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Author: Jacek Anaszewski j.anaszew...@samsung.com + * + * The configuration file has to comply with following format: + * + * Link description entry format: + * + * link { + * TABsource_entity: entity_nameLF + * TABsource_pad: pad_idLF + * TABsink_entity: entity_nameLF + * TABsink_pad: pad_idLF + * } Could you use the existing libmediactl format? The parser exists as well. As a matter of fact, I have a few patches to make it easier to user in a library. libmediactl appears to be located under utils/media-ctl. Perhaps it's be better placed under lib. Cc Laurent. + * The V4L2 control group format: + * + * v4l2-controls { + * TABcontrol1_name: entity_nameLF + * TABcontrol2_name: entity_nameLF + * ... + * TABcontrolN_name: entity_nameLF + * } I didn't know you were working on this. I have a small library which does essentially the same. The implementation is incomplete, that's why I hadn't posted it to the list. We could perhaps discuss this a little bit tomorrow. When would you be available, in case you are? What would you think of using a little bit more condensed format for this, similar to that of libmediactl? -- Kind regards, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC v2 1/4] Add a media device configuration file parser.
This patch adds a parser for a media device configuration file. The parser expects the configuration file containing links end v4l2-controls definitions as described in the header file being added. The links describe connections between media entities and v4l2-controls define the target sub-devices for particular user controls related ioctl calls. Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Mauro Carvalho Chehab mche...@osg.samsung.com Cc: Hans Verkuil hans.verk...@cisco.com --- lib/include/libv4l2-media-conf-parser.h | 148 +++ lib/libv4l2/libv4l2-media-conf-parser.c | 441 +++ 2 files changed, 589 insertions(+) create mode 100644 lib/include/libv4l2-media-conf-parser.h create mode 100644 lib/libv4l2/libv4l2-media-conf-parser.c diff --git a/lib/include/libv4l2-media-conf-parser.h b/lib/include/libv4l2-media-conf-parser.h new file mode 100644 index 000..b2dba3a --- /dev/null +++ b/lib/include/libv4l2-media-conf-parser.h @@ -0,0 +1,148 @@ +/* + * Parser of media device configuration file. + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Author: Jacek Anaszewski j.anaszew...@samsung.com + * + * The configuration file has to comply with following format: + * + * Link description entry format: + * + * link { + * TABsource_entity: entity_nameLF + * TABsource_pad: pad_idLF + * TABsink_entity: entity_nameLF + * TABsink_pad: pad_idLF + * } + * + * The V4L2 control group format: + * + * v4l2-controls { + * TABcontrol1_name: entity_nameLF + * TABcontrol2_name: entity_nameLF + * ... + * TABcontrolN_name: entity_nameLF + * } + * + * Example: + * + * link { + * source_entity: s5p-mipi-csis.0 + * source_pad: 1 + * sink_entity: FIMC.0 + * sink_pad: 0 + * } + * + * v4l2-controls { + * Color Effects: S5C73M3 + * Saturation: S5C73M3 + * } + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + */ + +#ifndef __LIBV4L_MEDIA_CONF_PARSER_H +#define __LIBV4L_MEDIA_CONF_PARSER_H + +#include libv4l2.h + +#ifdef DEBUG +#define V4L2_MDCFG_PARSER_DBG(format, ARG...)\ + printf([%s:%d] [%s] format \n, __FILE__, __LINE__, __func__, ##ARG) +#else +#define V4L2_MDCFG_PARSER_DBG(format, ARG...) +#endif + +#define V4L2_MDCFG_PARSER_ERR(format, ARG...)\ + fprintf(stderr, Libv4l device config parser: format \n, ##ARG) + +#define V4L2_MDCFG_PARSER_LOG(format, ARG...)\ + fprintf(stdout, Libv4l device config parser: format \n, ##ARG) + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* + * struct libv4l2_media_link_conf - media entity link configuration + * @source_entity: source entity of the link + * @source_pad:source pad id + * @sink_entity: sink entity of the link + * @sink_pad: sink pad id + * @next: pointer to the next data structure in the list + */ +struct libv4l2_media_link_conf { + char *source_entity; + int source_pad; + char *sink_entity; + int sink_pad; + struct libv4l2_media_link_conf *next; +}; + +/* + * struct libv4l2_media_ctrl_conf - user control to media entity configuration + * @control_name: user control name + * @entity_name: media entity name + * @entity:media entity matched by entity_name + * @cid: user control id + * @next: pointer to the next data structure in the list + */ +struct libv4l2_media_ctrl_conf { + char *control_name; + char *entity_name; + struct media_entity *entity; + int cid; + struct libv4l2_media_ctrl_conf *next; +}; + +/* + * struct libv4l2_media_device_conf - media device config + * @links: media entity link config + * @controls: user control to media entity config + */ +struct libv4l2_media_device_conf { + struct libv4l2_media_link_conf *links; + struct libv4l2_media_ctrl_conf *controls; +}; + +/* + * struct libv4l2_conf_parser_ctx - parser context + * @line_start_pos:start position of the current line in the file buffer + * @line_end: end position of the current line in the file buffer + * @buf_pos: file buffer position of the currently analyzed character + * @buf: config file buffer + * @buf_size: number of characters in the file buffer + */ +struct libv4l2_conf_parser_ctx { + int line_start_pos; + int line_end_pos; + int buf_pos; + char *buf;