[FFmpeg-devel] [PATCH] examples/muxing: set timestamps in output audio packet

Stefano Sabatini stefasab at gmail.com
Thu Jan 9 01:08:57 CET 2014


On date Thursday 2014-01-09 00:41:45 +0100, Michael Niedermayer encoded:
> On Wed, Jan 08, 2014 at 03:45:21PM +0100, Stefano Sabatini wrote:
> > In particular, fix trac ticket #3231.
> > ---
> >  doc/examples/muxing.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
> > index 33b2989..cf3e336 100644
> > --- a/doc/examples/muxing.c
> > +++ b/doc/examples/muxing.c
> > @@ -270,6 +270,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
> >      }
> >  
> >      audio_frame->nb_samples = dst_nb_samples;
> > +    audio_frame->pts += av_rescale_q(dst_nb_samples, (AVRational){1, c->sample_rate}, c->time_base);
> >      avcodec_fill_audio_frame(audio_frame, c->channels, c->sample_fmt,
> >                               dst_samples_data[0], dst_samples_size, 0);
> >  
> > @@ -280,6 +281,13 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
> >      }
> >  
> >      pkt.stream_index = st->index;
> 
> > +    /* rescale output packet timestamp values */
> > +    if (pkt.pts != AV_NOPTS_VALUE)
> > +        pkt.pts = av_rescale_q(pkt.pts, c->time_base, st->time_base);
> > +    if (pkt.dts != AV_NOPTS_VALUE)
> > +        pkt.dts = av_rescale_q(pkt.dts, c->time_base, st->time_base);
> 
> see AV_ROUND_PASS_MINMAX
> 
> > +    if (pkt.duration)
> > +        pkt.duration = av_rescale_q(pkt.duration, c->time_base, st->time_base);
> 
> the if seems unneeded

Up.
-- 
FFmpeg = Forgiving & Fabulous Mean Programmable Ecumenical God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-examples-muxing-set-timestamps-in-output-audio-packe.patch
Type: text/x-diff
Size: 1718 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140109/25ad80f6/attachment.bin>


More information about the ffmpeg-devel mailing list