Skip to content

Commit 8d0c04c

Browse files
http: add --http-listen=<ip4>, and listen by default on 127.0.0.1 (#81)
Co-authored-by: AndrolGenhald <AndrolGenhald@gmail.com>
1 parent f1966ab commit 8d0c04c

12 files changed

Lines changed: 37 additions & 6 deletions

cmd/camera-streamer/opts.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ camera_options_t camera_options = {
4646
};
4747

4848
http_server_options_t http_options = {
49+
.listen = "127.0.0.1",
4950
.port = 8080,
5051
.maxcons = 10
5152
};
@@ -126,6 +127,7 @@ option_t all_options[] = {
126127

127128
DEFINE_OPTION_DEFAULT(camera, list_options, bool, "1", "List all available options and exit."),
128129

130+
DEFINE_OPTION_PTR(http, listen, string, "Set the IP address the HTTP web-server will bind to. Set to 0.0.0.0 to listen on all interfaces."),
129131
DEFINE_OPTION(http, port, uint, "Set the HTTP web-server port."),
130132
DEFINE_OPTION(http, maxcons, uint, "Set maximum number of concurrent HTTP connections."),
131133

service/camera-streamer-arducam-16MP.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ExecStart=/usr/local/bin/camera-streamer \
2323
-camera-options=brightness=0.1 \
2424
; disable auto-focus
2525
-camera-auto_focus=1 \
26+
--http-listen=0.0.0.0 \
27+
--http-port=8080 \
2628
-rtsp-port
2729

2830
DynamicUser=yes

service/camera-streamer-arducam-64MP.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ ExecStart=/usr/local/bin/camera-streamer \
2525
-camera-options=brightness=0.1 \
2626
; disable auto-focus
2727
-camera-auto_focus=0 \
28+
--http-listen=0.0.0.0 \
29+
--http-port=8080 \
2830
-rtsp-port
2931

3032
DynamicUser=yes

service/camera-streamer-generic-usb-cam.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ExecStart=/usr/local/bin/camera-streamer \
1111
-camera-fps=30 \
1212
; use two memory buffers to optimise usage
1313
-camera-nbufs=3 \
14+
--http-listen=0.0.0.0 \
15+
--http-port=8080 \
1416
; disable video streaming (WebRTC, RTSP, H264)
1517
; on non-supported platforms
1618
-camera-video.disabled

service/camera-streamer-raspi-usb-cam.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ExecStart=/usr/local/bin/camera-streamer \
1717
-camera-video.height=720 \
1818
; the stream is 853x480
1919
-camera-stream.height=480 \
20+
--http-listen=0.0.0.0 \
21+
--http-port=8080 \
2022
-rtsp-port
2123

2224
DynamicUser=yes

service/camera-streamer-raspi-v2-8MP.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ ExecStart=/usr/local/bin/camera-streamer \
2424
-camera-stream.height=480 \
2525
; bump brightness slightly
2626
-camera-options=brightness=0.1 \
27+
--http-listen=0.0.0.0 \
28+
--http-port=8080 \
2729
-rtsp-port
2830

2931
DynamicUser=yes

service/camera-streamer-raspi-v3-12MP.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ ExecStart=/usr/local/bin/camera-streamer \
2525
; enable continuous autofocus
2626
-camera-options=AfMode=2 \
2727
-camera-options=AfRange=2 \
28+
--http-listen=0.0.0.0 \
29+
--http-port=8080 \
2830
-rtsp-port
2931

3032
DynamicUser=yes

tools/csi_camera.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fi
2222
set -xeo pipefail
2323
make -j$(nproc)
2424
$GDB ./camera-streamer -camera-path="${CAMERA_PATH[0]}" \
25+
--http-listen=0.0.0.0 \
2526
-camera-options=vertical_blanking=728 \
2627
-camera-options=exposure=2444 \
2728
-camera-options=analogue_gain=600 \

tools/libcamera_camera.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cd "$SCRIPT_DIR/.."
66
set -xeo pipefail
77
make -j$(nproc)
88
$GDB ./camera-streamer \
9+
--http-listen=0.0.0.0 \
910
-camera-type=libcamera \
1011
-camera-format=YUYV \
1112
"$@"

tools/usb_camera.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ CAMERA_PATH=( $(echo /dev/v4l/by-id/usb-*-video-index0) )
77

88
set -xeo pipefail
99
make -j$(nproc)
10-
$GDB ./camera-streamer -camera-path="${CAMERA_PATH[${CAMERA_INDEX:-0}]}" "$@"
10+
$GDB ./camera-streamer \
11+
-camera-path="${CAMERA_PATH[${CAMERA_INDEX:-0}]}"
12+
--http-listen=0.0.0.0 \
13+
"$@"

0 commit comments

Comments
 (0)