Skip to content

Commit

Permalink
Refactor nuttx v4l2
Browse files Browse the repository at this point in the history
Adjust the v4l2 framework to support both capture and v4l2m2m,
and can easily add other v4l2 features.

Signed-off-by: shizhenghui <[email protected]>
  • Loading branch information
shizhenghui committed Mar 11, 2024
1 parent bf10c49 commit 9e206c9
Show file tree
Hide file tree
Showing 8 changed files with 2,986 additions and 2,245 deletions.
6 changes: 3 additions & 3 deletions boards/sim/sim/sim/src/sim_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <nuttx/serial/uart_rpmsg.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/video/fb.h>
#include <nuttx/video/video.h>
#include <nuttx/video/v4l2_cap.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/wireless/pktradio.h>
#include <nuttx/wireless/bluetooth/bt_null.h>
Expand Down Expand Up @@ -300,10 +300,10 @@ int sim_bringup(void)

sim_camera_initialize();

ret = video_initialize(CONFIG_SIM_CAMERA_DEV_PATH);
ret = capture_initialize(CONFIG_SIM_CAMERA_DEV_PATH);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: video_initialize() failed: %d\n", ret);
syslog(LOG_ERR, "ERROR: capture_initialize() failed: %d\n", ret);
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(CONFIG_DRIVERS_VIDEO)
endif()

if(CONFIG_VIDEO_STREAM)
list(APPEND SRCS video.c video_framebuff.c)
list(APPEND SRCS v4l2_core.c video_framebuff.c v4l2_cap.c)
endif()

# These video drivers depend on I2C support
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ifeq ($(CONFIG_VIDEO_FB),y)
endif

ifeq ($(CONFIG_VIDEO_STREAM),y)
CSRCS += video.c video_framebuff.c
CSRCS += v4l2_core.c video_framebuff.c v4l2_cap.c
endif

# These video drivers depend on I2C support
Expand Down
6 changes: 2 additions & 4 deletions drivers/video/goldfish_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <nuttx/video/imgsensor.h>
#include <nuttx/video/imgdata.h>
#include <nuttx/video/video.h>
#include <nuttx/video/v4l2_cap.h>

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -779,10 +780,7 @@ int goldfish_camera_initialize(void)
snprintf(devpath, sizeof(devpath), "/dev/video%zd", i);
}

video_register(devpath,
&priv[i]->data,
&sensor,
1);
capture_register(devpath, &priv[i]->data, &sensor, 1);
}

return 0;
Expand Down
Loading

0 comments on commit 9e206c9

Please sign in to comment.