libcamera: v4l2_videodevice: Expose setSelection()
Expose V4L2Videodevice::setSelection() method and drop V4L2Videodevice::setCrop() and V4L2Videodevice::setComopse() as wrapping each target with a single function does not provide any benefit. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
e8d4797ef5
commit
b8728b76a6
2 changed files with 7 additions and 21 deletions
|
@ -211,8 +211,7 @@ public:
|
||||||
int setFormat(V4L2DeviceFormat *format);
|
int setFormat(V4L2DeviceFormat *format);
|
||||||
std::map<V4L2PixelFormat, std::vector<SizeRange>> formats();
|
std::map<V4L2PixelFormat, std::vector<SizeRange>> formats();
|
||||||
|
|
||||||
int setCrop(Rectangle *rect);
|
int setSelection(unsigned int target, Rectangle *rect);
|
||||||
int setCompose(Rectangle *rect);
|
|
||||||
|
|
||||||
int allocateBuffers(unsigned int count,
|
int allocateBuffers(unsigned int count,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
||||||
|
@ -254,8 +253,6 @@ private:
|
||||||
std::vector<V4L2PixelFormat> enumPixelformats();
|
std::vector<V4L2PixelFormat> enumPixelformats();
|
||||||
std::vector<SizeRange> enumSizes(V4L2PixelFormat pixelFormat);
|
std::vector<SizeRange> enumSizes(V4L2PixelFormat pixelFormat);
|
||||||
|
|
||||||
int setSelection(unsigned int target, Rectangle *rect);
|
|
||||||
|
|
||||||
int requestBuffers(unsigned int count, enum v4l2_memory memoryType);
|
int requestBuffers(unsigned int count, enum v4l2_memory memoryType);
|
||||||
int createBuffers(unsigned int count,
|
int createBuffers(unsigned int count,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
||||||
|
|
|
@ -1108,25 +1108,14 @@ std::vector<SizeRange> V4L2VideoDevice::enumSizes(V4L2PixelFormat pixelFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set a crop rectangle on the V4L2 video device node
|
* \brief Set a selection rectangle \a rect for \a target
|
||||||
* \param[inout] rect The rectangle describing the crop target area
|
* \param[in] target The selection target defined by the V4L2_SEL_TGT_* flags
|
||||||
|
* \param[inout] rect The selection rectangle to be applied
|
||||||
|
*
|
||||||
|
* \todo Define a V4L2SelectionTarget enum for the selection target
|
||||||
|
*
|
||||||
* \return 0 on success or a negative error code otherwise
|
* \return 0 on success or a negative error code otherwise
|
||||||
*/
|
*/
|
||||||
int V4L2VideoDevice::setCrop(Rectangle *rect)
|
|
||||||
{
|
|
||||||
return setSelection(V4L2_SEL_TGT_CROP, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Set a compose rectangle on the V4L2 video device node
|
|
||||||
* \param[inout] rect The rectangle describing the compose target area
|
|
||||||
* \return 0 on success or a negative error code otherwise
|
|
||||||
*/
|
|
||||||
int V4L2VideoDevice::setCompose(Rectangle *rect)
|
|
||||||
{
|
|
||||||
return setSelection(V4L2_SEL_TGT_COMPOSE, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
int V4L2VideoDevice::setSelection(unsigned int target, Rectangle *rect)
|
int V4L2VideoDevice::setSelection(unsigned int target, Rectangle *rect)
|
||||||
{
|
{
|
||||||
struct v4l2_selection sel = {};
|
struct v4l2_selection sel = {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue