parser: expose MJPEG documentation

This commit is contained in:
Dan Kortschak 2018-06-17 21:30:00 +09:30
parent 0b0f12431b
commit 77cb074ede
1 changed files with 10 additions and 10 deletions

View File

@ -29,7 +29,7 @@ package parser
const frameStartCode = 0xD8
type mjpegParser struct {
type MJPEG struct {
inputBuffer []byte
isParsing bool
parserOutputChanRef chan []byte
@ -38,39 +38,39 @@ type mjpegParser struct {
delay uint
}
func NewMJPEGParser(inputChanLen int) (p *mjpegParser) {
p = new(mjpegParser)
func NewMJPEGParser(inputChanLen int) (p *MJPEG) {
p = new(MJPEG)
p.isParsing = true
p.inputChan = make(chan byte, inputChanLen)
return
}
func (p *mjpegParser) Stop() {
func (p *MJPEG) Stop() {
p.isParsing = false
}
func (p *mjpegParser) Start() {
func (p *MJPEG) Start() {
go p.parse()
}
func (p *mjpegParser) SetDelay(delay uint) {
func (p *MJPEG) SetDelay(delay uint) {
p.delay = delay
}
func (p *mjpegParser) InputChan() chan byte {
func (p *MJPEG) InputChan() chan byte {
return p.inputChan
}
func (p *mjpegParser) OutputChan() <-chan []byte {
func (p *MJPEG) OutputChan() <-chan []byte {
return p.userOutputChanRef
}
func (p *mjpegParser) SetOutputChan(o chan []byte) {
func (p *MJPEG) SetOutputChan(o chan []byte) {
p.parserOutputChanRef = o
p.userOutputChanRef = o
}
func (p *mjpegParser) parse() {
func (p *MJPEG) parse() {
var outputBuffer []byte
for p.isParsing {
aByte := <-p.inputChan