FFmpeg
htmlsubtitles.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include "libavutil/common.h"
21 
22 static const char * const test_cases[] = {
23  /* latin guillemets and other < > garbage */
24  "<<hello>>", // guillemets
25  "<<<b>hello</b>>>", // guillemets + tags
26  "< hello < 2000 > world >", // unlikely tags due to spaces
27  "<h1>TITLE</h1>", // likely unhandled tags
28  "< font color=red >red</font>", // invalid format of valid tag
29  "Foo <foo@bar.com>", // not a tag (not alnum)
30 
31  "<b> foo <I> bar </B> bla </i>", // broken nesting
32 
33  "A<br>B<BR/>C<br / >D< Br >E<brk><brk/>", // misc line breaks
34 };
35 
36 int main(void)
37 {
38  int i;
39  AVBPrint dst;
40 
42  for (i = 0; i < FF_ARRAY_ELEMS(test_cases); i++) {
44  if (ret < 0)
45  return ret;
46  printf("%s --> %s\n", test_cases[i], dst.str);
48  }
50  return 0;
51 }
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
htmlsubtitles.c
test_cases
static const char *const test_cases[]
Definition: htmlsubtitles.c:22
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
NULL
#define NULL
Definition: coverity.c:32
main
int main(void)
Definition: htmlsubtitles.c:36
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
printf
printf("static const uint8_t my_array[100] = {\n")
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
common.h
ff_htmlmarkup_to_ass
int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
Definition: htmlsubtitles.c:129
ret
ret
Definition: filter_design.txt:187
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:232