libcamera: v4l2_subdevice: Add V4L2Subdevice::Route structure
The V4L2Subdevice class deals with streams in two places: - In routing tables, streams as expressed as a pad number and a stream number in a v4l2_subdev_route instance. - In the format and selection get and set functions, streams as expressed using the Stream structure, which binds the pad number and stream number. Expressing streams in different ways requires pipeline handlers and other helpers to convert between the two representations. This isn't much of an issue yet as libcamera has little stream-aware code, but it is expected to increasingly become a burden. To simplify the API, introduce a V4L2Subdevice::Route structure that mimicks the kernel v4l2_subdev_route structure but represents streams as V4L2Subdevice::Stream instances. This will improve seamless integration of routes, formats and selection rectangles. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
e8f01b37e8
commit
c5a8152af2
4 changed files with 123 additions and 26 deletions
|
@ -95,7 +95,23 @@ public:
|
|||
unsigned int stream;
|
||||
};
|
||||
|
||||
using Routing = std::vector<struct v4l2_subdev_route>;
|
||||
struct Route {
|
||||
Route()
|
||||
: flags(0)
|
||||
{
|
||||
}
|
||||
|
||||
Route(const Stream &snk, const Stream &src, uint32_t f)
|
||||
: sink(snk), source(src), flags(f)
|
||||
{
|
||||
}
|
||||
|
||||
Stream sink;
|
||||
Stream source;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
using Routing = std::vector<Route>;
|
||||
|
||||
explicit V4L2Subdevice(const MediaEntity *entity);
|
||||
~V4L2Subdevice();
|
||||
|
@ -174,6 +190,7 @@ static inline bool operator!=(const V4L2Subdevice::Stream &lhs,
|
|||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Stream &stream);
|
||||
std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Route &route);
|
||||
std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Routing &routing);
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue