[FFmpeg-devel] [PATCH]Basic XSUB encoder

Björn Axelsson gecko
Mon Feb 2 22:27:15 CET 2009


On Mon, 2 Feb 2009, Reimar D?ffinger wrote:

> On Sun, Feb 01, 2009 at 11:39:46PM +0100, Bj?rn Axelsson wrote:
> > +static const int tc_divs[3] = { 1000, 60, 60 };
> > +static void make_tc(uint64_t ms, int *tc)
> > +{
> > +    int i;
> > +    for(i=0; i<3; i++) {
> > +        tc[i] = ms % tc_divs[i];
> > +        ms /= tc_divs[i];
> > +    }
> > +    tc[3] = ms;
> > +}
>
> What is the intended behaviour when the time code is >= 100 hours?
> Should this maybe be
> tc[3] = ms % 100?
> Or should it error out?
> Or should it indeed write a timecode with an over-long hours field (then
> the decoder does not handle it right and needs to be fixed, but it seems
> to me like this could cause lots of issues, not to mention that the hdr
> += 27; would be wrong).
> Also I just noticed that no length is passed to encode_xsub_subtitles
> which means there are no buffer overflow checks at all.
> I start to remember why I never cleaned up the encoder but only wrote a
> decoder...

Without a spec on how to handle >=100 hours time codes there's not much I
can do. An error, and no subtitles, seems to be the best solution.

-- 
Bj?rn Axelsson



More information about the ffmpeg-devel mailing list