func (m *Muxer) AddElementaryStream(es PMTElementaryStream) error {
	if es.ElementaryPID != 0 {
		for _, oes := range m.pmt.ElementaryStreams {
			if oes.ElementaryPID == es.ElementaryPID {
				return ErrPIDAlreadyExists
			}
		}
	} else {
		es.ElementaryPID = m.nextPID
		m.nextPID++
	}

	m.pmt.ElementaryStreams = append(m.pmt.ElementaryStreams, &es)

	m.esContexts[es.ElementaryPID] = newEsContext(&es)
	// invalidate pmt cache
	m.pmtBytes.Reset()
	return nil
}
// if es.ElementaryPID is zero, it will be generated automatically
if es.ElementaryPID is zero, it will be generated automatically
// if es . ElementaryPID is zero it will be generated automatically
func (m *Muxer) AddElementaryStream(es PMTElementaryStream) error {
	if es.ElementaryPID != 0 {
		for _, oes := range m.pmt.ElementaryStreams {
			if oes.ElementaryPID == es.ElementaryPID {
				return ErrPIDAlreadyExists
			}
		}
	} else {
		es.ElementaryPID = m.nextPID
		m.nextPID++
	}
	m.pmt.ElementaryStreams = append(m.pmt.ElementaryStreams, &es)
	m.esContexts[es.ElementaryPID] = newEsContext(&es)
	m.pmtBytes.Reset()
	return nil
}
func ( m * Muxer ) AddElementaryStream ( es PMTElementaryStream ) error { if es . ElementaryPID != 0 { for _ , oes := range m . pmt . ElementaryStreams { if oes . ElementaryPID == es . ElementaryPID { return ErrPIDAlreadyExists } } } else { es . ElementaryPID = m . nextPID m . nextPID ++ } m . pmt . ElementaryStreams = append ( m . pmt . ElementaryStreams , & es ) m . esContexts [ es . ElementaryPID ] = newEsContext ( & es ) m . pmtBytes . Reset ( ) return nil }
if es.ElementaryPID is zero, it will be generated automatically
if es . ElementaryPID is zero it will be generated automatically
// invalidate pmt cache