diff --git a/codec/h264/lex.go b/codec/h264/lex.go index 9a071715..abb92dce 100644 --- a/codec/h264/lex.go +++ b/codec/h264/lex.go @@ -48,7 +48,7 @@ var h264Prefix = [...]byte{0x00, 0x00, 0x01, 0x09, 0xf0} // successive writes being performed not earlier than the specified delay. // NAL units are split after type 1 (Coded slice of a non-IDR picture), 5 // (Coded slice of a IDR picture) and 8 (Picture parameter set). -func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { +func Lex(dst io.Writer, src io.Reader, delay time.Duration, n int) error { var tick <-chan time.Time if delay == 0 { tick = noDelay diff --git a/codec/h265/lex.go b/codec/h265/lex.go index ebe34013..7593fe5e 100644 --- a/codec/h265/lex.go +++ b/codec/h265/lex.go @@ -70,7 +70,7 @@ func NewLexer(donl bool) *Lexer { // Lex continually reads RTP packets from the io.Reader src and lexes into // access units which are written to the io.Writer dst. Lex expects that for // each read from src, a single RTP packet is received. -func (l *Lexer) Lex(dst io.Writer, src io.Reader, delay time.Duration) error { +func (l *Lexer) Lex(dst io.Writer, src io.Reader, delay time.Duration, n int) error { buf := make([]byte, maxRTPSize) for { n, err := src.Read(buf) diff --git a/codec/mjpeg/lex.go b/codec/mjpeg/lex.go index da2ecae1..21717fe6 100644 --- a/codec/mjpeg/lex.go +++ b/codec/mjpeg/lex.go @@ -45,7 +45,7 @@ func init() { // Lex parses MJPEG frames read from src into separate writes to dst with // successive writes being performed not earlier than the specified delay. -func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { +func Lex(dst io.Writer, src io.Reader, delay time.Duration, n int) error { var tick <-chan time.Time if delay == 0 { tick = noDelay diff --git a/container/mts/pes/pes.go b/container/mts/pes/pes.go index 1dc2dd3e..16382d84 100644 --- a/container/mts/pes/pes.go +++ b/container/mts/pes/pes.go @@ -26,13 +26,9 @@ LICENSE package pes -<<<<<<< HEAD -const MaxPesSize = 64 * 1 << 10 // 65536 -======= import "github.com/Comcast/gots" -const MaxPesSize = 64 * 1 << 10 ->>>>>>> master +const MaxPesSize = 64 * 1 << 10 // 65536 /* The below data struct encapsulates the fields of an PES packet. Below is diff --git a/revid/audio-input_test.go b/revid/audio-input_test.go index 20c6e01f..5f057679 100644 --- a/revid/audio-input_test.go +++ b/revid/audio-input_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "bitbucket.org/ausocean/av/codec/lex" + "bitbucket.org/ausocean/av/codec/codecutil" "github.com/yobert/alsa" ) @@ -114,7 +114,7 @@ func TestAudio(t *testing.T) { t.Error(err) } num := 3 // How many 'ac.RecPeriod's to record. - go lex.ADPCM(dst, ai, time.Duration(ac.RecPeriod*float64(time.Second)), ai.ChunkSize()) + go codecutil.LexBytes(dst, ai, time.Duration(ac.RecPeriod*float64(time.Second)), ai.ChunkSize()) time.Sleep(time.Millisecond * 1000 * time.Duration(num)) ai.Stop() err = ioutil.WriteFile("./testout", dst.Bytes(), 0644) diff --git a/revid/revid.go b/revid/revid.go index ec34b358..0bc4b954 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -173,7 +173,7 @@ func (r *Revid) reset(config Config) error { r.config.Logger.SetLevel(config.LogLevel) err = r.setupPipeline( - func(dst io.WriteCloser, fps int, medType int) (io.WriteCloser, error) { + func(dst io.WriteCloser, fps float64) (io.WriteCloser, error) { var st int switch r.config.Input { case Raspivid, File, V4L: @@ -217,7 +217,7 @@ func (r *Revid) setConfig(config Config) error { // mtsEnc and flvEnc will be called to obtain an mts encoder and flv encoder // respectively. multiWriter will be used to create an ioext.multiWriteCloser // so that encoders can write to multiple senders. -func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64, mediaType int) (io.WriteCloser, error), flvEnc func(dst io.WriteCloser, rate int) (io.WriteCloser, error), multiWriter func(...io.WriteCloser) io.WriteCloser) error { +func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.WriteCloser, error), flvEnc func(dst io.WriteCloser, rate int) (io.WriteCloser, error), multiWriter func(...io.WriteCloser) io.WriteCloser) error { // encoders will hold the encoders that are required for revid's current // configuration. var encoders []io.WriteCloser @@ -261,13 +261,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64, medi // as a destination. if len(mtsSenders) != 0 { mw := multiWriter(mtsSenders...) - var mediaType int - if r.config.Input == Audio { - mediaType = mts.Audio - } else { - mediaType = mts.Video - } - e, _ := mtsEnc(mw, r.config.WriteRate, mediaType) + e, _ := mtsEnc(mw, r.config.WriteRate) encoders = append(encoders, e) } @@ -725,7 +719,7 @@ func (r *Revid) startRTSPCamera() (func() error, error) { // Start reading data from the RTP client. r.wg.Add(1) - go r.processFrom(rtpClt, time.Second/time.Duration(r.config.FrameRate)) + go r.processFrom(rtpClt, time.Second/time.Duration(r.config.FrameRate), 0) return func() error { rtspClt.Close() diff --git a/revid/revid_test.go b/revid/revid_test.go index fa5b7cb5..82991955 100644 --- a/revid/revid_test.go +++ b/revid/revid_test.go @@ -232,7 +232,7 @@ func TestResetEncoderSenderSetup(t *testing.T) { // This logic is what we want to check. err = rv.setupPipeline( - func(dst io.WriteCloser, rate float64, mediaType int) (io.WriteCloser, error) { + func(dst io.WriteCloser, rate float64) (io.WriteCloser, error) { return &tstMtsEncoder{dst: dst}, nil }, func(dst io.WriteCloser, rate int) (io.WriteCloser, error) {