From 51f4d123bf6722d57e16c43634fa1c8e4674c5ae Mon Sep 17 00:00:00 2001 From: Saxon Date: Sat, 11 May 2019 21:14:28 +0930 Subject: [PATCH] container/mts: using MPEG-TS in comments rather than MPEGTS or mpegts --- container/mts/discontinuity.go | 8 ++++---- container/mts/encoder.go | 6 +++--- container/mts/encoder_test.go | 6 +++--- container/mts/mpegts.go | 12 ++++++------ container/mts/mpegts_test.go | 2 +- container/mts/psi/helpers.go | 2 +- container/mts/psi/psi.go | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/container/mts/discontinuity.go b/container/mts/discontinuity.go index adccebad..e127ff94 100644 --- a/container/mts/discontinuity.go +++ b/container/mts/discontinuity.go @@ -4,8 +4,8 @@ NAME DESCRIPTION discontinuity.go provides functionality for detecting discontinuities in - mpegts and accounting for using the discontinuity indicator in the adaptation - field. + MPEG-TS and accounting for using the discontinuity indicator in the adaptation + field. AUTHOR Saxon A. Nelson-Milton @@ -33,7 +33,7 @@ import ( "github.com/Comcast/gots/packet" ) -// discontinuityRepairer provides function to detect discontinuities in mpegts +// discontinuityRepairer provides function to detect discontinuities in MPEG-TS // and set the discontinuity indicator as appropriate. type DiscontinuityRepairer struct { expCC map[int]int @@ -56,7 +56,7 @@ func (dr *DiscontinuityRepairer) Failed() { dr.decExpectedCC(PatPid) } -// Repair takes a clip of mpegts and checks that the first packet, which should +// Repair takes a clip of MPEG-TS and checks that the first packet, which should // be a PAT, contains a cc that is expected, otherwise the discontinuity indicator // is set to true. func (dr *DiscontinuityRepairer) Repair(d []byte) error { diff --git a/container/mts/encoder.go b/container/mts/encoder.go index e2a9fe94..485c0415 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -124,7 +124,7 @@ const ( pcrFreq = 90000 // Hz ) -// Encoder encapsulates properties of an mpegts generator. +// Encoder encapsulates properties of an MPEG-TS generator. type Encoder struct { dst io.WriteCloser @@ -201,7 +201,7 @@ func (e *Encoder) TimeBasedPsi(b bool, sendCount int) { e.pktCount = e.psiSendCount } -// Write implements io.Writer. Write takes raw h264 and encodes into mpegts, +// Write implements io.Writer. Write takes raw h264 and encodes into MPEG-TS, // then sending it to the encoder's io.Writer destination. func (e *Encoder) Write(data []byte) (int, error) { now := time.Now() @@ -256,7 +256,7 @@ func (e *Encoder) Write(data []byte) (int, error) { return len(data), nil } -// writePSI creates mpegts with pat and pmt tables - with pmt table having updated +// writePSI creates MPEG-TS with pat and pmt tables - with pmt table having updated // location and time data. func (e *Encoder) writePSI() error { // Write PAT. diff --git a/container/mts/encoder_test.go b/container/mts/encoder_test.go index 148d0e99..8436d241 100644 --- a/container/mts/encoder_test.go +++ b/container/mts/encoder_test.go @@ -53,7 +53,7 @@ func (d *destination) Write(p []byte) (int, error) { } // TestEncodeVideo checks that we can correctly encode some dummy data into a -// valid MPEGTS stream. This checks for correct MPEGTS headers and also that the +// valid MPEG-TS stream. This checks for correct MPEG-TS headers and also that the // original data is stored correctly and is retreivable. func TestEncodeVideo(t *testing.T) { Meta = meta.New() @@ -148,8 +148,8 @@ func TestEncodeVideo(t *testing.T) { } } -// TestEncodePcm tests the mpegts encoder's ability to encode pcm audio data. -// It reads and encodes input pcm data into mpegts, then decodes the mpegts and compares the result to the input pcm. +// TestEncodePcm tests the MPEG-TS encoder's ability to encode pcm audio data. +// It reads and encodes input pcm data into MPEG-TS, then decodes the MPEG-TS and compares the result to the input pcm. func TestEncodePcm(t *testing.T) { Meta = meta.New() diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index f47e78ba..ebbaa493 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -1,7 +1,7 @@ /* NAME mpegts.go - provides a data structure intended to encapsulate the properties - of an MpegTs packet and also functions to allow manipulation of these packets. + of an MPEG-TS packet and also functions to allow manipulation of these packets. DESCRIPTION See Readme.md @@ -48,7 +48,7 @@ const ( // StreamID is the id of the first stream. const StreamID = 0xe0 -// HeadSize is the size of an mpegts packet header. +// HeadSize is the size of an MPEG-TS packet header. const HeadSize = 4 // Consts relating to adaptation field. @@ -159,23 +159,23 @@ type Packet struct { Payload []byte // Mpeg ts Payload } -// FindPmt will take a clip of mpegts and try to find a PMT table - if one +// FindPmt will take a clip of MPEG-TS and try to find a PMT table - if one // is found, then it is returned along with its index, otherwise nil, -1 and an error is returned. func FindPmt(d []byte) ([]byte, int, error) { return FindPid(d, PmtPid) } -// FindPat will take a clip of mpegts and try to find a PAT table - if one +// FindPat will take a clip of MPEG-TS and try to find a PAT table - if one // is found, then it is returned along with its index, otherwise nil, -1 and an error is returned. func FindPat(d []byte) ([]byte, int, error) { return FindPid(d, PatPid) } -// FindPid will take a clip of mpegts and try to find a packet with given PID - if one +// FindPid will take a clip of MPEG-TS and try to find a packet with given PID - if one // is found, then it is returned along with its index, otherwise nil, -1 and an error is returned. func FindPid(d []byte, pid uint16) (pkt []byte, i int, err error) { if len(d) < PacketSize { - return nil, -1, errors.New("MPEGTS data not of valid length") + return nil, -1, errors.New("MPEG-TS data not of valid length") } for i = 0; i < len(d); i += PacketSize { p := (uint16(d[i+1]&0x1f) << 8) | uint16(d[i+2]) diff --git a/container/mts/mpegts_test.go b/container/mts/mpegts_test.go index 67670de9..c949f0b4 100644 --- a/container/mts/mpegts_test.go +++ b/container/mts/mpegts_test.go @@ -97,7 +97,7 @@ func TestBytes(t *testing.T) { } // TestFindPid checks that FindPid can correctly extract the first instance -// of a PID from an MPEGTS stream. +// of a PID from an MPEG-TS stream. func TestFindPid(t *testing.T) { const targetPacketNum, numOfPackets, targetPid, stdPid = 6, 15, 1, 0 diff --git a/container/mts/psi/helpers.go b/container/mts/psi/helpers.go index b8bab6b5..621460f5 100644 --- a/container/mts/psi/helpers.go +++ b/container/mts/psi/helpers.go @@ -125,7 +125,7 @@ func trimTo(d []byte, t byte) []byte { } // addPadding adds an appropriate amount of padding to a pat or pmt table for -// addition to an mpegts packet +// addition to an MPEG-TS packet func AddPadding(d []byte) []byte { t := make([]byte, PacketSize) copy(t, d) diff --git a/container/mts/psi/psi.go b/container/mts/psi/psi.go index c93d3011..3703faf4 100644 --- a/container/mts/psi/psi.go +++ b/container/mts/psi/psi.go @@ -32,7 +32,7 @@ import ( "github.com/Comcast/gots/psi" ) -// PacketSize of psi (without mpegts header) +// PacketSize of psi (without MPEG-TS header) const PacketSize = 184 // Lengths of section definitions.