Browse Source

rename RTSP_SERVER_PATH environment variable into RTSP_PATH

pull/169/head
aler9 5 years ago
parent
commit
93f6687ad9
  1. 4
      Makefile
  2. 8
      README.md
  3. 4
      externalcmd/externalcmd.go
  4. 6
      main_test.go
  5. 8
      rtsp-simple-server.yml

4
Makefile

@ -80,10 +80,10 @@ define CONFIG_RUN @@ -80,10 +80,10 @@ define CONFIG_RUN
paths:
all:
# runOnPublish: ffmpeg -i rtsp://localhost:8554/$$RTSP_SERVER_PATH -c copy -f mpegts myfile_$$RTSP_SERVER_PATH.ts
# runOnPublish: ffmpeg -i rtsp://localhost:8554/$$RTSP_PATH -c copy -f mpegts myfile_$$RTSP_PATH.ts
# readUser: test
# readPass: tast
# runOnDemand: ffmpeg -re -stream_loop -1 -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$$RTSP_SERVER_PATH
# runOnDemand: ffmpeg -re -stream_loop -1 -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$$RTSP_PATH
# proxied:
# source: rtsp://192.168.2.198:8554/stream

8
README.md

@ -108,7 +108,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with @@ -108,7 +108,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with
```yaml
paths:
cam:
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:8554/$RTSP_PATH
runOnInitRestart: yes
```
@ -128,7 +128,7 @@ Then edit `rtsp-simple-server.yml` and replace everything inside section `paths` @@ -128,7 +128,7 @@ Then edit `rtsp-simple-server.yml` and replace everything inside section `paths`
```yaml
paths:
cam:
runOnInit: gst-launch-1.0 rpicamsrc preview=false bitrate=2000000 keyframe-interval=50 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! rtspclientsink location=rtsp://localhost:8554/$RTSP_SERVER_PATH
runOnInit: gst-launch-1.0 rpicamsrc preview=false bitrate=2000000 keyframe-interval=50 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! rtspclientsink location=rtsp://localhost:8554/$RTSP_PATH
runOnInitRestart: yes
```
@ -140,7 +140,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with @@ -140,7 +140,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with
```yaml
paths:
ondemand:
runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH
runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH
runOnDemandRestart: yes
```
@ -153,7 +153,7 @@ To change the format, codec or compression of a stream, you can use _FFmpeg_ or @@ -153,7 +153,7 @@ To change the format, codec or compression of a stream, you can use _FFmpeg_ or
paths:
all:
original:
runOnPublish: ffmpeg -i rtsp://localhost:8554/$RTSP_SERVER_PATH -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:8554/compressed
runOnPublish: ffmpeg -i rtsp://localhost:8554/$RTSP_PATH -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:8554/compressed
runOnPublishRestart: yes
```

4
externalcmd/externalcmd.go

@ -79,7 +79,7 @@ func (e *ExternalCmd) runInner() bool { @@ -79,7 +79,7 @@ func (e *ExternalCmd) runInner() bool {
// on Windows the shell is not used and command is started directly
// variables are replaced manually in order to guarantee compatibility
// with Linux commands
args := strings.Fields(strings.ReplaceAll(e.cmdstr, "$RTSP_SERVER_PATH", e.pathName))
args := strings.Fields(strings.ReplaceAll(e.cmdstr, "$RTSP_PATH", e.pathName))
cmd = exec.Command(args[0], args[1:]...)
} else {
@ -88,7 +88,7 @@ func (e *ExternalCmd) runInner() bool { @@ -88,7 +88,7 @@ func (e *ExternalCmd) runInner() bool {
// variables are inserted into the environment
cmd.Env = append(os.Environ(),
"RTSP_SERVER_PATH="+e.pathName,
"RTSP_PATH="+e.pathName,
)
cmd.Stdout = os.Stdout

6
main_test.go

@ -692,7 +692,7 @@ func TestRedirect(t *testing.T) { @@ -692,7 +692,7 @@ func TestRedirect(t *testing.T) {
func TestRunOnDemand(t *testing.T) {
p1, err := testProgram("paths:\n" +
" all:\n" +
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n")
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n")
require.NoError(t, err)
defer p1.close()
@ -716,7 +716,7 @@ func TestHotReloading(t *testing.T) { @@ -716,7 +716,7 @@ func TestHotReloading(t *testing.T) {
err := ioutil.WriteFile(confPath, []byte("paths:\n"+
" test1:\n"+
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n"),
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n"),
0644)
require.NoError(t, err)
@ -742,7 +742,7 @@ func TestHotReloading(t *testing.T) { @@ -742,7 +742,7 @@ func TestHotReloading(t *testing.T) {
err = ioutil.WriteFile(confPath, []byte("paths:\n"+
" test2:\n"+
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n"),
" runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n"),
0644)
require.NoError(t, err)

8
rtsp-simple-server.yml

@ -82,7 +82,7 @@ paths: @@ -82,7 +82,7 @@ paths:
# command to run when this path is initialized.
# this can be used to publish a stream and keep it always opened.
# this is terminated with SIGINT when the program closes.
# the path name is available in the RTSP_SERVER_PATH variable.
# the path name is available in the RTSP_PATH variable.
# the restart parameter allows to restart the command if it exits suddenly.
runOnInit:
runOnInitRestart: no
@ -90,7 +90,7 @@ paths: @@ -90,7 +90,7 @@ paths:
# command to run when this path is requested.
# this can be used to publish a stream on demand.
# this is terminated with SIGINT when the path is not requested anymore.
# the path name is available in the RTSP_SERVER_PATH variable.
# the path name is available in the RTSP_PATH variable.
# the restart parameter allows to restart the command if it exits suddenly.
runOnDemand:
runOnDemandRestart: no
@ -103,14 +103,14 @@ paths: @@ -103,14 +103,14 @@ paths:
# command to run when a client starts publishing.
# this is terminated with SIGINT when a client stops publishing.
# the path name is available in the RTSP_SERVER_PATH variable.
# the path name is available in the RTSP_PATH variable.
# the restart parameter allows to restart the command if it exits suddenly.
runOnPublish:
runOnPublishRestart: no
# command to run when a clients starts reading.
# this is terminated with SIGINT when a client stops reading.
# the path name is available in the RTSP_SERVER_PATH variable.
# the path name is available in the RTSP_PATH variable.
# the restart parameter allows to restart the command if it exits suddenly.
runOnRead:
runOnReadRestart: no

Loading…
Cancel
Save