rename consts

This commit is contained in:
nareix 2016-07-01 17:53:33 +08:00
parent a310437804
commit d4285826d9
2 changed files with 17 additions and 10 deletions

View File

@ -133,7 +133,7 @@ func MakeADTSHeader(config MPEG4AudioConfig, samples int, payloadLength int) (he
return return
} }
func ExtractADTSFrames(frames []byte) (config MPEG4AudioConfig, payload [][]byte, samples int, err error) { func SplitADTSFrames(frames []byte) (config MPEG4AudioConfig, payload [][]byte, samples int, err error) {
for len(frames) > 0 { for len(frames) > 0 {
var n, framelen int var n, framelen int
var _payload []byte var _payload []byte

View File

@ -9,6 +9,13 @@ import (
"bytes" "bytes"
) )
const (
NALU_SEI = 6
NALU_PPS = 7
NALU_SPS = 8
NALU_AUD = 9
)
/* /*
From: http://stackoverflow.com/questions/24884827/possible-locations-for-sequence-picture-parameter-sets-for-h-264-stream From: http://stackoverflow.com/questions/24884827/possible-locations-for-sequence-picture-parameter-sets-for-h-264-stream
@ -677,20 +684,20 @@ type SliceType uint
func (self SliceType) String() string { func (self SliceType) String() string {
switch self { switch self {
case P: case SLICE_P:
return "P" return "P"
case B: case SLICE_B:
return "B" return "B"
case I: case SLICE_I:
return "I" return "I"
} }
return "" return ""
} }
const ( const (
P = iota+1 SLICE_P = iota+1
B SLICE_B
I SLICE_I
) )
func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error) { func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error) {
@ -726,11 +733,11 @@ func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error) {
switch u { switch u {
case 0,3,5,8: case 0,3,5,8:
sliceType = P sliceType = SLICE_P
case 1,6: case 1,6:
sliceType = B sliceType = SLICE_B
case 2,4,7,9: case 2,4,7,9:
sliceType = I sliceType = SLICE_I
default: default:
err = fmt.Errorf("h264parser: slice_type=%d invalid", u) err = fmt.Errorf("h264parser: slice_type=%d invalid", u)
return return