mirror of https://bitbucket.org/ausocean/av.git
fixing bugs and wrote test file... need to build and see my errors now
This commit is contained in:
parent
010b252782
commit
ec796bd9ae
|
@ -29,11 +29,11 @@ type tsGenerator struct {
|
|||
ccMap map[int]int
|
||||
}
|
||||
|
||||
func (g *tsGenerator)GetNalInputChan() chan []byte {
|
||||
func (g *tsGenerator)GetInputChan() chan []byte {
|
||||
return g.nalInputChan
|
||||
}
|
||||
|
||||
func (g *tsGenerator)GetTsOutputChan() <-chan *mpegts.MpegTsPacket {
|
||||
func (g *tsGenerator)GetOutputChan() <-chan *mpegts.MpegTsPacket {
|
||||
return g.TsChan
|
||||
}
|
||||
|
||||
|
|
|
@ -164,16 +164,21 @@ func (r *revidInst) ChangeState(config Config) error {
|
|||
r.Log(Info, "Using MJPEG parser!")
|
||||
r.parser = parser.NewMJPEGParser(mjpegParserInChanLen)
|
||||
}
|
||||
switch r.config.Packetization {
|
||||
case None:
|
||||
if r.config.Packetization == None {
|
||||
r.parser.SetOutputChan(r.outputChan)
|
||||
getFrame = getFrameForNoPacketization
|
||||
case Mpegts:
|
||||
frameRateAsInt, _ := strconv.Atoi(r.config.FrameRate)
|
||||
r.generator = tsgenerator.NewTsGenerator(uint(frameRateAsInt))
|
||||
r.parser.SetOutputChan(r.generator.GetNalInputChan())
|
||||
} else {
|
||||
switch r.config.Packetization {
|
||||
case Mpegts:
|
||||
frameRateAsInt, _ := strconv.Atoi(r.config.FrameRate)
|
||||
r.generator = tsgenerator.NewTsGenerator(uint(frameRateAsInt))
|
||||
case Flv:
|
||||
frameRateAsInt, _ := strconv.Atoi(r.config.FrameRate)
|
||||
r.generator = flvGenerator.NewFlvGenerator(uint(frameRateAsInt))
|
||||
}
|
||||
getFrame = getFrameForPacketization
|
||||
r.parser.SetOutputChan(r.generator.GetInputChan())
|
||||
r.generator.Start()
|
||||
getFrame = getFrameForMpegtsPacketization
|
||||
}
|
||||
r.config = config
|
||||
return nil
|
||||
|
|
|
@ -96,6 +96,7 @@ func TestRaspividMJPEGInput(t *testing.T){
|
|||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Test revidInst with rtmp output
|
||||
func TestRtmpOutput(t *testing.T){
|
||||
config := Config{
|
||||
|
@ -119,3 +120,25 @@ func TestRtmpOutput(t *testing.T){
|
|||
time.Sleep(120*time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
*/
|
||||
|
||||
// Test h264 inputfile to flv output files
|
||||
func TestFlvOutputFile(t *testing.T){
|
||||
config := Config{
|
||||
Input: File,
|
||||
InputFileName: "testInput.h264",
|
||||
InputCodec: H264,
|
||||
Output: File,
|
||||
OutputFileName: "testOutput.flv",
|
||||
Packetization: Flv,
|
||||
FrameRate: "25",
|
||||
}
|
||||
revidInst, err := NewRevidInstance(config)
|
||||
if err != nil {
|
||||
t.Errorf("Should not of have got an error!: %v\n", err.Error())
|
||||
return
|
||||
}
|
||||
revidInst.Start()
|
||||
time.Sleep(5*time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue