mirror of https://bitbucket.org/ausocean/av.git
container/mts/encoder.go: generalising stream id logic
This commit is contained in:
parent
548b7caa81
commit
92d4c5f79a
|
@ -86,7 +86,6 @@ func (l *Lexer) Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not get rtp payload, failed with err: %v\n", err)
|
return fmt.Errorf("could not get rtp payload, failed with err: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nalType := (payload[0] >> 1) & 0x3f
|
nalType := (payload[0] >> 1) & 0x3f
|
||||||
|
|
||||||
// If not currently fragmented then we ignore current write.
|
// If not currently fragmented then we ignore current write.
|
||||||
|
|
|
@ -138,10 +138,10 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
||||||
sid = audioStreamID
|
sid = audioStreamID
|
||||||
case H265:
|
case H265:
|
||||||
mPid = videoPid
|
mPid = videoPid
|
||||||
sid = H264ID
|
sid = H265ID
|
||||||
case H264:
|
case H264:
|
||||||
mPid = videoPid
|
mPid = videoPid
|
||||||
sid = H265ID
|
sid = H264ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// standardPmt is a minimal PMT, without descriptors for time and location.
|
// standardPmt is a minimal PMT, without descriptors for time and location.
|
||||||
|
@ -224,7 +224,7 @@ func (e *Encoder) Write(data []byte) (int, error) {
|
||||||
|
|
||||||
// Prepare PES data.
|
// Prepare PES data.
|
||||||
pesPkt := pes.Packet{
|
pesPkt := pes.Packet{
|
||||||
StreamID: byte(36),
|
StreamID: e.streamID,
|
||||||
PDI: hasPTS,
|
PDI: hasPTS,
|
||||||
PTS: e.pts(),
|
PTS: e.pts(),
|
||||||
Data: data,
|
Data: data,
|
||||||
|
|
Loading…
Reference in New Issue