Add write_yuv

This commit is contained in:
Kamil Trzcinski 2022-04-05 10:10:29 +02:00
parent d3d7453b26
commit d2676b8abd
2 changed files with 17 additions and 3 deletions

View File

@ -10,6 +10,8 @@
extern bool check_streaming();
void write_yuvu(buffer_t *buffer);
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, 0, camera->nbufs) < 0) {
@ -60,9 +62,9 @@ int camera_configure_srgb_isp(camera_t *camera, bool use_half)
if (use_half) {
*links++ = (link_t){ camera->isp.isp_yuuv, { } };
*links++ = (link_t){ camera->isp.isp_yuuv_low, { camera->codec_jpeg, camera->codec_h264 } };
*links++ = (link_t){ camera->isp.isp_yuuv_low, { camera->codec_jpeg, camera->codec_h264 }, { write_yuvu } };
} else {
*links++ = (link_t){ camera->isp.isp_yuuv, { camera->codec_jpeg, camera->codec_h264 } };
*links++ = (link_t){ camera->isp.isp_yuuv, { camera->codec_jpeg, camera->codec_h264 }, { write_yuvu } };
}
*links++ = (link_t){ camera->codec_jpeg, { }, { http_jpeg_capture, http_jpeg_needs_buffer } };

View File

@ -10,6 +10,18 @@
extern bool check_streaming();
void write_yuvu(buffer_t *buffer)
{
#if 1
FILE *fp = fopen("/tmp/capture-yuyv.raw.tmp", "wb");
if (fp) {
fwrite(buffer->start, 1, buffer->used, fp);
fclose(fp);
}
rename("/tmp/capture-yuyv.raw.tmp", "/tmp/capture-yuyv.raw");
#endif
}
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, 0, camera->nbufs) < 0) {
@ -42,7 +54,7 @@ int camera_configure_srgb_legacy_isp(camera_t *camera)
link_t *links = camera->links;
*links++ = (link_t){ camera->camera, { camera->legacy_isp.isp }, { NULL, check_streaming } };
*links++ = (link_t){ camera->legacy_isp.isp, { camera->codec_jpeg, camera->codec_h264 } };
*links++ = (link_t){ camera->legacy_isp.isp, { camera->codec_jpeg, camera->codec_h264 }, { write_yuvu, NULL } };
*links++ = (link_t){ camera->codec_jpeg, { }, { http_jpeg_capture, http_jpeg_needs_buffer } };
*links++ = (link_t){ camera->codec_h264, { }, { http_h264_capture, http_h264_needs_buffer } };
return 0;