[FFmpeg-devel] understanding usage of av_compare_ts() in avformat/hlsenc
Nicolas Martyanoff
khaelin at gmail.com
Thu Jul 10 01:20:46 CEST 2014
On 2014-07-10 01:41, Anssi Hannula wrote:
> 08.07.2014 13:19, Nicolas Martyanoff kirjoitti:
> > Hi,
>
> Hi,
>
> > I am currently working on improving the hlsenc muxer to support byteranges
> > (HLS version 4), and it is starting to work :) But there is a line that really
> > puzzles me:
> >
> >
> > if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
> > end_pts, AV_TIME_BASE_Q) >= 0) {
> >
> > // libavformat/hlsenc.c 282
> >
> >
> > Afaik, av_compare_ts() compares two presentation timestamps with potentially
> > different time bases, and returns a value indicating if the first timestamp is
> > larger (i.e. more recent) than the second one.
> >
> > However in this code, the first argument is the difference between two
> > presentation timestamp, i.e. a time length. I do not get how comparing a time
> > length and a presentation timestamp makes any kind of sense.
> >
> > Does anyone know what I am missing here ?
>
> I guess you may have gotten this already, but anyway:
>
> The end_pts is actually a time length as well, not an actual PTS, since
> it is just (number_of_segments * length_of_segment).
Yes, I got it :) Thank you anyway.
--
Nicolas Martyanoff
http://wandrian.net
khaelin at gmail.com
More information about the ffmpeg-devel
mailing list