syntax highlighting in the README
This commit is contained in:
parent
4a7ed9cf72
commit
1a3d00af18
19
README.md
19
README.md
@ -2,10 +2,11 @@
|
|||||||
codec
|
codec
|
||||||
====
|
====
|
||||||
|
|
||||||
Golang aac/h264 encoder and decoder
|
Golang aac/h264 encoder and decoder.
|
||||||
|
|
||||||
H264 encoding example
|
H264 encoding example:
|
||||||
|
|
||||||
|
```go
|
||||||
w := 400
|
w := 400
|
||||||
h := 400
|
h := 400
|
||||||
var nal [][]byte
|
var nal [][]byte
|
||||||
@ -28,9 +29,11 @@ H264 encoding example
|
|||||||
}
|
}
|
||||||
nal = append(nal, p.Data)
|
nal = append(nal, p.Data)
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
H264 decoding example
|
H264 decoding example:
|
||||||
|
|
||||||
|
```go
|
||||||
dec, err := codec.NewH264Decoder(nal[0])
|
dec, err := codec.NewH264Decoder(nal[0])
|
||||||
for i, n := range nal[1:] {
|
for i, n := range nal[1:] {
|
||||||
img, err := dec.Decode(n)
|
img, err := dec.Decode(n)
|
||||||
@ -40,9 +43,11 @@ H264 decoding example
|
|||||||
fp.Close()
|
fp.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
AAC encoding example
|
AAC encoding example:
|
||||||
|
|
||||||
|
```go
|
||||||
var pkts [][]byte
|
var pkts [][]byte
|
||||||
|
|
||||||
c, _ := codec.NewAACEncoder()
|
c, _ := codec.NewAACEncoder()
|
||||||
@ -55,11 +60,13 @@ AAC encoding example
|
|||||||
pkts = append(pkts, p)
|
pkts = append(pkts, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
AAC decoding example
|
AAC decoding example:
|
||||||
|
|
||||||
|
```go
|
||||||
dec, _ := codec.NewAACDecoder(pkts[0])
|
dec, _ := codec.NewAACDecoder(pkts[0])
|
||||||
for _, p := range pkts[1:] {
|
for _, p := range pkts[1:] {
|
||||||
sample, err := dec.Decode(p)
|
sample, err := dec.Decode(p)
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user