Age | Commit message (Collapse) | Author |
|
Set the compressed flag in ENUM_FMT if the format is MJPEG. As the only
compressed format that libcamera currently supports is MJPEG, this
should be sufficient.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
|
|
Now that libcamera has the V4L2 format names, retrieve and report those
names in ENUM_FMT. While at it, refactor the code slightly with
PixelFormatInfo.
This fixes the test failures on v4l2-compliance with the v4l2
compatilibity layer that were observed in version v4l2-compliance
version 1.21.0-4838.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
|
|
Some applications (like Firefox) run open() many times on video device
nodes. This may lead to user confusion when they see "INFO V4L2Compat
v4l2_compat_manager.cpp:146 No camera found for /dev/videoX" over and
over again.
Lower the log level to debug so that we can still get this information
on debug, and so users won't see it all the time.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The V4L2 compatibility layer supports the single-planar API only, and
thus exposes /* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* v4l2_camera.h - V4L2 compatibility camera
*/
#ifndef __V4L2_CAMERA_H__
#define __V4L2_CAMERA_H__
#include <deque>
#include <mutex>
#include <utility>
#include <libcamera/buffer.h>
#include <libcamera/camera.h>
#include <libcamera/file_descriptor.h>
#include <libcamera/framebuffer_allocator.h>
#include "libcamera/internal/semaphore.h"
using namespace libcamera;
class V4L2Camera
{
public:
struct Buffer {
Buffer(unsigned int index, const FrameMetadata &data)
: index(index), data(data)
{
}
unsigned int index;
FrameMetadata data;
};
V4L2Camera(std::shared_ptr<Camera> camera);
~V4L2Camera();
int open();
void close();
void bind(int efd);
void unbind();
void getStreamConfig(StreamConfiguration *streamConfig);
std::vector<Buffer> completedBuffers();
int configure(StreamConfiguration *streamConfigOut,
const Size &size, const PixelFormat &pixelformat,
unsigned int bufferCount);
int validateConfiguration(const PixelFormat &pixelformat,
const Size &size,
StreamConfiguration *streamConfigOut);
int allocBuffers(unsigned int count);
void freeBuffers();
FileDescriptor getBufferFd(unsigned int index);
int streamOn();
int streamOff();
int qbuf(unsigned int index);
void waitForBufferAvailable();
bool isBufferAvailable();
bool isRunning();
private:
void requestComplete(Request *request);
std::shared_ptr<Camera> camera_;
std::unique_ptr<CameraConfiguration> config_;
bool isRunning_;
std::mutex bufferLock_;
FrameBufferAllocator *bufferAllocator_;
std::deque<std::unique_ptr<Request>> pendingRequests_;
std::deque<std::unique_ptr<Buffer>> completedBuffers_;
int efd_;
Mutex bufferMutex_;
std::condition_variable bufferCV_;
unsigned int bufferAvailableCount_;
};
#endif /* __V4L2_CAMERA_H__ */
|