2023-10-22 11:46:19 CST W43D0

This commit is contained in:
aggresss
2023-10-22 11:46:19 +08:00
parent 0f95831c39
commit e163918619
62 changed files with 2326 additions and 355 deletions

View File

@@ -34,7 +34,7 @@ func getFormatFromSampleFmt(sampleFmt ffmpeg.AVSampleFormat) (string, int32) {
fmt.Fprintf(os.Stderr, "sample format %s is not supported as output format\n",
ffmpeg.AvGetSampleFmtName(sampleFmt))
return "", -1
return ffmpeg.NIL, -1
}
func decode(decCtx *ffmpeg.AVCodecContext, pkt *ffmpeg.AVPacket, frame *ffmpeg.AVFrame, outfile *os.File) {
@@ -62,7 +62,7 @@ func decode(decCtx *ffmpeg.AVCodecContext, pkt *ffmpeg.AVPacket, frame *ffmpeg.A
}
for i := int32(0); i < frame.GetNbSamples(); i++ {
for ch := 0; ch < int(decCtx.GetChannels()); ch++ {
outfile.Write(ffmpeg.ByteSliceWithOffset(frame.GetDataIdx(ch), dataSize*i, dataSize))
outfile.Write(ffmpeg.ByteSliceWithOffset(frame.GetData()[ch], dataSize*i, dataSize))
}
}
}