From 98e925b23b12baf5f3a6e1aafc55110827348596 Mon Sep 17 00:00:00 2001 From: Trek H Date: Thu, 8 Apr 2021 17:58:49 +0930 Subject: [PATCH] mts: remove gots packet conversion func, moved to iotsvc for local use --- container/mts/mpegts.go | 11 ----------- container/mts/mpegts_test.go | 9 --------- 2 files changed, 20 deletions(-) diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index 68565078..cdabf239 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -32,7 +32,6 @@ package mts import ( "fmt" - "unsafe" "github.com/Comcast/gots/packet" gotspsi "github.com/Comcast/gots/psi" @@ -376,16 +375,6 @@ func asByte(b bool) byte { return 0 } -// GotsPacket takes a byte slice and returns a Packet as defined in github.com/comcast/gots/packet. -// TODO: replace this with a type conversion as described here: https://github.com/golang/go/issues/395 -// when it becomes available in Go 1.17. -func GotsPacket(b []byte) *packet.Packet { - if len(b) != packet.PacketSize { - panic("invalid packet size") - } - return *(**packet.Packet)(unsafe.Pointer(&b)) -} - type Option func(p *packet.Packet) // addAdaptationField adds an adaptation field to p, and applys the passed options to this field. diff --git a/container/mts/mpegts_test.go b/container/mts/mpegts_test.go index 3370ff11..c6d8ba26 100644 --- a/container/mts/mpegts_test.go +++ b/container/mts/mpegts_test.go @@ -769,12 +769,3 @@ func TestFindPSI(t *testing.T) { } } } - -func TestGotsPacket(t *testing.T) { - b := make([]byte, 188) - p := GotsPacket(b) - p.SetPID(PIDAudio) - if p.PID() != PIDAudio { - t.Error("failed to set PID in gots Packet") - } -}