Message ID | 20190613074955.14512-2-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thank you for the patch. On Thu, Jun 13, 2019 at 09:49:54AM +0200, Jacopo Mondi wrote: > In preparation of creating a new V4L2Device base class, rename > V4L2Device to V4L2VideoDevice. > > This is a project wide rename without any intended functional change. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > include/libcamera/buffer.h | 2 +- > .../{v4l2_device.h => v4l2_videodevice.h} | 24 ++--- > src/libcamera/meson.build | 4 +- > src/libcamera/pipeline/ipu3/ipu3.cpp | 24 ++--- > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +- > src/libcamera/pipeline/uvcvideo.cpp | 6 +- > src/libcamera/pipeline/vimc.cpp | 6 +- > src/libcamera/v4l2_subdevice.cpp | 2 +- > .../{v4l2_device.cpp => v4l2_videodevice.cpp} | 101 +++++++++--------- > test/meson.build | 2 +- > .../buffer_sharing.cpp | 18 ++-- > .../capture_async.cpp | 6 +- > .../double_open.cpp | 8 +- > .../formats.cpp | 8 +- > .../meson.build | 8 +- > .../request_buffers.cpp | 6 +- > .../stream_on_off.cpp | 6 +- > .../v4l2_videodevice_test.cpp} | 8 +- > .../v4l2_videodevice_test.h} | 8 +- > 19 files changed, 127 insertions(+), 126 deletions(-) > rename src/libcamera/include/{v4l2_device.h => v4l2_videodevice.h} (86%) > rename src/libcamera/{v4l2_device.cpp => v4l2_videodevice.cpp} (90%) > rename test/{v4l2_device => v4l2_videodevice}/buffer_sharing.cpp (90%) > rename test/{v4l2_device => v4l2_videodevice}/capture_async.cpp (91%) > rename test/{v4l2_device => v4l2_videodevice}/double_open.cpp (75%) > rename test/{v4l2_device => v4l2_videodevice}/formats.cpp (85%) > rename test/{v4l2_device => v4l2_videodevice}/meson.build (74%) > rename test/{v4l2_device => v4l2_videodevice}/request_buffers.cpp (77%) > rename test/{v4l2_device => v4l2_videodevice}/stream_on_off.cpp (78%) > rename test/{v4l2_device/v4l2_device_test.cpp => v4l2_videodevice/v4l2_videodevice_test.cpp} (90%) > rename test/{v4l2_device/v4l2_device_test.h => v4l2_videodevice/v4l2_videodevice_test.h} (81%) > > diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h > index 8f9b42e39339..260a62e9e77e 100644 > --- a/include/libcamera/buffer.h > +++ b/include/libcamera/buffer.h > @@ -59,7 +59,7 @@ private: > friend class BufferPool; > friend class PipelineHandler; > friend class Request; > - friend class V4L2Device; > + friend class V4L2VideoDevice; > > void cancel(); > > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_videodevice.h > similarity index 86% > rename from src/libcamera/include/v4l2_device.h > rename to src/libcamera/include/v4l2_videodevice.h > index bdecc087fe5a..6ecdb64e5f3c 100644 > --- a/src/libcamera/include/v4l2_device.h > +++ b/src/libcamera/include/v4l2_videodevice.h > @@ -2,10 +2,10 @@ > /* > * Copyright (C) 2019, Google Inc. > * > - * v4l2_device.h - V4L2 Device > + * v4l2_videodevice.h - V4L2 Video Device > */ > -#ifndef __LIBCAMERA_V4L2_DEVICE_H__ > -#define __LIBCAMERA_V4L2_DEVICE_H__ > +#ifndef __LIBCAMERA_V4L2_VIDEODEVICE_H__ > +#define __LIBCAMERA_V4L2_VIDEODEVICE_H__ > > #include <atomic> > #include <string> > @@ -111,15 +111,15 @@ public: > const std::string toString() const; > }; > > -class V4L2Device : protected Loggable > +class V4L2VideoDevice : protected Loggable > { > public: > - explicit V4L2Device(const std::string &deviceNode); > - explicit V4L2Device(const MediaEntity *entity); > - V4L2Device(const V4L2Device &) = delete; > - ~V4L2Device(); > + explicit V4L2VideoDevice(const std::string &deviceNode); > + explicit V4L2VideoDevice(const MediaEntity *entity); > + V4L2VideoDevice(const V4L2VideoDevice &) = delete; > + ~V4L2VideoDevice(); > > - V4L2Device &operator=(const V4L2Device &) = delete; > + V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete; > > int open(); > bool isOpen() const; > @@ -143,8 +143,8 @@ public: > int streamOn(); > int streamOff(); > > - static V4L2Device *fromEntityName(const MediaDevice *media, > - const std::string &entity); > + static V4L2VideoDevice *fromEntityName(const MediaDevice *media, > + const std::string &entity); > > protected: > std::string logPrefix() const; > @@ -181,4 +181,4 @@ private: > > } /* namespace libcamera */ > > -#endif /* __LIBCAMERA_V4L2_DEVICE_H__ */ > +#endif /* __LIBCAMERA_V4L2_VIDEODEVICE_H__ */ > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > index 1ca1083cf5c7..15ab53b1abbe 100644 > --- a/src/libcamera/meson.build > +++ b/src/libcamera/meson.build > @@ -23,8 +23,8 @@ libcamera_sources = files([ > 'stream.cpp', > 'timer.cpp', > 'utils.cpp', > - 'v4l2_device.cpp', > 'v4l2_subdevice.cpp', > + 'v4l2_videodevice.cpp', > ]) > > libcamera_headers = files([ > @@ -41,8 +41,8 @@ libcamera_headers = files([ > 'include/media_object.h', > 'include/pipeline_handler.h', > 'include/utils.h', > - 'include/v4l2_device.h', > 'include/v4l2_subdevice.h', > + 'include/v4l2_videodevice.h', > ]) > > libcamera_internal_includes = include_directories('include') > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > index f2bdecbac20f..1c0a9825b4cd 100644 > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > @@ -22,8 +22,8 @@ > #include "media_device.h" > #include "pipeline_handler.h" > #include "utils.h" > -#include "v4l2_device.h" > #include "v4l2_subdevice.h" > +#include "v4l2_videodevice.h" > > namespace libcamera { > > @@ -39,7 +39,7 @@ public: > > /* ImgU output descriptor: group data specific to an ImgU output. */ > struct ImgUOutput { > - V4L2Device *dev; > + V4L2VideoDevice *dev; > unsigned int pad; > std::string name; > BufferPool *pool; > @@ -85,7 +85,7 @@ public: > MediaDevice *media_; > > V4L2Subdevice *imgu_; > - V4L2Device *input_; > + V4L2VideoDevice *input_; > ImgUOutput output_; > ImgUOutput viewfinder_; > ImgUOutput stat_; > @@ -125,7 +125,7 @@ public: > > static int mediaBusToFormat(unsigned int code); > > - V4L2Device *output_; > + V4L2VideoDevice *output_; > V4L2Subdevice *csi2_; > CameraSensor *sensor_; > > @@ -943,7 +943,7 @@ void IPU3CameraData::cio2BufferReady(Buffer *buffer) > * Create and open the V4L2 devices and subdevices of the ImgU instance > * with \a index. > * > - * In case of errors the created V4L2Device and V4L2Subdevice instances > + * In case of errors the created V4L2VideoDevice and V4L2Subdevice instances > * are destroyed at pipeline handler delete time. > * > * \return 0 on success or a negative error code otherwise > @@ -966,12 +966,12 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > if (ret) > return ret; > > - input_ = V4L2Device::fromEntityName(media, name_ + " input"); > + input_ = V4L2VideoDevice::fromEntityName(media, name_ + " input"); > ret = input_->open(); > if (ret) > return ret; > > - output_.dev = V4L2Device::fromEntityName(media, name_ + " output"); > + output_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " output"); > ret = output_.dev->open(); > if (ret) > return ret; > @@ -980,8 +980,8 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > output_.name = "output"; > output_.pool = &outPool_; > > - viewfinder_.dev = V4L2Device::fromEntityName(media, > - name_ + " viewfinder"); > + viewfinder_.dev = V4L2VideoDevice::fromEntityName(media, > + name_ + " viewfinder"); > ret = viewfinder_.dev->open(); > if (ret) > return ret; > @@ -990,7 +990,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > viewfinder_.name = "viewfinder"; > viewfinder_.pool = &vfPool_; > > - stat_.dev = V4L2Device::fromEntityName(media, name_ + " 3a stat"); > + stat_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " 3a stat"); > ret = stat_.dev->open(); > if (ret) > return ret; > @@ -1067,7 +1067,7 @@ int ImgUDevice::configureInput(const Size &size, > int ImgUDevice::configureOutput(ImgUOutput *output, > const StreamConfiguration &cfg) > { > - V4L2Device *dev = output->dev; > + V4L2VideoDevice *dev = output->dev; > unsigned int pad = output->pad; > > V4L2SubdeviceFormat imguFormat = {}; > @@ -1337,7 +1337,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) > return ret; > > std::string cio2Name = "ipu3-cio2 " + std::to_string(index); > - output_ = V4L2Device::fromEntityName(media, cio2Name); > + output_ = V4L2VideoDevice::fromEntityName(media, cio2Name); > ret = output_->open(); > if (ret) > return ret; > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > index 9b3eea2f6dd3..4a5898d25f91 100644 > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > @@ -23,8 +23,8 @@ > #include "media_device.h" > #include "pipeline_handler.h" > #include "utils.h" > -#include "v4l2_device.h" > #include "v4l2_subdevice.h" > +#include "v4l2_videodevice.h" > > namespace libcamera { > > @@ -106,7 +106,7 @@ private: > MediaDevice *media_; > V4L2Subdevice *dphy_; > V4L2Subdevice *isp_; > - V4L2Device *video_; > + V4L2VideoDevice *video_; > > Camera *activeCamera_; > }; > @@ -458,7 +458,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) > return false; > > /* Locate and open the capture video node. */ > - video_ = V4L2Device::fromEntityName(media_, "rkisp1_mainpath"); > + video_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_mainpath"); > if (video_->open() < 0) > return false; > > diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp > index 45260f34c8f5..b0d768628a19 100644 > --- a/src/libcamera/pipeline/uvcvideo.cpp > +++ b/src/libcamera/pipeline/uvcvideo.cpp > @@ -14,7 +14,7 @@ > #include "media_device.h" > #include "pipeline_handler.h" > #include "utils.h" > -#include "v4l2_device.h" > +#include "v4l2_videodevice.h" > > namespace libcamera { > > @@ -35,7 +35,7 @@ public: > > void bufferReady(Buffer *buffer); > > - V4L2Device *video_; > + V4L2VideoDevice *video_; > Stream stream_; > }; > > @@ -229,7 +229,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > /* Locate and open the default video node. */ > for (MediaEntity *entity : media->entities()) { > if (entity->flags() & MEDIA_ENT_FL_DEFAULT) { > - data->video_ = new V4L2Device(entity); > + data->video_ = new V4L2VideoDevice(entity); > break; > } > } > diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp > index ad4577acd9d6..6833213650dc 100644 > --- a/src/libcamera/pipeline/vimc.cpp > +++ b/src/libcamera/pipeline/vimc.cpp > @@ -20,7 +20,7 @@ > #include "media_device.h" > #include "pipeline_handler.h" > #include "utils.h" > -#include "v4l2_device.h" > +#include "v4l2_videodevice.h" > > namespace libcamera { > > @@ -41,7 +41,7 @@ public: > > void bufferReady(Buffer *buffer); > > - V4L2Device *video_; > + V4L2VideoDevice *video_; > Stream stream_; > }; > > @@ -262,7 +262,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) > std::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this); > > /* Locate and open the capture video node. */ > - data->video_ = new V4L2Device(media->getEntityByName("Raw Capture 1")); > + data->video_ = new V4L2VideoDevice(media->getEntityByName("Raw Capture 1")); > if (data->video_->open()) > return false; > > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp > index fceee33156e9..6681c1920065 100644 > --- a/src/libcamera/v4l2_subdevice.cpp > +++ b/src/libcamera/v4l2_subdevice.cpp > @@ -44,7 +44,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev) > * as the "media bus format", and it is identified by a resolution and a pixel > * format identification code, known as the "media bus code", not to be confused > * with the fourcc code that identify the format of images when stored in memory > - * (see V4L2Device::V4L2DeviceFormat). > + * (see V4L2VideoDevice::V4L2DeviceFormat). I wonder if we should rename V4L2DeviceFormat format too, but that can come in a second step. > * > * Media Bus formats supported by the V4L2 APIs are described in Section > * 4.15.3.4.1 of the "Part I - Video for Linux API" chapter of the "Linux Media > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_videodevice.cpp > similarity index 90% > rename from src/libcamera/v4l2_device.cpp > rename to src/libcamera/v4l2_videodevice.cpp > index 0821bd75fb42..8957cf8f97d3 100644 > --- a/src/libcamera/v4l2_device.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -2,10 +2,10 @@ > /* > * Copyright (C) 2019, Google Inc. > * > - * v4l2_device.cpp - V4L2 Device > + * v4l2_videodevice.cpp - V4L2 Video Device > */ > > -#include "v4l2_device.h" > +#include "v4l2_videodevice.h" > > #include <fcntl.h> > #include <iomanip> > @@ -25,8 +25,8 @@ > #include "media_object.h" > > /** > - * \file v4l2_device.h > - * \brief V4L2 Device API > + * \file v4l2_videodevice.h > + * \brief V4L2 Video Device API > */ > namespace libcamera { > > @@ -243,8 +243,8 @@ const std::string V4L2DeviceFormat::toString() const > } > > /** > - * \class V4L2Device > - * \brief V4L2Device object and API > + * \class V4L2VideoDevice > + * \brief V4L2VideoDevice object and API > * > * The V4L2 Device API class models an instance of a V4L2 device node. "V4L2 Video Device API" and "V4L2 video device node". Could you have a look through the documentation to see if there are other instances ? > * It is constructed with the path to a V4L2 video device node. The device node > @@ -257,7 +257,7 @@ const std::string V4L2DeviceFormat::toString() const > * No API call other than open(), isOpen() and close() shall be called on an > * unopened device instance. > * > - * The V4L2Device class tracks queued buffers and handles buffer events. It > + * The V4L2VideoDevice class tracks queued buffers and handles buffer events. It > * automatically dequeues completed buffers and emits the \ref bufferReady > * signal. > * > @@ -266,10 +266,10 @@ const std::string V4L2DeviceFormat::toString() const > */ > > /** > - * \brief Construct a V4L2Device > + * \brief Construct a V4L2VideoDevice > * \param[in] deviceNode The file-system path to the video device node > */ > -V4L2Device::V4L2Device(const std::string &deviceNode) > +V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode) > : deviceNode_(deviceNode), fd_(-1), bufferPool_(nullptr), > queuedBuffersCount_(0), fdEvent_(nullptr) > { > @@ -282,17 +282,17 @@ V4L2Device::V4L2Device(const std::string &deviceNode) > } > > /** > - * \brief Construct a V4L2Device from a MediaEntity > + * \brief Construct a V4L2VideoDevice from a MediaEntity > * \param[in] entity The MediaEntity to build the device from > * > - * Construct a V4L2Device from a MediaEntity's device node path. > + * Construct a V4L2VideoDevice from a MediaEntity's device node path. > */ > -V4L2Device::V4L2Device(const MediaEntity *entity) > - : V4L2Device(entity->deviceNode()) > +V4L2VideoDevice::V4L2VideoDevice(const MediaEntity *entity) > + : V4L2VideoDevice(entity->deviceNode()) > { > } > > -V4L2Device::~V4L2Device() > +V4L2VideoDevice::~V4L2VideoDevice() > { > close(); > } > @@ -301,7 +301,7 @@ V4L2Device::~V4L2Device() > * \brief Open a V4L2 device and query its capabilities Here's another one, "V4L2 video device". With the documentation addressed, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> If you would like the documentation changes to be reviewed, you can send a separate patch on top of this one, and then squash the two when merging. > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::open() > +int V4L2VideoDevice::open() > { > int ret; > > @@ -362,7 +362,7 @@ int V4L2Device::open() > return -EINVAL; > } > > - fdEvent_->activated.connect(this, &V4L2Device::bufferAvailable); > + fdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable); > fdEvent_->setEnabled(false); > > return 0; > @@ -372,7 +372,7 @@ int V4L2Device::open() > * \brief Check if device is successfully opened > * \return True if the device is open, false otherwise > */ > -bool V4L2Device::isOpen() const > +bool V4L2VideoDevice::isOpen() const > { > return fd_ != -1; > } > @@ -380,7 +380,7 @@ bool V4L2Device::isOpen() const > /** > * \brief Close the device, releasing any resources acquired by open() > */ > -void V4L2Device::close() > +void V4L2VideoDevice::close() > { > if (fd_ < 0) > return; > @@ -393,30 +393,30 @@ void V4L2Device::close() > } > > /** > - * \fn V4L2Device::driverName() > + * \fn V4L2VideoDevice::driverName() > * \brief Retrieve the name of the V4L2 device driver > * \return The string containing the driver name > */ > > /** > - * \fn V4L2Device::deviceName() > + * \fn V4L2VideoDevice::deviceName() > * \brief Retrieve the name of the V4L2 device > * \return The string containing the device name > */ > > /** > - * \fn V4L2Device::busName() > + * \fn V4L2VideoDevice::busName() > * \brief Retrieve the location of the device in the system > * \return The string containing the device location > */ > > /** > - * \fn V4L2Device::deviceNode() > + * \fn V4L2VideoDevice::deviceNode() > * \brief Retrieve the video device node path > * \return The video device device node path > */ > > -std::string V4L2Device::logPrefix() const > +std::string V4L2VideoDevice::logPrefix() const > { > return deviceNode_ + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]"); > } > @@ -426,7 +426,7 @@ std::string V4L2Device::logPrefix() const > * \param[out] format The image format applied on the device > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::getFormat(V4L2DeviceFormat *format) > +int V4L2VideoDevice::getFormat(V4L2DeviceFormat *format) > { > if (caps_.isMeta()) > return getFormatMeta(format); > @@ -441,11 +441,11 @@ int V4L2Device::getFormat(V4L2DeviceFormat *format) > * \param[inout] format The image format to apply to the device > * > * Apply the supplied \a format to the device, and return the actually > - * applied format parameters, as \ref V4L2Device::getFormat would do. > + * applied format parameters, as \ref V4L2VideoDevice::getFormat would do. > * > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::setFormat(V4L2DeviceFormat *format) > +int V4L2VideoDevice::setFormat(V4L2DeviceFormat *format) > { > if (caps_.isMeta()) > return setFormatMeta(format); > @@ -455,7 +455,7 @@ int V4L2Device::setFormat(V4L2DeviceFormat *format) > return setFormatSingleplane(format); > } > > -int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) > +int V4L2VideoDevice::getFormatMeta(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; > @@ -479,7 +479,7 @@ int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) > +int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; > @@ -509,7 +509,7 @@ int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) > +int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; > @@ -536,7 +536,7 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) > +int V4L2VideoDevice::setFormatMultiplane(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; > @@ -577,7 +577,7 @@ int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) > +int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; > @@ -601,7 +601,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) > +int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format) > { > struct v4l2_format v4l2Format = {}; > struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; > @@ -634,7 +634,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) > return 0; > } > > -int V4L2Device::requestBuffers(unsigned int count) > +int V4L2VideoDevice::requestBuffers(unsigned int count) > { > struct v4l2_requestbuffers rb = {}; > int ret; > @@ -663,7 +663,7 @@ int V4L2Device::requestBuffers(unsigned int count) > * \param[out] pool BufferPool to populate with buffers > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::exportBuffers(BufferPool *pool) > +int V4L2VideoDevice::exportBuffers(BufferPool *pool) > { > unsigned int allocatedBuffers; > unsigned int i; > @@ -677,7 +677,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) > > allocatedBuffers = ret; > if (allocatedBuffers < pool->count()) { > - LOG(V4L2, Error) << "Not enough buffers provided by V4L2Device"; > + LOG(V4L2, Error) > + << "Not enough buffers provided by V4L2VideoDevice"; > requestBuffers(0); > return -ENOMEM; > } > @@ -731,8 +732,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) > return 0; > } > > -int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, > - unsigned int length) > +int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex, > + unsigned int length) > { > struct v4l2_exportbuffer expbuf = {}; > int ret; > @@ -768,7 +769,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, > * \param[in] pool BufferPool of buffers to import > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::importBuffers(BufferPool *pool) > +int V4L2VideoDevice::importBuffers(BufferPool *pool) > { > unsigned int allocatedBuffers; > int ret; > @@ -782,7 +783,7 @@ int V4L2Device::importBuffers(BufferPool *pool) > allocatedBuffers = ret; > if (allocatedBuffers < pool->count()) { > LOG(V4L2, Error) > - << "Not enough buffers provided by V4L2Device"; > + << "Not enough buffers provided by V4L2VideoDevice"; > requestBuffers(0); > return -ENOMEM; > } > @@ -796,7 +797,7 @@ int V4L2Device::importBuffers(BufferPool *pool) > /** > * \brief Release all internally allocated buffers > */ > -int V4L2Device::releaseBuffers() > +int V4L2VideoDevice::releaseBuffers() > { > LOG(V4L2, Debug) << "Releasing bufferPool"; > > @@ -816,7 +817,7 @@ int V4L2Device::releaseBuffers() > * > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::queueBuffer(Buffer *buffer) > +int V4L2VideoDevice::queueBuffer(Buffer *buffer) > { > struct v4l2_buffer buf = {}; > struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; > @@ -877,7 +878,7 @@ int V4L2Device::queueBuffer(Buffer *buffer) > * > * \return A pointer to the dequeued buffer on success, or nullptr otherwise > */ > -Buffer *V4L2Device::dequeueBuffer() > +Buffer *V4L2VideoDevice::dequeueBuffer() > { > struct v4l2_buffer buf = {}; > struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; > @@ -926,7 +927,7 @@ Buffer *V4L2Device::dequeueBuffer() > * For Capture devices the Buffer will contain valid data. > * For Output devices the Buffer can be considered empty. > */ > -void V4L2Device::bufferAvailable(EventNotifier *notifier) > +void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier) > { > Buffer *buffer = dequeueBuffer(); > if (!buffer) > @@ -939,7 +940,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) > } > > /** > - * \var V4L2Device::bufferReady > + * \var V4L2VideoDevice::bufferReady > * \brief A Signal emitted when a buffer completes > */ > > @@ -947,7 +948,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) > * \brief Start the video stream > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::streamOn() > +int V4L2VideoDevice::streamOn() > { > int ret; > > @@ -970,7 +971,7 @@ int V4L2Device::streamOn() > * > * \return 0 on success or a negative error code otherwise > */ > -int V4L2Device::streamOff() > +int V4L2VideoDevice::streamOff() > { > int ret; > > @@ -997,16 +998,16 @@ int V4L2Device::streamOff() > * Releasing memory of the newly created instance is responsibility of the > * caller of this function. > * > - * \return A newly created V4L2Device on success, nullptr otherwise > + * \return A newly created V4L2VideoDevice on success, nullptr otherwise > */ > -V4L2Device *V4L2Device::fromEntityName(const MediaDevice *media, > - const std::string &entity) > +V4L2VideoDevice *V4L2VideoDevice::fromEntityName(const MediaDevice *media, > + const std::string &entity) > { > MediaEntity *mediaEntity = media->getEntityByName(entity); > if (!mediaEntity) > return nullptr; > > - return new V4L2Device(mediaEntity); > + return new V4L2VideoDevice(mediaEntity); > } > > } /* namespace libcamera */ > diff --git a/test/meson.build b/test/meson.build > index 609aeab80e7d..82b29d8dc7eb 100644 > --- a/test/meson.build > +++ b/test/meson.build > @@ -4,8 +4,8 @@ subdir('camera') > subdir('ipa') > subdir('media_device') > subdir('pipeline') > -subdir('v4l2_device') > subdir('v4l2_subdevice') > +subdir('v4l2_videodevice') > > public_tests = [ > ['event', 'event.cpp'], > diff --git a/test/v4l2_device/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp > similarity index 90% > rename from test/v4l2_device/buffer_sharing.cpp > rename to test/v4l2_videodevice/buffer_sharing.cpp > index e63ddff85689..1bc478fe8f8e 100644 > --- a/test/v4l2_device/buffer_sharing.cpp > +++ b/test/v4l2_videodevice/buffer_sharing.cpp > @@ -4,8 +4,8 @@ > * > * libcamera V4L2 API tests > * > - * Validate the function of exporting buffers from a V4L2Device and > - * the ability to import them to another V4L2Device instance. > + * Validate the function of exporting buffers from a V4L2VideoDevice and > + * the ability to import them to another V4L2VideoDevice instance. > * Ensure that the Buffers can successfully be queued and dequeued > * between both devices. > */ > @@ -17,19 +17,19 @@ > #include <libcamera/event_dispatcher.h> > #include <libcamera/timer.h> > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > -class BufferSharingTest : public V4L2DeviceTest > +class BufferSharingTest : public V4L2VideoDeviceTest > { > public: > BufferSharingTest() > - : V4L2DeviceTest("vivid", "vivid-000-vid-cap"), > + : V4L2VideoDeviceTest("vivid", "vivid-000-vid-cap"), > output_(nullptr), framesCaptured_(0), framesOutput_(0) {} > > protected: > int init() > { > - int ret = V4L2DeviceTest::init(); > + int ret = V4L2VideoDeviceTest::init(); > if (ret) > return ret; > > @@ -38,7 +38,7 @@ protected: > if (!entity) > return TestSkip; > > - output_ = new V4L2Device(entity); > + output_ = new V4L2VideoDevice(entity); > if (!output_) { > std::cout << "Failed to create output device" << std::endl; > return TestFail; > @@ -171,13 +171,13 @@ protected: > > delete output_; > > - V4L2DeviceTest::cleanup(); > + V4L2VideoDeviceTest::cleanup(); > } > > private: > const unsigned int bufferCount = 4; > > - V4L2Device *output_; > + V4L2VideoDevice *output_; > > unsigned int framesCaptured_; > unsigned int framesOutput_; > diff --git a/test/v4l2_device/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp > similarity index 91% > rename from test/v4l2_device/capture_async.cpp > rename to test/v4l2_videodevice/capture_async.cpp > index 69b1d5a13ed8..cea4fffbf7a5 100644 > --- a/test/v4l2_device/capture_async.cpp > +++ b/test/v4l2_videodevice/capture_async.cpp > @@ -12,13 +12,13 @@ > > #include <iostream> > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > -class CaptureAsyncTest : public V4L2DeviceTest > +class CaptureAsyncTest : public V4L2VideoDeviceTest > { > public: > CaptureAsyncTest() > - : V4L2DeviceTest("vimc", "Raw Capture 0"), frames(0) {} > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0"), frames(0) {} > > void receiveBuffer(Buffer *buffer) > { > diff --git a/test/v4l2_device/double_open.cpp b/test/v4l2_videodevice/double_open.cpp > similarity index 75% > rename from test/v4l2_device/double_open.cpp > rename to test/v4l2_videodevice/double_open.cpp > index 53850620889b..5768d4043d0b 100644 > --- a/test/v4l2_device/double_open.cpp > +++ b/test/v4l2_videodevice/double_open.cpp > @@ -7,15 +7,15 @@ > > #include <iostream> > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > namespace { > > -class DoubleOpen : public V4L2DeviceTest > +class DoubleOpen : public V4L2VideoDeviceTest > { > public: > DoubleOpen() > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > protected: > int run() > { > @@ -23,7 +23,7 @@ protected: > > /* > * Expect failure: The device has already been opened by the > - * V4L2DeviceTest base class > + * V4L2VideoDeviceTest base class > */ > ret = capture_->open(); > if (!ret) { > diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_videodevice/formats.cpp > similarity index 85% > rename from test/v4l2_device/formats.cpp > rename to test/v4l2_videodevice/formats.cpp > index 6be045ff754c..ee7d357de075 100644 > --- a/test/v4l2_device/formats.cpp > +++ b/test/v4l2_videodevice/formats.cpp > @@ -8,18 +8,18 @@ > #include <climits> > #include <iostream> > > -#include "v4l2_device.h" > +#include "v4l2_videodevice.h" > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > using namespace std; > using namespace libcamera; > > -class Format : public V4L2DeviceTest > +class Format : public V4L2VideoDeviceTest > { > public: > Format() > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > protected: > int run() > { > diff --git a/test/v4l2_device/meson.build b/test/v4l2_videodevice/meson.build > similarity index 74% > rename from test/v4l2_device/meson.build > rename to test/v4l2_videodevice/meson.build > index de540b1ba6f5..76be5e142bb6 100644 > --- a/test/v4l2_device/meson.build > +++ b/test/v4l2_videodevice/meson.build > @@ -1,6 +1,6 @@ > # Tests are listed in order of complexity. > # They are not alphabetically sorted. > -v4l2_device_tests = [ > +v4l2_videodevice_tests = [ > [ 'double_open', 'double_open.cpp' ], > [ 'formats', 'formats.cpp' ], > [ 'request_buffers', 'request_buffers.cpp' ], > @@ -9,10 +9,10 @@ v4l2_device_tests = [ > [ 'buffer_sharing', 'buffer_sharing.cpp' ], > ] > > -foreach t : v4l2_device_tests > - exe = executable(t[0], [t[1], 'v4l2_device_test.cpp'], > +foreach t : v4l2_videodevice_tests > + exe = executable(t[0], [t[1], 'v4l2_videodevice_test.cpp'], > dependencies : libcamera_dep, > link_with : test_libraries, > include_directories : test_includes_internal) > - test(t[0], exe, suite : 'v4l2_device', is_parallel : false) > + test(t[0], exe, suite : 'v4l2_videodevice', is_parallel : false) > endforeach > diff --git a/test/v4l2_device/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp > similarity index 77% > rename from test/v4l2_device/request_buffers.cpp > rename to test/v4l2_videodevice/request_buffers.cpp > index 7b7b06b2b409..c4aedf7b3cd6 100644 > --- a/test/v4l2_device/request_buffers.cpp > +++ b/test/v4l2_videodevice/request_buffers.cpp > @@ -5,13 +5,13 @@ > * libcamera V4L2 API tests > */ > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > -class RequestBuffersTest : public V4L2DeviceTest > +class RequestBuffersTest : public V4L2VideoDeviceTest > { > public: > RequestBuffersTest() > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > > protected: > int run() > diff --git a/test/v4l2_device/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp > similarity index 78% > rename from test/v4l2_device/stream_on_off.cpp > rename to test/v4l2_videodevice/stream_on_off.cpp > index b158b8e402c8..7664adc4c1f0 100644 > --- a/test/v4l2_device/stream_on_off.cpp > +++ b/test/v4l2_videodevice/stream_on_off.cpp > @@ -5,13 +5,13 @@ > * libcamera V4L2 API tests > */ > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > -class StreamOnStreamOffTest : public V4L2DeviceTest > +class StreamOnStreamOffTest : public V4L2VideoDeviceTest > { > public: > StreamOnStreamOffTest() > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > protected: > int run() > { > diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp > similarity index 90% > rename from test/v4l2_device/v4l2_device_test.cpp > rename to test/v4l2_videodevice/v4l2_videodevice_test.cpp > index baad48f8aa9e..b26d06ad4519 100644 > --- a/test/v4l2_device/v4l2_device_test.cpp > +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp > @@ -8,7 +8,7 @@ > #include <iostream> > #include <sys/stat.h> > > -#include "v4l2_device_test.h" > +#include "v4l2_videodevice_test.h" > > #include "device_enumerator.h" > #include "media_device.h" > @@ -26,7 +26,7 @@ bool exists(const std::string &path) > return false; > } > > -int V4L2DeviceTest::init() > +int V4L2VideoDeviceTest::init() > { > enumerator_ = DeviceEnumerator::create(); > if (!enumerator_) { > @@ -50,7 +50,7 @@ int V4L2DeviceTest::init() > if (!entity) > return TestSkip; > > - capture_ = new V4L2Device(entity); > + capture_ = new V4L2VideoDevice(entity); > if (!capture_) > return TestFail; > > @@ -77,7 +77,7 @@ int V4L2DeviceTest::init() > return TestPass; > } > > -void V4L2DeviceTest::cleanup() > +void V4L2VideoDeviceTest::cleanup() > { > capture_->streamOff(); > capture_->releaseBuffers(); > diff --git a/test/v4l2_device/v4l2_device_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h > similarity index 81% > rename from test/v4l2_device/v4l2_device_test.h > rename to test/v4l2_videodevice/v4l2_videodevice_test.h > index 651c005f4e54..3321b5a4f98f 100644 > --- a/test/v4l2_device/v4l2_device_test.h > +++ b/test/v4l2_videodevice/v4l2_videodevice_test.h > @@ -15,14 +15,14 @@ > > #include "device_enumerator.h" > #include "media_device.h" > -#include "v4l2_device.h" > +#include "v4l2_videodevice.h" > > using namespace libcamera; > > -class V4L2DeviceTest : public Test > +class V4L2VideoDeviceTest : public Test > { > public: > - V4L2DeviceTest(const char *driver, const char *entity) > + V4L2VideoDeviceTest(const char *driver, const char *entity) > : driver_(driver), entity_(entity), capture_(nullptr) > { > } > @@ -35,7 +35,7 @@ protected: > std::string entity_; > std::unique_ptr<DeviceEnumerator> enumerator_; > std::shared_ptr<MediaDevice> media_; > - V4L2Device *capture_; > + V4L2VideoDevice *capture_; > BufferPool pool_; > }; >
Hi Laurent, On Tue, Jun 18, 2019 at 11:47:23PM +0300, Laurent Pinchart wrote: > Hi Jacopo, > > Thank you for the patch. > > On Thu, Jun 13, 2019 at 09:49:54AM +0200, Jacopo Mondi wrote: > > In preparation of creating a new V4L2Device base class, rename > > V4L2Device to V4L2VideoDevice. > > > > This is a project wide rename without any intended functional change. > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > --- > > include/libcamera/buffer.h | 2 +- > > .../{v4l2_device.h => v4l2_videodevice.h} | 24 ++--- > > src/libcamera/meson.build | 4 +- > > src/libcamera/pipeline/ipu3/ipu3.cpp | 24 ++--- > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 +- > > src/libcamera/pipeline/uvcvideo.cpp | 6 +- > > src/libcamera/pipeline/vimc.cpp | 6 +- > > src/libcamera/v4l2_subdevice.cpp | 2 +- > > .../{v4l2_device.cpp => v4l2_videodevice.cpp} | 101 +++++++++--------- > > test/meson.build | 2 +- > > .../buffer_sharing.cpp | 18 ++-- > > .../capture_async.cpp | 6 +- > > .../double_open.cpp | 8 +- > > .../formats.cpp | 8 +- > > .../meson.build | 8 +- > > .../request_buffers.cpp | 6 +- > > .../stream_on_off.cpp | 6 +- > > .../v4l2_videodevice_test.cpp} | 8 +- > > .../v4l2_videodevice_test.h} | 8 +- > > 19 files changed, 127 insertions(+), 126 deletions(-) > > rename src/libcamera/include/{v4l2_device.h => v4l2_videodevice.h} (86%) > > rename src/libcamera/{v4l2_device.cpp => v4l2_videodevice.cpp} (90%) > > rename test/{v4l2_device => v4l2_videodevice}/buffer_sharing.cpp (90%) > > rename test/{v4l2_device => v4l2_videodevice}/capture_async.cpp (91%) > > rename test/{v4l2_device => v4l2_videodevice}/double_open.cpp (75%) > > rename test/{v4l2_device => v4l2_videodevice}/formats.cpp (85%) > > rename test/{v4l2_device => v4l2_videodevice}/meson.build (74%) > > rename test/{v4l2_device => v4l2_videodevice}/request_buffers.cpp (77%) > > rename test/{v4l2_device => v4l2_videodevice}/stream_on_off.cpp (78%) > > rename test/{v4l2_device/v4l2_device_test.cpp => v4l2_videodevice/v4l2_videodevice_test.cpp} (90%) > > rename test/{v4l2_device/v4l2_device_test.h => v4l2_videodevice/v4l2_videodevice_test.h} (81%) > > > > diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h > > index 8f9b42e39339..260a62e9e77e 100644 > > --- a/include/libcamera/buffer.h > > +++ b/include/libcamera/buffer.h > > @@ -59,7 +59,7 @@ private: > > friend class BufferPool; > > friend class PipelineHandler; > > friend class Request; > > - friend class V4L2Device; > > + friend class V4L2VideoDevice; > > > > void cancel(); > > > > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_videodevice.h > > similarity index 86% > > rename from src/libcamera/include/v4l2_device.h > > rename to src/libcamera/include/v4l2_videodevice.h > > index bdecc087fe5a..6ecdb64e5f3c 100644 > > --- a/src/libcamera/include/v4l2_device.h > > +++ b/src/libcamera/include/v4l2_videodevice.h > > @@ -2,10 +2,10 @@ > > /* > > * Copyright (C) 2019, Google Inc. > > * > > - * v4l2_device.h - V4L2 Device > > + * v4l2_videodevice.h - V4L2 Video Device > > */ > > -#ifndef __LIBCAMERA_V4L2_DEVICE_H__ > > -#define __LIBCAMERA_V4L2_DEVICE_H__ > > +#ifndef __LIBCAMERA_V4L2_VIDEODEVICE_H__ > > +#define __LIBCAMERA_V4L2_VIDEODEVICE_H__ > > > > #include <atomic> > > #include <string> > > @@ -111,15 +111,15 @@ public: > > const std::string toString() const; > > }; > > > > -class V4L2Device : protected Loggable > > +class V4L2VideoDevice : protected Loggable > > { > > public: > > - explicit V4L2Device(const std::string &deviceNode); > > - explicit V4L2Device(const MediaEntity *entity); > > - V4L2Device(const V4L2Device &) = delete; > > - ~V4L2Device(); > > + explicit V4L2VideoDevice(const std::string &deviceNode); > > + explicit V4L2VideoDevice(const MediaEntity *entity); > > + V4L2VideoDevice(const V4L2VideoDevice &) = delete; > > + ~V4L2VideoDevice(); > > > > - V4L2Device &operator=(const V4L2Device &) = delete; > > + V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete; > > > > int open(); > > bool isOpen() const; > > @@ -143,8 +143,8 @@ public: > > int streamOn(); > > int streamOff(); > > > > - static V4L2Device *fromEntityName(const MediaDevice *media, > > - const std::string &entity); > > + static V4L2VideoDevice *fromEntityName(const MediaDevice *media, > > + const std::string &entity); > > > > protected: > > std::string logPrefix() const; > > @@ -181,4 +181,4 @@ private: > > > > } /* namespace libcamera */ > > > > -#endif /* __LIBCAMERA_V4L2_DEVICE_H__ */ > > +#endif /* __LIBCAMERA_V4L2_VIDEODEVICE_H__ */ > > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > > index 1ca1083cf5c7..15ab53b1abbe 100644 > > --- a/src/libcamera/meson.build > > +++ b/src/libcamera/meson.build > > @@ -23,8 +23,8 @@ libcamera_sources = files([ > > 'stream.cpp', > > 'timer.cpp', > > 'utils.cpp', > > - 'v4l2_device.cpp', > > 'v4l2_subdevice.cpp', > > + 'v4l2_videodevice.cpp', > > ]) > > > > libcamera_headers = files([ > > @@ -41,8 +41,8 @@ libcamera_headers = files([ > > 'include/media_object.h', > > 'include/pipeline_handler.h', > > 'include/utils.h', > > - 'include/v4l2_device.h', > > 'include/v4l2_subdevice.h', > > + 'include/v4l2_videodevice.h', > > ]) > > > > libcamera_internal_includes = include_directories('include') > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > > index f2bdecbac20f..1c0a9825b4cd 100644 > > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > > @@ -22,8 +22,8 @@ > > #include "media_device.h" > > #include "pipeline_handler.h" > > #include "utils.h" > > -#include "v4l2_device.h" > > #include "v4l2_subdevice.h" > > +#include "v4l2_videodevice.h" > > > > namespace libcamera { > > > > @@ -39,7 +39,7 @@ public: > > > > /* ImgU output descriptor: group data specific to an ImgU output. */ > > struct ImgUOutput { > > - V4L2Device *dev; > > + V4L2VideoDevice *dev; > > unsigned int pad; > > std::string name; > > BufferPool *pool; > > @@ -85,7 +85,7 @@ public: > > MediaDevice *media_; > > > > V4L2Subdevice *imgu_; > > - V4L2Device *input_; > > + V4L2VideoDevice *input_; > > ImgUOutput output_; > > ImgUOutput viewfinder_; > > ImgUOutput stat_; > > @@ -125,7 +125,7 @@ public: > > > > static int mediaBusToFormat(unsigned int code); > > > > - V4L2Device *output_; > > + V4L2VideoDevice *output_; > > V4L2Subdevice *csi2_; > > CameraSensor *sensor_; > > > > @@ -943,7 +943,7 @@ void IPU3CameraData::cio2BufferReady(Buffer *buffer) > > * Create and open the V4L2 devices and subdevices of the ImgU instance > > * with \a index. > > * > > - * In case of errors the created V4L2Device and V4L2Subdevice instances > > + * In case of errors the created V4L2VideoDevice and V4L2Subdevice instances > > * are destroyed at pipeline handler delete time. > > * > > * \return 0 on success or a negative error code otherwise > > @@ -966,12 +966,12 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > > if (ret) > > return ret; > > > > - input_ = V4L2Device::fromEntityName(media, name_ + " input"); > > + input_ = V4L2VideoDevice::fromEntityName(media, name_ + " input"); > > ret = input_->open(); > > if (ret) > > return ret; > > > > - output_.dev = V4L2Device::fromEntityName(media, name_ + " output"); > > + output_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " output"); > > ret = output_.dev->open(); > > if (ret) > > return ret; > > @@ -980,8 +980,8 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > > output_.name = "output"; > > output_.pool = &outPool_; > > > > - viewfinder_.dev = V4L2Device::fromEntityName(media, > > - name_ + " viewfinder"); > > + viewfinder_.dev = V4L2VideoDevice::fromEntityName(media, > > + name_ + " viewfinder"); > > ret = viewfinder_.dev->open(); > > if (ret) > > return ret; > > @@ -990,7 +990,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) > > viewfinder_.name = "viewfinder"; > > viewfinder_.pool = &vfPool_; > > > > - stat_.dev = V4L2Device::fromEntityName(media, name_ + " 3a stat"); > > + stat_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " 3a stat"); > > ret = stat_.dev->open(); > > if (ret) > > return ret; > > @@ -1067,7 +1067,7 @@ int ImgUDevice::configureInput(const Size &size, > > int ImgUDevice::configureOutput(ImgUOutput *output, > > const StreamConfiguration &cfg) > > { > > - V4L2Device *dev = output->dev; > > + V4L2VideoDevice *dev = output->dev; > > unsigned int pad = output->pad; > > > > V4L2SubdeviceFormat imguFormat = {}; > > @@ -1337,7 +1337,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) > > return ret; > > > > std::string cio2Name = "ipu3-cio2 " + std::to_string(index); > > - output_ = V4L2Device::fromEntityName(media, cio2Name); > > + output_ = V4L2VideoDevice::fromEntityName(media, cio2Name); > > ret = output_->open(); > > if (ret) > > return ret; > > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > > index 9b3eea2f6dd3..4a5898d25f91 100644 > > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > > @@ -23,8 +23,8 @@ > > #include "media_device.h" > > #include "pipeline_handler.h" > > #include "utils.h" > > -#include "v4l2_device.h" > > #include "v4l2_subdevice.h" > > +#include "v4l2_videodevice.h" > > > > namespace libcamera { > > > > @@ -106,7 +106,7 @@ private: > > MediaDevice *media_; > > V4L2Subdevice *dphy_; > > V4L2Subdevice *isp_; > > - V4L2Device *video_; > > + V4L2VideoDevice *video_; > > > > Camera *activeCamera_; > > }; > > @@ -458,7 +458,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) > > return false; > > > > /* Locate and open the capture video node. */ > > - video_ = V4L2Device::fromEntityName(media_, "rkisp1_mainpath"); > > + video_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_mainpath"); > > if (video_->open() < 0) > > return false; > > > > diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp > > index 45260f34c8f5..b0d768628a19 100644 > > --- a/src/libcamera/pipeline/uvcvideo.cpp > > +++ b/src/libcamera/pipeline/uvcvideo.cpp > > @@ -14,7 +14,7 @@ > > #include "media_device.h" > > #include "pipeline_handler.h" > > #include "utils.h" > > -#include "v4l2_device.h" > > +#include "v4l2_videodevice.h" > > > > namespace libcamera { > > > > @@ -35,7 +35,7 @@ public: > > > > void bufferReady(Buffer *buffer); > > > > - V4L2Device *video_; > > + V4L2VideoDevice *video_; > > Stream stream_; > > }; > > > > @@ -229,7 +229,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > > /* Locate and open the default video node. */ > > for (MediaEntity *entity : media->entities()) { > > if (entity->flags() & MEDIA_ENT_FL_DEFAULT) { > > - data->video_ = new V4L2Device(entity); > > + data->video_ = new V4L2VideoDevice(entity); > > break; > > } > > } > > diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp > > index ad4577acd9d6..6833213650dc 100644 > > --- a/src/libcamera/pipeline/vimc.cpp > > +++ b/src/libcamera/pipeline/vimc.cpp > > @@ -20,7 +20,7 @@ > > #include "media_device.h" > > #include "pipeline_handler.h" > > #include "utils.h" > > -#include "v4l2_device.h" > > +#include "v4l2_videodevice.h" > > > > namespace libcamera { > > > > @@ -41,7 +41,7 @@ public: > > > > void bufferReady(Buffer *buffer); > > > > - V4L2Device *video_; > > + V4L2VideoDevice *video_; > > Stream stream_; > > }; > > > > @@ -262,7 +262,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) > > std::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this); > > > > /* Locate and open the capture video node. */ > > - data->video_ = new V4L2Device(media->getEntityByName("Raw Capture 1")); > > + data->video_ = new V4L2VideoDevice(media->getEntityByName("Raw Capture 1")); > > if (data->video_->open()) > > return false; > > > > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp > > index fceee33156e9..6681c1920065 100644 > > --- a/src/libcamera/v4l2_subdevice.cpp > > +++ b/src/libcamera/v4l2_subdevice.cpp > > @@ -44,7 +44,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev) > > * as the "media bus format", and it is identified by a resolution and a pixel > > * format identification code, known as the "media bus code", not to be confused > > * with the fourcc code that identify the format of images when stored in memory > > - * (see V4L2Device::V4L2DeviceFormat). > > + * (see V4L2VideoDevice::V4L2DeviceFormat). > > I wonder if we should rename V4L2DeviceFormat format too, but that can > come in a second step. > I intentionally left them out as Niklas' series removes them > > * > > * Media Bus formats supported by the V4L2 APIs are described in Section > > * 4.15.3.4.1 of the "Part I - Video for Linux API" chapter of the "Linux Media > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_videodevice.cpp > > similarity index 90% > > rename from src/libcamera/v4l2_device.cpp > > rename to src/libcamera/v4l2_videodevice.cpp > > index 0821bd75fb42..8957cf8f97d3 100644 > > --- a/src/libcamera/v4l2_device.cpp > > +++ b/src/libcamera/v4l2_videodevice.cpp > > @@ -2,10 +2,10 @@ > > /* > > * Copyright (C) 2019, Google Inc. > > * > > - * v4l2_device.cpp - V4L2 Device > > + * v4l2_videodevice.cpp - V4L2 Video Device > > */ > > > > -#include "v4l2_device.h" > > +#include "v4l2_videodevice.h" > > > > #include <fcntl.h> > > #include <iomanip> > > @@ -25,8 +25,8 @@ > > #include "media_object.h" > > > > /** > > - * \file v4l2_device.h > > - * \brief V4L2 Device API > > + * \file v4l2_videodevice.h > > + * \brief V4L2 Video Device API > > */ > > namespace libcamera { > > > > @@ -243,8 +243,8 @@ const std::string V4L2DeviceFormat::toString() const > > } > > > > /** > > - * \class V4L2Device > > - * \brief V4L2Device object and API > > + * \class V4L2VideoDevice > > + * \brief V4L2VideoDevice object and API > > * > > * The V4L2 Device API class models an instance of a V4L2 device node. > > "V4L2 Video Device API" and "V4L2 video device node". Could you have a > look through the documentation to see if there are other instances ? > > > * It is constructed with the path to a V4L2 video device node. The device node > > @@ -257,7 +257,7 @@ const std::string V4L2DeviceFormat::toString() const > > * No API call other than open(), isOpen() and close() shall be called on an > > * unopened device instance. > > * > > - * The V4L2Device class tracks queued buffers and handles buffer events. It > > + * The V4L2VideoDevice class tracks queued buffers and handles buffer events. It > > * automatically dequeues completed buffers and emits the \ref bufferReady > > * signal. > > * > > @@ -266,10 +266,10 @@ const std::string V4L2DeviceFormat::toString() const > > */ > > > > /** > > - * \brief Construct a V4L2Device > > + * \brief Construct a V4L2VideoDevice > > * \param[in] deviceNode The file-system path to the video device node > > */ > > -V4L2Device::V4L2Device(const std::string &deviceNode) > > +V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode) > > : deviceNode_(deviceNode), fd_(-1), bufferPool_(nullptr), > > queuedBuffersCount_(0), fdEvent_(nullptr) > > { > > @@ -282,17 +282,17 @@ V4L2Device::V4L2Device(const std::string &deviceNode) > > } > > > > /** > > - * \brief Construct a V4L2Device from a MediaEntity > > + * \brief Construct a V4L2VideoDevice from a MediaEntity > > * \param[in] entity The MediaEntity to build the device from > > * > > - * Construct a V4L2Device from a MediaEntity's device node path. > > + * Construct a V4L2VideoDevice from a MediaEntity's device node path. > > */ > > -V4L2Device::V4L2Device(const MediaEntity *entity) > > - : V4L2Device(entity->deviceNode()) > > +V4L2VideoDevice::V4L2VideoDevice(const MediaEntity *entity) > > + : V4L2VideoDevice(entity->deviceNode()) > > { > > } > > > > -V4L2Device::~V4L2Device() > > +V4L2VideoDevice::~V4L2VideoDevice() > > { > > close(); > > } > > @@ -301,7 +301,7 @@ V4L2Device::~V4L2Device() > > * \brief Open a V4L2 device and query its capabilities > > Here's another one, "V4L2 video device". > > With the documentation addressed, > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > If you would like the documentation changes to be reviewed, you can send > a separate patch on top of this one, and then squash the two when > merging. > Ack Thanks j > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::open() > > +int V4L2VideoDevice::open() > > { > > int ret; > > > > @@ -362,7 +362,7 @@ int V4L2Device::open() > > return -EINVAL; > > } > > > > - fdEvent_->activated.connect(this, &V4L2Device::bufferAvailable); > > + fdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable); > > fdEvent_->setEnabled(false); > > > > return 0; > > @@ -372,7 +372,7 @@ int V4L2Device::open() > > * \brief Check if device is successfully opened > > * \return True if the device is open, false otherwise > > */ > > -bool V4L2Device::isOpen() const > > +bool V4L2VideoDevice::isOpen() const > > { > > return fd_ != -1; > > } > > @@ -380,7 +380,7 @@ bool V4L2Device::isOpen() const > > /** > > * \brief Close the device, releasing any resources acquired by open() > > */ > > -void V4L2Device::close() > > +void V4L2VideoDevice::close() > > { > > if (fd_ < 0) > > return; > > @@ -393,30 +393,30 @@ void V4L2Device::close() > > } > > > > /** > > - * \fn V4L2Device::driverName() > > + * \fn V4L2VideoDevice::driverName() > > * \brief Retrieve the name of the V4L2 device driver > > * \return The string containing the driver name > > */ > > > > /** > > - * \fn V4L2Device::deviceName() > > + * \fn V4L2VideoDevice::deviceName() > > * \brief Retrieve the name of the V4L2 device > > * \return The string containing the device name > > */ > > > > /** > > - * \fn V4L2Device::busName() > > + * \fn V4L2VideoDevice::busName() > > * \brief Retrieve the location of the device in the system > > * \return The string containing the device location > > */ > > > > /** > > - * \fn V4L2Device::deviceNode() > > + * \fn V4L2VideoDevice::deviceNode() > > * \brief Retrieve the video device node path > > * \return The video device device node path > > */ > > > > -std::string V4L2Device::logPrefix() const > > +std::string V4L2VideoDevice::logPrefix() const > > { > > return deviceNode_ + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]"); > > } > > @@ -426,7 +426,7 @@ std::string V4L2Device::logPrefix() const > > * \param[out] format The image format applied on the device > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::getFormat(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::getFormat(V4L2DeviceFormat *format) > > { > > if (caps_.isMeta()) > > return getFormatMeta(format); > > @@ -441,11 +441,11 @@ int V4L2Device::getFormat(V4L2DeviceFormat *format) > > * \param[inout] format The image format to apply to the device > > * > > * Apply the supplied \a format to the device, and return the actually > > - * applied format parameters, as \ref V4L2Device::getFormat would do. > > + * applied format parameters, as \ref V4L2VideoDevice::getFormat would do. > > * > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::setFormat(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::setFormat(V4L2DeviceFormat *format) > > { > > if (caps_.isMeta()) > > return setFormatMeta(format); > > @@ -455,7 +455,7 @@ int V4L2Device::setFormat(V4L2DeviceFormat *format) > > return setFormatSingleplane(format); > > } > > > > -int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::getFormatMeta(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; > > @@ -479,7 +479,7 @@ int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; > > @@ -509,7 +509,7 @@ int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; > > @@ -536,7 +536,7 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::setFormatMultiplane(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; > > @@ -577,7 +577,7 @@ int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; > > @@ -601,7 +601,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) > > +int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format) > > { > > struct v4l2_format v4l2Format = {}; > > struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; > > @@ -634,7 +634,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) > > return 0; > > } > > > > -int V4L2Device::requestBuffers(unsigned int count) > > +int V4L2VideoDevice::requestBuffers(unsigned int count) > > { > > struct v4l2_requestbuffers rb = {}; > > int ret; > > @@ -663,7 +663,7 @@ int V4L2Device::requestBuffers(unsigned int count) > > * \param[out] pool BufferPool to populate with buffers > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::exportBuffers(BufferPool *pool) > > +int V4L2VideoDevice::exportBuffers(BufferPool *pool) > > { > > unsigned int allocatedBuffers; > > unsigned int i; > > @@ -677,7 +677,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) > > > > allocatedBuffers = ret; > > if (allocatedBuffers < pool->count()) { > > - LOG(V4L2, Error) << "Not enough buffers provided by V4L2Device"; > > + LOG(V4L2, Error) > > + << "Not enough buffers provided by V4L2VideoDevice"; > > requestBuffers(0); > > return -ENOMEM; > > } > > @@ -731,8 +732,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) > > return 0; > > } > > > > -int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, > > - unsigned int length) > > +int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex, > > + unsigned int length) > > { > > struct v4l2_exportbuffer expbuf = {}; > > int ret; > > @@ -768,7 +769,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, > > * \param[in] pool BufferPool of buffers to import > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::importBuffers(BufferPool *pool) > > +int V4L2VideoDevice::importBuffers(BufferPool *pool) > > { > > unsigned int allocatedBuffers; > > int ret; > > @@ -782,7 +783,7 @@ int V4L2Device::importBuffers(BufferPool *pool) > > allocatedBuffers = ret; > > if (allocatedBuffers < pool->count()) { > > LOG(V4L2, Error) > > - << "Not enough buffers provided by V4L2Device"; > > + << "Not enough buffers provided by V4L2VideoDevice"; > > requestBuffers(0); > > return -ENOMEM; > > } > > @@ -796,7 +797,7 @@ int V4L2Device::importBuffers(BufferPool *pool) > > /** > > * \brief Release all internally allocated buffers > > */ > > -int V4L2Device::releaseBuffers() > > +int V4L2VideoDevice::releaseBuffers() > > { > > LOG(V4L2, Debug) << "Releasing bufferPool"; > > > > @@ -816,7 +817,7 @@ int V4L2Device::releaseBuffers() > > * > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::queueBuffer(Buffer *buffer) > > +int V4L2VideoDevice::queueBuffer(Buffer *buffer) > > { > > struct v4l2_buffer buf = {}; > > struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; > > @@ -877,7 +878,7 @@ int V4L2Device::queueBuffer(Buffer *buffer) > > * > > * \return A pointer to the dequeued buffer on success, or nullptr otherwise > > */ > > -Buffer *V4L2Device::dequeueBuffer() > > +Buffer *V4L2VideoDevice::dequeueBuffer() > > { > > struct v4l2_buffer buf = {}; > > struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; > > @@ -926,7 +927,7 @@ Buffer *V4L2Device::dequeueBuffer() > > * For Capture devices the Buffer will contain valid data. > > * For Output devices the Buffer can be considered empty. > > */ > > -void V4L2Device::bufferAvailable(EventNotifier *notifier) > > +void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier) > > { > > Buffer *buffer = dequeueBuffer(); > > if (!buffer) > > @@ -939,7 +940,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) > > } > > > > /** > > - * \var V4L2Device::bufferReady > > + * \var V4L2VideoDevice::bufferReady > > * \brief A Signal emitted when a buffer completes > > */ > > > > @@ -947,7 +948,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) > > * \brief Start the video stream > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::streamOn() > > +int V4L2VideoDevice::streamOn() > > { > > int ret; > > > > @@ -970,7 +971,7 @@ int V4L2Device::streamOn() > > * > > * \return 0 on success or a negative error code otherwise > > */ > > -int V4L2Device::streamOff() > > +int V4L2VideoDevice::streamOff() > > { > > int ret; > > > > @@ -997,16 +998,16 @@ int V4L2Device::streamOff() > > * Releasing memory of the newly created instance is responsibility of the > > * caller of this function. > > * > > - * \return A newly created V4L2Device on success, nullptr otherwise > > + * \return A newly created V4L2VideoDevice on success, nullptr otherwise > > */ > > -V4L2Device *V4L2Device::fromEntityName(const MediaDevice *media, > > - const std::string &entity) > > +V4L2VideoDevice *V4L2VideoDevice::fromEntityName(const MediaDevice *media, > > + const std::string &entity) > > { > > MediaEntity *mediaEntity = media->getEntityByName(entity); > > if (!mediaEntity) > > return nullptr; > > > > - return new V4L2Device(mediaEntity); > > + return new V4L2VideoDevice(mediaEntity); > > } > > > > } /* namespace libcamera */ > > diff --git a/test/meson.build b/test/meson.build > > index 609aeab80e7d..82b29d8dc7eb 100644 > > --- a/test/meson.build > > +++ b/test/meson.build > > @@ -4,8 +4,8 @@ subdir('camera') > > subdir('ipa') > > subdir('media_device') > > subdir('pipeline') > > -subdir('v4l2_device') > > subdir('v4l2_subdevice') > > +subdir('v4l2_videodevice') > > > > public_tests = [ > > ['event', 'event.cpp'], > > diff --git a/test/v4l2_device/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp > > similarity index 90% > > rename from test/v4l2_device/buffer_sharing.cpp > > rename to test/v4l2_videodevice/buffer_sharing.cpp > > index e63ddff85689..1bc478fe8f8e 100644 > > --- a/test/v4l2_device/buffer_sharing.cpp > > +++ b/test/v4l2_videodevice/buffer_sharing.cpp > > @@ -4,8 +4,8 @@ > > * > > * libcamera V4L2 API tests > > * > > - * Validate the function of exporting buffers from a V4L2Device and > > - * the ability to import them to another V4L2Device instance. > > + * Validate the function of exporting buffers from a V4L2VideoDevice and > > + * the ability to import them to another V4L2VideoDevice instance. > > * Ensure that the Buffers can successfully be queued and dequeued > > * between both devices. > > */ > > @@ -17,19 +17,19 @@ > > #include <libcamera/event_dispatcher.h> > > #include <libcamera/timer.h> > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > -class BufferSharingTest : public V4L2DeviceTest > > +class BufferSharingTest : public V4L2VideoDeviceTest > > { > > public: > > BufferSharingTest() > > - : V4L2DeviceTest("vivid", "vivid-000-vid-cap"), > > + : V4L2VideoDeviceTest("vivid", "vivid-000-vid-cap"), > > output_(nullptr), framesCaptured_(0), framesOutput_(0) {} > > > > protected: > > int init() > > { > > - int ret = V4L2DeviceTest::init(); > > + int ret = V4L2VideoDeviceTest::init(); > > if (ret) > > return ret; > > > > @@ -38,7 +38,7 @@ protected: > > if (!entity) > > return TestSkip; > > > > - output_ = new V4L2Device(entity); > > + output_ = new V4L2VideoDevice(entity); > > if (!output_) { > > std::cout << "Failed to create output device" << std::endl; > > return TestFail; > > @@ -171,13 +171,13 @@ protected: > > > > delete output_; > > > > - V4L2DeviceTest::cleanup(); > > + V4L2VideoDeviceTest::cleanup(); > > } > > > > private: > > const unsigned int bufferCount = 4; > > > > - V4L2Device *output_; > > + V4L2VideoDevice *output_; > > > > unsigned int framesCaptured_; > > unsigned int framesOutput_; > > diff --git a/test/v4l2_device/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp > > similarity index 91% > > rename from test/v4l2_device/capture_async.cpp > > rename to test/v4l2_videodevice/capture_async.cpp > > index 69b1d5a13ed8..cea4fffbf7a5 100644 > > --- a/test/v4l2_device/capture_async.cpp > > +++ b/test/v4l2_videodevice/capture_async.cpp > > @@ -12,13 +12,13 @@ > > > > #include <iostream> > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > -class CaptureAsyncTest : public V4L2DeviceTest > > +class CaptureAsyncTest : public V4L2VideoDeviceTest > > { > > public: > > CaptureAsyncTest() > > - : V4L2DeviceTest("vimc", "Raw Capture 0"), frames(0) {} > > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0"), frames(0) {} > > > > void receiveBuffer(Buffer *buffer) > > { > > diff --git a/test/v4l2_device/double_open.cpp b/test/v4l2_videodevice/double_open.cpp > > similarity index 75% > > rename from test/v4l2_device/double_open.cpp > > rename to test/v4l2_videodevice/double_open.cpp > > index 53850620889b..5768d4043d0b 100644 > > --- a/test/v4l2_device/double_open.cpp > > +++ b/test/v4l2_videodevice/double_open.cpp > > @@ -7,15 +7,15 @@ > > > > #include <iostream> > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > namespace { > > > > -class DoubleOpen : public V4L2DeviceTest > > +class DoubleOpen : public V4L2VideoDeviceTest > > { > > public: > > DoubleOpen() > > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > > protected: > > int run() > > { > > @@ -23,7 +23,7 @@ protected: > > > > /* > > * Expect failure: The device has already been opened by the > > - * V4L2DeviceTest base class > > + * V4L2VideoDeviceTest base class > > */ > > ret = capture_->open(); > > if (!ret) { > > diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_videodevice/formats.cpp > > similarity index 85% > > rename from test/v4l2_device/formats.cpp > > rename to test/v4l2_videodevice/formats.cpp > > index 6be045ff754c..ee7d357de075 100644 > > --- a/test/v4l2_device/formats.cpp > > +++ b/test/v4l2_videodevice/formats.cpp > > @@ -8,18 +8,18 @@ > > #include <climits> > > #include <iostream> > > > > -#include "v4l2_device.h" > > +#include "v4l2_videodevice.h" > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > using namespace std; > > using namespace libcamera; > > > > -class Format : public V4L2DeviceTest > > +class Format : public V4L2VideoDeviceTest > > { > > public: > > Format() > > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > > protected: > > int run() > > { > > diff --git a/test/v4l2_device/meson.build b/test/v4l2_videodevice/meson.build > > similarity index 74% > > rename from test/v4l2_device/meson.build > > rename to test/v4l2_videodevice/meson.build > > index de540b1ba6f5..76be5e142bb6 100644 > > --- a/test/v4l2_device/meson.build > > +++ b/test/v4l2_videodevice/meson.build > > @@ -1,6 +1,6 @@ > > # Tests are listed in order of complexity. > > # They are not alphabetically sorted. > > -v4l2_device_tests = [ > > +v4l2_videodevice_tests = [ > > [ 'double_open', 'double_open.cpp' ], > > [ 'formats', 'formats.cpp' ], > > [ 'request_buffers', 'request_buffers.cpp' ], > > @@ -9,10 +9,10 @@ v4l2_device_tests = [ > > [ 'buffer_sharing', 'buffer_sharing.cpp' ], > > ] > > > > -foreach t : v4l2_device_tests > > - exe = executable(t[0], [t[1], 'v4l2_device_test.cpp'], > > +foreach t : v4l2_videodevice_tests > > + exe = executable(t[0], [t[1], 'v4l2_videodevice_test.cpp'], > > dependencies : libcamera_dep, > > link_with : test_libraries, > > include_directories : test_includes_internal) > > - test(t[0], exe, suite : 'v4l2_device', is_parallel : false) > > + test(t[0], exe, suite : 'v4l2_videodevice', is_parallel : false) > > endforeach > > diff --git a/test/v4l2_device/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp > > similarity index 77% > > rename from test/v4l2_device/request_buffers.cpp > > rename to test/v4l2_videodevice/request_buffers.cpp > > index 7b7b06b2b409..c4aedf7b3cd6 100644 > > --- a/test/v4l2_device/request_buffers.cpp > > +++ b/test/v4l2_videodevice/request_buffers.cpp > > @@ -5,13 +5,13 @@ > > * libcamera V4L2 API tests > > */ > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > -class RequestBuffersTest : public V4L2DeviceTest > > +class RequestBuffersTest : public V4L2VideoDeviceTest > > { > > public: > > RequestBuffersTest() > > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > > > > protected: > > int run() > > diff --git a/test/v4l2_device/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp > > similarity index 78% > > rename from test/v4l2_device/stream_on_off.cpp > > rename to test/v4l2_videodevice/stream_on_off.cpp > > index b158b8e402c8..7664adc4c1f0 100644 > > --- a/test/v4l2_device/stream_on_off.cpp > > +++ b/test/v4l2_videodevice/stream_on_off.cpp > > @@ -5,13 +5,13 @@ > > * libcamera V4L2 API tests > > */ > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > -class StreamOnStreamOffTest : public V4L2DeviceTest > > +class StreamOnStreamOffTest : public V4L2VideoDeviceTest > > { > > public: > > StreamOnStreamOffTest() > > - : V4L2DeviceTest("vimc", "Raw Capture 0") {} > > + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} > > protected: > > int run() > > { > > diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp > > similarity index 90% > > rename from test/v4l2_device/v4l2_device_test.cpp > > rename to test/v4l2_videodevice/v4l2_videodevice_test.cpp > > index baad48f8aa9e..b26d06ad4519 100644 > > --- a/test/v4l2_device/v4l2_device_test.cpp > > +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp > > @@ -8,7 +8,7 @@ > > #include <iostream> > > #include <sys/stat.h> > > > > -#include "v4l2_device_test.h" > > +#include "v4l2_videodevice_test.h" > > > > #include "device_enumerator.h" > > #include "media_device.h" > > @@ -26,7 +26,7 @@ bool exists(const std::string &path) > > return false; > > } > > > > -int V4L2DeviceTest::init() > > +int V4L2VideoDeviceTest::init() > > { > > enumerator_ = DeviceEnumerator::create(); > > if (!enumerator_) { > > @@ -50,7 +50,7 @@ int V4L2DeviceTest::init() > > if (!entity) > > return TestSkip; > > > > - capture_ = new V4L2Device(entity); > > + capture_ = new V4L2VideoDevice(entity); > > if (!capture_) > > return TestFail; > > > > @@ -77,7 +77,7 @@ int V4L2DeviceTest::init() > > return TestPass; > > } > > > > -void V4L2DeviceTest::cleanup() > > +void V4L2VideoDeviceTest::cleanup() > > { > > capture_->streamOff(); > > capture_->releaseBuffers(); > > diff --git a/test/v4l2_device/v4l2_device_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h > > similarity index 81% > > rename from test/v4l2_device/v4l2_device_test.h > > rename to test/v4l2_videodevice/v4l2_videodevice_test.h > > index 651c005f4e54..3321b5a4f98f 100644 > > --- a/test/v4l2_device/v4l2_device_test.h > > +++ b/test/v4l2_videodevice/v4l2_videodevice_test.h > > @@ -15,14 +15,14 @@ > > > > #include "device_enumerator.h" > > #include "media_device.h" > > -#include "v4l2_device.h" > > +#include "v4l2_videodevice.h" > > > > using namespace libcamera; > > > > -class V4L2DeviceTest : public Test > > +class V4L2VideoDeviceTest : public Test > > { > > public: > > - V4L2DeviceTest(const char *driver, const char *entity) > > + V4L2VideoDeviceTest(const char *driver, const char *entity) > > : driver_(driver), entity_(entity), capture_(nullptr) > > { > > } > > @@ -35,7 +35,7 @@ protected: > > std::string entity_; > > std::unique_ptr<DeviceEnumerator> enumerator_; > > std::shared_ptr<MediaDevice> media_; > > - V4L2Device *capture_; > > + V4L2VideoDevice *capture_; > > BufferPool pool_; > > }; > > > > -- > Regards, > > Laurent Pinchart
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 8f9b42e39339..260a62e9e77e 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -59,7 +59,7 @@ private: friend class BufferPool; friend class PipelineHandler; friend class Request; - friend class V4L2Device; + friend class V4L2VideoDevice; void cancel(); diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_videodevice.h similarity index 86% rename from src/libcamera/include/v4l2_device.h rename to src/libcamera/include/v4l2_videodevice.h index bdecc087fe5a..6ecdb64e5f3c 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_videodevice.h @@ -2,10 +2,10 @@ /* * Copyright (C) 2019, Google Inc. * - * v4l2_device.h - V4L2 Device + * v4l2_videodevice.h - V4L2 Video Device */ -#ifndef __LIBCAMERA_V4L2_DEVICE_H__ -#define __LIBCAMERA_V4L2_DEVICE_H__ +#ifndef __LIBCAMERA_V4L2_VIDEODEVICE_H__ +#define __LIBCAMERA_V4L2_VIDEODEVICE_H__ #include <atomic> #include <string> @@ -111,15 +111,15 @@ public: const std::string toString() const; }; -class V4L2Device : protected Loggable +class V4L2VideoDevice : protected Loggable { public: - explicit V4L2Device(const std::string &deviceNode); - explicit V4L2Device(const MediaEntity *entity); - V4L2Device(const V4L2Device &) = delete; - ~V4L2Device(); + explicit V4L2VideoDevice(const std::string &deviceNode); + explicit V4L2VideoDevice(const MediaEntity *entity); + V4L2VideoDevice(const V4L2VideoDevice &) = delete; + ~V4L2VideoDevice(); - V4L2Device &operator=(const V4L2Device &) = delete; + V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete; int open(); bool isOpen() const; @@ -143,8 +143,8 @@ public: int streamOn(); int streamOff(); - static V4L2Device *fromEntityName(const MediaDevice *media, - const std::string &entity); + static V4L2VideoDevice *fromEntityName(const MediaDevice *media, + const std::string &entity); protected: std::string logPrefix() const; @@ -181,4 +181,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_DEVICE_H__ */ +#endif /* __LIBCAMERA_V4L2_VIDEODEVICE_H__ */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 1ca1083cf5c7..15ab53b1abbe 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -23,8 +23,8 @@ libcamera_sources = files([ 'stream.cpp', 'timer.cpp', 'utils.cpp', - 'v4l2_device.cpp', 'v4l2_subdevice.cpp', + 'v4l2_videodevice.cpp', ]) libcamera_headers = files([ @@ -41,8 +41,8 @@ libcamera_headers = files([ 'include/media_object.h', 'include/pipeline_handler.h', 'include/utils.h', - 'include/v4l2_device.h', 'include/v4l2_subdevice.h', + 'include/v4l2_videodevice.h', ]) libcamera_internal_includes = include_directories('include') diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f2bdecbac20f..1c0a9825b4cd 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -22,8 +22,8 @@ #include "media_device.h" #include "pipeline_handler.h" #include "utils.h" -#include "v4l2_device.h" #include "v4l2_subdevice.h" +#include "v4l2_videodevice.h" namespace libcamera { @@ -39,7 +39,7 @@ public: /* ImgU output descriptor: group data specific to an ImgU output. */ struct ImgUOutput { - V4L2Device *dev; + V4L2VideoDevice *dev; unsigned int pad; std::string name; BufferPool *pool; @@ -85,7 +85,7 @@ public: MediaDevice *media_; V4L2Subdevice *imgu_; - V4L2Device *input_; + V4L2VideoDevice *input_; ImgUOutput output_; ImgUOutput viewfinder_; ImgUOutput stat_; @@ -125,7 +125,7 @@ public: static int mediaBusToFormat(unsigned int code); - V4L2Device *output_; + V4L2VideoDevice *output_; V4L2Subdevice *csi2_; CameraSensor *sensor_; @@ -943,7 +943,7 @@ void IPU3CameraData::cio2BufferReady(Buffer *buffer) * Create and open the V4L2 devices and subdevices of the ImgU instance * with \a index. * - * In case of errors the created V4L2Device and V4L2Subdevice instances + * In case of errors the created V4L2VideoDevice and V4L2Subdevice instances * are destroyed at pipeline handler delete time. * * \return 0 on success or a negative error code otherwise @@ -966,12 +966,12 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) if (ret) return ret; - input_ = V4L2Device::fromEntityName(media, name_ + " input"); + input_ = V4L2VideoDevice::fromEntityName(media, name_ + " input"); ret = input_->open(); if (ret) return ret; - output_.dev = V4L2Device::fromEntityName(media, name_ + " output"); + output_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " output"); ret = output_.dev->open(); if (ret) return ret; @@ -980,8 +980,8 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) output_.name = "output"; output_.pool = &outPool_; - viewfinder_.dev = V4L2Device::fromEntityName(media, - name_ + " viewfinder"); + viewfinder_.dev = V4L2VideoDevice::fromEntityName(media, + name_ + " viewfinder"); ret = viewfinder_.dev->open(); if (ret) return ret; @@ -990,7 +990,7 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index) viewfinder_.name = "viewfinder"; viewfinder_.pool = &vfPool_; - stat_.dev = V4L2Device::fromEntityName(media, name_ + " 3a stat"); + stat_.dev = V4L2VideoDevice::fromEntityName(media, name_ + " 3a stat"); ret = stat_.dev->open(); if (ret) return ret; @@ -1067,7 +1067,7 @@ int ImgUDevice::configureInput(const Size &size, int ImgUDevice::configureOutput(ImgUOutput *output, const StreamConfiguration &cfg) { - V4L2Device *dev = output->dev; + V4L2VideoDevice *dev = output->dev; unsigned int pad = output->pad; V4L2SubdeviceFormat imguFormat = {}; @@ -1337,7 +1337,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) return ret; std::string cio2Name = "ipu3-cio2 " + std::to_string(index); - output_ = V4L2Device::fromEntityName(media, cio2Name); + output_ = V4L2VideoDevice::fromEntityName(media, cio2Name); ret = output_->open(); if (ret) return ret; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 9b3eea2f6dd3..4a5898d25f91 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -23,8 +23,8 @@ #include "media_device.h" #include "pipeline_handler.h" #include "utils.h" -#include "v4l2_device.h" #include "v4l2_subdevice.h" +#include "v4l2_videodevice.h" namespace libcamera { @@ -106,7 +106,7 @@ private: MediaDevice *media_; V4L2Subdevice *dphy_; V4L2Subdevice *isp_; - V4L2Device *video_; + V4L2VideoDevice *video_; Camera *activeCamera_; }; @@ -458,7 +458,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) return false; /* Locate and open the capture video node. */ - video_ = V4L2Device::fromEntityName(media_, "rkisp1_mainpath"); + video_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_mainpath"); if (video_->open() < 0) return false; diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 45260f34c8f5..b0d768628a19 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -14,7 +14,7 @@ #include "media_device.h" #include "pipeline_handler.h" #include "utils.h" -#include "v4l2_device.h" +#include "v4l2_videodevice.h" namespace libcamera { @@ -35,7 +35,7 @@ public: void bufferReady(Buffer *buffer); - V4L2Device *video_; + V4L2VideoDevice *video_; Stream stream_; }; @@ -229,7 +229,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) /* Locate and open the default video node. */ for (MediaEntity *entity : media->entities()) { if (entity->flags() & MEDIA_ENT_FL_DEFAULT) { - data->video_ = new V4L2Device(entity); + data->video_ = new V4L2VideoDevice(entity); break; } } diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index ad4577acd9d6..6833213650dc 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -20,7 +20,7 @@ #include "media_device.h" #include "pipeline_handler.h" #include "utils.h" -#include "v4l2_device.h" +#include "v4l2_videodevice.h" namespace libcamera { @@ -41,7 +41,7 @@ public: void bufferReady(Buffer *buffer); - V4L2Device *video_; + V4L2VideoDevice *video_; Stream stream_; }; @@ -262,7 +262,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) std::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this); /* Locate and open the capture video node. */ - data->video_ = new V4L2Device(media->getEntityByName("Raw Capture 1")); + data->video_ = new V4L2VideoDevice(media->getEntityByName("Raw Capture 1")); if (data->video_->open()) return false; diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index fceee33156e9..6681c1920065 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -44,7 +44,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev) * as the "media bus format", and it is identified by a resolution and a pixel * format identification code, known as the "media bus code", not to be confused * with the fourcc code that identify the format of images when stored in memory - * (see V4L2Device::V4L2DeviceFormat). + * (see V4L2VideoDevice::V4L2DeviceFormat). * * Media Bus formats supported by the V4L2 APIs are described in Section * 4.15.3.4.1 of the "Part I - Video for Linux API" chapter of the "Linux Media diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_videodevice.cpp similarity index 90% rename from src/libcamera/v4l2_device.cpp rename to src/libcamera/v4l2_videodevice.cpp index 0821bd75fb42..8957cf8f97d3 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -2,10 +2,10 @@ /* * Copyright (C) 2019, Google Inc. * - * v4l2_device.cpp - V4L2 Device + * v4l2_videodevice.cpp - V4L2 Video Device */ -#include "v4l2_device.h" +#include "v4l2_videodevice.h" #include <fcntl.h> #include <iomanip> @@ -25,8 +25,8 @@ #include "media_object.h" /** - * \file v4l2_device.h - * \brief V4L2 Device API + * \file v4l2_videodevice.h + * \brief V4L2 Video Device API */ namespace libcamera { @@ -243,8 +243,8 @@ const std::string V4L2DeviceFormat::toString() const } /** - * \class V4L2Device - * \brief V4L2Device object and API + * \class V4L2VideoDevice + * \brief V4L2VideoDevice object and API * * The V4L2 Device API class models an instance of a V4L2 device node. * It is constructed with the path to a V4L2 video device node. The device node @@ -257,7 +257,7 @@ const std::string V4L2DeviceFormat::toString() const * No API call other than open(), isOpen() and close() shall be called on an * unopened device instance. * - * The V4L2Device class tracks queued buffers and handles buffer events. It + * The V4L2VideoDevice class tracks queued buffers and handles buffer events. It * automatically dequeues completed buffers and emits the \ref bufferReady * signal. * @@ -266,10 +266,10 @@ const std::string V4L2DeviceFormat::toString() const */ /** - * \brief Construct a V4L2Device + * \brief Construct a V4L2VideoDevice * \param[in] deviceNode The file-system path to the video device node */ -V4L2Device::V4L2Device(const std::string &deviceNode) +V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode) : deviceNode_(deviceNode), fd_(-1), bufferPool_(nullptr), queuedBuffersCount_(0), fdEvent_(nullptr) { @@ -282,17 +282,17 @@ V4L2Device::V4L2Device(const std::string &deviceNode) } /** - * \brief Construct a V4L2Device from a MediaEntity + * \brief Construct a V4L2VideoDevice from a MediaEntity * \param[in] entity The MediaEntity to build the device from * - * Construct a V4L2Device from a MediaEntity's device node path. + * Construct a V4L2VideoDevice from a MediaEntity's device node path. */ -V4L2Device::V4L2Device(const MediaEntity *entity) - : V4L2Device(entity->deviceNode()) +V4L2VideoDevice::V4L2VideoDevice(const MediaEntity *entity) + : V4L2VideoDevice(entity->deviceNode()) { } -V4L2Device::~V4L2Device() +V4L2VideoDevice::~V4L2VideoDevice() { close(); } @@ -301,7 +301,7 @@ V4L2Device::~V4L2Device() * \brief Open a V4L2 device and query its capabilities * \return 0 on success or a negative error code otherwise */ -int V4L2Device::open() +int V4L2VideoDevice::open() { int ret; @@ -362,7 +362,7 @@ int V4L2Device::open() return -EINVAL; } - fdEvent_->activated.connect(this, &V4L2Device::bufferAvailable); + fdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable); fdEvent_->setEnabled(false); return 0; @@ -372,7 +372,7 @@ int V4L2Device::open() * \brief Check if device is successfully opened * \return True if the device is open, false otherwise */ -bool V4L2Device::isOpen() const +bool V4L2VideoDevice::isOpen() const { return fd_ != -1; } @@ -380,7 +380,7 @@ bool V4L2Device::isOpen() const /** * \brief Close the device, releasing any resources acquired by open() */ -void V4L2Device::close() +void V4L2VideoDevice::close() { if (fd_ < 0) return; @@ -393,30 +393,30 @@ void V4L2Device::close() } /** - * \fn V4L2Device::driverName() + * \fn V4L2VideoDevice::driverName() * \brief Retrieve the name of the V4L2 device driver * \return The string containing the driver name */ /** - * \fn V4L2Device::deviceName() + * \fn V4L2VideoDevice::deviceName() * \brief Retrieve the name of the V4L2 device * \return The string containing the device name */ /** - * \fn V4L2Device::busName() + * \fn V4L2VideoDevice::busName() * \brief Retrieve the location of the device in the system * \return The string containing the device location */ /** - * \fn V4L2Device::deviceNode() + * \fn V4L2VideoDevice::deviceNode() * \brief Retrieve the video device node path * \return The video device device node path */ -std::string V4L2Device::logPrefix() const +std::string V4L2VideoDevice::logPrefix() const { return deviceNode_ + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]"); } @@ -426,7 +426,7 @@ std::string V4L2Device::logPrefix() const * \param[out] format The image format applied on the device * \return 0 on success or a negative error code otherwise */ -int V4L2Device::getFormat(V4L2DeviceFormat *format) +int V4L2VideoDevice::getFormat(V4L2DeviceFormat *format) { if (caps_.isMeta()) return getFormatMeta(format); @@ -441,11 +441,11 @@ int V4L2Device::getFormat(V4L2DeviceFormat *format) * \param[inout] format The image format to apply to the device * * Apply the supplied \a format to the device, and return the actually - * applied format parameters, as \ref V4L2Device::getFormat would do. + * applied format parameters, as \ref V4L2VideoDevice::getFormat would do. * * \return 0 on success or a negative error code otherwise */ -int V4L2Device::setFormat(V4L2DeviceFormat *format) +int V4L2VideoDevice::setFormat(V4L2DeviceFormat *format) { if (caps_.isMeta()) return setFormatMeta(format); @@ -455,7 +455,7 @@ int V4L2Device::setFormat(V4L2DeviceFormat *format) return setFormatSingleplane(format); } -int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) +int V4L2VideoDevice::getFormatMeta(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; @@ -479,7 +479,7 @@ int V4L2Device::getFormatMeta(V4L2DeviceFormat *format) return 0; } -int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) +int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_meta_format *pix = &v4l2Format.fmt.meta; @@ -509,7 +509,7 @@ int V4L2Device::setFormatMeta(V4L2DeviceFormat *format) return 0; } -int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) +int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; @@ -536,7 +536,7 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) return 0; } -int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) +int V4L2VideoDevice::setFormatMultiplane(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; @@ -577,7 +577,7 @@ int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) return 0; } -int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) +int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; @@ -601,7 +601,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) return 0; } -int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) +int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format) { struct v4l2_format v4l2Format = {}; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; @@ -634,7 +634,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) return 0; } -int V4L2Device::requestBuffers(unsigned int count) +int V4L2VideoDevice::requestBuffers(unsigned int count) { struct v4l2_requestbuffers rb = {}; int ret; @@ -663,7 +663,7 @@ int V4L2Device::requestBuffers(unsigned int count) * \param[out] pool BufferPool to populate with buffers * \return 0 on success or a negative error code otherwise */ -int V4L2Device::exportBuffers(BufferPool *pool) +int V4L2VideoDevice::exportBuffers(BufferPool *pool) { unsigned int allocatedBuffers; unsigned int i; @@ -677,7 +677,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) allocatedBuffers = ret; if (allocatedBuffers < pool->count()) { - LOG(V4L2, Error) << "Not enough buffers provided by V4L2Device"; + LOG(V4L2, Error) + << "Not enough buffers provided by V4L2VideoDevice"; requestBuffers(0); return -ENOMEM; } @@ -731,8 +732,8 @@ int V4L2Device::exportBuffers(BufferPool *pool) return 0; } -int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, - unsigned int length) +int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex, + unsigned int length) { struct v4l2_exportbuffer expbuf = {}; int ret; @@ -768,7 +769,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex, * \param[in] pool BufferPool of buffers to import * \return 0 on success or a negative error code otherwise */ -int V4L2Device::importBuffers(BufferPool *pool) +int V4L2VideoDevice::importBuffers(BufferPool *pool) { unsigned int allocatedBuffers; int ret; @@ -782,7 +783,7 @@ int V4L2Device::importBuffers(BufferPool *pool) allocatedBuffers = ret; if (allocatedBuffers < pool->count()) { LOG(V4L2, Error) - << "Not enough buffers provided by V4L2Device"; + << "Not enough buffers provided by V4L2VideoDevice"; requestBuffers(0); return -ENOMEM; } @@ -796,7 +797,7 @@ int V4L2Device::importBuffers(BufferPool *pool) /** * \brief Release all internally allocated buffers */ -int V4L2Device::releaseBuffers() +int V4L2VideoDevice::releaseBuffers() { LOG(V4L2, Debug) << "Releasing bufferPool"; @@ -816,7 +817,7 @@ int V4L2Device::releaseBuffers() * * \return 0 on success or a negative error code otherwise */ -int V4L2Device::queueBuffer(Buffer *buffer) +int V4L2VideoDevice::queueBuffer(Buffer *buffer) { struct v4l2_buffer buf = {}; struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; @@ -877,7 +878,7 @@ int V4L2Device::queueBuffer(Buffer *buffer) * * \return A pointer to the dequeued buffer on success, or nullptr otherwise */ -Buffer *V4L2Device::dequeueBuffer() +Buffer *V4L2VideoDevice::dequeueBuffer() { struct v4l2_buffer buf = {}; struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; @@ -926,7 +927,7 @@ Buffer *V4L2Device::dequeueBuffer() * For Capture devices the Buffer will contain valid data. * For Output devices the Buffer can be considered empty. */ -void V4L2Device::bufferAvailable(EventNotifier *notifier) +void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier) { Buffer *buffer = dequeueBuffer(); if (!buffer) @@ -939,7 +940,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) } /** - * \var V4L2Device::bufferReady + * \var V4L2VideoDevice::bufferReady * \brief A Signal emitted when a buffer completes */ @@ -947,7 +948,7 @@ void V4L2Device::bufferAvailable(EventNotifier *notifier) * \brief Start the video stream * \return 0 on success or a negative error code otherwise */ -int V4L2Device::streamOn() +int V4L2VideoDevice::streamOn() { int ret; @@ -970,7 +971,7 @@ int V4L2Device::streamOn() * * \return 0 on success or a negative error code otherwise */ -int V4L2Device::streamOff() +int V4L2VideoDevice::streamOff() { int ret; @@ -997,16 +998,16 @@ int V4L2Device::streamOff() * Releasing memory of the newly created instance is responsibility of the * caller of this function. * - * \return A newly created V4L2Device on success, nullptr otherwise + * \return A newly created V4L2VideoDevice on success, nullptr otherwise */ -V4L2Device *V4L2Device::fromEntityName(const MediaDevice *media, - const std::string &entity) +V4L2VideoDevice *V4L2VideoDevice::fromEntityName(const MediaDevice *media, + const std::string &entity) { MediaEntity *mediaEntity = media->getEntityByName(entity); if (!mediaEntity) return nullptr; - return new V4L2Device(mediaEntity); + return new V4L2VideoDevice(mediaEntity); } } /* namespace libcamera */ diff --git a/test/meson.build b/test/meson.build index 609aeab80e7d..82b29d8dc7eb 100644 --- a/test/meson.build +++ b/test/meson.build @@ -4,8 +4,8 @@ subdir('camera') subdir('ipa') subdir('media_device') subdir('pipeline') -subdir('v4l2_device') subdir('v4l2_subdevice') +subdir('v4l2_videodevice') public_tests = [ ['event', 'event.cpp'], diff --git a/test/v4l2_device/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp similarity index 90% rename from test/v4l2_device/buffer_sharing.cpp rename to test/v4l2_videodevice/buffer_sharing.cpp index e63ddff85689..1bc478fe8f8e 100644 --- a/test/v4l2_device/buffer_sharing.cpp +++ b/test/v4l2_videodevice/buffer_sharing.cpp @@ -4,8 +4,8 @@ * * libcamera V4L2 API tests * - * Validate the function of exporting buffers from a V4L2Device and - * the ability to import them to another V4L2Device instance. + * Validate the function of exporting buffers from a V4L2VideoDevice and + * the ability to import them to another V4L2VideoDevice instance. * Ensure that the Buffers can successfully be queued and dequeued * between both devices. */ @@ -17,19 +17,19 @@ #include <libcamera/event_dispatcher.h> #include <libcamera/timer.h> -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" -class BufferSharingTest : public V4L2DeviceTest +class BufferSharingTest : public V4L2VideoDeviceTest { public: BufferSharingTest() - : V4L2DeviceTest("vivid", "vivid-000-vid-cap"), + : V4L2VideoDeviceTest("vivid", "vivid-000-vid-cap"), output_(nullptr), framesCaptured_(0), framesOutput_(0) {} protected: int init() { - int ret = V4L2DeviceTest::init(); + int ret = V4L2VideoDeviceTest::init(); if (ret) return ret; @@ -38,7 +38,7 @@ protected: if (!entity) return TestSkip; - output_ = new V4L2Device(entity); + output_ = new V4L2VideoDevice(entity); if (!output_) { std::cout << "Failed to create output device" << std::endl; return TestFail; @@ -171,13 +171,13 @@ protected: delete output_; - V4L2DeviceTest::cleanup(); + V4L2VideoDeviceTest::cleanup(); } private: const unsigned int bufferCount = 4; - V4L2Device *output_; + V4L2VideoDevice *output_; unsigned int framesCaptured_; unsigned int framesOutput_; diff --git a/test/v4l2_device/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp similarity index 91% rename from test/v4l2_device/capture_async.cpp rename to test/v4l2_videodevice/capture_async.cpp index 69b1d5a13ed8..cea4fffbf7a5 100644 --- a/test/v4l2_device/capture_async.cpp +++ b/test/v4l2_videodevice/capture_async.cpp @@ -12,13 +12,13 @@ #include <iostream> -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" -class CaptureAsyncTest : public V4L2DeviceTest +class CaptureAsyncTest : public V4L2VideoDeviceTest { public: CaptureAsyncTest() - : V4L2DeviceTest("vimc", "Raw Capture 0"), frames(0) {} + : V4L2VideoDeviceTest("vimc", "Raw Capture 0"), frames(0) {} void receiveBuffer(Buffer *buffer) { diff --git a/test/v4l2_device/double_open.cpp b/test/v4l2_videodevice/double_open.cpp similarity index 75% rename from test/v4l2_device/double_open.cpp rename to test/v4l2_videodevice/double_open.cpp index 53850620889b..5768d4043d0b 100644 --- a/test/v4l2_device/double_open.cpp +++ b/test/v4l2_videodevice/double_open.cpp @@ -7,15 +7,15 @@ #include <iostream> -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" namespace { -class DoubleOpen : public V4L2DeviceTest +class DoubleOpen : public V4L2VideoDeviceTest { public: DoubleOpen() - : V4L2DeviceTest("vimc", "Raw Capture 0") {} + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} protected: int run() { @@ -23,7 +23,7 @@ protected: /* * Expect failure: The device has already been opened by the - * V4L2DeviceTest base class + * V4L2VideoDeviceTest base class */ ret = capture_->open(); if (!ret) { diff --git a/test/v4l2_device/formats.cpp b/test/v4l2_videodevice/formats.cpp similarity index 85% rename from test/v4l2_device/formats.cpp rename to test/v4l2_videodevice/formats.cpp index 6be045ff754c..ee7d357de075 100644 --- a/test/v4l2_device/formats.cpp +++ b/test/v4l2_videodevice/formats.cpp @@ -8,18 +8,18 @@ #include <climits> #include <iostream> -#include "v4l2_device.h" +#include "v4l2_videodevice.h" -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" using namespace std; using namespace libcamera; -class Format : public V4L2DeviceTest +class Format : public V4L2VideoDeviceTest { public: Format() - : V4L2DeviceTest("vimc", "Raw Capture 0") {} + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} protected: int run() { diff --git a/test/v4l2_device/meson.build b/test/v4l2_videodevice/meson.build similarity index 74% rename from test/v4l2_device/meson.build rename to test/v4l2_videodevice/meson.build index de540b1ba6f5..76be5e142bb6 100644 --- a/test/v4l2_device/meson.build +++ b/test/v4l2_videodevice/meson.build @@ -1,6 +1,6 @@ # Tests are listed in order of complexity. # They are not alphabetically sorted. -v4l2_device_tests = [ +v4l2_videodevice_tests = [ [ 'double_open', 'double_open.cpp' ], [ 'formats', 'formats.cpp' ], [ 'request_buffers', 'request_buffers.cpp' ], @@ -9,10 +9,10 @@ v4l2_device_tests = [ [ 'buffer_sharing', 'buffer_sharing.cpp' ], ] -foreach t : v4l2_device_tests - exe = executable(t[0], [t[1], 'v4l2_device_test.cpp'], +foreach t : v4l2_videodevice_tests + exe = executable(t[0], [t[1], 'v4l2_videodevice_test.cpp'], dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) - test(t[0], exe, suite : 'v4l2_device', is_parallel : false) + test(t[0], exe, suite : 'v4l2_videodevice', is_parallel : false) endforeach diff --git a/test/v4l2_device/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp similarity index 77% rename from test/v4l2_device/request_buffers.cpp rename to test/v4l2_videodevice/request_buffers.cpp index 7b7b06b2b409..c4aedf7b3cd6 100644 --- a/test/v4l2_device/request_buffers.cpp +++ b/test/v4l2_videodevice/request_buffers.cpp @@ -5,13 +5,13 @@ * libcamera V4L2 API tests */ -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" -class RequestBuffersTest : public V4L2DeviceTest +class RequestBuffersTest : public V4L2VideoDeviceTest { public: RequestBuffersTest() - : V4L2DeviceTest("vimc", "Raw Capture 0") {} + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} protected: int run() diff --git a/test/v4l2_device/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp similarity index 78% rename from test/v4l2_device/stream_on_off.cpp rename to test/v4l2_videodevice/stream_on_off.cpp index b158b8e402c8..7664adc4c1f0 100644 --- a/test/v4l2_device/stream_on_off.cpp +++ b/test/v4l2_videodevice/stream_on_off.cpp @@ -5,13 +5,13 @@ * libcamera V4L2 API tests */ -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" -class StreamOnStreamOffTest : public V4L2DeviceTest +class StreamOnStreamOffTest : public V4L2VideoDeviceTest { public: StreamOnStreamOffTest() - : V4L2DeviceTest("vimc", "Raw Capture 0") {} + : V4L2VideoDeviceTest("vimc", "Raw Capture 0") {} protected: int run() { diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp similarity index 90% rename from test/v4l2_device/v4l2_device_test.cpp rename to test/v4l2_videodevice/v4l2_videodevice_test.cpp index baad48f8aa9e..b26d06ad4519 100644 --- a/test/v4l2_device/v4l2_device_test.cpp +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp @@ -8,7 +8,7 @@ #include <iostream> #include <sys/stat.h> -#include "v4l2_device_test.h" +#include "v4l2_videodevice_test.h" #include "device_enumerator.h" #include "media_device.h" @@ -26,7 +26,7 @@ bool exists(const std::string &path) return false; } -int V4L2DeviceTest::init() +int V4L2VideoDeviceTest::init() { enumerator_ = DeviceEnumerator::create(); if (!enumerator_) { @@ -50,7 +50,7 @@ int V4L2DeviceTest::init() if (!entity) return TestSkip; - capture_ = new V4L2Device(entity); + capture_ = new V4L2VideoDevice(entity); if (!capture_) return TestFail; @@ -77,7 +77,7 @@ int V4L2DeviceTest::init() return TestPass; } -void V4L2DeviceTest::cleanup() +void V4L2VideoDeviceTest::cleanup() { capture_->streamOff(); capture_->releaseBuffers(); diff --git a/test/v4l2_device/v4l2_device_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h similarity index 81% rename from test/v4l2_device/v4l2_device_test.h rename to test/v4l2_videodevice/v4l2_videodevice_test.h index 651c005f4e54..3321b5a4f98f 100644 --- a/test/v4l2_device/v4l2_device_test.h +++ b/test/v4l2_videodevice/v4l2_videodevice_test.h @@ -15,14 +15,14 @@ #include "device_enumerator.h" #include "media_device.h" -#include "v4l2_device.h" +#include "v4l2_videodevice.h" using namespace libcamera; -class V4L2DeviceTest : public Test +class V4L2VideoDeviceTest : public Test { public: - V4L2DeviceTest(const char *driver, const char *entity) + V4L2VideoDeviceTest(const char *driver, const char *entity) : driver_(driver), entity_(entity), capture_(nullptr) { } @@ -35,7 +35,7 @@ protected: std::string entity_; std::unique_ptr<DeviceEnumerator> enumerator_; std::shared_ptr<MediaDevice> media_; - V4L2Device *capture_; + V4L2VideoDevice *capture_; BufferPool pool_; };