add IsCodecSupported
This commit is contained in:
parent
eec4063cf9
commit
3f00344bcf
14
muxer.go
14
muxer.go
@ -26,7 +26,21 @@ type Muxer struct {
|
|||||||
mdatWriter *atom.Writer
|
mdatWriter *atom.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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{CodecData: codec}
|
stream := &Stream{CodecData: codec}
|
||||||
|
|
||||||
stream.sample = &atom.SampleTable{
|
stream.sample = &atom.SampleTable{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user