On 8/17/16, Michael Niedermayer <mich...@niedermayer.cc> wrote: > This is needed for encoders which store a final sample count or checksum in > extradata > > alternatively every encoder as well as muxer can implement > AV_PKT_DATA_NEW_EXTRADATA support > to update the extradata at the end. > > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > --- > ffmpeg.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/ffmpeg.c b/ffmpeg.c > index bae515d..9d972d0 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -1772,6 +1772,23 @@ static void flush_encoders(void) > if (stop_encoding) > break; > } > + if (ost->enc_ctx->extradata_size) { > + void *ptr = av_mallocz(ost->enc_ctx->extradata_size + > AV_INPUT_BUFFER_PADDING_SIZE); > + void *ptr2 = av_mallocz(ost->enc_ctx->extradata_size + > AV_INPUT_BUFFER_PADDING_SIZE); > + if (ptr && ptr2) { > + av_free(ost->st->codec->extradata); > + av_free(ost->st->codecpar->extradata); > + ost->st->codec->extradata = ptr; > + ost->st->codecpar->extradata = ptr2; > + memcpy(ost->st->codec->extradata , > ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > + memcpy(ost->st->codecpar->extradata, > ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > + ost->st->codec ->extradata_size = > ost->enc_ctx->extradata_size; > + ost->st->codecpar->extradata_size = > ost->enc_ctx->extradata_size; > + } else { > + av_free(ptr); > + av_free(ptr2); > + } > + } > } > }
I'm against this patch. Use API already available, don't add hacks on top of hacks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel