FFmpeg
Loading...
Searching...
No Matches
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
22static 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
36int 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}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition bprint.c:69
#define AV_BPRINT_SIZE_UNLIMITED
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
common internal and external API header
#define NULL
Definition coverity.c:32
__device__ int printf(const char *,...)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition bprint.c:235
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition bprint.c:227
int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
#define FF_ARRAY_ELEMS(a)
int main(void)
static const char *const test_cases[]