add IsCodecSupported

This commit is contained in:
nareix 2016-05-26 20:14:36 +08:00
parent eec4063cf9
commit 3f00344bcf

View File

@ -26,7 +26,21 @@ type Muxer struct {
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) {
if !self.IsCodecSupported(codec) {
err = fmt.Errorf("codec type=%x is not supported", codec.Type())
return
}
stream := &Stream{CodecData: codec}
stream.sample = &atom.SampleTable{