device: make device_open_buffer_list_capture
to use buffer_format_t
This commit is contained in:
parent
71a88f3fc2
commit
2e9718fea7
@ -68,8 +68,8 @@ buffer_list_t *camera_configure_decoder(camera_t *camera, buffer_list_t *src_cap
|
||||
|
||||
buffer_list_t *decoder_output = device_open_buffer_list_output(
|
||||
camera->decoder, src_capture);
|
||||
buffer_list_t *decoder_capture = device_open_buffer_list_capture(
|
||||
camera->decoder, NULL, decoder_output, 0, 0, chosen_format, true);
|
||||
buffer_list_t *decoder_capture = device_open_buffer_list_capture2(
|
||||
camera->decoder, NULL, decoder_output, chosen_format, true);
|
||||
|
||||
if (getenv("CAMERA_DECODER_DEBUG")) {
|
||||
camera_capture_add_callbacks(camera, decoder_capture, decoder_debug_callbacks);
|
||||
|
@ -16,8 +16,8 @@ buffer_list_t *camera_configure_isp(camera_t *camera, buffer_list_t *src_capture
|
||||
|
||||
buffer_list_t *isp_output = device_open_buffer_list_output(
|
||||
camera->isp, src_capture);
|
||||
buffer_list_t *isp_capture = device_open_buffer_list_capture(
|
||||
camera->isp, "/dev/video14", isp_output, 0, 0, V4L2_PIX_FMT_YUYV, true);
|
||||
buffer_list_t *isp_capture = device_open_buffer_list_capture2(
|
||||
camera->isp, "/dev/video14", isp_output, V4L2_PIX_FMT_YUYV, true);
|
||||
|
||||
camera_capture_add_output(camera, src_capture, isp_output);
|
||||
|
||||
|
@ -104,7 +104,7 @@ int camera_configure_output(camera_t *camera, const char *name, unsigned target_
|
||||
*device = device_v4l2_open(name, device_info->path);
|
||||
|
||||
buffer_list_t *output = device_open_buffer_list_output(*device, src_capture);
|
||||
buffer_list_t *capture = device_open_buffer_list_capture(*device, NULL, output, 0, 0, chosen_format, true);
|
||||
buffer_list_t *capture = device_open_buffer_list_capture2(*device, NULL, output, chosen_format, true);
|
||||
|
||||
if (!capture) {
|
||||
return -1;
|
||||
|
@ -40,9 +40,15 @@ buffer_list_t *camera_try_rescaller(camera_t *camera, buffer_list_t *src_capture
|
||||
|
||||
buffer_list_t *rescaller_output = device_open_buffer_list_output(
|
||||
device, src_capture);
|
||||
|
||||
buffer_format_t target_fmt = {
|
||||
.width = target_width,
|
||||
.height = target_height,
|
||||
.format = target_format
|
||||
};
|
||||
|
||||
buffer_list_t *rescaller_capture = device_open_buffer_list_capture(
|
||||
device, NULL, rescaller_output,
|
||||
target_width, target_height, target_format, true);
|
||||
device, NULL, rescaller_output, target_fmt, true);
|
||||
|
||||
if (!rescaller_capture) {
|
||||
device_close(device);
|
||||
|
@ -125,25 +125,33 @@ buffer_list_t *device_open_buffer_list_output(device_t *dev, buffer_list_t *capt
|
||||
do_mmap);
|
||||
}
|
||||
|
||||
buffer_list_t *device_open_buffer_list_capture(device_t *dev, const char *path, buffer_list_t *output_list, unsigned width, unsigned height, unsigned format, bool do_mmap)
|
||||
buffer_list_t *device_open_buffer_list_capture(device_t *dev, const char *path, buffer_list_t *output_list, buffer_format_t fmt, bool do_mmap)
|
||||
{
|
||||
if (!dev || !output_list) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer_format_t fmt = output_list->fmt;
|
||||
|
||||
if (width)
|
||||
fmt.width = width;
|
||||
if (height)
|
||||
fmt.height = height;
|
||||
fmt.format = format;
|
||||
fmt.bytesperline = 0;
|
||||
fmt.sizeimage = 0;
|
||||
if (!fmt.width)
|
||||
fmt.width = output_list->fmt.width;
|
||||
if (!fmt.height)
|
||||
fmt.height = output_list->fmt.height;
|
||||
if (!fmt.nbufs)
|
||||
fmt.nbufs = output_list->fmt.nbufs;
|
||||
if (!fmt.interval_us)
|
||||
fmt.interval_us = output_list->fmt.interval_us;
|
||||
|
||||
return device_open_buffer_list2(dev, path, true, fmt, do_mmap);
|
||||
}
|
||||
|
||||
buffer_list_t *device_open_buffer_list_capture2(device_t *dev, const char *path, buffer_list_t *output_list, unsigned choosen_format, bool do_mmap)
|
||||
{
|
||||
buffer_format_t fmt = {
|
||||
.format = choosen_format
|
||||
};
|
||||
|
||||
return device_open_buffer_list_capture(dev, path, output_list, fmt, do_mmap);
|
||||
}
|
||||
|
||||
int device_set_stream(device_t *dev, bool do_on)
|
||||
{
|
||||
// TODO: support events
|
||||
|
@ -61,7 +61,8 @@ void device_close(device_t *dev);
|
||||
buffer_list_t *device_open_buffer_list(device_t *dev, bool do_capture, buffer_format_t fmt, bool do_mmap);
|
||||
buffer_list_t *device_open_buffer_list2(device_t *dev, const char *path, bool do_capture, buffer_format_t fmt, bool do_mmap);
|
||||
buffer_list_t *device_open_buffer_list_output(device_t *dev, buffer_list_t *capture_list);
|
||||
buffer_list_t *device_open_buffer_list_capture(device_t *dev, const char *path, buffer_list_t *output_list, unsigned width, unsigned height, unsigned format, bool do_mmap);
|
||||
buffer_list_t *device_open_buffer_list_capture(device_t *dev, const char *path, buffer_list_t *output_list, buffer_format_t fmt, bool do_mmap);
|
||||
buffer_list_t *device_open_buffer_list_capture2(device_t *dev, const char *path, buffer_list_t *output_list, unsigned choosen_format, bool do_mmap);
|
||||
int device_consume_event(device_t *dev);
|
||||
|
||||
int device_set_stream(device_t *dev, bool do_on);
|
||||
|
Loading…
x
Reference in New Issue
Block a user