[FFmpeg-devel] [PATCH 2/3] textdec: Rename all generic parts from srt to text.

Philip Langdale philipl at overt.org
Wed Aug 1 19:53:28 CEST 2012


On Wed, 1 Aug 2012 18:51:02 +0200
Nicolas George <nicolas.george at normalesup.org> wrote:

> 
> This is not really text -> ass. It could be called "pseudohtml_to_ass"

Sure.
 
> >  
> > -static int srt_decode_frame(AVCodecContext *avctx,
> > -                            void *data, int *got_sub_ptr, AVPacket
> > *avpkt) +static int text_decode_frame(AVCodecContext *avctx,
> > +                             void *data, int *got_sub_ptr,
> > AVPacket *avpkt) {
> >      AVSubtitle *sub = data;
> >      int ts_start, ts_end, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
> > @@ -220,8 +220,8 @@ static int srt_decode_frame(AVCodecContext
> > *avctx, ptr = read_ts(ptr, &ts_start, &ts_end, &x1, &y1, &x2, &y2);
> >          if (!ptr)
> >              break;
> > -        ptr = srt_to_ass(avctx, buffer, buffer+sizeof(buffer), ptr,
> > -                         x1, y1, x2, y2);
> > +        ptr = text_to_ass(avctx, buffer, buffer+sizeof(buffer),
> > ptr,
> > +                          x1, y1, x2, y2);
> 
> After some thought, I am not comfortable with that. If the codec is
> text, it should have nothing to do with ASS, especially since ASS is
> still a mess of temporary hacks.

So, the problem here is matroska. When you put SRT into matroska, it
gets tagged as TEXT, but all the formatting remains, and should be
respected. You may recall the change I proposed a couple of months ago
to identify matroska TEXT tracks as SRT, as a way to make things line
up again. You and Clément felt that was abusive as the track is text
in the sense of not including SRT timing information. Fair enough, hence
I made this change.

But the pseudohtml styling is still present in the track and needs to
be respected, so any decoder that wants to decode CODEC_ID_TEXT and
work correctly with SRT-in-MKV must behave as written.

Either we do this, or we identify mkv text tracks as srt. I don't see
another solution (unless you want a third decoder just for
srt-in-mkv...)

--phil


More information about the ffmpeg-devel mailing list