public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH v2 4/4] media-ctl: add colorimetry support
Date: Mon, 13 Feb 2017 10:49:42 +0100	[thread overview]
Message-ID: <1486979382.2873.31.camel@pengutronix.de> (raw)
In-Reply-To: <1958d6aa-b5ba-9e8f-aa34-d08a54843c47@xs4all.nl>

On Mon, 2017-02-13 at 10:40 +0100, Hans Verkuil wrote:
> On 02/13/2017 10:33 AM, Philipp Zabel wrote:
> > media-ctl can be used to propagate v4l2 subdevice pad formats from
> > source pads of one subdevice to another one's sink pads. These formats
> > include colorimetry information, so media-ctl should be able to print
> > or change it using the --set/get-v4l2 option.
> > 
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Just one small comment:
> 
> > ---
> >  utils/media-ctl/libv4l2subdev.c | 263 ++++++++++++++++++++++++++++++++++++++++
> >  utils/media-ctl/media-ctl.c     |  17 +++
> >  utils/media-ctl/options.c       |  22 +++-
> >  utils/media-ctl/v4l2subdev.h    |  80 ++++++++++++
> >  4 files changed, 381 insertions(+), 1 deletion(-)
> > 
> > diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
> > index 7f9ef48..c918777 100644
> > --- a/utils/media-ctl/libv4l2subdev.c
> > +++ b/utils/media-ctl/libv4l2subdev.c
> > @@ -511,6 +511,118 @@ static struct media_pad *v4l2_subdev_parse_pad_format(
> >  			continue;
> >  		}
> >  
> > +		if (strhazit("colorspace:", &p)) {
> > +			enum v4l2_colorspace colorspace;
> > +			char *strfield;
> > +
> > +			for (end = (char *)p; isalnum(*end) || *end == '-';
> > +			     ++end);
> > +
> > +			strfield = strndup(p, end - p);
> > +			if (!strfield) {
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			colorspace = v4l2_subdev_string_to_colorspace(strfield);
> > +			free(strfield);
> > +			if (colorspace == (enum v4l2_colorspace)-1) {
> > +				media_dbg(media, "Invalid colorspace value '%*s'\n",
> > +					  end - p, p);
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			format->colorspace = colorspace;
> > +
> > +			p = end;
> > +			continue;
> > +		}
> > +
> > +		if (strhazit("xfer:", &p)) {
> > +			enum v4l2_xfer_func xfer_func;
> > +			char *strfield;
> > +
> > +			for (end = (char *)p; isalnum(*end) || *end == '-';
> > +			     ++end);
> > +
> > +			strfield = strndup(p, end - p);
> > +			if (!strfield) {
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			xfer_func = v4l2_subdev_string_to_xfer_func(strfield);
> > +			free(strfield);
> > +			if (xfer_func == (enum v4l2_xfer_func)-1) {
> > +				media_dbg(media, "Invalid transfer function value '%*s'\n",
> > +					  end - p, p);
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			format->xfer_func = xfer_func;
> > +
> > +			p = end;
> > +			continue;
> > +		}
> > +
> > +		if (strhazit("ycbcr:", &p)) {
> > +			enum v4l2_ycbcr_encoding ycbcr_enc;
> > +			char *strfield;
> > +
> > +			for (end = (char *)p; isalnum(*end) || *end == '-';
> > +			     ++end);
> > +
> > +			strfield = strndup(p, end - p);
> > +			if (!strfield) {
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			ycbcr_enc = v4l2_subdev_string_to_ycbcr_encoding(strfield);
> > +			free(strfield);
> > +			if (ycbcr_enc == (enum v4l2_ycbcr_encoding)-1) {
> > +				media_dbg(media, "Invalid YCbCr encoding value '%*s'\n",
> > +					  end - p, p);
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			format->ycbcr_enc = ycbcr_enc;
> > +
> > +			p = end;
> > +			continue;
> > +		}
> > +
> > +		if (strhazit("quantization:", &p)) {
> > +			enum v4l2_quantization quantization;
> > +			char *strfield;
> > +
> > +			for (end = (char *)p; isalnum(*end) || *end == '-';
> > +			     ++end);
> > +
> > +			strfield = strndup(p, end - p);
> > +			if (!strfield) {
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			quantization = v4l2_subdev_string_to_quantization(strfield);
> > +			free(strfield);
> > +			if (quantization == (enum v4l2_quantization)-1) {
> > +				media_dbg(media, "Invalid quantization value '%*s'\n",
> > +					  end - p, p);
> > +				*endp = (char *)p;
> > +				return NULL;
> > +			}
> > +
> > +			format->quantization = quantization;
> > +
> > +			p = end;
> > +			continue;
> > +		}
> > +
> >  		/*
> >  		 * Backward compatibility: crop rectangles can be specified
> >  		 * implicitly without the 'crop:' property name.
> > @@ -839,6 +951,157 @@ enum v4l2_field v4l2_subdev_string_to_field(const char *string)
> >  	return (enum v4l2_field)-1;
> >  }
> >  
> > +static struct {
> > +	const char *name;
> > +	enum v4l2_colorspace colorspace;
> > +} colorspaces[] = {
> > +	{ "default", V4L2_COLORSPACE_DEFAULT },
> > +	{ "smpte170m", V4L2_COLORSPACE_SMPTE170M },
> > +	{ "smpte240m", V4L2_COLORSPACE_SMPTE240M },
> > +	{ "rec709", V4L2_COLORSPACE_REC709 },
> > +	{ "bt878", V4L2_COLORSPACE_BT878 },
> 
> Drop this, it's no longer used in the kernel.

Done, thanks.

regards
Philipp

      parent reply	other threads:[~2017-02-13  9:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13  9:33 [PATCH v2 1/4] media-ctl: add pad support to set/get_frame_interval Philipp Zabel
2017-02-13  9:33 ` [PATCH v2 2/4] media-ctl: print the configured frame interval Philipp Zabel
2017-02-13  9:33 ` [PATCH v2 3/4] media-ctl: propagate " Philipp Zabel
2017-02-13  9:33 ` [PATCH v2 4/4] media-ctl: add colorimetry support Philipp Zabel
2017-02-13  9:40   ` Hans Verkuil
2017-02-13  9:48     ` Sakari Ailus
2017-02-13  9:58       ` Hans Verkuil
2017-02-13 10:02       ` Philipp Zabel
2017-02-13 10:05         ` Sakari Ailus
2017-02-13 10:06         ` Hans Verkuil
2017-02-13  9:49     ` Philipp Zabel [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=1486979382.2873.31.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=slongerbeam@gmail.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