linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [v4l-utils PATCH v1.1 2/2] mediactl: Separate entity and pad parsing
Date: Wed, 25 May 2016 01:38:22 +0300	[thread overview]
Message-ID: <6283972.6M3G8a2Qjm@avalon> (raw)
In-Reply-To: <1464123393-14336-1-git-send-email-sakari.ailus@linux.intel.com>

Hi Sakari,

Thank you for the patch.

On Tuesday 24 May 2016 23:56:33 Sakari Ailus wrote:
> Sometimes it's useful to be able to parse the entity independent of the pad.
> Separate entity parsing into media_parse_entity().
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/media-ctl/libmediactl.c | 29 +++++++++++++++++++++++++----
>  utils/media-ctl/mediactl.h    | 14 ++++++++++++++
>  2 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
> index 78caa7c..498dfd1 100644
> --- a/utils/media-ctl/libmediactl.c
> +++ b/utils/media-ctl/libmediactl.c
> @@ -781,10 +781,10 @@ int media_device_add_entity(struct media_device
> *media, return 0;
>  }
> 
> -struct media_pad *media_parse_pad(struct media_device *media,
> -				  const char *p, char **endp)
> +struct media_entity *media_parse_entity(struct media_device *media,
> +					const char *p, char **endp)
>  {
> -	unsigned int entity_id, pad;
> +	unsigned int entity_id;
>  	struct media_entity *entity;
>  	char *end;
> 
> @@ -827,7 +827,28 @@ struct media_pad *media_parse_pad(struct media_device
> *media, return NULL;
>  		}
>  	}
> -	for (; isspace(*end); ++end);
> +	for (p = end; isspace(*p); ++p);
> +
> +	*endp = (char *)p;
> +
> +	return entity;
> +}
> +
> +struct media_pad *media_parse_pad(struct media_device *media,
> +				  const char *p, char **endp)
> +{
> +	unsigned int pad;
> +	struct media_entity *entity;
> +	char *end;
> +
> +	if (endp == NULL)
> +		endp = &end;
> +
> +	entity = media_parse_entity(media, p, &end);
> +	if (!entity) {
> +		*endp = end;
> +		return NULL;
> +	}
> 
>  	if (*end != ':') {
>  		media_dbg(media, "Expected ':'\n", *end);
> diff --git a/utils/media-ctl/mediactl.h b/utils/media-ctl/mediactl.h
> index b5a92f5..af36051 100644
> --- a/utils/media-ctl/mediactl.h
> +++ b/utils/media-ctl/mediactl.h
> @@ -367,6 +367,20 @@ int media_setup_link(struct media_device *media,
>  int media_reset_links(struct media_device *media);
> 
>  /**
> + * @brief Parse string to an entity on the media device.
> + * @param media - media device.
> + * @param p - input string
> + * @param endp - pointer to string where parsing ended
> + *
> + * Parse NULL terminated string describing an entity and return its
> + * struct media_entity instance.
> + *
> + * @return Pointer to struct media_entity on success, NULL on failure.
> + */
> +struct media_entity *media_parse_entity(struct media_device *media,
> +					const char *p, char **endp);
> +
> +/**
>   * @brief Parse string to a pad on the media device.
>   * @param media - media device.
>   * @param p - input string

-- 
Regards,

Laurent Pinchart


      reply	other threads:[~2016-05-24 22:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 12:48 [v4l-utils PATCH 0/2] Prepare for mediatext library, cleanups Sakari Ailus
2016-05-24 12:48 ` [v4l-utils PATCH 1/2] libmediactl: Drop length argument from media_get_entity_by_name() Sakari Ailus
2016-05-24 17:09   ` Laurent Pinchart
2016-05-24 20:50     ` Sakari Ailus
2016-05-26 12:07       ` Laurent Pinchart
2016-05-26 12:28         ` Sakari Ailus
2016-05-24 12:48 ` [v4l-utils PATCH 2/2] mediactl: Separate entity and pad parsing Sakari Ailus
2016-05-24 17:14   ` Laurent Pinchart
2016-05-24 20:54     ` Sakari Ailus
2016-05-24 20:56     ` [v4l-utils PATCH v1.1 " Sakari Ailus
2016-05-24 22:38       ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6283972.6M3G8a2Qjm@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).