diff --git a/codec.go b/codec.go new file mode 100644 index 0000000..d4eb2db --- /dev/null +++ b/codec.go @@ -0,0 +1,46 @@ +package codec + +import ( + "github.com/nareix/av" +) + +type AudioCodecData struct { + CodecType int + CodecSampleRate int + CodecChannelLayout av.ChannelLayout + CodecSampleFormat av.SampleFormat +} + +func (self AudioCodecData) Type() int { + return self.CodecType +} + +func (self AudioCodecData) IsAudio() bool { + return true +} + +func (self AudioCodecData) IsVideo() bool { + return false +} + +func (self AudioCodecData) SampleRate() int { + return self.CodecSampleRate +} + +func (self AudioCodecData) ChannelLayout() av.ChannelLayout { + return self.CodecChannelLayout +} + +func (self AudioCodecData) SampleFormat() av.SampleFormat { + return self.CodecSampleFormat +} + +func NewPCMMulawCodecData() av.AudioCodecData { + return AudioCodecData{ + CodecType: av.PCM_MULAW, + CodecSampleFormat: av.S16, + CodecChannelLayout: av.CH_MONO, + CodecSampleRate: 8000, + } +} +