[FFmpeg-devel] [PATCH] timestamp discontinuity in subtitles is OK
Aurelien Jacobs
aurel
Thu Oct 9 13:17:23 CEST 2008
Michael Niedermayer wrote:
> On Thu, Oct 09, 2008 at 12:39:21AM +0200, Aurelien Jacobs wrote:
> > Michael Niedermayer wrote:
> >
> > > On Mon, Oct 06, 2008 at 08:24:45AM -0000, Wolfram Gloger wrote:
> > > > Hi,
> > > >
> > > > > i think there is a easier solution
> > > > > just check for AVFMT_TS_DISCONT which would prevent misdetection in all
> > > > > containers that do not allow discontinuities.
> > > >
> > > > But we _do_ have containers with AVFMT_TS_DISCONT which can have
> > > > subtitles in them (dvbsub in mpegts, dvdsub in mpeg), so this wouldn't
> > > > help.
> > >
> > > when discontinuities are allowed, then they likely are also allowed
> > > between subtitle packets (but if you disagree, feel free to quote the specs,
> > > id be happy to hear what they say ...),
> > > thus whichever way is used to detect them, the detection should
> > > be needed between subtitle packets as well.
> > >
> > > a check for AVFMT_TS_DISCONT is correct, one for subtitles is not AFAICS.
> > > The real question is what do the dvbsub/dvdsub specs say about
> > > discontinuities?
> >
> > I guess attached patch is what you meant.
> >
> > Aurel
> > Index: ffmpeg.c
> > ===================================================================
> > --- ffmpeg.c (revision 15588)
> > +++ ffmpeg.c (working copy)
> > @@ -285,6 +285,7 @@
> > is not defined */
> > int64_t pts; /* current pts */
> > int is_start; /* is 1 at the start and after a discontinuity */
> > + int ts_discont;
> > } AVInputStream;
> >
> > typedef struct AVInputFile {
> > @@ -1573,6 +1574,7 @@
> > ist->start = av_gettime();
> > ist->frame = 0;
> > }
> > + ist->ts_discont = is->iformat->flags & AVFMT_TS_DISCONT;
> > }
> > }
> >
>
> > @@ -2105,7 +2107,8 @@
> > }
> >
> > // fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
> > - if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE) {
> > + if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
> > + && ist->ts_discont) {
> > int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
>
> Is there any reason why is->iformat->flags & AVFMT_TS_DISCONT is not
> directly used here?
Because 'is' is not accessible by any mean in this scope (at least AFAICT).
Aurel
More information about the ffmpeg-devel
mailing list