diff --git a/codec/h264/h264dec/frame.go b/codec/h264/h264dec/frame.go index 82b32ae5..ca85982b 100644 --- a/codec/h264/h264dec/frame.go +++ b/codec/h264/h264dec/frame.go @@ -9,7 +9,7 @@ const ( naluTypeSlicePartC naluTypeSliceIDRPicture naluTypeSEI - naluTypeSPS + NALTypeSPS naluTypePPS naluTypeAccessUnitDelimiter naluTypeEndOfSequence diff --git a/codec/h264/h264dec/read.go b/codec/h264/h264dec/read.go index c98d46ca..9b283c92 100644 --- a/codec/h264/h264dec/read.go +++ b/codec/h264/h264dec/read.go @@ -61,7 +61,7 @@ func (h *H264Reader) Start() { // TODO: need to handle error from this. nalUnit, _, _ := h.readNalUnit() switch nalUnit.Type { - case naluTypeSPS: + case NALTypeSPS: // TODO: handle this error sps, _ := NewSPS(nalUnit.RBSP, false) h.VideoStreams = append( diff --git a/container/mts/encoder.go b/container/mts/encoder.go index 63413b77..cb3d9d06 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -33,6 +33,7 @@ import ( "time" "bitbucket.org/ausocean/av/codec/h264" + "bitbucket.org/ausocean/av/codec/h264/h264dec" "bitbucket.org/ausocean/av/container/mts/meta" "bitbucket.org/ausocean/av/container/mts/pes" "bitbucket.org/ausocean/av/container/mts/psi" @@ -252,11 +253,7 @@ func (e *Encoder) Write(data []byte) (int, error) { return 0, fmt.Errorf("could not get type from NAL unit, failed with error: %v", err) } - // NAL type that will signify refresh. These are defined in H.264 specifications - // table 7-1. - const nalTypeSPS = 7 - - if nalType == nalTypeSPS { + if nalType == h264dec.NALTypeSPS { err := e.writePSI() if err != nil { return 0, err