[FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code

Clément Bœsch u at pkh.me
Sat Aug 8 17:17:32 CEST 2015


> Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code

typo in the commit message: srtdec

On Fri, Aug 07, 2015 at 11:03:28PM -0700, Yayoi wrote:
> This code will be used in SAMI decoder in a later commit.
> ---
>  libavcodec/Makefile        |   4 +-
>  libavcodec/htmlsubtitles.c | 198 +++++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/htmlsubtitles.h |  29 +++++++
>  libavcodec/srtdec.c        | 149 +---------------------------------
>  4 files changed, 231 insertions(+), 149 deletions(-)
>  create mode 100644 libavcodec/htmlsubtitles.c
>  create mode 100644 libavcodec/htmlsubtitles.h
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index e61b9cd..8201aa0 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -447,7 +447,7 @@ OBJS-$(CONFIG_RV20_DECODER)            += rv10.o
>  OBJS-$(CONFIG_RV20_ENCODER)            += rv20enc.o
>  OBJS-$(CONFIG_RV30_DECODER)            += rv30.o rv34.o rv30dsp.o
>  OBJS-$(CONFIG_RV40_DECODER)            += rv40.o rv34.o rv40dsp.o

> -OBJS-$(CONFIG_SAMI_DECODER)            += samidec.o ass.o
> +OBJS-$(CONFIG_SAMI_DECODER)            += samidec.o ass.o htmlsubtitles.o

This change doesn't belong in this commit

>  OBJS-$(CONFIG_S302M_DECODER)           += s302m.o
>  OBJS-$(CONFIG_S302M_ENCODER)           += s302menc.o
>  OBJS-$(CONFIG_SANM_DECODER)            += sanm.o
> @@ -471,7 +471,7 @@ OBJS-$(CONFIG_SONIC_DECODER)           += sonic.o
>  OBJS-$(CONFIG_SONIC_ENCODER)           += sonic.o
>  OBJS-$(CONFIG_SONIC_LS_ENCODER)        += sonic.o
>  OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o
> -OBJS-$(CONFIG_SRT_DECODER)             += srtdec.o ass.o
> +OBJS-$(CONFIG_SRT_DECODER)             += srtdec.o ass.o htmlsubtitles.o
>  OBJS-$(CONFIG_SRT_ENCODER)             += srtenc.o ass_split.o
>  OBJS-$(CONFIG_STL_DECODER)             += textdec.o ass.o
>  OBJS-$(CONFIG_SUBRIP_DECODER)          += srtdec.o ass.o
> diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c
> new file mode 100644
> index 0000000..b766130
> --- /dev/null
> +++ b/libavcodec/htmlsubtitles.c
> @@ -0,0 +1,198 @@
> +/*

> + *

nit: drop that empty line

> + * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "libavutil/avstring.h"
> +#include "libavutil/common.h"
> +#include "libavutil/parseutils.h"

> +#include "ass.h"

There is no dependency on ff_ass_* symbols here

[...]
> -    while (dst->len >= 2 && !strncmp(&dst->str[dst->len - 2], "\\N", 2))
> -        dst->len -= 2;
> -    dst->str[dst->len] = 0;
> -    rstrip_spaces_buf(dst);

why did you completely remove this chunk?

> +    ff_htmlmarkup_to_ass(avctx, dst, in);
>  }

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150808/65b3b709/attachment.sig>


More information about the ffmpeg-devel mailing list