rename fields

This commit is contained in:
nareix 2016-06-12 11:15:30 +08:00
parent 0ee725cc8d
commit 323db22c7e

View File

@ -329,8 +329,8 @@ func WriteMPEG4AudioConfig(w io.Writer, config MPEG4AudioConfig) (err error) {
} }
type CodecData struct { type CodecData struct {
Config []byte ConfigBytes []byte
ConfigInfo MPEG4AudioConfig Config MPEG4AudioConfig
} }
func (self CodecData) IsVideo() bool { func (self CodecData) IsVideo() bool {
@ -346,15 +346,15 @@ func (self CodecData) Type() int {
} }
func (self CodecData) MPEG4AudioConfigBytes() []byte { func (self CodecData) MPEG4AudioConfigBytes() []byte {
return self.Config return self.ConfigBytes
} }
func (self CodecData) ChannelLayout() av.ChannelLayout { func (self CodecData) ChannelLayout() av.ChannelLayout {
return self.ConfigInfo.ChannelLayout return self.Config.ChannelLayout
} }
func (self CodecData) SampleRate() int { func (self CodecData) SampleRate() int {
return self.ConfigInfo.SampleRate return self.Config.SampleRate
} }
func (self CodecData) SampleFormat() av.SampleFormat { func (self CodecData) SampleFormat() av.SampleFormat {
@ -362,12 +362,12 @@ func (self CodecData) SampleFormat() av.SampleFormat {
} }
func (self CodecData) MakeADTSHeader(samples int, payloadLength int) []byte { func (self CodecData) MakeADTSHeader(samples int, payloadLength int) []byte {
return MakeADTSHeader(self.ConfigInfo, samples, payloadLength) return MakeADTSHeader(self.Config, samples, payloadLength)
} }
func NewCodecDataFromMPEG4AudioConfigBytes(config []byte) (self CodecData, err error) { func NewCodecDataFromMPEG4AudioConfigBytes(config []byte) (self CodecData, err error) {
self.Config = config self.ConfigBytes = config
if self.ConfigInfo, err = ParseMPEG4AudioConfig(config); err != nil { if self.Config, err = ParseMPEG4AudioConfig(config); err != nil {
err = fmt.Errorf("parse MPEG4AudioConfig failed(%s)", err) err = fmt.Errorf("parse MPEG4AudioConfig failed(%s)", err)
return return
} }