[FFmpeg-devel] [PATCH] Decoding of Bold-Italic-Underlined styles for 3gpp timed text

Michael Niedermayer michaelni at gmx.at
Wed Apr 22 13:21:20 CEST 2015


Hi

On Wed, Apr 22, 2015 at 03:40:03PM +0530, Niklesh Lalwani wrote:
> From: Niklesh <niklesh.lalwani at iitb.ac.in>
> 
> This patch supports decoding of Bold, Italic, Underlined styles for 3gpp timed text. While the code can be improved upon to make it more clean and well structured, this works for now, even for multiple style records. Suggestions awaited.
> Signed-off-by: Niklesh <niklesh.lalwani at iitb.ac.in>
> ---
>  libavcodec/movtextdec.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 82 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index 1c7ffea..a4aa7cb 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -25,10 +25,28 @@
>  #include "libavutil/common.h"
>  #include "libavutil/bprint.h"
>  #include "libavutil/intreadwrite.h"
> +#include "libavutil/mem.h"
>  
> -static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end)
> +#define STYLE_FLAG_BOLD         1
> +#define STYLE_FLAG_ITALIC       2
> +#define STYLE_FLAG_UNDERLINE    4
> +
> +static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, 
> +                        const char **style_start, const char **style_end, 
> +                        const int **style_flags, const int style_entries)
>  {
>      while (text < text_end) {

> +        for (int i=0; i<style_entries; i++) {

some compilers dont like "for (int"
please move the int i up

also please fix the other build warnings:
CC  libavcodec/movtextdec.o
libavcodec/movtextdec.c: In function ‘mov_text_decode_frame’:
libavcodec/movtextdec.c:101:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
libavcodec/movtextdec.c:148:29: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
libavcodec/movtextdec.c:152:29: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
libavcodec/movtextdec.c:166:17: warning: passing argument 4 of ‘text_to_ass’ from incompatible pointer type [enabled by default]
libavcodec/movtextdec.c:34:12: note: expected ‘const char **’ but argument is of type ‘char **’
libavcodec/movtextdec.c:166:17: warning: passing argument 5 of ‘text_to_ass’ from incompatible pointer type [enabled by default]
libavcodec/movtextdec.c:34:12: note: expected ‘const char **’ but argument is of type ‘char **’
libavcodec/movtextdec.c:166:17: warning: passing argument 6 of ‘text_to_ass’ from incompatible pointer type [enabled by default]
libavcodec/movtextdec.c:34:12: note: expected ‘const int **’ but argument is of type ‘int **’

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150422/32bb3df9/attachment.asc>


More information about the ffmpeg-devel mailing list