Skip to content

Commit

Permalink
Merge pull request #250 from OctoPrint/revert-multiple-mjpeg
Browse files Browse the repository at this point in the history
revert #245
  • Loading branch information
LongLiveCHIEF authored Mar 5, 2023
2 parents c3037a5 + 0fa5a5e commit e24fb42
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions root/etc/services.d/mjpg-streamer/run
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
#!/usr/bin/with-contenv bash
#!/usr/bin/with-contenv sh

if [ -n "$MJPEG_STREAMER_INPUT" ]; then
echo "Deprecation warning: the environment variable '\$MJPEG_STREAMER_INPUT' was renamed to '\$MJPG_STREAMER_INPUT'"

MJPG_STREAMER_INPUT=$MJPEG_STREAMER_INPUT
fi

if ! expr "$MJPG_STREAMER_INPUT" : ".*\.so.*" >/dev/null; then
if ! expr "$MJPG_STREAMER_INPUT" : ".*\.so.*" > /dev/null; then
MJPG_STREAMER_INPUT="input_uvc.so $MJPG_STREAMER_INPUT"
fi

# Loop through all camera devices and start mjpg_streamer for each
IFS=',' read -ra CAMERA_DEVS <<<"$CAMERA_DEV"
COUNTER=0
for CAMERA in "${CAMERA_DEVS[@]}"; do
# start from port 8080 and increment for each camera
PORT=$((8080 + "$COUNTER"))
((COUNTER++))
echo "Starting mjpg_streamer for camera device $CAMERA on port $PORT"

# Start mjpg_streamer
mjpg_streamer -b \
-i "/usr/local/lib/mjpg-streamer/${MJPG_STREAMER_INPUT} -d ${CAMERA}" \
-o "/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/share/mjpg-streamer/www -p ${PORT}"
done
exec mjpg_streamer \
-i "/usr/local/lib/mjpg-streamer/$MJPG_STREAMER_INPUT -d $CAMERA_DEV" \
-o "/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/share/mjpg-streamer/www -p 8080"

0 comments on commit e24fb42

Please sign in to comment.