|
| 1 | +--- |
| 2 | +name: build-run |
| 3 | +description: > |
| 4 | + Build, run, and configure rtp2httpd locally. Use this skill whenever the user wants to compile |
| 5 | + the project, start the daemon, pass command-line arguments, edit configuration, or troubleshoot |
| 6 | + build/runtime issues. Also activate when the user mentions cmake, build directory, rtp2httpd.conf, |
| 7 | + or asks how to test the service locally. |
| 8 | +--- |
| 9 | + |
| 10 | +# Building and Running rtp2httpd |
| 11 | + |
| 12 | +rtp2httpd is a C daemon (CMake build system) that converts RTP multicast / RTSP / HTTP streams |
| 13 | +to HTTP unicast. This skill covers local development builds — not OpenWrt cross-compilation. |
| 14 | + |
| 15 | +## Build |
| 16 | + |
| 17 | +```bash |
| 18 | +# Configure (Debug for development, Release for performance) |
| 19 | +cmake -B build -DCMAKE_BUILD_TYPE=Debug |
| 20 | + |
| 21 | +# Compile |
| 22 | +cmake --build build -j$(nproc) |
| 23 | +``` |
| 24 | + |
| 25 | +The binary lands at `build/rtp2httpd`. |
| 26 | + |
| 27 | +### Build options |
| 28 | + |
| 29 | +| CMake option | Default | Purpose | |
| 30 | +|---------------------------|---------|--------------------------------------| |
| 31 | +| `CMAKE_BUILD_TYPE` | Release | Debug / Release / RelWithDebInfo | |
| 32 | +| `ENABLE_AGGRESSIVE_OPT` | OFF | LTO, fast-math, loop unrolling | |
| 33 | + |
| 34 | +## Run |
| 35 | + |
| 36 | +```bash |
| 37 | +# Minimal: no config file, verbose, listen on port 8080 |
| 38 | +./build/rtp2httpd -C -v -v -v -v -l 8080 |
| 39 | + |
| 40 | +# With a config file |
| 41 | +./build/rtp2httpd -c rtp2httpd.conf |
| 42 | + |
| 43 | +# Override specific settings via CLI |
| 44 | +./build/rtp2httpd -c rtp2httpd.conf -l 5140 -m 20 -v -v |
| 45 | +``` |
| 46 | + |
| 47 | +### Commonly used CLI flags |
| 48 | + |
| 49 | +| Flag | Short | Purpose | |
| 50 | +|--------------------|-------|--------------------------------------------| |
| 51 | +| `--noconfig` | `-C` | Skip default config file | |
| 52 | +| `--config <file>` | `-c` | Use specific config file | |
| 53 | +| `--listen [addr:]port` | `-l` | Bind address/port (default ANY:5140) | |
| 54 | +| `--verbose` | `-v` | Increase verbosity (stack up to 4 times) | |
| 55 | +| `--maxclients <n>` | `-m` | Max simultaneous clients (default 5) | |
| 56 | +| `--help` | `-h` | Show all available options | |
| 57 | + |
| 58 | +Run `./build/rtp2httpd --help` for the complete flag list. |
| 59 | + |
| 60 | +## Configuration |
| 61 | + |
| 62 | +The config file is INI-style with three sections: `[global]`, `[bind]`, `[services]`. |
| 63 | + |
| 64 | +- **Reference config**: `rtp2httpd.conf` in the project root — all options are documented with comments |
| 65 | +- **Full docs**: `docs/.vitepress/dist/reference/configuration.md` |
| 66 | + |
| 67 | +When both CLI flags and config file settings are present, CLI flags take precedence. |
| 68 | + |
| 69 | +### Quick config example |
| 70 | + |
| 71 | +```ini |
| 72 | +[global] |
| 73 | +verbosity = 3 |
| 74 | + |
| 75 | +[bind] |
| 76 | +* 5140 |
| 77 | + |
| 78 | +[services] |
| 79 | +#EXTM3U |
| 80 | +#EXTINF:-1,Channel One |
| 81 | +rtp://239.253.64.120:5140 |
| 82 | +#EXTINF:-1,RTSP Channel |
| 83 | +rtsp://10.0.0.50:554/live |
| 84 | +#EXTINF:-1,HTTP Channel |
| 85 | +http://upstream.example.com/stream |
| 86 | +``` |
| 87 | + |
| 88 | +## Verify it works |
| 89 | + |
| 90 | +```bash |
| 91 | +# Status page |
| 92 | +curl http://127.0.0.1:5140/status |
| 93 | + |
| 94 | +# M3U playlist (if services configured) |
| 95 | +curl http://127.0.0.1:5140/playlist.m3u |
| 96 | + |
| 97 | +# Stream a channel (replace with actual multicast addr) |
| 98 | +curl http://127.0.0.1:5140/rtp/239.253.64.120:5140 --max-time 3 -o /dev/null -w "%{http_code}" |
| 99 | +``` |
| 100 | + |
| 101 | +## Troubleshooting |
| 102 | + |
| 103 | +- **Port in use**: change `-l` port or kill the old process |
0 commit comments