container/mts/encoder.go: using NALTypeSPS from h264dec package

This commit is contained in:
Saxon 2019-08-26 09:24:18 +09:30
parent 817cc86a34
commit b9cd6b3f13
3 changed files with 4 additions and 7 deletions

View File

@ -9,7 +9,7 @@ const (
naluTypeSlicePartC
naluTypeSliceIDRPicture
naluTypeSEI
naluTypeSPS
NALTypeSPS
naluTypePPS
naluTypeAccessUnitDelimiter
naluTypeEndOfSequence

View File

@ -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(

View File

@ -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