Add bytesperline
This commit is contained in:
parent
f52a991459
commit
d3d7453b26
@ -12,7 +12,7 @@ extern bool check_streaming();
|
|||||||
|
|
||||||
int camera_configure_srgb_isp(camera_t *camera, bool use_half)
|
int camera_configure_srgb_isp(camera_t *camera, bool use_half)
|
||||||
{
|
{
|
||||||
if (device_open_buffer_list(camera->camera, true, camera->width, camera->height, V4L2_PIX_FMT_SRGGB10P, camera->nbufs) < 0) {
|
if (device_open_buffer_list(camera->camera, true, camera->width, camera->height, V4L2_PIX_FMT_SRGGB10P, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,15 +23,15 @@ int camera_configure_srgb_isp(camera_t *camera, bool use_half)
|
|||||||
camera->codec_jpeg = device_open("JPEG", "/dev/video31");
|
camera->codec_jpeg = device_open("JPEG", "/dev/video31");
|
||||||
camera->codec_h264 = device_open("H264", "/dev/video11");
|
camera->codec_h264 = device_open("H264", "/dev/video11");
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->isp.isp_srgb, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->isp.isp_srgb, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->isp.isp_yuuv, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_YUYV, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->isp.isp_yuuv, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_YUYV, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_half) {
|
if (use_half) {
|
||||||
camera->isp.isp_yuuv_low = device_open("ISP-YUUV-LOW", "/dev/video15");
|
camera->isp.isp_yuuv_low = device_open("ISP-YUUV-LOW", "/dev/video15");
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->isp.isp_yuuv_low, true, src->fmt_width / 2, src->fmt_height / 2, V4L2_PIX_FMT_YUYV, camera->nbufs) < 0) {
|
if (device_open_buffer_list(camera->isp.isp_yuuv_low, true, src->fmt_width / 2, src->fmt_height / 2, V4L2_PIX_FMT_YUYV, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +40,13 @@ int camera_configure_srgb_isp(camera_t *camera, bool use_half)
|
|||||||
src = camera->isp.isp_yuuv->capture_list;
|
src = camera->isp.isp_yuuv->capture_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->codec_jpeg, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->codec_jpeg, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->codec_jpeg, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_JPEG, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->codec_jpeg, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_JPEG, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->codec_h264, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->codec_h264, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->codec_h264, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_H264, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->codec_h264, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_H264, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ extern bool check_streaming();
|
|||||||
|
|
||||||
int camera_configure_srgb_legacy_isp(camera_t *camera)
|
int camera_configure_srgb_legacy_isp(camera_t *camera)
|
||||||
{
|
{
|
||||||
if (device_open_buffer_list(camera->camera, true, camera->width, camera->height, V4L2_PIX_FMT_SRGGB10P, camera->nbufs) < 0) {
|
if (device_open_buffer_list(camera->camera, true, camera->width, camera->height, V4L2_PIX_FMT_SRGGB10P, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,20 +22,20 @@ int camera_configure_srgb_legacy_isp(camera_t *camera)
|
|||||||
camera->codec_jpeg = device_open("JPEG", "/dev/video31");
|
camera->codec_jpeg = device_open("JPEG", "/dev/video31");
|
||||||
camera->codec_h264 = device_open("H264", "/dev/video11");
|
camera->codec_h264 = device_open("H264", "/dev/video11");
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->legacy_isp.isp, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->legacy_isp.isp, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->legacy_isp.isp, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_YUYV, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->legacy_isp.isp, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_YUYV, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
src = camera->legacy_isp.isp->capture_list;
|
src = camera->legacy_isp.isp->capture_list;
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->codec_jpeg, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->codec_jpeg, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->codec_jpeg, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_JPEG, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->codec_jpeg, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_JPEG, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_open_buffer_list(camera->codec_h264, false, src->fmt_width, src->fmt_height, src->fmt_format, camera->nbufs) < 0 ||
|
if (device_open_buffer_list(camera->codec_h264, false, src->fmt_width, src->fmt_height, src->fmt_format, src->fmt_bytesperline, camera->nbufs) < 0 ||
|
||||||
device_open_buffer_list(camera->codec_h264, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_H264, camera->nbufs) < 0) {
|
device_open_buffer_list(camera->codec_h264, true, src->fmt_width, src->fmt_height, V4L2_PIX_FMT_H264, 0, camera->nbufs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void buffer_list_close(buffer_list_t *buf_list)
|
|||||||
free(buf_list);
|
free(buf_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
int buffer_list_set_format(buffer_list_t *buf_list, unsigned width, unsigned height, unsigned format)
|
int buffer_list_set_format(buffer_list_t *buf_list, unsigned width, unsigned height, unsigned format, unsigned bytesperline)
|
||||||
{
|
{
|
||||||
struct v4l2_format *fmt = &buf_list->v4l2_format;
|
struct v4l2_format *fmt = &buf_list->v4l2_format;
|
||||||
|
|
||||||
@ -120,9 +120,13 @@ retry:
|
|||||||
fourcc_to_string(fmt->fmt.pix.pixelformat).buf);
|
fourcc_to_string(fmt->fmt.pix.pixelformat).buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
E_LOG_INFO(buf_list, "Using: %ux%u/%s",
|
E_LOG_INFO(
|
||||||
fmt->fmt.pix.width, fmt->fmt.pix.height, fourcc_to_string(fmt->fmt.pix.pixelformat).buf);
|
buf_list,
|
||||||
|
"Using: %ux%u/%s, bytesperline=%d",
|
||||||
|
fmt->fmt.pix.width, fmt->fmt.pix.height,
|
||||||
|
fourcc_to_string(fmt->fmt.pix.pixelformat).buf,
|
||||||
|
fmt->fmt.pix.bytesperline
|
||||||
|
);
|
||||||
|
|
||||||
buf_list->fmt_width = fmt->fmt.pix.width;
|
buf_list->fmt_width = fmt->fmt.pix.width;
|
||||||
buf_list->fmt_height = fmt->fmt.pix.height;
|
buf_list->fmt_height = fmt->fmt.pix.height;
|
||||||
|
@ -15,7 +15,7 @@ typedef struct buffer_list_s {
|
|||||||
bool do_dma;
|
bool do_dma;
|
||||||
bool do_capture;
|
bool do_capture;
|
||||||
|
|
||||||
unsigned fmt_width, fmt_height, fmt_format;
|
unsigned fmt_width, fmt_height, fmt_format, fmt_bytesperline;
|
||||||
|
|
||||||
bool streaming;
|
bool streaming;
|
||||||
int frames;
|
int frames;
|
||||||
@ -24,7 +24,7 @@ typedef struct buffer_list_s {
|
|||||||
buffer_list_t *buffer_list_open(const char *name, struct device_s *dev, unsigned type, bool do_mmap);
|
buffer_list_t *buffer_list_open(const char *name, struct device_s *dev, unsigned type, bool do_mmap);
|
||||||
void buffer_list_close(buffer_list_t *buf_list);
|
void buffer_list_close(buffer_list_t *buf_list);
|
||||||
|
|
||||||
int buffer_list_set_format(buffer_list_t *buffer_list, unsigned width, unsigned height, unsigned format);
|
int buffer_list_set_format(buffer_list_t *buffer_list, unsigned width, unsigned height, unsigned format, unsigned bytesperline);
|
||||||
int buffer_list_request(buffer_list_t *buf_list, int nbufs);
|
int buffer_list_request(buffer_list_t *buf_list, int nbufs);
|
||||||
|
|
||||||
int buffer_list_stream(buffer_list_t *buf_list, bool do_on);
|
int buffer_list_stream(buffer_list_t *buf_list, bool do_on);
|
||||||
|
@ -49,7 +49,7 @@ void device_close(device_t *dev) {
|
|||||||
free(dev);
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsigned height, unsigned format, int nbufs)
|
int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsigned height, unsigned format, unsigned bytesperline, int nbufs)
|
||||||
{
|
{
|
||||||
unsigned type;
|
unsigned type;
|
||||||
char name[64];
|
char name[64];
|
||||||
@ -101,7 +101,7 @@ int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsi
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer_list_set_format(*buf_list, width, height, format) < 0) {
|
if (buffer_list_set_format(*buf_list, width, height, format, bytesperline) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ typedef struct device_s {
|
|||||||
device_t *device_open(const char *name, const char *path);
|
device_t *device_open(const char *name, const char *path);
|
||||||
void device_close(device_t *device);
|
void device_close(device_t *device);
|
||||||
|
|
||||||
int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsigned height, unsigned format, int nbufs);
|
int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsigned height, unsigned format, unsigned bytesperline, int nbufs);
|
||||||
int device_consume_event(device_t *device);
|
int device_consume_event(device_t *device);
|
||||||
|
|
||||||
int device_stream(device_t *dev, bool do_on);
|
int device_stream(device_t *dev, bool do_on);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user