Rename mpegts module to mpeg

This commit is contained in:
Alex X
2026-02-08 07:09:36 +03:00
parent 44f6f111c4
commit 2735bafd86
8 changed files with 36 additions and 47 deletions
+3 -3
View File
@@ -237,7 +237,7 @@ A summary table of all modules and features can be found [here](internal/README.
### Streaming output
- [`adts`](internal/mpegts/README.md) - Output stream in ADTS format with [AAC](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) audio.
- [`adts`](internal/mpeg/README.md) - Output stream in ADTS format with [AAC](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) audio.
- [`ascii`](internal/mjpeg/README.md#ascii) - Just for fun stream as [ASCII to Terminal](https://www.youtube.com/watch?v=sHj_3h_sX7M).
- [`flv`](internal/rtmp/README.md) - Output stream in [Flash Video](https://en.wikipedia.org/wiki/Flash_Video) format.
- [`hls`](internal/hls/README.md) - Output stream in [HTTP Live Streaming](https://en.wikipedia.org/wiki/HTTP_Live_Streaming) format.
@@ -245,7 +245,7 @@ A summary table of all modules and features can be found [here](internal/README.
- [`jpeg`](internal/mjpeg/README.md#jpeg) - Output snapshots in [JPEG](https://en.wikipedia.org/wiki/JPEG) format.
- [`mpjpeg`](internal/mjpeg/README.md#mpjpeg) - Output a stream in [MJPEG](https://en.wikipedia.org/wiki/Motion_JPEG) format.
- [`mp4`](internal/mp4/README.md) - Output as [MP4 stream](https://en.wikipedia.org/wiki/Progressive_download) or [Media Source Extensions](https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API) (MSE) compatible format.
- [`mpegts`](internal/homekit/README.md) - Output stream in [MPEG transport stream](https://en.wikipedia.org/wiki/MPEG_transport_stream) format.
- [`mpegts`](internal/mpeg/README.md) - Output stream in [MPEG transport stream](https://en.wikipedia.org/wiki/MPEG_transport_stream) format.
- [`onvif`](internal/onvif/README.md#onvif-server) - Output stream using [ONVIF](https://en.wikipedia.org/wiki/ONVIF) protocol.
- [`rtmp`](internal/rtmp/README.md#rtmp-server) - Output stream using [Real-Time Messaging](https://en.wikipedia.org/wiki/Real-Time_Messaging_Protocol) protocol.
- [`rtsp`](internal/rtsp/README.md#rtsp-server) - Output stream using [Real-Time Streaming](https://en.wikipedia.org/wiki/Real-Time_Streaming_Protocol) protocol.
@@ -258,7 +258,7 @@ A summary table of all modules and features can be found [here](internal/README.
Supported for:
[`flv`](internal/rtmp/README.md#flv-server),
[`mjpeg`](internal/mjpeg/README.md#streaming-ingest),
[`mpegts`](internal/mpegts/README.md#streaming-ingest),
[`mpegts`](internal/mpeg/README.md#streaming-ingest),
[`rtmp`](internal/rtmp/README.md#rtmp-server),
[`rtsp`](internal/rtsp/README.md#streaming-ingest),
[`webrtc`](internal/webrtc/README.md#streaming-ingest).
+3 -3
View File
@@ -47,8 +47,8 @@ Some formats and protocols go2rtc supports exclusively. They have no equivalent
| [`mjpeg`] | `mpjpeg` | `http` | | yes | yes | |
| [`mjpeg`] | `yuv4mpegpipe` | `http` | | yes | | |
| [`mp4`] | `mp4` | `http`, `ws` | | yes | | |
| [`mpegts`] | `adts` | `http` | | yes | | |
| [`mpegts`] | `mpegts` | `http` | | yes | yes | |
| [`mpeg`] | `adts` | `http` | | yes | | |
| [`mpeg`] | `mpegts` | `http` | | yes | yes | |
| [`multitrans`] | `rtp` | `tcp` | | | | yes |
| [`nest`] | `srtp` | `rtsp`, `webrtc` | yes | | | no |
| [`onvif`] | `rtp` | * | yes | yes | | |
@@ -90,7 +90,7 @@ Some formats and protocols go2rtc supports exclusively. They have no equivalent
[`kasa`]: kasa/README.md
[`mjpeg`]: mjpeg/README.md
[`mp4`]: mp4/README.md
[`mpegts`]: mpegts/README.md
[`mpeg`]: mpeg/README.md
[`multitrans`]: multitrans/README.md
[`nest`]: nest/README.md
[`ngrok`]: ngrok/README.md
@@ -1,4 +1,4 @@
# MPEG-TS
# MPEG
This module provides an [HTTP API](../api/README.md) for:
@@ -6,9 +6,6 @@ This module provides an [HTTP API](../api/README.md) for:
- Streaming output in `adts` format.
- Streaming ingest in `mpegts` format.
> [!NOTE]
> This module is probably better called mpeg. Because AAC is part of MPEG-2 and MPEG-4 and MPEG-TS is part of MPEG-2.
## MPEG-TS Server
```shell
@@ -1,10 +1,11 @@
package mpegts
package mpeg
import (
"net/http"
"github.com/AlexxIT/go2rtc/internal/api"
"github.com/AlexxIT/go2rtc/internal/streams"
"github.com/AlexxIT/go2rtc/pkg/aac"
"github.com/AlexxIT/go2rtc/pkg/mpegts"
)
@@ -66,3 +67,26 @@ func inputMpegTS(w http.ResponseWriter, r *http.Request) {
return
}
}
func apiStreamAAC(w http.ResponseWriter, r *http.Request) {
src := r.URL.Query().Get("src")
stream := streams.Get(src)
if stream == nil {
http.Error(w, api.StreamNotFound, http.StatusNotFound)
return
}
cons := aac.NewConsumer()
cons.WithRequest(r)
if err := stream.AddConsumer(cons); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "audio/aac")
_, _ = cons.WriteTo(w)
stream.RemoveConsumer(cons)
}
-32
View File
@@ -1,32 +0,0 @@
package mpegts
import (
"net/http"
"github.com/AlexxIT/go2rtc/internal/api"
"github.com/AlexxIT/go2rtc/internal/streams"
"github.com/AlexxIT/go2rtc/pkg/aac"
)
func apiStreamAAC(w http.ResponseWriter, r *http.Request) {
src := r.URL.Query().Get("src")
stream := streams.Get(src)
if stream == nil {
http.Error(w, api.StreamNotFound, http.StatusNotFound)
return
}
cons := aac.NewConsumer()
cons.WithRequest(r)
if err := stream.AddConsumer(cons); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "audio/aac")
_, _ = cons.WriteTo(w)
stream.RemoveConsumer(cons)
}
+2 -2
View File
@@ -27,7 +27,7 @@ import (
"github.com/AlexxIT/go2rtc/internal/kasa"
"github.com/AlexxIT/go2rtc/internal/mjpeg"
"github.com/AlexxIT/go2rtc/internal/mp4"
"github.com/AlexxIT/go2rtc/internal/mpegts"
"github.com/AlexxIT/go2rtc/internal/mpeg"
"github.com/AlexxIT/go2rtc/internal/multitrans"
"github.com/AlexxIT/go2rtc/internal/nest"
"github.com/AlexxIT/go2rtc/internal/ngrok"
@@ -98,7 +98,7 @@ func main() {
{"isapi", isapi.Init},
{"ivideon", ivideon.Init},
{"kasa", kasa.Init},
{"mpegts", mpegts.Init},
{"mpegts", mpeg.Init},
{"multitrans", multitrans.Init},
{"nest", nest.Init},
{"ring", ring.Init},
+1 -1
View File
@@ -134,7 +134,7 @@ export default defineConfig({
{text: 'isapi', link: '/internal/isapi/'},
{text: 'ivideon', link: '/internal/ivideon/'},
{text: 'kasa', link: '/internal/kasa/'},
{text: 'mpegts', link: '/internal/mpegts/'},
{text: 'mpeg', link: '/internal/mpeg/'},
{text: 'multitrans', link: '/internal/multitrans/'},
{text: 'nest', link: '/internal/nest/'},
{text: 'ring', link: '/internal/ring/'},
+1 -1
View File
@@ -172,7 +172,7 @@
"isapi",
"ivideon",
"kasa",
"mpegts",
"mpeg",
"nest",
"ring",
"roborock",