sim/camera: add AVFoundation backend and multi-cam support#18745
sim/camera: add AVFoundation backend and multi-cam support#18745PeterBee97 wants to merge 6 commits intoapache:masterfrom
Conversation
acassis
left a comment
There was a problem hiding this comment.
@PeterBee97 WOW! Amazing! Please update the nxcamera Documentation/ to include this new parameter: https://nuttx.apache.org/docs/latest/applications/system/nxcamera/index.html
|
@PeterBee97 please include this picture in the Documentation page, it is funny :-) |
d0fdb9c to
1131750
Compare
As u wish :) |
1131750 to
f1c856b
Compare
| char resolved_path[PATH_MAX]; | ||
| int ret; | ||
|
|
||
| ret = host_video_resolve_device_path(host_video_dev_path, resolved_path, |
There was a problem hiding this comment.
why not call host_video_is_capture_device directly
There was a problem hiding this comment.
Because I wanted to filter-out non-capture video device. For now I have two cameras connected, but 4 video devices under /dev in host. I intentionally mapped /dev/video0 and /dev/video2 on host to /dev/video0 and /dev/video1 in NuttX. Is this behavior desired or do you prefer mapping directly without changing numbers?
|
|
||
| fd = open(host_video_dev_path, O_RDWR | O_NONBLOCK); | ||
| if (fd < 0) | ||
| ret = host_video_resolve_device_path(host_video_dev_path, resolved_path, |
There was a problem hiding this comment.
why not call open with host_video_dev_path directly
There was a problem hiding this comment.
Same reason as above. I wanted to map dev numbers without "holes".
acassis
left a comment
There was a problem hiding this comment.
@PeterBee97 Amazing! Thank you very much!
f1c856b to
c2ea6da
Compare
|
Hi @PeterBee97 please fix |
6b24b6b to
6ae23c9
Compare
| static FAR struct imgsensor_s **g_capture_registered_sensor = NULL; | ||
| static size_t g_capture_registered_sensor_num; | ||
| static FAR struct imgdata_s *g_capture_data = NULL; | ||
| static FAR struct imgdata_s **g_capture_registered_data = NULL; |
There was a problem hiding this comment.
move the common change to new patch
|
|
||
| # Add dummy.c to ensure that we have at least one object. | ||
| # On some platforms like macOS, we can't create an empty archive. | ||
| ifeq ($(strip $(ASRCS) $(CSRCS)),) |
|
|
||
| snprintf(devpath, sizeof(devpath), "%s%d", | ||
| CONFIG_SIM_CAMERA_DEV_PATH, i); | ||
| ret = capture_initialize(devpath); |
There was a problem hiding this comment.
it's betterr to call capture_register if you want to support multiple camera
| return -EINVAL; | ||
| } | ||
|
|
||
| return avf_try_format(vdev->backend, width, height, fmt, denom, numer); |
There was a problem hiding this comment.
why not let arch/sim/src/sim/macos/sim_host_avfoundation_backend.m implement host_video_xxx and remove avf_xxx directly
Add dummy.c so video can build an archive even when there are no other objects (e.g. on macOS). Signed-off-by: bijunda <bijunda@bytedance.com>
Move common v4l2 capture framework changes to a standalone commit. Signed-off-by: bijunda <bijunda@bytedance.com>
Allow the SIM camera/V4L2 capture framework to manage multiple imgdata instances with dynamic mounting. This avoids cross-talk between camera streams when multiple devices are used. Signed-off-by: Peter Bee <bijunda@bytedance.com>
Adapt the macOS AVFoundation backend for multi-device discovery, camera index mapping and capture startup compatibility. This enables reliable use of multiple cameras through the SIM camera framework. Signed-off-by: Peter Bee <bijunda@bytedance.com>
/Library/Developer/CommandLineTools/usr/bin/c++filt: error: unknown argument '-[' Signed-off-by: Peter Bee <bijunda@bytedance.com>
Document the nxcamera command usage, including device selection, resolution, and pixel format options. Also mention recent support for multi-instance camera mounting and the macOS AVFoundation backend on the SIM platform. Signed-off-by: Peter Bee <bijunda@bytedance.com>
6ae23c9 to
c07e073
Compare
Summary
Add AVFoundation backend and multi-cam support, enabling macOS users as well as Linux users to use multiple cameras on Simulator.
Impact
mkallsymshost-tool behavior for Objective-C symbols on macOSTesting
Tested on:
sim:nxcamera