[FFmpeg-devel] [PATCH] Decoding of raw UTF-8 text from Ogg streams
Diego Biurrun
diego
Sat Jul 11 10:18:52 CEST 2009
On Sat, Jul 11, 2009 at 12:41:09AM +0100, ogg.k.ogg.k at googlemail.com wrote:
>
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -132,6 +132,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
> oggparsespeex.o \
> oggparsetheora.o \
> oggparsevorbis.o \
> + oggparsekate.o \
This was previously in alphabetical order.
> --- /dev/null
> +++ b/libavformat/oggparsekate.c
> @@ -0,0 +1,248 @@
> +/*
> + * Copyright (C) 2009 ogg.k.ogg.k at googlemail.com
Please add a one-line description of what this file is about.
> +static int
> +parse_kate_header (AVFormatContext * s, int idx)
> +{
Please consistently use K&R style for new files.
> + if(!thp){
> + thp = av_mallocz(sizeof(*thp));
> + os->private = thp;
> + }
ditto
> + thp->major = bytestream_get_byte(&ptr);
> + thp->minor = bytestream_get_byte(&ptr);
> + thp->num_headers = bytestream_get_byte(&ptr);
> + thp->text_encoding = bytestream_get_byte(&ptr);
> + thp->directionality = bytestream_get_byte(&ptr);
This could be vertically aligned.
> + st->codec->codec_type = CODEC_TYPE_SUBTITLE;
> + st->codec->codec_id = CODEC_ID_TEXT;
> + st->codec->time_base.num = thp->gps_den; // time_base = 1 / granule_rate
> + st->codec->time_base.den = thp->gps_num;
> + st->time_base = st->codec->time_base;
ditto
> + st->codec->extradata = av_realloc (st->codec->extradata,
> + cds + FF_INPUT_BUFFER_PADDING_SIZE);
Drop the space after the function name please, same in other places.
> + start = bytestream_get_le64(&ptr);
> + duration = bytestream_get_le64(&ptr);
> + backlink = bytestream_get_le64(&ptr);
align
> + else {
> + os->skip = os->psize - len;
> + os->psize = len;
ditto
> + if (!thp)
> + return 0;
> + base = gp >> thp->granule_shift;
> + offset = gp & ((1<<thp->granule_shift)-1);
ditto
> +const struct ogg_codec ff_kate_codec = {
> + .magic = "\200kate\0\0\0",
> + .magicsize = 8,
> + .header = parse_kate_header,
> + .packet = parse_kate_packet,
> + .gptopts = parse_kate_granpos
ditto
Diego
More information about the ffmpeg-devel
mailing list