libcamera: v4l2_subdevice: Implement ENUM_FRAME_SIZES
Implement format and size enumeration methods to list all the available subdevice image resolutions and formats. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -17,6 +17,18 @@ struct Rectangle {
|
||||
unsigned int h;
|
||||
};
|
||||
|
||||
struct SizeRange {
|
||||
SizeRange(unsigned int minW, unsigned int minH,
|
||||
unsigned int maxW, unsigned int maxH)
|
||||
: minWidth(minW), minHeight(minH), maxWidth(maxW),
|
||||
maxHeight(maxH) {}
|
||||
|
||||
unsigned int minWidth;
|
||||
unsigned int minHeight;
|
||||
unsigned int maxWidth;
|
||||
unsigned int maxHeight;
|
||||
};
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
#endif /* __LIBCAMERA_GEOMETRY_H__ */
|
||||
|
||||
@@ -7,15 +7,16 @@
|
||||
#ifndef __LIBCAMERA_V4L2_SUBDEVICE_H__
|
||||
#define __LIBCAMERA_V4L2_SUBDEVICE_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "geometry.h"
|
||||
#include "log.h"
|
||||
#include "media_object.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
struct Rectangle;
|
||||
|
||||
struct V4L2SubdeviceFormat {
|
||||
uint32_t mbus_code;
|
||||
uint32_t width;
|
||||
@@ -39,6 +40,9 @@ public:
|
||||
int setCrop(unsigned int pad, Rectangle *rect);
|
||||
int setCompose(unsigned int pad, Rectangle *rect);
|
||||
|
||||
const std::map<unsigned int, std::vector<SizeRange>>
|
||||
formats(unsigned int pad);
|
||||
|
||||
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format);
|
||||
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format);
|
||||
|
||||
@@ -46,6 +50,9 @@ protected:
|
||||
std::string logPrefix() const;
|
||||
|
||||
private:
|
||||
int enumPadSizes(unsigned int pad, unsigned int code,
|
||||
std::vector<SizeRange> *size);
|
||||
|
||||
int setSelection(unsigned int pad, unsigned int target,
|
||||
Rectangle *rect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user