add IsCodecSupported
This commit is contained in:
parent
d3ba527309
commit
e620324491
14
muxer.go
14
muxer.go
@ -27,7 +27,21 @@ type Muxer struct {
|
|||||||
tswPMT *TSWriter
|
tswPMT *TSWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Muxer) IsCodecSupported(codec av.CodecData) bool {
|
||||||
|
switch codec.Type() {
|
||||||
|
case av.H264, av.AAC:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Muxer) NewStream(codec av.CodecData) (err error) {
|
func (self *Muxer) NewStream(codec av.CodecData) (err error) {
|
||||||
|
if !self.IsCodecSupported(codec) {
|
||||||
|
err = fmt.Errorf("codec type=%x is not supported", codec.Type())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
stream := &Stream{
|
stream := &Stream{
|
||||||
muxer: self,
|
muxer: self,
|
||||||
CodecData: codec,
|
CodecData: codec,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user