av/parser/parser_test.go

38 lines
768 B
Go

package parser
import (
"testing"
)
const (
testInputFileName = "inputFiles/inputFile.avi"
)
func TestMJPEGParser(t *testing.T){
parser := NewMJPEGParser()
// TODO: Find mjpeg file and see if the mjpeg parser can output individual
// jpeg images...
inputFile, err = os.Open(testInputFileName)
if err != nil {
t.Errorf("Should not have got error opening file!")
}
stats, err := inputFile.Stat()
if err != nil {
t.Errorf("Could not get input file stats!")
return
}
data := make([]byte, stats.Size())
_, err = r.inputFile.Read(data)
if err != nil {
t.Errorf("Should not have got read error!")
return
}
for i := range data {
parser.InputByteChan <- data[i]
}
for len(parser.GetOutputByteChan()) > 0 {
}
}