Make buffer_list_t *device_open_buffer_list
to return buffer_list
This commit is contained in:
@ -72,7 +72,7 @@ int camera_run(camera_t *camera);
|
||||
|
||||
int camera_configure_v4l2(camera_t *camera);
|
||||
int camera_configure_libcamera(camera_t *camera);
|
||||
int camera_configure_isp(camera_t *camera, float high_div, float low_div);
|
||||
int camera_configure_legacy_isp(camera_t *camera, float div);
|
||||
int camera_configure_direct(camera_t *camera);
|
||||
int camera_configure_decoder(camera_t *camera);
|
||||
int camera_configure_isp(camera_t *camera, buffer_list_t *src, float high_div, float low_div);
|
||||
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src, float div);
|
||||
int camera_configure_direct(camera_t *camera, buffer_list_t *src);
|
||||
int camera_configure_decoder(camera_t *camera, buffer_list_t *src);
|
||||
|
@ -9,9 +9,8 @@
|
||||
#include "device/buffer_list.h"
|
||||
#include "http/http.h"
|
||||
|
||||
int camera_configure_decoder(camera_t *camera)
|
||||
int camera_configure_decoder(camera_t *camera, buffer_list_t *camera_src)
|
||||
{
|
||||
buffer_list_t *camera_src = camera->camera->capture_list;
|
||||
buffer_list_t *src = camera_src;
|
||||
device_video_force_key(camera->camera);
|
||||
|
||||
|
@ -9,10 +9,8 @@
|
||||
#include "device/buffer_list.h"
|
||||
#include "http/http.h"
|
||||
|
||||
int camera_configure_direct(camera_t *camera)
|
||||
int camera_configure_direct(camera_t *camera, buffer_list_t *src)
|
||||
{
|
||||
buffer_list_t *src = camera->camera->capture_list;
|
||||
|
||||
camera->codec_jpeg = device_v4l2_open("JPEG", "/dev/video31");
|
||||
camera->codec_h264 = device_v4l2_open("H264", "/dev/video11");
|
||||
|
||||
|
@ -11,24 +11,24 @@
|
||||
|
||||
void write_yuvu(buffer_t *buffer);
|
||||
|
||||
int camera_configure_isp(camera_t *camera, float high_div, float low_div)
|
||||
int camera_configure_isp(camera_t *camera, buffer_list_t *src, float high_div, float low_div)
|
||||
{
|
||||
camera->isp_srgb = device_v4l2_open("ISP", "/dev/video13");
|
||||
camera->isp_yuuv = device_v4l2_open("ISP-YUUV", "/dev/video14");
|
||||
camera->codec_jpeg = device_v4l2_open("JPEG", "/dev/video31");
|
||||
camera->codec_h264 = device_v4l2_open("H264", "/dev/video11");
|
||||
|
||||
if (device_open_buffer_list_output(camera->isp_srgb, camera->camera->capture_list) < 0 ||
|
||||
device_open_buffer_list_capture(camera->isp_yuuv, camera->camera->capture_list, high_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
if (device_open_buffer_list_output(camera->isp_srgb, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->isp_yuuv, camera->isp_srgb->output_list, high_div, V4L2_PIX_FMT_YUYV, true) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
camera->isp_yuuv->output_device = camera->isp_srgb;
|
||||
|
||||
link_t *links = camera->links;
|
||||
*links++ = (link_t){ camera->camera->capture_list, { camera->isp_srgb->output_list } };
|
||||
*links++ = (link_t){ src, { camera->isp_srgb->output_list } };
|
||||
|
||||
buffer_list_t *src = camera->isp_yuuv->capture_list;
|
||||
src = camera->isp_yuuv->capture_list;
|
||||
|
||||
if (device_open_buffer_list_output(camera->codec_jpeg, src) < 0 ||
|
||||
device_open_buffer_list_capture(camera->codec_jpeg, src, 1.0, V4L2_PIX_FMT_JPEG, true) < 0) {
|
||||
|
@ -21,10 +21,8 @@ void write_yuvu(buffer_t *buffer)
|
||||
#endif
|
||||
}
|
||||
|
||||
int camera_configure_legacy_isp(camera_t *camera, float div)
|
||||
int camera_configure_legacy_isp(camera_t *camera, buffer_list_t *src, float div)
|
||||
{
|
||||
buffer_list_t *src = camera->camera->capture_list;
|
||||
|
||||
camera->legacy_isp = device_v4l2_open("ISP", "/dev/video12");
|
||||
camera->codec_jpeg = device_v4l2_open("JPEG", "/dev/video31");
|
||||
camera->codec_h264 = device_v4l2_open("H264", "/dev/video11");
|
||||
|
@ -16,16 +16,17 @@ int camera_configure_libcamera(camera_t *camera)
|
||||
|
||||
camera->camera->opts.allow_dma = camera->options.allow_dma;
|
||||
|
||||
if (device_open_buffer_list(camera->camera, true, camera->options.width / camera->options.high_res_factor, camera->options.height / camera->options.high_res_factor, camera->options.format, 0, camera->options.nbufs, true) < 0) {
|
||||
buffer_list_t *src = device_open_buffer_list(camera->camera, true, camera->options.width / camera->options.high_res_factor, camera->options.height / camera->options.high_res_factor, camera->options.format, 0, camera->options.nbufs, true);
|
||||
if (!src) {
|
||||
goto error;
|
||||
}
|
||||
camera->camera->capture_list->do_timestamps = true;
|
||||
src->do_timestamps = true;
|
||||
|
||||
if (camera->options.fps > 0) {
|
||||
camera->camera->capture_list->fmt.interval_us = 1000 * 1000 / camera->options.fps;
|
||||
src->fmt.interval_us = 1000 * 1000 / camera->options.fps;
|
||||
}
|
||||
|
||||
if (camera_configure_direct(camera) < 0) {
|
||||
if (camera_configure_direct(camera, src) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -21,16 +21,17 @@ int camera_configure_v4l2(camera_t *camera)
|
||||
camera->camera->opts.allow_dma = false;
|
||||
}
|
||||
|
||||
if (device_open_buffer_list(camera->camera, true, camera->options.width, camera->options.height, camera->options.format, 0, camera->options.nbufs, true) < 0) {
|
||||
buffer_list_t *src = device_open_buffer_list(camera->camera, true, camera->options.width, camera->options.height, camera->options.format, 0, camera->options.nbufs, true);
|
||||
if (!src) {
|
||||
goto error;
|
||||
}
|
||||
camera->camera->capture_list->do_timestamps = true;
|
||||
src->do_timestamps = true;
|
||||
|
||||
if (camera->options.fps > 0) {
|
||||
camera->camera->capture_list->fmt.interval_us = 1000 * 1000 / camera->options.fps;
|
||||
src->fmt.interval_us = 1000 * 1000 / camera->options.fps;
|
||||
}
|
||||
|
||||
switch (camera->camera->capture_list->fmt.format) {
|
||||
switch (src->fmt.format) {
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
case V4L2_PIX_FMT_YVYU:
|
||||
case V4L2_PIX_FMT_VYUY:
|
||||
@ -38,25 +39,25 @@ int camera_configure_v4l2(camera_t *camera)
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
case V4L2_PIX_FMT_RGB565:
|
||||
case V4L2_PIX_FMT_RGB24:
|
||||
if (camera_configure_direct(camera) < 0) {
|
||||
if (camera_configure_direct(camera, src) < 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_MJPEG:
|
||||
case V4L2_PIX_FMT_H264:
|
||||
if (camera_configure_decoder(camera) < 0) {
|
||||
if (camera_configure_decoder(camera, src) < 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_SRGGB10P:
|
||||
#if 1
|
||||
if (camera_configure_isp(camera, camera->options.high_res_factor, camera->options.low_res_factor) < 0) {
|
||||
if (camera_configure_isp(camera, src, camera->options.high_res_factor, camera->options.low_res_factor) < 0) {
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
if (camera_configure_legacy_isp(camera, camera->options.high_res_factor) < 0) {
|
||||
if (camera_configure_legacy_isp(camera, src, camera->options.high_res_factor) < 0) {
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
@ -64,7 +65,7 @@ int camera_configure_v4l2(camera_t *camera)
|
||||
|
||||
default:
|
||||
LOG_ERROR(camera, "Unsupported camera format=%s",
|
||||
fourcc_to_string(camera->camera->capture_list->fmt.format).buf);
|
||||
fourcc_to_string(src->fmt.format).buf);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user