Register buffer_lock as a global output

This commit is contained in:
Kamil Trzcinski
2022-09-03 11:04:37 +02:00
parent 3c818772d1
commit 5031cd99f6
12 changed files with 128 additions and 108 deletions

View File

@ -3,6 +3,7 @@
#include "device/device.h"
#include "device/device_list.h"
#include "device/buffer_list.h"
#include "device/buffer_lock.h"
#include "device/links.h"
#include "util/opts/log.h"
#include "util/opts/fourcc.h"
@ -82,6 +83,10 @@ void camera_capture_set_callbacks(camera_t *camera, buffer_list_t *capture, link
{
link_t *link = camera_ensure_capture(camera, capture);
link->callbacks = callbacks;
if (callbacks.buf_lock) {
callbacks.buf_lock->buf_list = capture;
}
}
int camera_set_params(camera_t *camera)

View File

@ -18,8 +18,8 @@ static const char *jpeg_names[2] = {
};
static link_callbacks_t jpeg_callbacks[2] = {
{ "JPEG-CAPTURE", http_jpeg_capture, http_jpeg_needs_buffer },
{ "JPEG-LOW-CAPTURE", http_jpeg_lowres_capture, http_jpeg_needs_buffer }
{ .name = "JPEG-CAPTURE", .buf_lock = &http_jpeg },
{ .name = "JPEG-LOW-CAPTURE", .buf_lock = &http_jpeg_lowres }
};
static const char *h264_names[2] = {
@ -27,26 +27,9 @@ static const char *h264_names[2] = {
"H264-LOW"
};
static void h264_capture(buffer_t *buf)
{
http_h264_capture(buf);
rtsp_h264_capture(buf);
}
static void h264_lowres_capture(buffer_t *buf)
{
http_h264_lowres_capture(buf);
rtsp_h264_low_res_capture(buf);
}
static bool h264_needs_buffer()
{
return http_h264_needs_buffer() | rtsp_h264_needs_buffer();
}
static link_callbacks_t h264_callbacks[2] = {
{ "H264-CAPTURE", h264_capture, h264_needs_buffer },
{ "H264-LOW-CAPTURE", h264_lowres_capture, h264_needs_buffer }
{ .name = "H264-CAPTURE", .buf_lock = &http_h264 },
{ .name = "H264-LOW-CAPTURE", .buf_lock = &http_h264_lowres }
};
static int camera_configure_h264_output(camera_t *camera, buffer_list_t *src_capture, int res)