libcamera: pipeline: extend pipelines to support stream configuration
All streams which are to be used for capture need to be configured at the same time. This allows the pipeline handler to take any dependencies between the different streams and their configuration into account when setting up the hardware. Extend the pipeline API and all pipeline implementations with two new functions, one to read a default configuration and one to set a new configuration. Both functions operate on a group of streams which the pipeline handler should consider when performing the operations. In the current implemented pipelines this is rather easy as they only have one stream each per camera. Furthermore as there is yet no way for the pipeline handlers to interact with the hardware all they do is return a null format, log that a default configuration has been requested and log that a new configuration has been set. Future work based on more components are needed to make the pipelines return a good default format and actually interact with the hardware. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
75476f86d2
commit
0d913813b5
5 changed files with 144 additions and 0 deletions
|
@ -9,17 +9,26 @@
|
|||
#include <libcamera/stream.h>
|
||||
|
||||
#include "device_enumerator.h"
|
||||
#include "log.h"
|
||||
#include "media_device.h"
|
||||
#include "pipeline_handler.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
LOG_DEFINE_CATEGORY(VIMC)
|
||||
|
||||
class PipeHandlerVimc : public PipelineHandler
|
||||
{
|
||||
public:
|
||||
PipeHandlerVimc(CameraManager *manager);
|
||||
~PipeHandlerVimc();
|
||||
|
||||
std::map<Stream *, StreamConfiguration>
|
||||
streamConfiguration(Camera *camera,
|
||||
std::vector<Stream *> &streams) override;
|
||||
int configureStreams(Camera *camera,
|
||||
std::map<Stream *, StreamConfiguration> &config) override;
|
||||
|
||||
bool match(DeviceEnumerator *enumerator);
|
||||
|
||||
private:
|
||||
|
@ -38,6 +47,32 @@ PipeHandlerVimc::~PipeHandlerVimc()
|
|||
media_->release();
|
||||
}
|
||||
|
||||
std::map<Stream *, StreamConfiguration>
|
||||
PipeHandlerVimc::streamConfiguration(Camera *camera,
|
||||
std::vector<Stream *> &streams)
|
||||
{
|
||||
std::map<Stream *, StreamConfiguration> configs;
|
||||
|
||||
StreamConfiguration config{};
|
||||
|
||||
LOG(VIMC, Info) << "TODO: Return a good default format";
|
||||
|
||||
configs[&stream_] = config;
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
int PipeHandlerVimc::configureStreams(Camera *camera,
|
||||
std::map<Stream *, StreamConfiguration> &config)
|
||||
{
|
||||
StreamConfiguration *cfg = &config[&stream_];
|
||||
|
||||
LOG(VIMC, Info) << "TODO: Configure the camera for resolution "
|
||||
<< cfg->width << "x" << cfg->height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)
|
||||
{
|
||||
DeviceMatch dm("vimc");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue