[FFmpeg-devel] [PATCH][RFC] ASS decoder/encoder

Aurélien Jacobs aurel
Sun Aug 8 02:26:55 CEST 2010


Hi,

I was trying to implement ASS decoder and encoder, which should be
pretty trivial, but I faced a problem.
This patch series illustrate what I got for now. This is more of an
RFC than an actual proposal for commit.

First patch adds a basic encoder and decoder. It simply memcpy()
ASS events to/from AVSubtitleRect. It works fine, except that the
decoder don't export extradata, and thus, the encoder/muxer don't
have any extradata/header.
There is no way for the encoder to generate this extradata which
contains specific text style definitions. It has to be passed
from the decoder to the encoder.

So third patch tries to implement this by passing extradata untouched
from decoder to encoder through a new field in AVCodecContext.
I'm not sure it is the best way to do this, but that's the only working
way I found.
I also thought about passing extradata as part of the first decoded
AVSubtitle, but this won't work, because the encoder would receive it
only in its encode() function, after the muxer got initialized and
wrote the file header. So the encoder must get the extradata in its
init() function.

Second patch just move encoders init after decoders init, so that
encoders can be inited with a copy of the subtitle headers provided
by the decoder init.

I would like to have comments about this proposition, and I would
be happy to have better suggestions about how to pass subtitle
headers between decoder and encoder.

Aurel



More information about the ffmpeg-devel mailing list