mirror of https://bitbucket.org/ausocean/av.git
Things seem to be working
This commit is contained in:
parent
86dc14fa7a
commit
c772b99267
|
@ -29,7 +29,7 @@ LICENSE
|
|||
package h264
|
||||
|
||||
import (
|
||||
"../itut"
|
||||
"bitbucket.org/ausocean/av/itut"
|
||||
"log"
|
||||
"sync"
|
||||
_"fmt"
|
||||
|
|
|
@ -45,8 +45,8 @@ import (
|
|||
"time"
|
||||
"io"
|
||||
|
||||
"../h264"
|
||||
"../tsgenerator"
|
||||
"bitbucket.org/ausocean/av/h264"
|
||||
"bitbucket.org/ausocean/av/tsgenerator"
|
||||
|
||||
"bitbucket.org/ausocean/av/ringbuffer"
|
||||
)
|
||||
|
@ -160,7 +160,7 @@ func (r *revidInst) input() {
|
|||
var inputReader *bufio.Reader
|
||||
switch r.config.Input {
|
||||
case raspivid:
|
||||
cmd := exec.Command("raspivid", "-o", "-", "-n", "-t", "0")
|
||||
cmd := exec.Command("raspivid", "-o", "-", "-n", "-t", "0", "-b", "5000000")
|
||||
stdout, _ := cmd.StdoutPipe()
|
||||
err := cmd.Start()
|
||||
inputReader = bufio.NewReader(stdout)
|
||||
|
@ -169,8 +169,6 @@ func (r *revidInst) input() {
|
|||
return
|
||||
}
|
||||
case file:
|
||||
|
||||
|
||||
default:
|
||||
r.Error.Println("Input not valid!")
|
||||
}
|
||||
|
@ -189,16 +187,18 @@ func (r *revidInst) input() {
|
|||
|
||||
donePSI := false
|
||||
ii := 0
|
||||
for r.isRunning {
|
||||
fmt.Println("reading")
|
||||
var h264Data []byte
|
||||
switch(r.config.Input){
|
||||
case raspivid:
|
||||
go func(){
|
||||
for {
|
||||
h264Data = make([]byte, 1)
|
||||
io.ReadFull(inputReader, h264Data)
|
||||
h264Data = make([]byte, 2)
|
||||
_,err := io.ReadFull(inputReader, h264Data)
|
||||
if err == nil {
|
||||
h264Parser.InputByteChan<-h264Data[0]
|
||||
h264Parser.InputByteChan<-h264Data[1]
|
||||
}
|
||||
}
|
||||
}()
|
||||
case file:
|
||||
|
@ -215,7 +215,7 @@ func (r *revidInst) input() {
|
|||
h264Parser.InputByteChan<-h264Data[i]
|
||||
}
|
||||
}
|
||||
|
||||
for r.isRunning {
|
||||
if clip, err := r.ringBuffer.Get(); err != nil {
|
||||
r.Error.Println(err.Error())
|
||||
return
|
||||
|
|
|
@ -37,6 +37,7 @@ import (
|
|||
* Testing with file input
|
||||
*
|
||||
*/
|
||||
/*
|
||||
func TestFileInput(t *testing.T){
|
||||
config := Config{
|
||||
Input: file,
|
||||
|
@ -52,12 +53,12 @@ func TestFileInput(t *testing.T){
|
|||
time.Sleep(100*time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
* */
|
||||
|
||||
|
||||
/*
|
||||
Testing use with raspivid
|
||||
*/
|
||||
/*
|
||||
func TestRaspividInput(t *testing.T){
|
||||
config := Config{
|
||||
Input: raspivid,
|
||||
|
@ -72,7 +73,7 @@ func TestRaspividInput(t *testing.T){
|
|||
time.Sleep(100*time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
* */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ package tsgenerator
|
|||
import (
|
||||
_ "fmt"
|
||||
_"os"
|
||||
"../mpegts"
|
||||
"../pes"
|
||||
"../tools"
|
||||
"../rtp"
|
||||
"bitbucket.org/ausocean/av/mpegts"
|
||||
"bitbucket.org/ausocean/av/pes"
|
||||
"bitbucket.org/ausocean/av/tools"
|
||||
"bitbucket.org/ausocean/av/rtp"
|
||||
)
|
||||
|
||||
type TsGenerator interface {
|
||||
|
|
Loading…
Reference in New Issue