From e62032449111847a9058eebeebe4440b06bd4a51 Mon Sep 17 00:00:00 2001 From: nareix Date: Thu, 26 May 2016 20:14:21 +0800 Subject: [PATCH] add IsCodecSupported --- muxer.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/muxer.go b/muxer.go index 975a545..ec6ee8b 100644 --- a/muxer.go +++ b/muxer.go @@ -27,7 +27,21 @@ type Muxer struct { 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) { + if !self.IsCodecSupported(codec) { + err = fmt.Errorf("codec type=%x is not supported", codec.Type()) + return + } + stream := &Stream{ muxer: self, CodecData: codec,