From a87f59db3482cdf80310d57e0f48f53676277418 Mon Sep 17 00:00:00 2001 From: Saxon Milton Date: Thu, 11 Jan 2018 22:36:57 +1030 Subject: [PATCH] Working on 'efficient slice' and also PSI stuff --- efficientbuffer/EfficientBuffer.go | 15 --------------- effslice/EffSlice.go | 28 ++++++++++++++++++++++++++++ mpegts/psi/pat.go | 17 ++++++++++++++++- mpegts/psi/pmt.go | 13 ++++++++++++- 4 files changed, 56 insertions(+), 17 deletions(-) delete mode 100644 efficientbuffer/EfficientBuffer.go create mode 100644 effslice/EffSlice.go diff --git a/efficientbuffer/EfficientBuffer.go b/efficientbuffer/EfficientBuffer.go deleted file mode 100644 index 1989f270..00000000 --- a/efficientbuffer/EfficientBuffer.go +++ /dev/null @@ -1,15 +0,0 @@ -package efficientbuffer - -type EfficientBuffer struct { - -} - -// TODO: work out how I can combine the following two functions into one -// using interfaces - we check what type it is and deal with accordingly -func Append(b1 *EfficientBuffer, b2 *EfficientBuffer)(out *EfficientBuffer){ - -} - -func Append(b1 *EfficientBuffer, b2 []byte)(out *EfficientBuffer){ - -} diff --git a/effslice/EffSlice.go b/effslice/EffSlice.go new file mode 100644 index 00000000..c6b7c4e7 --- /dev/null +++ b/effslice/EffSlice.go @@ -0,0 +1,28 @@ +package efficientbuffer + +type dataBlock struct { + address []byte // Address of the data block (slice) + lowerBound int // Lower bound of the data we're interested in + upperBound int // Upper bound of the data we're interested in + startIndex int // Index in our EffSlice +} + +type EffSlice struct { + data map[int](*dataChunk) +} + +func (s *EffSlice)GetElement(index int) byte { +} + +func (s *EffSlice)AsByteSlice() []byte { + +} + +func (s *EffSlice)Append(data *EffSlice){ +} + +func (s *EffSlice)Append(data []byte){ +} + +func (s *EffSlice)Len(){ +} diff --git a/mpegts/psi/pat.go b/mpegts/psi/pat.go index 0cb6d00d..9d40fa3b 100644 --- a/mpegts/psi/pat.go +++ b/mpegts/psi/pat.go @@ -28,7 +28,22 @@ LICENSE package psi type PAT struct { - + PF byte // POint field + PFB []byte // pointer filler bytes + TableID byte // Table ID + SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) + PB bool // Private bit (0 for PAT, PMT, CAT) + SL uint16 // Section length + TIE uint16 // Table ID extension + Version byte // Version number + CNI bool // Current/next indicator + Section byte // Section number + LSN byte // Last section number + DT byte // Descriptor tag + DL byte // Descriptor length + Program uint16 // Program number + PMPID uint16 // Program map PID + CRC32 uint32 // Checksum of table } type (p *PAT)ToByteSlice()(output []byte){ diff --git a/mpegts/psi/pmt.go b/mpegts/psi/pmt.go index 4805331b..ee5e89ee 100644 --- a/mpegts/psi/pmt.go +++ b/mpegts/psi/pmt.go @@ -28,7 +28,18 @@ LICENSE package psi type PMT struct { - + PF byte // POint field + PFB []byte // pointer filler bytes + TableID byte // Table ID + SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) + PB bool // Private bit (0 for PAT, PMT, CAT) + SL uint16 // Section length + TIE uint16 // Table ID extension + Version byte // Version number + CNI bool // Current/next indicator + Section byte // Section number + LSN byte // Last section number + } func (p* PMT)ToByteSlice()(output []byte){