mirror of https://bitbucket.org/ausocean/av.git
container/mts/encoder.go: using NALTypeSPS from h264dec package
This commit is contained in:
parent
817cc86a34
commit
b9cd6b3f13
|
@ -9,7 +9,7 @@ const (
|
||||||
naluTypeSlicePartC
|
naluTypeSlicePartC
|
||||||
naluTypeSliceIDRPicture
|
naluTypeSliceIDRPicture
|
||||||
naluTypeSEI
|
naluTypeSEI
|
||||||
naluTypeSPS
|
NALTypeSPS
|
||||||
naluTypePPS
|
naluTypePPS
|
||||||
naluTypeAccessUnitDelimiter
|
naluTypeAccessUnitDelimiter
|
||||||
naluTypeEndOfSequence
|
naluTypeEndOfSequence
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (h *H264Reader) Start() {
|
||||||
// TODO: need to handle error from this.
|
// TODO: need to handle error from this.
|
||||||
nalUnit, _, _ := h.readNalUnit()
|
nalUnit, _, _ := h.readNalUnit()
|
||||||
switch nalUnit.Type {
|
switch nalUnit.Type {
|
||||||
case naluTypeSPS:
|
case NALTypeSPS:
|
||||||
// TODO: handle this error
|
// TODO: handle this error
|
||||||
sps, _ := NewSPS(nalUnit.RBSP, false)
|
sps, _ := NewSPS(nalUnit.RBSP, false)
|
||||||
h.VideoStreams = append(
|
h.VideoStreams = append(
|
||||||
|
|
|
@ -33,6 +33,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/codec/h264"
|
"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/meta"
|
||||||
"bitbucket.org/ausocean/av/container/mts/pes"
|
"bitbucket.org/ausocean/av/container/mts/pes"
|
||||||
"bitbucket.org/ausocean/av/container/mts/psi"
|
"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)
|
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
|
if nalType == h264dec.NALTypeSPS {
|
||||||
// table 7-1.
|
|
||||||
const nalTypeSPS = 7
|
|
||||||
|
|
||||||
if nalType == nalTypeSPS {
|
|
||||||
err := e.writePSI()
|
err := e.writePSI()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
Loading…
Reference in New Issue