@@ -59,12 +59,14 @@ func main() {
5959 avcC := stsd .AvcX .AvcC
6060 trackID := trak .Tkhd .TrackID
6161 if * verbose {
62- fmt .Printf ("Video track ID=%d\n " , trackID )
62+ fmt .Printf ("Videavo track ID=%d\n " , trackID )
6363 }
64+ var spsInfo * avc.SPS
65+ var err error
6466 for i , sps := range avcC .SPSnalus {
6567 hexStr := hex .EncodeToString (sps )
6668 length := len (hexStr ) / 2
67- spsInfo , err : = avc .ParseSPSNALUnit (sps , * fullVUI )
69+ spsInfo , err = avc .ParseSPSNALUnit (sps , * fullVUI )
6870 if err != nil {
6971 fmt .Println ("Could not parse SPS" )
7072 return
@@ -73,18 +75,24 @@ func main() {
7375 if nrBytesRead < length {
7476 hexStr = fmt .Sprintf ("%s_%s" , hexStr [:2 * nrBytesRead ], hexStr [2 * nrBytesRead :])
7577 }
76- fmt .Printf ("%+v\n " , spsInfo )
7778 if * verbose {
7879 fmt .Printf ("SPS %d len %d: %+v\n " , i , length , hexStr )
80+ fmt .Printf ("%+v\n " , spsInfo )
7981 } else {
8082 fmt .Printf ("#SPS_%d_%dB:%+v" , i , length , hexStr )
8183 }
8284 }
8385 for i , pps := range avcC .PPSnalus {
86+ ppsInfo , err := avc .ParsePPSNALUnit (pps , spsInfo )
87+ if err != nil {
88+ fmt .Println ("Could not parse PPS" )
89+ return
90+ }
8491 hexStr := hex .EncodeToString (pps )
8592 length := len (hexStr ) / 2
8693 if * verbose {
8794 fmt .Printf ("PPS %d len %d: %+v\n " , i , length , hexStr )
95+ fmt .Printf ("%+v\n " , ppsInfo )
8896 } else {
8997 fmt .Printf ("#PPS_%d_%dB:%+v" , i , length , hexStr )
9098 }
0 commit comments