From d4285826d95369aa400f614c3241c9fc759afc40 Mon Sep 17 00:00:00 2001 From: nareix Date: Fri, 1 Jul 2016 17:53:33 +0800 Subject: [PATCH] rename consts --- aacparser/parser.go | 2 +- h264parser/parser.go | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/aacparser/parser.go b/aacparser/parser.go index 03733d4..91e152b 100644 --- a/aacparser/parser.go +++ b/aacparser/parser.go @@ -133,7 +133,7 @@ func MakeADTSHeader(config MPEG4AudioConfig, samples int, payloadLength int) (he 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 { var n, framelen int var _payload []byte diff --git a/h264parser/parser.go b/h264parser/parser.go index ea3506b..b8070ee 100644 --- a/h264parser/parser.go +++ b/h264parser/parser.go @@ -9,6 +9,13 @@ import ( "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 @@ -677,20 +684,20 @@ type SliceType uint func (self SliceType) String() string { switch self { - case P: + case SLICE_P: return "P" - case B: + case SLICE_B: return "B" - case I: + case SLICE_I: return "I" } return "" } const ( - P = iota+1 - B - I + SLICE_P = iota+1 + SLICE_B + SLICE_I ) func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error) { @@ -726,11 +733,11 @@ func ParseSliceHeaderFromNALU(packet []byte) (sliceType SliceType, err error) { switch u { case 0,3,5,8: - sliceType = P + sliceType = SLICE_P case 1,6: - sliceType = B + sliceType = SLICE_B case 2,4,7,9: - sliceType = I + sliceType = SLICE_I default: err = fmt.Errorf("h264parser: slice_type=%d invalid", u) return