From 824fd75d18c24c8149d1a95998842fac0ffc7aae Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 27 Dec 2022 17:27:59 +0100 Subject: [PATCH] rename MJPEG label into M-JPEG --- README.md | 2 +- examples/client-publish-format-mjpeg/main.go | 10 +++++----- examples/client-read-format-mjpeg/main.go | 6 +++--- pkg/format/mjpeg.go | 2 +- pkg/format/mjpeg_test.go | 2 +- pkg/formatdecenc/rtpmjpeg/decoder.go | 4 ++-- pkg/formatdecenc/rtpmjpeg/encoder.go | 4 ++-- pkg/formatdecenc/rtpmjpeg/headers/headers.go | 2 +- pkg/formatdecenc/rtpmjpeg/rtpmjpeg.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 265c6ece..f675eae4 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Features: * Generate RTCP sender reports * Utilities * Encode/decode format-specific frames into/from RTP packets. The following formats are supported: - * Video: H264, H265, MJPEG, VP8, VP9 + * Video: H264, H265, M-JPEG, VP8, VP9 * Audio: G711 (PCMA, PCMU), G722, LPCM, MPEG4 Audio (AAC), Opus * Parse RTSP elements: requests, responses, SDP * Parse H264 elements and formats: Annex-B, AVCC, anti-competition, DTS diff --git a/examples/client-publish-format-mjpeg/main.go b/examples/client-publish-format-mjpeg/main.go index cb9c1b71..bc20f0bd 100644 --- a/examples/client-publish-format-mjpeg/main.go +++ b/examples/client-publish-format-mjpeg/main.go @@ -11,19 +11,19 @@ import ( ) // This example shows how to -// 1. generate RTP/MJPEG packets with GStreamer -// 2. connect to a RTSP server, announce an MJPEG media +// 1. generate RTP/M-JPEG packets with GStreamer +// 2. connect to a RTSP server, announce a M-JPEG media // 3. route the packets from GStreamer to the server func main() { - // open a listener to receive RTP/MJPEG packets + // open a listener to receive RTP/M-JPEG packets pc, err := net.ListenPacket("udp", "localhost:9000") if err != nil { panic(err) } defer pc.Close() - log.Println("Waiting for a RTP/MJPEG stream on UDP port 9000 - you can send one with GStreamer:\n" + + log.Println("Waiting for a RTP/M-JPEG stream on UDP port 9000 - you can send one with GStreamer:\n" + "gst-launch-1.0 videotestsrc ! video/x-raw,width=1920,height=1080,format=I420" + " ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=9000") @@ -35,7 +35,7 @@ func main() { } log.Println("stream connected") - // create a media that contains a MJPEG format + // create a media that contains a M-JPEG format medias := media.Medias{&media.Media{ Type: media.TypeVideo, Formats: []format.Format{&format.MJPEG{}}, diff --git a/examples/client-read-format-mjpeg/main.go b/examples/client-read-format-mjpeg/main.go index fd1cd22c..1c644e71 100644 --- a/examples/client-read-format-mjpeg/main.go +++ b/examples/client-read-format-mjpeg/main.go @@ -14,7 +14,7 @@ import ( // This example shows how to // 1. connect to a RTSP server -// 2. check if there's a MJPEG media +// 2. check if there's a M-JPEG media // 3. get JPEG images of that media // 4. decode JPEG images into raw images @@ -40,14 +40,14 @@ func main() { panic(err) } - // find the MJPEG media and format + // find the M-JPEG media and format var forma *format.MJPEG medi := medias.FindFormat(&forma) if medi == nil { panic("media not found") } - // setup RTP/MJPEG->MJPEG decoder + // setup RTP/M-JPEG->M-JPEG decoder rtpDec := forma.CreateDecoder() // setup the chosen media only diff --git a/pkg/format/mjpeg.go b/pkg/format/mjpeg.go index aac4c28d..c019b8f5 100644 --- a/pkg/format/mjpeg.go +++ b/pkg/format/mjpeg.go @@ -11,7 +11,7 @@ type MJPEG struct{} // String implements Format. func (t *MJPEG) String() string { - return "MJPEG" + return "M-JPEG" } // ClockRate implements Format. diff --git a/pkg/format/mjpeg_test.go b/pkg/format/mjpeg_test.go index a5cdacc9..64013a50 100644 --- a/pkg/format/mjpeg_test.go +++ b/pkg/format/mjpeg_test.go @@ -9,7 +9,7 @@ import ( func TestMJPEGAttributes(t *testing.T) { format := &MJPEG{} - require.Equal(t, "MJPEG", format.String()) + require.Equal(t, "M-JPEG", format.String()) require.Equal(t, 90000, format.ClockRate()) require.Equal(t, uint8(26), format.PayloadType()) require.Equal(t, true, format.PTSEqualsDTS(&rtp.Packet{})) diff --git a/pkg/formatdecenc/rtpmjpeg/decoder.go b/pkg/formatdecenc/rtpmjpeg/decoder.go index 94a37b6f..55f341d3 100644 --- a/pkg/formatdecenc/rtpmjpeg/decoder.go +++ b/pkg/formatdecenc/rtpmjpeg/decoder.go @@ -94,7 +94,7 @@ var chmAcSymbols = []byte{ //nolint:dupl 0xf9, 0xfa, } -// Decoder is a RTP/MJPEG decoder. +// Decoder is a RTP/M-JPEG decoder. type Decoder struct { timeDecoder *rtptimedec.Decoder firstPacketReceived bool @@ -109,7 +109,7 @@ func (d *Decoder) Init() { d.timeDecoder = rtptimedec.New(rtpClockRate) } -// Decode decodes an image from a RTP/MJPEG packet. +// Decode decodes an image from a RTP/M-JPEG packet. func (d *Decoder) Decode(pkt *rtp.Packet) ([]byte, time.Duration, error) { byts := pkt.Payload diff --git a/pkg/formatdecenc/rtpmjpeg/encoder.go b/pkg/formatdecenc/rtpmjpeg/encoder.go index 77dc56c9..a4e72eec 100644 --- a/pkg/formatdecenc/rtpmjpeg/encoder.go +++ b/pkg/formatdecenc/rtpmjpeg/encoder.go @@ -22,7 +22,7 @@ func randUint32() uint32 { return uint32(b[0])<<24 | uint32(b[1])<<16 | uint32(b[2])<<8 | uint32(b[3]) } -// Encoder is a RTP/MJPEG encoder. +// Encoder is a RTP/M-JPEG encoder. type Encoder struct { // SSRC of packets (optional). // It defaults to a random value. @@ -68,7 +68,7 @@ func (e *Encoder) encodeTimestamp(ts time.Duration) uint32 { return *e.InitialTimestamp + uint32(ts.Seconds()*rtpClockRate) } -// Encode encodes an image into RTP/MJPEG packets. +// Encode encodes an image into RTP/M-JPEG packets. func (e *Encoder) Encode(image []byte, pts time.Duration) ([]*rtp.Packet, error) { l := len(image) if l < 2 || image[0] != 0xFF || image[1] != jpeg.MarkerStartOfImage { diff --git a/pkg/formatdecenc/rtpmjpeg/headers/headers.go b/pkg/formatdecenc/rtpmjpeg/headers/headers.go index 1cbd88d2..88070c99 100644 --- a/pkg/formatdecenc/rtpmjpeg/headers/headers.go +++ b/pkg/formatdecenc/rtpmjpeg/headers/headers.go @@ -1,2 +1,2 @@ -// Package headers contains RTP/MJPEG headers. +// Package headers contains RTP/M-JPEG headers. package headers diff --git a/pkg/formatdecenc/rtpmjpeg/rtpmjpeg.go b/pkg/formatdecenc/rtpmjpeg/rtpmjpeg.go index b47089b3..dce344d5 100644 --- a/pkg/formatdecenc/rtpmjpeg/rtpmjpeg.go +++ b/pkg/formatdecenc/rtpmjpeg/rtpmjpeg.go @@ -1,4 +1,4 @@ -// Package rtpmjpeg contains a RTP/MJPEG decoder and encoder. +// Package rtpmjpeg contains a RTP/M-JPEG decoder and encoder. package rtpmjpeg const (