[FFmpeg-devel] [PATCH] doc/examples/decode_audio: read the audio data from data[0]

Steven Liu lq at chinaffmpeg.org
Tue Oct 8 11:26:27 EEST 2019


only frame linesize[0] can get length size,
i have tested before patch like this:
ffmpeg -i /Users/liuqi/input.mp3 -codec:a ac3 -ac 5 a.ac3
./doc/examples/decode_audio a.ac3 a.pcm
ffplay -f f32le -ac 5 -ar 44100 a.pcm
there have problem.

no problem after this patch.

Reported-by: Bepartofyou
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 doc/examples/decode_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c
index 6c2a8ed550..4a81302ad3 100644
--- a/doc/examples/decode_audio.c
+++ b/doc/examples/decode_audio.c
@@ -98,7 +98,7 @@ static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
         }
         for (i = 0; i < frame->nb_samples; i++)
             for (ch = 0; ch < dec_ctx->channels; ch++)
-                fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
+                fwrite(frame->data[0] + data_size*i, 1, data_size, outfile);
     }
 }
 
-- 
2.15.1





More information about the ffmpeg-devel mailing list