On Mon, 05 May 2014 13:24:42 -0400, Justin Ruggles <[email protected]> 
wrote:
> On 05/03/2014 03:13 PM, Anton Khirnov wrote:
> > ---
> >   libavcodec/flacenc.c |   20 ++++++++++++++++++++
> >   1 file changed, 20 insertions(+)
> >
> > diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
> > index 58e86be..9138b99 100644
> > --- a/libavcodec/flacenc.c
> > +++ b/libavcodec/flacenc.c
> > @@ -114,6 +114,9 @@ typedef struct FlacEncodeContext {
> >       unsigned int md5_buffer_size;
> >       DSPContext dsp;
> >       FLACDSPContext flac_dsp;
> > +
> > +    int flushed;
> > +    int64_t next_pts;
> >   } FlacEncodeContext;
> >   
> >   
> > @@ -1212,6 +1215,20 @@ static int flac_encode_frame(AVCodecContext *avctx, 
> > AVPacket *avpkt,
> >           s->max_framesize = s->max_encoded_framesize;
> >           av_md5_final(s->md5ctx, s->md5sum);
> >           write_streaminfo(s, avctx->extradata);
> > +
> > +        if (avctx->side_data_only_packets && !s->flushed) {
> > +            uint8_t *side_data = av_packet_new_side_data(avpkt, 
> > AV_PKT_DATA_NEW_EXTRADATA,
> > +                                                         
> > avctx->extradata_size);
> > +            if (!side_data)
> > +                return AVERROR(ENOMEM);
> > +            memcpy(side_data, avctx->extradata, avctx->extradata_size);
> > +
> > +            avpkt->pts = s->next_pts;
> 
> What is the purpose of setting PTS on this packet?
> 

So that it gets interleaved correctly.

I suppose more properly i should set DTS (and we probably should have a flag for
packets that do not result in presented output and thus have no PTS), but those
are changes I'd rather not go into right now.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to