add encoding codec - alaw,mulaw,g729

master v1.0.25
Baik S. Hyun 3 years ago
parent bcd63baee9
commit 5d45f1ec27

@ -587,7 +587,7 @@ func (self *AudioDecoder) Decode(pkt []byte) (gotframe bool, frame av.AudioFrame
if ff.codecCtx == nil || &pkt[0] == nil { if ff.codecCtx == nil || &pkt[0] == nil {
err = fmt.Errorf("ffmpeg: Decode ff.codecCtx NULL or pkg NULL") err = fmt.Errorf("ffmpeg: Decode ff.codecCtx NULL or pkg NULL")
return return
} }
cerr := C.decode(ff.codecCtx, ff.frame, (*C.uchar)(unsafe.Pointer(&pkt[0])), C.int(len(pkt)), &cgotframe) cerr := C.decode(ff.codecCtx, ff.frame, (*C.uchar)(unsafe.Pointer(&pkt[0])), C.int(len(pkt)), &cgotframe)
@ -620,6 +620,12 @@ func NewAudioEncoderByCodecType(typ av.CodecType) (enc *AudioEncoder, err error)
switch typ { switch typ {
case av.AAC: case av.AAC:
id = C.AV_CODEC_ID_AAC id = C.AV_CODEC_ID_AAC
case av.PCM_ALAW:
id = C.AV_CODEC_ID_PCM_ALAW
case av.PCM_MULAW:
id = C.AV_CODEC_ID_PCM_MULAW
case av.G729:
id = C.AV_CODEC_ID_G729
default: default:
err = fmt.Errorf("ffmpeg: cannot find encoder codecType=%d", typ) err = fmt.Errorf("ffmpeg: cannot find encoder codecType=%d", typ)

Loading…
Cancel
Save