stream: added GetDst func to Encoder interface

It has become apparent that it would be useful to be able to get the destination from
the encoder, so this it at least a temporary fix.
This commit is contained in:
Saxon 2019-03-13 18:24:18 +10:30
parent e593a04faf
commit 7c54775291
3 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import "io"
type Encoder interface { type Encoder interface {
Write([]byte) (int, error) Write([]byte) (int, error)
GetDst() io.Writer
} }
// NopEncoder returns an // NopEncoder returns an
@ -47,3 +48,5 @@ func (e noop) Write(p []byte) (int, error) {
n, err := e.dst.Write(p) n, err := e.dst.Write(p)
return n, err return n, err
} }
func (e noop) GetDst() io.Writer { return e.dst }

View File

@ -261,3 +261,5 @@ func (e *Encoder) Write(frame []byte) (int, error) {
return len(frame), nil return len(frame), nil
} }
func (e *Encoder) GetDst() io.Writer { return e.dst }

View File

@ -232,6 +232,8 @@ func (e *Encoder) Write(nalu []byte) (int, error) {
return len(nalu), nil return len(nalu), nil
} }
func (e *Encoder) GetDst() io.Writer { return e.dst }
// writePSI creates mpegts with pat and pmt tables - with pmt table having updated // writePSI creates mpegts with pat and pmt tables - with pmt table having updated
// location and time data. // location and time data.
func (e *Encoder) writePSI() error { func (e *Encoder) writePSI() error {