Message ID | 20191008082627.4044-1-lq@chinaffmpeg.org |
---|---|
State | New |
Headers | show |
On 10/8/19, Steven Liu <lq@chinaffmpeg.org> wrote: > 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@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); > } > } OK, but check for case of planar sample format is missing. > > -- > 2.15.1 > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
On Tue, Oct 8, 2019 at 10:44 AM Steven Liu <lq@chinaffmpeg.org> wrote: > > 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@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); > } > } > This change is definitely not correct. Without further changes, all this does is copy the same block up to "channels" times. But whats with all the other channel? The current code is correct for handling planar audio. (ie. S16P/FLTP, for example), but not packed audio (ie. S16/FLT). If you want to support both planar and packed, you will need more changes then this. - Hendrik
> 在 2019年10月8日,16:48,Paul B Mahol <onemda@gmail.com> 写道: > > On 10/8/19, Steven Liu <lq@chinaffmpeg.org> wrote: >> 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@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); >> } >> } > > OK, but check for case of planar sample format is missing. Hi Paul, I have no planar sample test file, i have read the comments of the linesize, i have known there maybe have planar audio, but i don’t know how to construct the sample :( > > >> >> -- >> 2.15.1 >> >> >> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > Thanks Steven
On 10/8/19, Steven Liu <lq@chinaffmpeg.org> wrote: > > >> 在 2019年10月8日,16:48,Paul B Mahol <onemda@gmail.com> 写道: >> >> On 10/8/19, Steven Liu <lq@chinaffmpeg.org> wrote: >>> 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@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); >>> } >>> } >> >> OK, but check for case of planar sample format is missing. > Hi Paul, > > I have no planar sample test file, i have read the comments of the > linesize, > i have known there maybe have planar audio, but i don’t know how to > construct the sample :( As nev poinited out, change is incorrect, you need to add support for both planar and packed or drop patch completely. >> >> >>> >>> -- >>> 2.15.1 >>> >>> >>> >>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> To unsubscribe, visit link above, or email >>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >> > > Thanks > Steven > > > > > >
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); } }
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@chinaffmpeg.org> --- doc/examples/decode_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)