Skip to content

Commit

Permalink
Merge branch 'master' into commit_pinning
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Gehrsitz <[email protected]>
  • Loading branch information
mryel00 committed Mar 3, 2024
2 parents a386d32 + b070970 commit db9875d
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 98 deletions.
10 changes: 6 additions & 4 deletions .github/label-actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration for Label Actions - https://github.com/dessant/label-actions

not on Github:
not an Issue:
issues:
comment: |
Ahoi!
Expand All @@ -9,10 +9,12 @@ not on Github:
Many helpful people will not see your message here and you are
unlikely to get a useful response.
We use github to handle bugreports, feature requests and
planning new releases.
We use the Github Issue-Tracker only for development related
topics, like feature requests, bug reports etc. To get help,
please join our Discord-Server or ask in Github Discussions:
Please use our Discord-Server for help: [discord.gg/mainsail](https://discord.gg/mainsail)
- [discord.gg/mainsail](https://discord.gg/mainsail)
- [GitHub Discussions](https://github.com/orgs/mainsail-crew/discussions)
This ticket will be automatically closed.
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@
# Changelog
All notable changes to Crowsnest will be documented in this file.

## [4.1.5](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.5) - 2024-02-28
### Bug Fixes and Improvements

- Fix ustreamer binary path for v5.52 changes ([#245](https://github.com/mainsail-crew/crowsnest/pull/245))

## [4.1.4](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.4) - 2024-02-17
### Bug Fixes and Improvements

- Support `no_proxy` mode with camera-streamer (bookworm) ([#238](https://github.com/mainsail-crew/crowsnest/pull/238))

## [4.1.3](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.3) - 2024-01-16
### Features

- Add dual picam detection ([#229](https://github.com/mainsail-crew/crowsnest/pull/229))

### Documentation

- Fix buster hint link ([#236](https://github.com/mainsail-crew/crowsnest/pull/236))

### Other

- Fix `clean_apps` for installations without all backends ([#230](https://github.com/mainsail-crew/crowsnest/pull/230))
- Remove `buildclean` from `make update` ([#231](https://github.com/mainsail-crew/crowsnest/pull/231))
- Update issue bot to add github discussions ([#234](https://github.com/mainsail-crew/crowsnest/pull/234))
- Add warning for libcamera on pi5 ([#235](https://github.com/mainsail-crew/crowsnest/pull/235))

## [4.1.2](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.2) - 2024-01-08
### Bug Fixes and Improvements

- **build.sh**: Fix wrong cs branch for cloning ([#215](https://github.com/mainsail-crew/crowsnest/pull/215))
- Fixes error in detect_legacy ([#217](https://github.com/mainsail-crew/crowsnest/pull/217))
- Skip do_memory_split on bookworm ([#223](https://github.com/mainsail-crew/crowsnest/pull/223))
- Fix crash with brokenfocus and camera-streamer ([#224](https://github.com/mainsail-crew/crowsnest/pull/224))
- Add pi5 support ([#225](https://github.com/mainsail-crew/crowsnest/pull/225))

### Other

- Shallow clone camera-streamer submodules ([#226](https://github.com/mainsail-crew/crowsnest/pull/226))
- Add note about proxies to crowsnest.conf ([#227](https://github.com/mainsail-crew/crowsnest/pull/227))

## [4.1.1](https://github.com/mainsail-crew/crowsnest/releases/tag/v4.1.1) - 2023-11-23
### Documentation

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ help: ## Shows this help
update: ## Update crowsnest (fetches and pulls repository changes)
@git fetch && git pull
@bash -c 'bin/build.sh --reclone'
${MAKE} buildclean
${MAKE} build

report: ## Generate report.txt
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ Not available: :heavy_minus_sign:

| Operating System | X86 Architecture | ARM Architecture |
| :-------------------------------: | :----------------: | :-----------------------------------------: |
| Raspberry Pi OS (buster) | :heavy_minus_sign: | :x: ([Hint](#hint)) |
| Raspberry Pi OS (buster) | :heavy_minus_sign: | :x: ([Hint](#hint-buster)) |
| Raspberry Pi OS (bullseye) | :heavy_minus_sign: | :heavy_check_mark: |
| Raspberry Pi OS (bookworm) | :heavy_minus_sign: | :heavy_check_mark: ([Hint](#hint-bookworm)) |
| MainsailOS (<0.7.1) | :heavy_minus_sign: | :x: ([Hint](#hint)) |
| MainsailOS (<0.7.1) | :heavy_minus_sign: | :x: ([Hint](#hint-buster)) |
| MainsailOS (>1.0.0) | :heavy_minus_sign: | :heavy_check_mark: (rpi) |
| Armbian | :question: | :heavy_check_mark: |
| DietPi | :question: | :heavy_check_mark: (rpi) |
Expand All @@ -90,6 +90,7 @@ See the [README.md](https://github.com/mainsail-crew/crowsnest/tree/legacy/v3) o
#### Hint Bookworm

Raspberry Pi OS images that are based on Debian 12 (codename 'bookworm') currently use a different branch of [camera-streamer](https://github.com/ayufan/camera-streamer)!
The Raspberry Pi 5 has only [ustreamer](https://github.com/pikvm/ustreamer) support! This is due to the missing JPEG and H264 Hardware encoders.

---

Expand Down
94 changes: 25 additions & 69 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#### crowsnest - A webcam Service for multiple Cams and Stream Services.
####
#### Written by Stephan Wendel aka KwadFan <[email protected]>
#### Copyright 2021 - 2023
#### Copyright 2021 - 2024
#### Co-authored by Patrick Gehrsitz aka mryel00 <[email protected]>
#### Copyright 2023 - till today
#### Copyright 2024 - till today
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
Expand Down Expand Up @@ -111,63 +111,22 @@ is_bookworm() {
fi
}

is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
is_pi5() {
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry Pi 5" /proc/device-tree/model; then
echo "1"
else
echo "0"
fi
}

test_load_module() {
if modprobe -n "${1}" &> /dev/null; then
echo 1
is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
echo "1"
else
echo 0
fi
}

shallow_cs_dependencies_check() {
printf "\nChecking for camera-streamer dependencies ...\n"

printf "Checking if device is a Raspberry Pi ...\n"
if [[ "$(is_raspberry_pi)" = "0" ]]; then
status_msg_build "Checking if device is a Raspberry Pi ..." "3"
printf "This device is not a Raspberry Pi therefore camera-streeamer cannot be installed ..."
return 1
fi
status_msg_build "Checking if device is a Raspberry Pi ..." "0"

printf "Checking if device is not running Ubuntu ...\n"
if [[ "$(is_ubuntu_arm)" = "1" ]]; then
status_msg_build "Checking if device is not running Ubuntu ..." "3"
printf "This device is running Ubuntu therefore camera-streeamer cannot be installed ..."
return 1
fi
status_msg_build "Checking if device is not running Ubuntu ..." "0"

printf "Checking for required kernel module ...\n"
SHALLOW_CHECK_MODULESLIST="bcm2835_codec"
if [[ "$(test_load_module "${SHALLOW_CHECK_MODULESLIST}")" = "0" ]]; then
status_msg_build "Checking for required kernel module ..." "3"
printf "Not all required kernel modules for camera-streamer can be loaded ..."
return 1
fi
status_msg_build "Checking for required kernel module ..." "0"

printf "Checking for required packages ...\n"
# Update the number below if you update SHALLOW_CHECK_PKGLIST
SHALLOW_CHECK_PKGLIST="^(libavformat-dev|libavutil-dev|libavcodec-dev|liblivemedia-dev|libcamera-dev|libcamera-apps-lite)$"
if [[ $(apt-cache search --names-only "${SHALLOW_CHECK_PKGLIST}" | wc -l) -lt 6 ]]; then
status_msg_build "Checking for required packages ..." "3"
printf "Not all required packages for camera-streamer can be installed ..."
return 1
echo "0"
fi
status_msg_build "Checking for required packages ..." "0"

status_msg_build "Checking for camera-streamer dependencies ..." "0"
return 0
}

### Get avail mem
Expand All @@ -180,10 +139,10 @@ get_avail_mem() {
delete_apps() {
for path in "${ALL_PATHS[@]}"; do
if [[ ! -d "${path}" ]]; then
printf "'%s' does not exist! Delete skipped ...\n" "${path}"
printf "'%s' does not exist! Delete ... [SKIPPED]\n" "${path}"
fi
if [[ -d "${path}" ]]; then
printf "Deleting '%s' ... \n" "${path}"
printf "Deleting '%s' ... [DONE]\n" "${path}"
rm -rf "${path}"
fi
done
Expand Down Expand Up @@ -211,18 +170,11 @@ clone_ustreamer() {
clone_cstreamer() {
## Special handling because only supported on Raspberry Pi
[[ -n "${CROWSNEST_UNATTENDED}" ]] || CROWSNEST_UNATTENDED="0"

## If CROWSNEST_UNATTENDED is 1, CN_INSTALL_CS should be already set
if [[ "${CROWSNEST_UNATTENDED}" = "0" ]] && [[ -z "${CN_INSTALL_CS}" ]]; then
if shallow_cs_dependencies_check; then
CN_INSTALL_CS="1"
else
CN_INSTALL_CS="0"
fi
fi

if [[ "${CN_INSTALL_CS}" = "0" ]]; then
printf "WARN: Cloning camera-streamer skipped! Device is not supported!"
if { [[ "$(is_raspberry_pi)" = "0" ]] ||
[[ "$(is_pi5)" = "1" ]] ||
[[ "$(is_ubuntu_arm)" = "1" ]]; } &&
[[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then
printf "Device is not supported! Cloning camera-streamer ... [SKIPPED]\n"
return
fi

Expand Down Expand Up @@ -262,10 +214,14 @@ clone_apps() {
### Run 'make clean' in cloned folders
clean_apps() {
for app in "${ALL_PATHS[@]}"; do
printf "\nRunning 'make clean' in %s ... \n" "${app}"
pushd "${app}" &> /dev/null || exit 1
make clean
popd &> /dev/null || exit 1
if [[ ! -d "${app}" ]]; then
printf "'%s' does not exist! Clean ... [SKIPPED]\n" "${app}"
else
printf "\nRunning 'make clean' in %s ... \n" "${app}"
pushd "${app}" &> /dev/null || exit 1
make clean
popd &> /dev/null || exit 1
fi
done
printf "\nRunning 'make clean' ... [DONE]\n"
}
Expand Down
12 changes: 11 additions & 1 deletion libs/camera-streamer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function run_multi() {
}

function run_ayucamstream() {
local cam_sec ust_bin dev pt res rtsp rtsp_pt fps cstm start_param
local cam_sec ust_bin dev pt res rtsp rtsp_pt fps cstm noprx start_param
local v4l2ctl
cam_sec="${1}"
ust_bin="${BASE_CN_PATH}/bin/camera-streamer/camera-streamer"
Expand All @@ -36,11 +36,21 @@ function run_ayucamstream() {
rtsp=$(get_param "cam ${cam_sec}" enable_rtsp)
rtsp_pt=$(get_param "cam ${cam_sec}" rtsp_port)
cstm="$(get_param "cam ${cam_sec}" custom_flags 2> /dev/null)"
noprx="$(get_param "crowsnest" no_proxy 2> /dev/null)"
## construct start parameter
# set http port
#
start_param=( --http-port="${pt}" )

if [[ -n "${noprx}" ]] && [[ "${noprx}" = "true" ]]; then
# See https://github.com/mainsail-crew/crowsnest/pull/221#issuecomment-1863555700 for why
# we cannot assume the binary has support for `--http-listen`.
if ${ust_bin} --help | grep -q "http-listen"; then
start_param+=( --http-listen=0.0.0.0 )
log_msg "INFO: Set to 'no_proxy' mode! Using 0.0.0.0!"
fi
fi

# Set device
start_param+=( --camera-path="${dev}" )

Expand Down
15 changes: 11 additions & 4 deletions libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,25 @@ function check_dep {

function check_apps {
local cstreamer ustreamer
ustreamer="bin/ustreamer/ustreamer"
ustreamer_base="bin/ustreamer"
ustreamer="$(find "${BASE_CN_PATH}"/"${ustreamer_base}" \
-iname 'ustreamer.bin' 2> /dev/null | sed '1q')"
cstreamer="bin/camera-streamer/camera-streamer"

if [[ -x "${BASE_CN_PATH}/${ustreamer}" ]]; then
log_msg "Dependency: '${ustreamer##*/}' found in ${ustreamer}."
if [[ -x "${ustreamer}" ]]; then
log_msg "Dependency: '${ustreamer##*/}' found in ${ustreamer_base}/${ustreamer##*/}."
UST_BIN="${ustreamer}"
# shellcheck disable=SC2034
declare -r UST_BIN
else
log_msg "Dependency: '${ustreamer##*/}' not found. Exiting!"
exit 1
fi

## Avoid dependency check if non rpi sbc
if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then
if [[ "$(is_raspberry_pi)" = "1" ]] &&
[[ "$(is_ubuntu_arm)" = "0" ]] &&
[[ "$(is_pi5)" = "0" ]]; then
if [[ -x "${BASE_CN_PATH}/${cstreamer}" ]]; then
log_msg "Dependency: '${cstreamer##*/}' found in ${cstreamer}."
else
Expand Down
26 changes: 19 additions & 7 deletions libs/hwhandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ detect_libcamera() {
[[ -x "$(command -v libcamera-hello)" ]]; then
avail="$(libcamera-hello --list-cameras | sed '/^\[.*\].*/d' | awk 'NR==1 {print $1}')"
if [[ "${avail}" = "Available" ]]; then
echo "1"
get_libcamera_path | wc -l
else
echo "0"
fi
Expand All @@ -86,13 +86,16 @@ get_libcamera_path() {
# Determine connected "legacy" device
function detect_legacy {
local avail
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry" /proc/device-tree/model; then
avail="$(vcgencmd get_camera | awk -F '=' '{ print $3 }' | cut -d',' -f1)"
else
avail="0"
if [[ "$(is_raspberry_pi)" = "1" ]] &&
command -v vcgencmd &> /dev/null; then
if vcgencmd get_camera &> /dev/null ; then
avail="$(vcgencmd get_camera \
| awk -F '=' '{ print $3 }' \
| cut -d',' -f1 \
)"
fi
fi
echo "${avail}"
echo "${avail:-0}"
}

function dev_is_legacy {
Expand Down Expand Up @@ -128,6 +131,15 @@ is_raspberry_pi() {
fi
}

is_pi5() {
if [[ -f /proc/device-tree/model ]] &&
grep -q "Raspberry Pi 5" /proc/device-tree/model; then
echo "1"
else
echo "0"
fi
}

is_ubuntu_arm() {
if [[ "$(is_raspberry_pi)" = "1" ]] &&
grep -q "ubuntu" /etc/os-release; then
Expand Down
4 changes: 3 additions & 1 deletion libs/init_stream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function construct_streamer {
check_section "${cams}"
case ${mode} in
[mM]ulti | camera-streamer)
if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then
if [[ "$(is_raspberry_pi)" = "1" ]] &&
[[ "$(is_ubuntu_arm)" = "0" ]] &&
[[ "$(is_pi5)" = "0" ]]; then
MULTI_INSTANCES+=( "${cams}" )
else
log_msg "WARN: Mode 'camera-streamer' is not supported on your device!"
Expand Down
11 changes: 9 additions & 2 deletions libs/logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function print_cfg {
}

function print_cams {
local total v4l
local device total v4l
v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null | wc -l)"
libcamera="$(detect_libcamera)"
legacy="$(detect_legacy)"
Expand All @@ -100,7 +100,14 @@ function print_cams {
log_msg "INFO: Found ${total} total available Device(s)"
fi
if [[ "${libcamera}" -ne 0 ]]; then
log_msg "Detected 'libcamera' device -> $(get_libcamera_path)"
if [[ "$(is_pi5)" = "1" ]]; then
log_msg "================================================================"
log_msg " WARN: 'libcamera' devices are currently not supported on Pi 5! "
log_msg "================================================================"
fi
for device in $(get_libcamera_path); do
log_msg "Detected 'libcamera' device -> ${device}"
done
fi
if [[ "${legacy}" -ne 0 ]]; then
raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
Expand Down
Loading

0 comments on commit db9875d

Please sign in to comment.