[FFmpeg-devel] [PATCH] RealText demuxer and decoder.
Philip Langdale
philipl at overt.org
Thu Jun 28 05:48:43 CEST 2012
On Thu, 28 Jun 2012 00:01:11 +0200
Clément Bœsch <ubitux at gmail.com> wrote:
> On Sun, Jun 17, 2012 at 02:43:39PM -0700, Philip Langdale wrote:
> > On Sat, 16 Jun 2012 22:13:42 +0200
> > Clément Bœsch <ubitux at gmail.com> wrote:
> >
> > > +static int realtext_decode_frame(AVCodecContext *avctx,
> > > + void *data, int *got_sub_ptr,
> > > AVPacket *avpkt) +{
> > > + AVSubtitle *sub = data;
> > > + const char *ptr = avpkt->data;
> > > + AVBPrint buf;
> > > +
> > > + av_bprint_init(&buf, 0, 4096);
> > > + if (ptr && avpkt->size > 0 && !rt_event_to_ass(&buf, ptr))
> > > + ff_ass_add_rect(sub, buf.str, avpkt->pts,
> > > avpkt->duration, 0);
> >
> > Don't you need to rescale the pts and duration? I know I had to for
> > mov_text.
> >
>
> Oh, I almost missed this comment, sorry. Do you have an example where
> I would need it?
>
> Note that it's not done in SubRip (which served as a base for JacoSUB,
> SAMI or RT). Maybe there is something to fix, but I can't figure out
> in what case it would be necessary, since we set a constant value for
> the PTS info in the demuxer (this is not the case for MicroDVD for
> instance, and there are indeed some rescale in the decoder).
>
It's going to depend on the container. SubRip doesn't do it because
it reads pts and duration from the embedded text. I know that it's
necessary for mov_text as mov has a configurable timebase. If you
know the demuxer has a fixed timebase *and* its the same as the ass
timebase, then sure - you don't need it, but it's not immediately
obvious and deserves a comment, if nothing else.
--phil
More information about the ffmpeg-devel
mailing list