@@ -16,13 +16,11 @@
#include "libcamera/internal/formats.h"
#include "libcamera/internal/log.h"
+#include "libcamera/internal/v4l2_subdevice.h"
namespace libcamera {
class MediaEntity;
-class V4L2Subdevice;
-
-struct V4L2SubdeviceFormat;
struct CameraSensorInfo {
std::string model;
@@ -75,7 +73,7 @@ private:
std::string model_;
- ImageFormats<uint32_t> formats_;
+ V4L2Subdevice::Formats formats_;
Size resolution_;
std::vector<unsigned int> mbusCodes_;
std::vector<Size> sizes_;
@@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat {
class V4L2Subdevice : public V4L2Device
{
public:
+ using Formats = ImageFormats<uint32_t>;
+
enum Whence {
ActiveFormat,
TryFormat,
@@ -51,7 +53,7 @@ public:
int setSelection(unsigned int pad, unsigned int target,
Rectangle *rect);
- ImageFormats<uint32_t> formats(unsigned int pad);
+ Formats formats(unsigned int pad);
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format,
Whence whence = ActiveFormat);
@@ -217,6 +217,12 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const
* any device left open will be closed, and any resources released.
*/
+/**
+ * \typedef V4L2Subdevice::Formats
+ * \brief An ImageFormats specialization mapping uint32_t media bus codes to
+ * image resolutions
+ */
+
/**
* \enum V4L2Subdevice::Whence
* \brief Specify the type of format for getFormat() and setFormat() operations
@@ -340,9 +346,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
*
* \return A list of the supported device formats
*/
-ImageFormats<uint32_t> V4L2Subdevice::formats(unsigned int pad)
+V4L2Subdevice::Formats V4L2Subdevice::formats(unsigned int pad)
{
- ImageFormats<uint32_t> formats;
+ Formats formats;
if (pad >= entity_->pads().size()) {
LOG(V4L2, Error) << "Invalid pad: " << pad;
@@ -47,7 +47,7 @@ void ListFormatsTest::printFormats(unsigned int pad,
int ListFormatsTest::run()
{
/* List all formats available on existing "Scaler" pads. */
- ImageFormats<uint32_t> formats;
+ V4L2Subdevice::Formats formats;
formats = scaler_->formats(0);
if (formats.isEmpty()) {