-
Notifications
You must be signed in to change notification settings - Fork 1.6k
sim/camera: add AVFoundation backend and multi-cam support #18745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PeterBee97
wants to merge
5
commits into
apache:master
Choose a base branch
from
PeterBee97:avfoundation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b98f3b0
video: ensure video library is non-empty
e36f529
sim: support camera framework multi-instance and dynamic mounting
97cc23f
sim: adapt macos avfoundation backend for camera indexing and capture
a0cb989
sim: fix mkallsyms for Objective-C symbols on macOS
60bdeaf
Documentation: add nxcamera documentation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,111 @@ | ||
| ============================================ | ||
| ``nxcamera`` NxCamera video test application | ||
| ============================================ | ||
| ============================================= | ||
| ``nxcamera`` Camera/Video Stream Test Command | ||
| ============================================= | ||
|
|
||
| Introduction | ||
| ============ | ||
|
|
||
| ``nxcamera`` is a command-line utility for testing camera devices and video | ||
| stream capture in NuttX. It is built on top of the NuttX video subsystem | ||
| (using a V4L2-style interface) and is typically used to: | ||
|
|
||
| - Enumerate and open video device nodes such as ``/dev/video0`` and | ||
| ``/dev/video1`` | ||
| - Configure capture parameters including resolution and pixel format | ||
| - Capture video frames for validation, debugging, or simple data dumping, | ||
| depending on platform support and build configuration | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| ``nxcamera`` is an interactive command-line program. Start it from NSH, then | ||
| enter commands at the ``nxcamera>`` prompt: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nsh> nxcamera | ||
| nxcamera> | ||
|
|
||
| Tip: Execute NSH Commands (Hidden) | ||
| ================================== | ||
|
|
||
| At the ``nxcamera>`` prompt you can run an NSH command by prefixing it with | ||
| ``!``. This is useful for quickly checking system state or invoking other | ||
| utilities without exiting ``nxcamera``. | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nxcamera> !ls /dev | ||
| /dev: | ||
| console | ||
| fb0 | ||
| gpio0 | ||
| gpio1 | ||
| gpio2 | ||
| gpio3 | ||
| loop | ||
| null | ||
| oneshot | ||
| ram0 | ||
| ram1 | ||
| ram2 | ||
| video0 | ||
| video1 | ||
| zero | ||
| nxcamera> !poweroff | ||
| bash> | ||
|
|
||
| A typical workflow at the prompt is: | ||
|
|
||
| - ``input /dev/video0`` to set the input video node. | ||
| - ``output /dev/fb0`` to set the output node, for example a framebuffer. | ||
| - ``stream 640 480 30 NV12`` to start streaming with ``width height fps | ||
| format``. | ||
| - ``stop`` to stop streaming. | ||
|
|
||
| You may just copy-paste the commands below to get started: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nxcamera | ||
| input /dev/video0 | ||
| output /dev/fb0 | ||
| stream 640 480 30 YUYV # or NV12 on macOS | ||
|
|
||
| Pixel Format | ||
| ============ | ||
|
|
||
| For the ``stream`` command, the pixel format depends on the platform. On the | ||
| macOS ``sim`` platform you may use ``NV12``, while on Linux systems ``YUYV`` | ||
| is more commonly used. | ||
|
|
||
| Examples | ||
| ======== | ||
|
|
||
| 1. Start ``nxcamera`` and configure a typical interactive capture session: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| nsh> nxcamera | ||
| nxcamera> input /dev/video0 | ||
| nxcamera> output /dev/fb0 | ||
| nxcamera> stream 640 480 30 NV12 | ||
| nxcamera> stop | ||
|
|
||
| .. figure:: nxcamera_macos_sim.png | ||
| :alt: nxcamera running on the macOS SIM platform | ||
| :align: center | ||
|
|
||
| ``nxcamera`` using the macOS AVFoundation backend on the SIM platform. | ||
|
|
||
| Features and Updates | ||
| ==================== | ||
|
|
||
| - Multiple camera instances are supported, allowing several cameras to be | ||
| exposed as different device nodes such as ``/dev/video0`` and | ||
| ``/dev/video1``. This makes it easier to select and validate different | ||
| video input sources on the same system. | ||
| - On the ``sim`` platform, support has been added for the macOS | ||
| AVFoundation backend. This enables camera capture and functional | ||
| verification on macOS hosts, subject to build configuration and host | ||
| permission settings. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # ############################################################################## | ||
| # arch/sim/src/sim/macos/CMakeLists.txt | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
| # license agreements. See the NOTICE file distributed with this work for | ||
| # additional information regarding copyright ownership. The ASF licenses this | ||
| # file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
| # use this file except in compliance with the License. You may obtain a copy of | ||
| # the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations under | ||
| # the License. | ||
| # | ||
| # ############################################################################## | ||
|
|
||
| add_library(sim_avf_backend OBJECT EXCLUDE_FROM_ALL | ||
| sim_host_avfoundation_backend.m) | ||
|
|
||
| set_property(TARGET sim_avf_backend PROPERTY INCLUDE_DIRECTORIES "") | ||
| set_property(TARGET sim_avf_backend PROPERTY COMPILE_OPTIONS "") | ||
| set_property(TARGET sim_avf_backend PROPERTY COMPILE_DEFINITIONS "") | ||
| set_property(TARGET sim_avf_backend PROPERTY INTERFACE_INCLUDE_DIRECTORIES "") | ||
| set_property(TARGET sim_avf_backend PROPERTY INTERFACE_COMPILE_OPTIONS "") | ||
| set_property(TARGET sim_avf_backend PROPERTY INTERFACE_COMPILE_DEFINITIONS "") | ||
|
|
||
| target_include_directories(sim_avf_backend PRIVATE ${CMAKE_CURRENT_LIST_DIR}) | ||
| target_compile_options(sim_avf_backend | ||
| PRIVATE $<$<COMPILE_LANGUAGE:OBJC>:-fobjc-arc>) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.