-
-
Notifications
You must be signed in to change notification settings - Fork 475
waybeam: add the SigmaStar encoder package #2332
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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,31 @@ | ||
| config BR2_PACKAGE_WAYBEAM | ||
| bool "waybeam" | ||
| depends on BR2_TOOLCHAIN_HAS_THREADS | ||
| depends on BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E | ||
| depends on !BR2_PACKAGE_MAJESTIC | ||
|
openipc-ai marked this conversation as resolved.
|
||
| help | ||
| Standalone H.265 video encoder and streamer for SigmaStar | ||
| Infinity6E (SSC338Q/SSC30KQ). Provides a dual encoder | ||
| backend, sensor unlock and an HTTP configuration API. | ||
|
|
||
| Infinity6C (SSC378QE) is not offered here even though the | ||
| encoder has a backend for it: waybeam's I6C backend targets | ||
| the 2024-06-18 SigmaStar MI libraries and | ||
| sigmastar-osdrv-infinity6c ships 2022-09-07. The pipeline | ||
| streams against those, but AE never actuates and the image | ||
| is black. I6C returns once the two agree. | ||
|
|
||
| It is an alternative to the Majestic streamer and cannot be | ||
| built alongside it: both drive the same sensor and encoder | ||
| hardware, and both rely on the SigmaStar OSDRV MI libraries, | ||
| which OSDRV installs only when Majestic is not selected. | ||
|
|
||
| Installs: | ||
| - /usr/bin/waybeam | ||
| - /usr/bin/json_cli | ||
| - /etc/waybeam.json | ||
| - /etc/init.d/S95waybeam | ||
| - unlocked imx335/imx415 sensor modules, compiled here | ||
| against this board's kernel | ||
|
|
||
| https://github.com/OpenIPC/waybeam | ||
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,73 @@ | ||
| #!/bin/sh | ||
|
|
||
| DAEMON="waybeam" | ||
| RESPAWN="waybeam-resp" | ||
| WATCHDOG="waybeam-wd" | ||
| DAEMON_PATH="/usr/bin/waybeam" | ||
| LOG_PATH="/tmp/waybeam.log" | ||
|
|
||
| # waybeam forks a respawn child (comm "waybeam-resp") on an API restart and a | ||
| # watchdog ("waybeam-wd"). pidof and killall match by comm, so every restart | ||
| # path must cover all three names, otherwise stop() returns while a helper is | ||
| # still alive and the next start() trips the duplicate-instance check. | ||
| still_running() { | ||
| pidof "$DAEMON" "$RESPAWN" "$WATCHDOG" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| wait_exit() { | ||
| i=0 | ||
| while [ $i -lt 30 ]; do | ||
| still_running || return 0 | ||
| sleep 0.5 | ||
| i=$((i + 1)) | ||
| done | ||
| return 1 | ||
| } | ||
|
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
|
||
|
|
||
| start() { | ||
| if still_running; then | ||
| echo "$DAEMON already running" | ||
| return 0 | ||
| fi | ||
| echo -n "Starting $DAEMON: " | ||
| # waybeam reads /etc/waybeam.json from a fixed path; it has no -c flag. | ||
| "$DAEMON_PATH" > "$LOG_PATH" 2>&1 & | ||
| i=0 | ||
| while [ $i -lt 10 ]; do | ||
| sleep 0.3 | ||
| still_running && { echo "OK"; return 0; } | ||
| i=$((i + 1)) | ||
| done | ||
| echo "FAILED (crashed at init or lost the duplicate-instance check, see $LOG_PATH)" | ||
| return 1 | ||
| } | ||
|
|
||
| stop() { | ||
| echo -n "Stopping $DAEMON: " | ||
| killall "$DAEMON" "$RESPAWN" "$WATCHDOG" 2>/dev/null | ||
| if wait_exit; then | ||
| echo "OK" | ||
| return 0 | ||
| fi | ||
| # 15s of SIGTERM was not enough. Escalate rather than report a stop that | ||
| # did not happen: restart would then run start() against a survivor, which | ||
| # trips the duplicate-instance check and returns 0 having done nothing -- | ||
| # the requested restart silently never happens. | ||
| killall -9 "$DAEMON" "$RESPAWN" "$WATCHDOG" 2>/dev/null | ||
| if wait_exit; then | ||
| echo "OK (forced)" | ||
| return 0 | ||
| fi | ||
| echo "FAILED ($DAEMON survived SIGKILL)" | ||
| return 1 | ||
| } | ||
|
|
||
| case "$1" in | ||
| start) start ;; | ||
| stop) stop ;; | ||
| restart) stop && start ;; | ||
| *) | ||
| echo "Usage: $0 {start|stop|restart}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
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,114 @@ | ||
| { | ||
| "system": { | ||
| "webPort": 80, | ||
| "overclockLevel": 1, | ||
| "verbose": false | ||
| }, | ||
| "sensor": { | ||
| "index": -1, | ||
| "mode": -1 | ||
| }, | ||
| "isp": { | ||
| "sensorBin": "", | ||
| "aeEngine": "sdk", | ||
| "aeFps": 15, | ||
| "gainMax": 0, | ||
| "awbMode": "auto", | ||
| "awbCt": 5500, | ||
| "keepAspect": true | ||
| }, | ||
| "image": { | ||
| "mirror": false, | ||
| "flip": false, | ||
| "rotate": 0 | ||
| }, | ||
| "video0": { | ||
| "rcMode": "cbr", | ||
| "fps": 90, | ||
| "size": "auto", | ||
| "bitrate": 2580, | ||
| "gopSize": 5.0, | ||
| "qpDelta": -12, | ||
| "sceneThreshold": 0, | ||
| "sceneHoldoff": 2, | ||
| "resilience": "off", | ||
| "zoomX": 0.5, | ||
| "zoomY": 0.5, | ||
| "framing": "off", | ||
| "stabCropPct": 0, | ||
| "stabRecenterSpeed": 0, | ||
| "stabKalmanQ": 0.0, | ||
| "stabKalmanR": 0.0 | ||
| }, | ||
| "outgoing": { | ||
| "enabled": true, | ||
| "server": "udp://192.168.1.10:5600", | ||
|
openipc-ai marked this conversation as resolved.
|
||
| "streamMode": "rtp", | ||
| "maxPayloadSize": 1400, | ||
| "connectedUdp": true, | ||
| "audioPort": 5601, | ||
| "sidecarPort": 5602 | ||
| }, | ||
| "discovery": { | ||
| "enabled": true, | ||
| "serviceType": "_waybeam-venc._tcp", | ||
| "name": "", | ||
| "bareAlias": true | ||
| }, | ||
| "fpv": { | ||
| "roiEnabled": false, | ||
| "roiQp": 0, | ||
| "roiSteps": 2, | ||
| "roiCenter": 0.4, | ||
| "noiseLevel": 0 | ||
| }, | ||
| "audio": { | ||
| "enabled": false, | ||
| "sampleRate": 48000, | ||
| "channels": 1, | ||
| "codec": "opus", | ||
| "volume": 80, | ||
| "mute": false | ||
| }, | ||
| "imu": { | ||
| "enabled": false, | ||
| "i2cDevice": "/dev/i2c-1", | ||
| "i2cAddr": "0x68", | ||
| "sampleRateHz": 200, | ||
| "gyroRangeDps": 1000, | ||
| "calFile": "/etc/imu.cal", | ||
| "calSamples": 400 | ||
| }, | ||
| "record": { | ||
| "enabled": false, | ||
| "dir": "/mnt/mmcblk0p1", | ||
| "format": "ts", | ||
| "mode": "mirror", | ||
| "maxSeconds": 300, | ||
| "maxMB": 500, | ||
| "bitrate": 0, | ||
| "fps": 0, | ||
| "gopSize": 0.0, | ||
| "server": "" | ||
| }, | ||
| "snapshot": { | ||
| "enabled": true, | ||
| "quality": 80, | ||
| "channel": 7, | ||
| "width": 0, | ||
| "height": 0 | ||
| }, | ||
| "debug": { | ||
| "showOsd": false | ||
| }, | ||
| "attitude": { | ||
| "enabled": false, | ||
| "mountDeg": 0, | ||
| "invertRoll": false, | ||
| "invertPitch": false, | ||
| "axisFwd": "+x", | ||
| "axisDown": "+z", | ||
| "trimRollDeg": 0.0, | ||
| "trimPitchDeg": 0.0 | ||
| } | ||
| } | ||
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,92 @@ | ||
| ################################################################################ | ||
| # | ||
| # waybeam | ||
| # | ||
| ################################################################################ | ||
|
|
||
| WAYBEAM_VERSION = HEAD | ||
|
openipc-ai marked this conversation as resolved.
|
||
| WAYBEAM_SITE = https://github.com/OpenIPC/waybeam.git | ||
| WAYBEAM_SITE_METHOD = git | ||
| # The sensor drivers include SigmaStar headers that are not in the waybeam | ||
| # tree itself — they come from the OpenIPC/sensors submodule at sensors-src/, | ||
| # so the checkout has to bring it along or drivers/ will not compile. | ||
| WAYBEAM_GIT_SUBMODULES = YES | ||
| WAYBEAM_LICENSE = MIT | ||
| WAYBEAM_LICENSE_FILES = LICENSE | ||
|
|
||
| # The encoder ships one source tree with a backend per SoC, picked by | ||
| # SOC_BUILD. Only the Infinity6E (star6e) backend is built here. The tree also | ||
| # has a maruko backend for Infinity6C, but it targets the 2024-06-18 SigmaStar | ||
| # MI libraries while sigmastar-osdrv-infinity6c ships 2022-09-07: measured on | ||
| # an SSC378QE, the pipeline streams against those but AE never actuates and | ||
| # the frame comes out black (mean luma 2.05/255, against 153.91 on the 2024 | ||
| # set). Config.in therefore does not offer I6C, and it returns here once the | ||
| # two revisions agree. | ||
| # | ||
| # CC_BIN points the tree's own toolchain check at Buildroot's compiler so it | ||
| # does not fetch one of its own. | ||
| WAYBEAM_SOC = star6e | ||
| WAYBEAM_MAKE_OPTS = SOC_BUILD=star6e STAR6E_CC="$(TARGET_CC)" CC_BIN="$(TARGET_CC)" | ||
| # Built after the stock sensor and MI-library packages so the modified sensor | ||
| # modules install over the stock sensor_imx*_mipi.ko names. | ||
| WAYBEAM_DEPENDENCIES += sigmastar-osdrv-sensors sigmastar-osdrv-infinity6e | ||
|
|
||
| # The sensor modules are compiled here against the kernel this build just | ||
| # produced, so linux must be built first. | ||
| WAYBEAM_DEPENDENCIES += linux | ||
|
|
||
| # `build` rather than the tree's `stage` target: stage exists to assemble a | ||
| # release tarball, and its extra work is unwanted here. It copies the vendor | ||
| # MI .so files into the bundle, which OSDRV already installs to /usr/lib, and | ||
| # it stages sensor modules vendored into the source tree as prebuilt | ||
| # binaries. The modules below are compiled from drivers/*.c instead. | ||
| define WAYBEAM_BUILD_CMDS | ||
| $(MAKE) -C $(@D) build json_cli $(WAYBEAM_MAKE_OPTS) | ||
| $(MAKE) -C $(@D)/drivers sensor SOC=$(WAYBEAM_SOC) \ | ||
| KSRC="$(LINUX_DIR)" CROSS="$(TARGET_CROSS)" | ||
| endef | ||
|
|
||
| define WAYBEAM_INSTALL_TARGET_CMDS | ||
| $(INSTALL) -m 0755 -D $(@D)/out/$(WAYBEAM_SOC)/waybeam \ | ||
| $(TARGET_DIR)/usr/bin/waybeam | ||
| $(INSTALL) -m 0755 -D $(@D)/out/$(WAYBEAM_SOC)/json_cli \ | ||
| $(TARGET_DIR)/usr/bin/json_cli | ||
| $(INSTALL) -m 0644 -D $(WAYBEAM_PKGDIR)/files/waybeam.json \ | ||
| $(TARGET_DIR)/etc/waybeam.json | ||
| endef | ||
|
|
||
| # The encoder dlopens the SigmaStar MI libraries at runtime. They are | ||
| # installed to /usr/lib by sigmastar-osdrv-infinity6e, which does so only when | ||
| # Majestic is not selected; waybeam depends on !MAJESTIC, so that path always | ||
| # applies and the package ships no libraries itself. That the shipped MI | ||
| # revision is one the backend targets is a real constraint, not a formality -- | ||
| # it is what rules out Infinity6C above. | ||
|
|
||
| # Waybeam drives its own imx335/imx415 drivers rather than the stock ones: | ||
| # they unlock higher-FPS sensor modes, up to 144 fps IMX335 / 100 fps IMX415. | ||
| # Install them over the stock _mipi.ko names the SigmaStar module loader looks | ||
| # for. LINUX_VERSION_PROBED rather than a literal 4.9.84 so the path follows | ||
| # whatever kernel the board actually built -- verified to resolve to the same | ||
| # directory the stock package writes to, which is what makes it an overwrite. | ||
| define WAYBEAM_INSTALL_SENSOR_MODULES | ||
| $(INSTALL) -m 0644 -D $(@D)/drivers/sensor_imx335_$(WAYBEAM_SOC).ko \ | ||
| $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/sigmastar/sensor_imx335_mipi.ko | ||
| $(INSTALL) -m 0644 -D $(@D)/drivers/sensor_imx415_$(WAYBEAM_SOC).ko \ | ||
| $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/sigmastar/sensor_imx415_mipi.ko | ||
|
openipc-ai marked this conversation as resolved.
|
||
| endef | ||
| WAYBEAM_POST_INSTALL_TARGET_HOOKS += WAYBEAM_INSTALL_SENSOR_MODULES | ||
|
|
||
| # No ISP tuning bins are installed. waybeam.json ships isp.sensorBin empty, | ||
| # and the encoder then resolves /etc/sensors/<sensor>.bin itself | ||
| # (src/pipeline_common.c) -- the same stock tuning Majestic loads, installed | ||
| # by sigmastar-osdrv-infinity6e and filtered on OPENIPC_SNS_MODEL. The bins | ||
| # vendored in the source tree under iq-profiles/ are not used: they were | ||
| # pulled off a running camera, which is the binary-without-source this tree | ||
| # refuses, and they are byte-identical to our own copies anyway. | ||
|
|
||
| define WAYBEAM_INSTALL_INIT_SYSV | ||
| $(INSTALL) -m 0755 -D $(WAYBEAM_PKGDIR)/files/S95waybeam \ | ||
| $(TARGET_DIR)/etc/init.d/S95waybeam | ||
| endef | ||
|
|
||
| $(eval $(generic-package)) | ||
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.