[FFmpeg-devel] [PATCH] RealText demuxer and decoder.
Clément Bœsch
ubitux at gmail.com
Thu Jun 28 21:17:12 CEST 2012
On Wed, Jun 27, 2012 at 08:48:43PM -0700, Philip Langdale wrote:
> 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.
>
Right, good point.
I fixed the SAMI demuxer to raise pts in the appropriate timebase (remove
the /10) and rescale them in the decoder (1/1000 → 1/100).
Also, I added a comment in the RT decoder as you suggested (RT is 1/100).
I'll push all of this soon, thank you.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120628/66ec7cde/attachment.asc>
More information about the ffmpeg-devel
mailing list