On Fri, Apr 17, 2015 at 07:21:23PM +0200, wm4 wrote: > On Fri, 17 Apr 2015 19:04:02 +0200 > Michael Niedermayer <michae...@gmx.at> wrote: > > > This could be made optional if preferred > > --- > > libavcodec/mpegaudiodec_template.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/libavcodec/mpegaudiodec_template.c > > b/libavcodec/mpegaudiodec_template.c > > index 2326a90..70c17a1 100644 > > --- a/libavcodec/mpegaudiodec_template.c > > +++ b/libavcodec/mpegaudiodec_template.c > > @@ -87,6 +87,7 @@ typedef struct MPADecodeContext { > > MPADSPContext mpadsp; > > AVFloatDSPContext *fdsp; > > AVFrame *frame; > > + int flushed; > > } MPADecodeContext; > > > > #define HEADER_SIZE 4 > > @@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, > > OUT_INT **samples, > > } > > } > > > > + if (s->flushed) { > > + s->avctx->internal->skip_samples = > > FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples); > > + s->flushed = 0; > > + } > > + > > return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels; > > } > > > > @@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx) > > memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf)); > > ctx->last_buf_size = 0; > > ctx->dither_state = 0; > > + ctx->flushed = 1; > > } > > > > static void flush(AVCodecContext *avctx) > > Would this not break gapless audio if you seek back to the first frame > after being done decoding? (Consider usecases like infinite looping.)
i did not test it but the skip value from AVPacket should override this if its set the first packet should contain skip sidedata or the mp3 would start with a "half" empty output frame [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel