mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-26 01:55:51 +03:00
libcamera: pipeline: Cast to derived pipeline handler with helpers
Replace manual static casts from the PipelineHandler pointer to a derived class pointer with helper functions in the camera data classes. This simplifies code accessing the pipeline from the camera data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
034b5d3699
commit
cb63fc75fb
2 changed files with 17 additions and 13 deletions
|
@ -87,6 +87,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PipelineHandlerRkISP1 *pipe();
|
||||||
int loadIPA(unsigned int hwRevision);
|
int loadIPA(unsigned int hwRevision);
|
||||||
|
|
||||||
Stream mainPathStream_;
|
Stream mainPathStream_;
|
||||||
|
@ -304,6 +305,11 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PipelineHandlerRkISP1 *RkISP1CameraData::pipe()
|
||||||
|
{
|
||||||
|
return static_cast<PipelineHandlerRkISP1 *>(Camera::Private::pipe());
|
||||||
|
}
|
||||||
|
|
||||||
int RkISP1CameraData::loadIPA(unsigned int hwRevision)
|
int RkISP1CameraData::loadIPA(unsigned int hwRevision)
|
||||||
{
|
{
|
||||||
ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);
|
ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);
|
||||||
|
@ -332,8 +338,7 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ipa::rkisp1::ActionParamFilled: {
|
case ipa::rkisp1::ActionParamFilled: {
|
||||||
PipelineHandlerRkISP1 *pipe =
|
PipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();
|
||||||
static_cast<PipelineHandlerRkISP1 *>(this->pipe());
|
|
||||||
RkISP1FrameInfo *info = frameInfo_.find(frame);
|
RkISP1FrameInfo *info = frameInfo_.find(frame);
|
||||||
if (!info)
|
if (!info)
|
||||||
break;
|
break;
|
||||||
|
@ -360,9 +365,6 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,
|
||||||
|
|
||||||
void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)
|
void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)
|
||||||
{
|
{
|
||||||
PipelineHandlerRkISP1 *pipe =
|
|
||||||
static_cast<PipelineHandlerRkISP1 *>(this->pipe());
|
|
||||||
|
|
||||||
RkISP1FrameInfo *info = frameInfo_.find(frame);
|
RkISP1FrameInfo *info = frameInfo_.find(frame);
|
||||||
if (!info)
|
if (!info)
|
||||||
return;
|
return;
|
||||||
|
@ -370,7 +372,7 @@ void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &meta
|
||||||
info->request->metadata().merge(metadata);
|
info->request->metadata().merge(metadata);
|
||||||
info->metadataProcessed = true;
|
info->metadataProcessed = true;
|
||||||
|
|
||||||
pipe->tryCompleteRequest(info->request);
|
pipe()->tryCompleteRequest(info->request);
|
||||||
}
|
}
|
||||||
|
|
||||||
RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,
|
RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,
|
||||||
|
|
|
@ -155,6 +155,7 @@ public:
|
||||||
MediaEntity *sensor);
|
MediaEntity *sensor);
|
||||||
|
|
||||||
bool isValid() const { return sensor_ != nullptr; }
|
bool isValid() const { return sensor_ != nullptr; }
|
||||||
|
SimplePipelineHandler *pipe();
|
||||||
|
|
||||||
int init();
|
int init();
|
||||||
int setupLinks();
|
int setupLinks();
|
||||||
|
@ -352,11 +353,14 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
|
||||||
[](const Entity &e) { return e.entity->name(); });
|
[](const Entity &e) { return e.entity->name(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SimplePipelineHandler *SimpleCameraData::pipe()
|
||||||
|
{
|
||||||
|
return static_cast<SimplePipelineHandler *>(Camera::Private::pipe());
|
||||||
|
}
|
||||||
|
|
||||||
int SimpleCameraData::init()
|
int SimpleCameraData::init()
|
||||||
{
|
{
|
||||||
SimplePipelineHandler *pipe =
|
SimpleConverter *converter = pipe()->converter();
|
||||||
static_cast<SimplePipelineHandler *>(this->pipe());
|
|
||||||
SimpleConverter *converter = pipe->converter();
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -480,8 +484,7 @@ int SimpleCameraData::setupLinks()
|
||||||
int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
|
int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
|
||||||
V4L2Subdevice::Whence whence)
|
V4L2Subdevice::Whence whence)
|
||||||
{
|
{
|
||||||
SimplePipelineHandler *pipe =
|
SimplePipelineHandler *pipe = SimpleCameraData::pipe();
|
||||||
static_cast<SimplePipelineHandler *>(this->pipe());
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -582,8 +585,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust the requested streams. */
|
/* Adjust the requested streams. */
|
||||||
SimplePipelineHandler *pipe = static_cast<SimplePipelineHandler *>(data_->pipe());
|
SimpleConverter *converter = data_->pipe()->converter();
|
||||||
SimpleConverter *converter = pipe->converter();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable usage of the converter when producing multiple streams, as
|
* Enable usage of the converter when producing multiple streams, as
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue