v4l2: camera: Handle memory mapping of buffers directly
In the upcoming FrameBuffer API the memory mapping of buffers will be left to the user of the FrameBuffer objects. Prepare the V4L2 compatibility layer to this upcoming change to ease conversion to the new API. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
35ac23dca1
commit
3c4b872443
5 changed files with 30 additions and 15 deletions
|
@ -121,12 +121,6 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *V4L2Camera::mmap(unsigned int index)
|
||||
{
|
||||
Stream *stream = *camera_->streams().begin();
|
||||
return stream->buffers()[index].planes()[0].mem();
|
||||
}
|
||||
|
||||
int V4L2Camera::allocBuffers(unsigned int count)
|
||||
{
|
||||
int ret = camera_->allocateBuffers();
|
||||
|
@ -138,6 +132,12 @@ void V4L2Camera::freeBuffers()
|
|||
camera_->freeBuffers();
|
||||
}
|
||||
|
||||
FileDescriptor V4L2Camera::getBufferFd(unsigned int index)
|
||||
{
|
||||
Stream *stream = *camera_->streams().begin();
|
||||
return FileDescriptor(stream->buffers()[index].planes()[0].dmabuf());
|
||||
}
|
||||
|
||||
int V4L2Camera::streamOn()
|
||||
{
|
||||
if (isRunning_)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue