[FFmpeg-devel] [RFC] ANSI/ASCII animation decoder

Michael Niedermayer michaelni
Wed Jun 16 23:00:46 CEST 2010


On Sun, May 30, 2010 at 07:33:04PM +1000, Peter Ross wrote:
> On Wed, Mar 10, 2010 at 12:09:24PM +0100, Michael Niedermayer wrote:
> > On Sun, Mar 07, 2010 at 03:13:00AM +1100, Peter Ross wrote:
> > > Hi,
> > > 
> > > This was done as a proof-of-concept for Remote Imaging Protocol (RIP)
> > > decoding.
> > > 
> > > The demuxer simulates the line rate, which can be overriden using the
> > > AVFormatParameters.sample_rate field (ffmpeg -ar 5000 gives a 5 kilo-
> > > byte/second line speed).
> > > 
> > > Samples: /MPlayer/incoming/ansi, or checkout the pile of floppies/cds
> > > gathering dust in your closet.
> > > 
> > > Cheers,
> > [...]
> > 
> > > +/**
> > > + * Draw character to screen
> > > + */
> > > +static void draw_char(AVCodecContext *avctx, int c)
> > 
> > please factor this out, we need it for our ass&utf8 subtitle renderer :)
> 
> Ok. Updated patch with char routines moved to libavcodec/cga_data.c.
> The tmv decoder has been modified to use these too.
> 
> Have also moved the sauce routines into a seperate file, as they will
> be used in a forthcoming patch to decode 'binary text' files.
> (sauce is a metadata format for text files).
> 
> Cheers,
> 
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

>  cga_data.c |  274 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  cga_data.h |   15 +++
>  2 files changed, 287 insertions(+), 2 deletions(-)
> fa058b8ab7de87fecf5c2d6eb11d0bc331ce97f6  ff_draw_pc_font.diff

ok

[...]

>  tmv.c |   16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> d14a4f29ec747c89f4c1e3775826c5d718eda673  ff_draw_pc_font-tmv.diff

ok

[...]

> +static void hscroll(AVCodecContext *avctx)
> +{
> +    AnsiContext *s = avctx->priv_data;
> +    if (s->y < avctx->height - s->font_height) {
> +        s->y += s->font_height;
> +    } else {
> +        memmove(s->frame.data[0], s->frame.data[0] + s->font_height*s->frame.linesize[0],
> +            (avctx->height - s->font_height)*s->frame.linesize[0]);

this is not guranteed to work, the data from the end of one line to the next
and outside the "egde" is not really supposed to be drawn into by the codec


> +        memset(s->frame.data[0] + (avctx->height - s->font_height)*s->frame.linesize[0],
> +            DEFAULT_BG_COLOR, s->font_height * s->frame.linesize[0]);
> +    }
> +}
> +
> +static void erase_line(AVCodecContext * avctx, int xoffset, int xlength)
> +{
> +    AnsiContext *s = avctx->priv_data;
> +    int i;
> +    for (i = 0; i < s->font_height; i++)
> +        memset(s->frame.data[0] + (s->y + i)*s->frame.linesize[0] + xoffset,
> +            DEFAULT_BG_COLOR, xlength);
> +}
> +
> +static void erase_screen(AVCodecContext *avctx)
> +{
> +    AnsiContext *s = avctx->priv_data;
> +    memset(s->frame.data[0], DEFAULT_BG_COLOR, avctx->height * s->frame.linesize[0]);
> +    s->x = s->y = 0;

same issue


[...]
> +static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
> +{
> +    TtyDemuxContext *s = avctx->priv_data;
> +    int n;
> +
> +    if (url_feof(avctx->pb))
> +        return AVERROR(EIO);

shouldnt this be eof ?

except these if you tested it with a fuzzer, i guess its ok for commit

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100616/12628d77/attachment.pgp>



More information about the ffmpeg-devel mailing list