[FFmpeg-devel] [PATCH] added slicing yuv, rgb
--- libavfilter/allfilters.c | 2 +- libavfilter/vf_lut.c | 119 ++- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index adb86be..76341bd 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -218,7 +218,7 @@ void avfilter_register_all(void) REGISTER_FILTER(YADIF, yadif, vf); REGISTER_FILTER(ZMQ,zmq,vf); REGISTER_FILTER(ZOOMPAN,zoompan,vf); - + REGISTER_FILTER(CELLAUTO, cellauto, vsrc); REGISTER_FILTER(COLOR, color, vsrc); REGISTER_FILTER(FREI0R, frei0r_src, vsrc); diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 0b7a2ca..3ab7f40 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -69,6 +69,13 @@ typedef struct LutContext { int negate_alpha; /* only used by negate */ } LutContext; +typedef struct ThreadData { +AVFrame *in, *out; +int plane; +int h,w; +AVFilterLink *inlink; +} ThreadData; + #define Y 0 #define U 1 #define V 2 @@ -276,14 +283,76 @@ static int config_props(AVFilterLink *inlink) return 0; } +static int process_slice_rgb(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ +int x, y; +LutContext *s = ctx->priv; +const ThreadData *td = arg; +const AVFrame *in = td->in; +const AVFrame *out = td->out; +const int step = s->step; +const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut; + + +const int slice_start = (in->height * jobnr ) / nb_jobs; +const int slice_end = (in->height * (jobnr+1)) / nb_jobs; +uint8_t *outrow = out->data[0] + slice_start * out->linesize[0]; +const uint8_t *inrow = in->data[0] + slice_start * in->linesize[0]; +int w = td->w; +for (y = slice_start; y < slice_end; y++) { + +for (x = 0; x < w; x++) { +switch (step) { +case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through +case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through +case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through +default: outrow[0] = tab[0][inrow[0]]; +} +outrow += step; +inrow += step; +} +} +return 0; + +} + + + +static int process_slice_yuv(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ +int x, y; +LutContext *s = ctx->priv; +const ThreadData *td = arg; +int plane = td->plane; +int h = td->h; +int w = td->w; + +const AVFrame *in = td->in; +const AVFrame *out = td->out; +int slice_start = (h * jobnr ) / nb_jobs; +int slice_end = (h * (jobnr+1)) / nb_jobs; +uint8_t *outrow = out->data[plane] + slice_start * out->linesize[plane]; +const uint8_t *inrow = in->data[plane] + slice_start * in->linesize[plane]; + +for (y = slice_start; y < slice_end; y++) { +const uint8_t *tab = s->lut[plane]; +for (x = 0; x < w; x++) +outrow[x] = tab[inrow[x]]; +inrow += in ->linesize[plane]; +outrow += out->linesize[plane]; +} +return 0; + +} + static int filter_frame(AVFilterLink *inlink, AVFrame *in) { AVFilterContext *ctx = inlink->dst; LutContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out; -uint8_t *inrow, *outrow, *inrow0, *outrow0; -int i, j, plane, direct = 0; +ThreadData td; +int plane, direct = 0; if (av_frame_is_writable(in)) { direct = 1; @@ -297,47 +366,33 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); } +td.in = in; +td.out = out; +td.inlink = inlink; + + if (s->is_rgb) { /* packed */ -inrow0 = in ->data[0]; -outrow0 = out->data[0]; - -for (i = 0; i < in->height; i ++) { -int w = inlink->w; -const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut; -inrow = inrow0; -outrow = outrow0; -for (j = 0; j < w; j++) { -switch (s->step) { -case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through -case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through -case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through -default: outrow[0] = tab[0][inrow[0]]; -} -outrow += s->step; -inrow += s->step; -} -inrow0 += in ->linesize[0]; -outrow0 += out->linesize[0]; -} + +int w = inlink->w; +td.w = w; +ctx->internal->execute(ctx, process_slice_rgb, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); + } else { /* planar */ + for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
[FFmpeg-devel] [PATCH] avfilter/lut: reduce dereference in the inner loop
For rgb, with a 1080p source, 69 to 74fps on core i5(2 core, 1.8GHz), and 136 to 160 fps on an core i7(4770R, 3.2Ghz) Changed the yuv code for consistency, even though the performance increase is not as obvious as rgb --- libavfilter/vf_lut.c | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 0b7a2ca..e262c6e 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -299,26 +299,31 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (s->is_rgb) { /* packed */ +const int w = inlink->w; +const int h = in->height; +const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut; +const int in_linesize = in->linesize[0]; +const int out_linesize = out->linesize[0]; +const int step = s->step; + inrow0 = in ->data[0]; outrow0 = out->data[0]; -for (i = 0; i < in->height; i ++) { -int w = inlink->w; -const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut; +for (i = 0; i < h; i ++) { inrow = inrow0; outrow = outrow0; for (j = 0; j < w; j++) { -switch (s->step) { +switch (step) { case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through default: outrow[0] = tab[0][inrow[0]]; } -outrow += s->step; -inrow += s->step; +outrow += step; +inrow += step; } -inrow0 += in ->linesize[0]; -outrow0 += out->linesize[0]; +inrow0 += in_linesize; +outrow0 += out_linesize; } } else { /* planar */ @@ -327,16 +332,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) int hsub = plane == 1 || plane == 2 ? s->hsub : 0; int h = FF_CEIL_RSHIFT(inlink->h, vsub); int w = FF_CEIL_RSHIFT(inlink->w, hsub); +const uint8_t *tab = s->lut[plane]; +const int in_linesize = in->linesize[plane]; +const int out_linesize = out->linesize[plane]; inrow = in ->data[plane]; outrow = out->data[plane]; for (i = 0; i < h; i++) { -const uint8_t *tab = s->lut[plane]; for (j = 0; j < w; j++) outrow[j] = tab[inrow[j]]; -inrow += in ->linesize[plane]; -outrow += out->linesize[plane]; +inrow += in_linesize; +outrow += out_linesize; } } } -- 1.8.3.4 (Apple Git-47) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
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 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 000..b766130 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,198 @@ +/* + * + * Copyright (c) 2010 Aurelien Jacobs + * + * 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" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} + +/* check if it is end of the paragraph or not*/ +in++; +count = 1; +while(*in == ' ') { +in++; +count++; +} +if (*in == '\0' || *in == '\n'){ +in = in - count; +break; +} +in = in - count; + +/*if not the end of the paragraph, add line break */ +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len)
[FFmpeg-devel] [PATCH 2/4] libavcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/samidec.c| 59 + tests/ref/fate/sub-sami | 18 +++ 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..41826a7 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,6 +27,7 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; @@ -41,11 +42,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +char *pcopy = NULL; +int index = 0; +int second_paragraph = 0; -av_bprint_clear(&sami->content); for (;;) { char *saveptr = NULL; -int prev_chr_is_space = 0; AVBPrint *dst = &sami->content; /* parse & extract paragraph tag */ @@ -77,37 +79,46 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) goto end; } -/* extract the text, stripping most of the tags */ +/* check for the second paragrph */ +pcopy = av_strdup(p); while (*p) { if (*p == '<') { -if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +ff_htmlmarkup_to_ass(avctx, dst, p); + +/* add the source if there are any. */ +av_bprint_clear(&sami->full); +if (sami->source.len) { +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); +av_bprintf(&sami->full, "%s", sami->content.str); +if (second_paragraph) { +second_paragraph = 0; +p = pcopy; +p += index; +index = 0; +continue; +} +} else { +av_bprintf(&sami->full, "%s", sami->content.str); +} +av_bprint_clear(&sami->content); + +} end: +av_free(pcopy); av_free(dupsrc); return ret; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..3c73526 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13.00,9:59:59.99,Default,,0,0,0,,{\i1}End of: {\i0}\NPresident John F. Kennedy Speech +Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\N +Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\NLet the word go forth,\Nfrom this time and place to friend and foe\Nalike that the torch +Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nhas been passed to a new generation of Americans,\Nborn in this century, tempered by war, +Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Ndisciplined by a hard and bitter peace,\Nproud of our ancient heritage, and unwilling to witness +Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nor permit the slow undoing of those human rights\Nto which this nation has always, +Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nbeen committed and to which we are\Ncommitted today at home and around the world. +Dialogue: 0,0:00:46.00,0:01:01.00,Default,
[FFmpeg-devel] [PATCH 3/4] libavformat/samidec: fix tag close
--- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fate reference for samidec
--- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..0a6c33d 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_ass_capability_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5703652 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠 +Dialogue: 0,
[FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/samidec.c| 59 + tests/ref/fate/sub-sami | 18 +++ 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..41826a7 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,6 +27,7 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; @@ -41,11 +42,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +char *pcopy = NULL; +int index = 0; +int second_paragraph = 0; -av_bprint_clear(&sami->content); for (;;) { char *saveptr = NULL; -int prev_chr_is_space = 0; AVBPrint *dst = &sami->content; /* parse & extract paragraph tag */ @@ -77,37 +79,46 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) goto end; } -/* extract the text, stripping most of the tags */ +/* check for the second paragrph */ +pcopy = av_strdup(p); while (*p) { if (*p == '<') { -if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +ff_htmlmarkup_to_ass(avctx, dst, p); + +/* add the source if there are any. */ +av_bprint_clear(&sami->full); +if (sami->source.len) { +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); +av_bprintf(&sami->full, "%s", sami->content.str); +if (second_paragraph) { +second_paragraph = 0; +p = pcopy; +p += index; +index = 0; +continue; +} +} else { +av_bprintf(&sami->full, "%s", sami->content.str); +} +av_bprint_clear(&sami->content); + +} end: +av_free(pcopy); av_free(dupsrc); return ret; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..3c73526 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13.00,9:59:59.99,Default,,0,0,0,,{\i1}End of: {\i0}\NPresident John F. Kennedy Speech +Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\N +Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\NLet the word go forth,\Nfrom this time and place to friend and foe\Nalike that the torch +Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nhas been passed to a new generation of Americans,\Nborn in this century, tempered by war, +Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Ndisciplined by a hard and bitter peace,\Nproud of our ancient heritage, and unwilling to witness +Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nor permit the slow undoing of those human rights\Nto which this nation has always, +Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nbeen committed and to which we are\Ncommitted today at home and around the world. +Dialogue: 0,0:00:46.00,0:01:01.00,Default,
[FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
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 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 000..b766130 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,198 @@ +/* + * + * Copyright (c) 2010 Aurelien Jacobs + * + * 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" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} + +/* check if it is end of the paragraph or not*/ +in++; +count = 1; +while(*in == ' ') { +in++; +count++; +} +if (*in == '\0' || *in == '\n'){ +in = in - count; +break; +} +in = in - count; + +/*if not the end of the paragraph, add line break */ +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len)
[FFmpeg-devel] [PATCH 3/4] avformat/samidec: fix tag close
--- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fate reference for samidec
--- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..0a6c33d 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_ass_capability_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5703652 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠 +Dialogue: 0,
[FFmpeg-devel] [PATCH 1/4] avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit. --- libavcodec/Makefile| 2 +- libavcodec/htmlsubtitles.c | 201 + libavcodec/htmlsubtitles.h | 29 +++ libavcodec/srtdec.c| 149 + 4 files changed, 233 insertions(+), 148 deletions(-) create mode 100644 libavcodec/htmlsubtitles.c create mode 100644 libavcodec/htmlsubtitles.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index e61b9cd..4ca824b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -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 000..b2f2273 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2010 Aurelien Jacobs + * + * 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 "avcodec.h" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} + +/* check if it is end of the paragraph or not*/ +in++; +count = 1; +while(*in == ' ') { +in++; +count++; +} +if (*in == '\0' || *in == '\n'){ +in = in - count; +break; +} +in = in - count; + +/*if not the end of the paragraph, add line break */ +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) || +(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) { +in += len - 1; +} else +av_bprint_chars(dst, *in, 1); +break; +case '<': +if (!av_strncasecmp(in, "]>%n", buffer, &len) >= 1 && len > 0) { +if ((param = strchr(buffer, ' '))) +*param++ = 0; +if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || +( tag_close && sptr > 0 && !strcmp(
[FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/Makefile | 2 +- libavcodec/samidec.c| 71 - tests/ref/fate/sub-sami | 18 ++--- 3 files changed, 56 insertions(+), 35 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 4ca824b..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 OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER)+= sanm.o diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..6ed1755 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,6 +27,7 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; @@ -41,14 +42,15 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +char *pcopy = NULL; +int index = 0; +int second_paragraph = 0; -av_bprint_clear(&sami->content); for (;;) { char *saveptr = NULL; -int prev_chr_is_space = 0; AVBPrint *dst = &sami->content; -/* parse & extract paragraph tag */ +/* extract paragraph tag */ p = av_stristr(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +ff_htmlmarkup_to_ass(avctx, dst, p); + +/* add the source if there are any. */ +av_bprint_clear(&sami->full); +if (sami->source.len) { +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); +av_bprintf(&sami->full, "%s", sami->content.str); +/* add back stored additional paragraph content. +* if there are any and run additional iteration. +*/ +if (second_paragraph) { +second_paragraph = 0; +p = pcopy; +p += index; +index = 0; +continue; +} +} else { +av_bprintf(&sami->full, "%s", sami->content.str); +} +av_bprint_clear(&sami->content); + +} end: +av_free(pcopy); av_free(dupsrc); return ret; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..9eabbd7 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13.00,9:59:59.99,Default,,0,0,0,,{\i1}End of: {\i0}\NPresident John F. Kennedy Speech +Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\N +Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\NLet the word go forth,\Nfrom this time and place to friend and foe\Nalike that the torch +Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy{\i0}\Nhas been passed to a new generation of Americans,\Nborn in this century, tempered by war, +Dia
[FFmpeg-devel] [PATCH 3/4] avformat/samidec:do not include trailing sami
footer in the last packet --- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fate/subtitles: add a new test for SAMI demuxer
and decoder --- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..f5270ea 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5703652 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠
[FFmpeg-devel] [PATCH 2/5] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/Makefile | 2 +- libavcodec/samidec.c| 35 +-- tests/ref/fate/sub-sami | 18 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d1ffb12..1045d7a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -450,7 +450,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 OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER)+= sanm.o diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..8b036a0 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,10 +27,13 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; AVBPrint content; +AVBPrint encoded_source; +AVBPrint encoded_content; AVBPrint full; } SAMIContext; @@ -41,8 +44,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +AVBPrint *dst_content = &sami->encoded_content; +AVBPrint *dst_source = &sami->encoded_source; +av_bprint_clear(&sami->encoded_content); av_bprint_clear(&sami->content); +av_bprint_clear(&sami->encoded_source); for (;;) { char *saveptr = NULL; int prev_chr_is_space = 0; @@ -82,18 +89,11 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) if (*p == '<') { if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +if (sami->source.len) { +ff_htmlmarkup_to_ass(avctx, dst_source, sami->source.str); +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->encoded_source.str); +} +ff_htmlmarkup_to_ass(avctx, dst_content, sami->content.str); +av_bprintf(&sami->full, "%s", sami->encoded_content.str); end: av_free(dupsrc); @@ -136,6 +139,8 @@ static av_cold int sami_init(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_init(&sami->source, 0, 2048); av_bprint_init(&sami->content, 0, 2048); +av_bprint_init(&sami->encoded_source, 0, 2048); +av_bprint_init(&sami->encoded_content, 0, 2048); av_bprint_init(&sami->full,0, 2048); return ff_ass_subtitle_header_default(avctx); } @@ -145,6 +150,8 @@ static av_cold int sami_close(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_finalize(&sami->source, NULL); av_bprint_finalize(&sami->content, NULL); +av_bprint_finalize(&sami->encoded_source, NULL); +av_bprint_finalize(&sami->encoded_content, NULL); av_bprint_finalize(&sami->full,NULL); return 0; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..9eabbd7 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13.00
[FFmpeg-devel] [PATCH 3/5] libavcodec/htmlsubtitles:Add parsing for sami
--- libavcodec/htmlsubtitles.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c index a138955..c1324d6 100644 --- a/libavcodec/htmlsubtitles.c +++ b/libavcodec/htmlsubtitles.c @@ -54,7 +54,7 @@ static void rstrip_spaces_buf(AVBPrint *buf) void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) { char *param, buffer[128], tmp[128]; -int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0; SrtStack stack[16]; stack[0].tag[0] = 0; @@ -90,6 +90,13 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) av_bprint_chars(dst, *in, 1); break; case '<': +if (!av_strncasecmp(in, "]>%n", buffer, &len) >= 1 && len > 0) { -- 1.8.5.2 (Apple Git-48) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] fate/subtitles: add a new test for SAMI demuxer
and decoder --- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..f5270ea 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5703652 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠
[FFmpeg-devel] [PATCH 1/5] avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit. --- libavcodec/Makefile| 2 +- libavcodec/htmlsubtitles.c | 177 + libavcodec/htmlsubtitles.h | 29 libavcodec/srtdec.c| 149 +- 4 files changed, 209 insertions(+), 148 deletions(-) create mode 100644 libavcodec/htmlsubtitles.c create mode 100644 libavcodec/htmlsubtitles.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 407c6c3..d1ffb12 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -474,7 +474,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 000..a138955 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2010 Aurelien Jacobs + * + * 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 "avcodec.h" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) || +(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) { +in += len - 1; +} else +av_bprint_chars(dst, *in, 1); +break; +case '<': +tag_close = in[1] == '/'; +len = 0; +if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) { +if ((param = strchr(buffer, ' '))) +*param++ = 0; +if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || +( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { +int i, j, unknown = 0; +in += len + tag_close; +if (!tag_close) +memset(stack+sptr, 0, sizeof(*stack)); +if (!strcmp(buffer, "font")) { +if (tag_close) { +
[FFmpeg-devel] [PATCH 4/5] avformat/samidec:do not include trailing sami
footer in the last packet --- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit. --- libavcodec/Makefile| 2 +- libavcodec/htmlsubtitles.c | 177 + libavcodec/htmlsubtitles.h | 29 libavcodec/srtdec.c| 149 +- 4 files changed, 209 insertions(+), 148 deletions(-) create mode 100644 libavcodec/htmlsubtitles.c create mode 100644 libavcodec/htmlsubtitles.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 407c6c3..d1ffb12 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -474,7 +474,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 000..a138955 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2010 Aurelien Jacobs + * + * 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 "avcodec.h" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) || +(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) { +in += len - 1; +} else +av_bprint_chars(dst, *in, 1); +break; +case '<': +tag_close = in[1] == '/'; +len = 0; +if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) { +if ((param = strchr(buffer, ' '))) +*param++ = 0; +if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || +( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { +int i, j, unknown = 0; +in += len + tag_close; +if (!tag_close) +memset(stack+sptr, 0, sizeof(*stack)); +if (!strcmp(buffer, "font")) { +if (tag_close) { +
[FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/Makefile | 2 +- libavcodec/samidec.c| 38 ++ tests/ref/fate/sub-sami | 18 +- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d1ffb12..1045d7a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -450,7 +450,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 OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER)+= sanm.o diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..50fde4f 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,10 +27,13 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; AVBPrint content; +AVBPrint encoded_source; +AVBPrint encoded_content; AVBPrint full; } SAMIContext; @@ -41,8 +44,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +AVBPrint *dst_content = &sami->encoded_content; +AVBPrint *dst_source = &sami->encoded_source; +av_bprint_clear(&sami->encoded_content); av_bprint_clear(&sami->content); +av_bprint_clear(&sami->encoded_source); for (;;) { char *saveptr = NULL; int prev_chr_is_space = 0; @@ -82,18 +89,18 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) if (*p == '<') { if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +if (sami->source.len) { +ff_htmlmarkup_to_ass(avctx, dst_source, sami->source.str); +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->encoded_source.str); +} +ff_htmlmarkup_to_ass(avctx, dst_content, sami->content.str); +av_bprintf(&sami->full, "%s", sami->encoded_content.str); end: av_free(dupsrc); @@ -136,6 +146,8 @@ static av_cold int sami_init(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_init(&sami->source, 0, 2048); av_bprint_init(&sami->content, 0, 2048); +av_bprint_init(&sami->encoded_source, 0, 2048); +av_bprint_init(&sami->encoded_content, 0, 2048); av_bprint_init(&sami->full,0, 2048); return ff_ass_subtitle_header_default(avctx); } @@ -145,6 +157,8 @@ static av_cold int sami_close(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_finalize(&sami->source, NULL); av_bprint_finalize(&sami->content, NULL); +av_bprint_finalize(&sami->encoded_source, NULL); +av_bprint_finalize(&sami->encoded_content, NULL); av_bprint_finalize(&sami->full,NULL); return 0; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..9eabbd7 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13
[FFmpeg-devel] [PATCH 3/4] avformat/samidec:do not include trailing sami
footer in the last packet --- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fate/subtitles: add a new test for SAMI demuxer
and decoder --- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..f5270ea 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5bce8a2 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠
[FFmpeg-devel] [PATCH 1/4] avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit. --- libavcodec/Makefile| 2 +- libavcodec/htmlsubtitles.c | 177 + libavcodec/htmlsubtitles.h | 29 libavcodec/srtdec.c| 149 +- 4 files changed, 209 insertions(+), 148 deletions(-) create mode 100644 libavcodec/htmlsubtitles.c create mode 100644 libavcodec/htmlsubtitles.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 407c6c3..d1ffb12 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -474,7 +474,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 000..a138955 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2010 Aurelien Jacobs + * + * 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 "avcodec.h" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) || +(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) { +in += len - 1; +} else +av_bprint_chars(dst, *in, 1); +break; +case '<': +tag_close = in[1] == '/'; +len = 0; +if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) { +if ((param = strchr(buffer, ' '))) +*param++ = 0; +if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || +( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { +int i, j, unknown = 0; +in += len + tag_close; +if (!tag_close) +memset(stack+sptr, 0, sizeof(*stack)); +if (!strcmp(buffer, "font")) { +if (tag_close) { +
[FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/Makefile | 2 +- libavcodec/samidec.c| 45 - tests/ref/fate/sub-sami | 18 +- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d1ffb12..1045d7a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -450,7 +450,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 OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER)+= sanm.o diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..6db0ec5 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,10 +27,13 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; AVBPrint content; +AVBPrint encoded_source; +AVBPrint encoded_content; AVBPrint full; } SAMIContext; @@ -41,11 +44,14 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +AVBPrint *dst_content = &sami->encoded_content; +AVBPrint *dst_source = &sami->encoded_source; +av_bprint_clear(&sami->encoded_content); av_bprint_clear(&sami->content); +av_bprint_clear(&sami->encoded_source); for (;;) { char *saveptr = NULL; -int prev_chr_is_space = 0; AVBPrint *dst = &sami->content; /* parse & extract paragraph tag */ @@ -82,30 +88,31 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) if (*p == '<') { if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +if (sami->source.len) { +ff_htmlmarkup_to_ass(avctx, dst_source, sami->source.str); +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->encoded_source.str); +} +ff_htmlmarkup_to_ass(avctx, dst_content, sami->content.str); +av_bprintf(&sami->full, "%s", sami->encoded_content.str); end: av_free(dupsrc); @@ -136,6 +143,8 @@ static av_cold int sami_init(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_init(&sami->source, 0, 2048); av_bprint_init(&sami->content, 0, 2048); +av_bprint_init(&sami->encoded_source, 0, 2048); +av_bprint_init(&sami->encoded_content, 0, 2048); av_bprint_init(&sami->full,0, 2048); return ff_ass_subtitle_header_default(avctx); } @@ -145,6 +154,8 @@ static av_cold int sami_close(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_finalize(&sami->source, NULL); av_bprint_finalize(&sami->content, NULL); +av_bprint_finalize(&sami->encoded_source, NULL); +av_bprint_finalize(&sami->encoded_content, NULL); av_bprint_finalize(&sami->full,NULL); return 0; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..9eabbd7 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support a
[FFmpeg-devel] [PATCH 3/4] avformat/samidec:do not include trailing sami
footer in the last packet --- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] fate/subtitles: add a new test for SAMI demuxer
and decoder --- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..f5270ea 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5bce8a2 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠
[FFmpeg-devel] [PATCH] avfilter/colormatrix:add slice threading
--- libavfilter/vf_colormatrix.c | 146 --- 1 file changed, 95 insertions(+), 51 deletions(-) diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index daba16e..8514684 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -73,6 +73,17 @@ typedef struct { int hsub, vsub; } ColorMatrixContext; +typedef struct ThreadData { +AVFrame *dst; +const AVFrame *src; +int c2; +int c3; +int c4; +int c5; +int c6; +int c7; +} ThreadData; + #define OFFSET(x) offsetof(ColorMatrixContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -179,24 +190,28 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static void process_frame_uyvy422(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_uyvy422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcp = src->data[0]; -const int src_pitch = src->linesize[0]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width*2; -unsigned char *dstp = dst->data[0]; +const int src_pitch = src->linesize[0]; const int dst_pitch = dst->linesize[0]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const unsigned char *srcp = src->data[0] + slice_start * src_pitch; +unsigned char *dstp = dst->data[0] + slice_start * dst_pitch; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 4) { const int u = srcp[x + 0] - 128; const int v = srcp[x + 2] - 128; @@ -209,32 +224,36 @@ static void process_frame_uyvy422(ColorMatrixContext *color, srcp += src_pitch; dstp += dst_pitch; } +return 0; } -static void process_frame_yuv422p(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_yuv422p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcpU = src->data[1]; -const unsigned char *srcpV = src->data[2]; -const unsigned char *srcpY = src->data[0]; -const int src_pitchY = src->linesize[0]; -const int src_pitchUV = src->linesize[1]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width; -unsigned char *dstpU = dst->data[1]; -unsigned char *dstpV = dst->data[2]; -unsigned char *dstpY = dst->data[0]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const int src_pitchY = src->linesize[0]; +const int src_pitchUV = src->linesize[1]; +const unsigned char *srcpU = src->data[1] + slice_start * src_pitchUV; +const unsigned char *srcpV = src->data[2] + slice_start * src_pitchUV; +const unsigned char *srcpY = src->data[0] + slice_start * src_pitchY; const int dst_pitchY = dst->linesize[0]; const int dst_pitchUV = dst->linesize[1]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +unsigned char *dstpU = dst->data[1] + slice_start * dst_pitchUV; +unsigned char *dstpV = dst->data[2] + slice_start * dst_pitchUV; +unsigned char *dstpY = dst->data[0] + slice_start * dst_pitchY; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; - -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 2) { const int u = srcpU[x >> 1] - 128; const int v = srcpV[x >> 1] - 128; @@ -251,34 +270,44 @@ static void process_frame_yuv422p(ColorMatrixContext *color, dstpU += dst_pitchUV; dstpV += dst_pitchUV; } +return 0; }
[FFmpeg-devel] [PATCH] avfilter/colormatrix:add slice threading
--- fixed the issue and cleaned up the code a bit --- libavfilter/vf_colormatrix.c | 146 +++ 1 file changed, 92 insertions(+), 54 deletions(-) diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index daba16e..d0839cc 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -73,6 +73,17 @@ typedef struct { int hsub, vsub; } ColorMatrixContext; +typedef struct ThreadData { +AVFrame *dst; +const AVFrame *src; +int c2; +int c3; +int c4; +int c5; +int c6; +int c7; +} ThreadData; + #define OFFSET(x) offsetof(ColorMatrixContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -179,24 +190,28 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static void process_frame_uyvy422(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_uyvy422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcp = src->data[0]; -const int src_pitch = src->linesize[0]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width*2; -unsigned char *dstp = dst->data[0]; +const int src_pitch = src->linesize[0]; const int dst_pitch = dst->linesize[0]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const unsigned char *srcp = src->data[0] + slice_start * src_pitch; +unsigned char *dstp = dst->data[0] + slice_start * dst_pitch; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 4) { const int u = srcp[x + 0] - 128; const int v = srcp[x + 2] - 128; @@ -209,32 +224,36 @@ static void process_frame_uyvy422(ColorMatrixContext *color, srcp += src_pitch; dstp += dst_pitch; } +return 0; } -static void process_frame_yuv422p(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_yuv422p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcpU = src->data[1]; -const unsigned char *srcpV = src->data[2]; -const unsigned char *srcpY = src->data[0]; -const int src_pitchY = src->linesize[0]; -const int src_pitchUV = src->linesize[1]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width; -unsigned char *dstpU = dst->data[1]; -unsigned char *dstpV = dst->data[2]; -unsigned char *dstpY = dst->data[0]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const int src_pitchY = src->linesize[0]; +const int src_pitchUV = src->linesize[1]; +const unsigned char *srcpU = src->data[1] + slice_start * src_pitchUV; +const unsigned char *srcpV = src->data[2] + slice_start * src_pitchUV; +const unsigned char *srcpY = src->data[0] + slice_start * src_pitchY; const int dst_pitchY = dst->linesize[0]; const int dst_pitchUV = dst->linesize[1]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +unsigned char *dstpU = dst->data[1] + slice_start * dst_pitchUV; +unsigned char *dstpV = dst->data[2] + slice_start * dst_pitchUV; +unsigned char *dstpY = dst->data[0] + slice_start * dst_pitchY; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; - -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 2) { const int u = srcpU[x >> 1] - 128; const int v = srcpV[x >> 1] - 128; @@ -251,34 +270,38 @@ static void process_frame_yuv422p(ColorMatrixContext *color, dstpU += dst_pitchUV;
[FFmpeg-devel] [PATCH] avfilter/colormatrix:add slice threading
--- separate a struct variable declaraion and assignment statements. --- libavfilter/vf_colormatrix.c | 146 --- 1 file changed, 94 insertions(+), 52 deletions(-) diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index daba16e..f5835cb 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -73,6 +73,17 @@ typedef struct { int hsub, vsub; } ColorMatrixContext; +typedef struct ThreadData { +AVFrame *dst; +const AVFrame *src; +int c2; +int c3; +int c4; +int c5; +int c6; +int c7; +} ThreadData; + #define OFFSET(x) offsetof(ColorMatrixContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -179,24 +190,28 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static void process_frame_uyvy422(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_uyvy422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcp = src->data[0]; -const int src_pitch = src->linesize[0]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width*2; -unsigned char *dstp = dst->data[0]; +const int src_pitch = src->linesize[0]; const int dst_pitch = dst->linesize[0]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const unsigned char *srcp = src->data[0] + slice_start * src_pitch; +unsigned char *dstp = dst->data[0] + slice_start * dst_pitch; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 4) { const int u = srcp[x + 0] - 128; const int v = srcp[x + 2] - 128; @@ -209,32 +224,38 @@ static void process_frame_uyvy422(ColorMatrixContext *color, srcp += src_pitch; dstp += dst_pitch; } + +return 0; } -static void process_frame_yuv422p(ColorMatrixContext *color, - AVFrame *dst, AVFrame *src) +static int process_slice_yuv422p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { -const unsigned char *srcpU = src->data[1]; -const unsigned char *srcpV = src->data[2]; -const unsigned char *srcpY = src->data[0]; -const int src_pitchY = src->linesize[0]; -const int src_pitchUV = src->linesize[1]; +const ThreadData *td = arg; +const AVFrame *src = td->src; +AVFrame *dst = td->dst; const int height = src->height; const int width = src->width; -unsigned char *dstpU = dst->data[1]; -unsigned char *dstpV = dst->data[2]; -unsigned char *dstpY = dst->data[0]; +const int slice_start = (height * jobnr ) / nb_jobs; +const int slice_end = (height * (jobnr+1)) / nb_jobs; +const int src_pitchY = src->linesize[0]; +const int src_pitchUV = src->linesize[1]; +const unsigned char *srcpU = src->data[1] + slice_start * src_pitchUV; +const unsigned char *srcpV = src->data[2] + slice_start * src_pitchUV; +const unsigned char *srcpY = src->data[0] + slice_start * src_pitchY; const int dst_pitchY = dst->linesize[0]; const int dst_pitchUV = dst->linesize[1]; -const int c2 = color->yuv_convert[color->mode][0][1]; -const int c3 = color->yuv_convert[color->mode][0][2]; -const int c4 = color->yuv_convert[color->mode][1][1]; -const int c5 = color->yuv_convert[color->mode][1][2]; -const int c6 = color->yuv_convert[color->mode][2][1]; -const int c7 = color->yuv_convert[color->mode][2][2]; +unsigned char *dstpU = dst->data[1] + slice_start * dst_pitchUV; +unsigned char *dstpV = dst->data[2] + slice_start * dst_pitchUV; +unsigned char *dstpY = dst->data[0] + slice_start * dst_pitchY; +const int c2 = td->c2; +const int c3 = td->c3; +const int c4 = td->c4; +const int c5 = td->c5; +const int c6 = td->c6; +const int c7 = td->c7; int x, y; -for (y = 0; y < height; y++) { +for (y = slice_start; y < slice_end; y++) { for (x = 0; x < width; x += 2) { const int u = srcpU[x >> 1] - 128; const int v = srcpV[x >> 1] - 128; @@ -251,34 +272,40 @@ static void process_frame_yuv422p(ColorMatrixContext *color, dstpU
Re: [FFmpeg-devel] [PATCH 4/4] fate reference for samidec
The (attached) file is a sample for this reference. Thank you! Yayoi On Thu, Aug 6, 2015 at 11:47 PM, Yayoi wrote: > --- > tests/fate/subtitles.mak | 3 ++ > tests/ref/fate/sub-sami2 | 91 > > 2 files changed, 94 insertions(+) > create mode 100644 tests/ref/fate/sub-sami2 > > diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak > index d8b2034..0a6c33d 100644 > --- a/tests/fate/subtitles.mak > +++ b/tests/fate/subtitles.mak > @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/RealText_capabil > FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami > fate-sub-sami: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi > > +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 > +fate-sub-sami2: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_ass_capability_tester.smi > + > FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt > fate-sub-srt: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt > > diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 > new file mode 100644 > index 000..5703652 > --- /dev/null > +++ b/tests/ref/fate/sub-sami2 > @@ -0,0 +1,91 @@ > +[Script Info] > +; Script generated by FFmpeg/Lavc > +ScriptType: v4.00+ > +PlayResX: 384 > +PlayResY: 288 > + > +[V4+ Styles] > +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, > OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, > ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, > MarginR, MarginV, Encoding > +Style: > Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 > + > +[Events] > +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, > Text > +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence > Fictionist\npsyencefiction...@gmail.com > +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and > Kerensky\Nwww.Addic7ed.com > +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 > 이야기죠{\b0} > +Dialogue: > 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} > {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} > {\c&H8000&}and{\c}{\c&H00&} > bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} > and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. > +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 > 대해서\N대립하는 가치관을 가진{\c} > +Dialogue: > 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} > {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} > intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} > {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} > +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 > 펼쳐집니다{\u1} > +Dialogue: > 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} > what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} > +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 > 철학으로\N담아내고 있어요{\i0} > +Dialogue: > 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} > has {\fs15}{\c&H00&}a{\c}{\fs} great > {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. > +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 > 가상왕국의\N권력 분쟁 이야기입니다{\s0} > +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game > of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} > about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} > struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} > kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} > +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 > +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a > power struggle\Nfor the Iron Throne,{\c} > +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 > 있는 자리에요{\fs} > +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of > power\Nin this kingdom. > +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 > +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a
Re: [FFmpeg-devel] [PATCH 4/4] fate reference for samidec
Hello, Sorry, I didn't mean to spam the mailing list...I noticed that commit message was not quite right.. Sample file is attached for this reference. (again) And besides these messages (title on these previous 3 email), nothing is changed from previous patches. Thank you for reviewing and have a super wonderful day!! Yayoi On Fri, Aug 7, 2015 at 11:03 PM, Yayoi wrote: > --- > tests/fate/subtitles.mak | 3 ++ > tests/ref/fate/sub-sami2 | 91 > > 2 files changed, 94 insertions(+) > create mode 100644 tests/ref/fate/sub-sami2 > > diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak > index d8b2034..0a6c33d 100644 > --- a/tests/fate/subtitles.mak > +++ b/tests/fate/subtitles.mak > @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/RealText_capabil > FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami > fate-sub-sami: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi > > +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 > +fate-sub-sami2: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_ass_capability_tester.smi > + > FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt > fate-sub-srt: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt > > diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 > new file mode 100644 > index 000..5703652 > --- /dev/null > +++ b/tests/ref/fate/sub-sami2 > @@ -0,0 +1,91 @@ > +[Script Info] > +; Script generated by FFmpeg/Lavc > +ScriptType: v4.00+ > +PlayResX: 384 > +PlayResY: 288 > + > +[V4+ Styles] > +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, > OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, > ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, > MarginR, MarginV, Encoding > +Style: > Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 > + > +[Events] > +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, > Text > +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence > Fictionist\npsyencefiction...@gmail.com > +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and > Kerensky\Nwww.Addic7ed.com > +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 > 이야기죠{\b0} > +Dialogue: > 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} > {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} > {\c&H8000&}and{\c}{\c&H00&} > bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} > and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. > +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 > 대해서\N대립하는 가치관을 가진{\c} > +Dialogue: > 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} > {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} > intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} > {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} > +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 > 펼쳐집니다{\u1} > +Dialogue: > 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} > what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} > +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 > 철학으로\N담아내고 있어요{\i0} > +Dialogue: > 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} > has {\fs15}{\c&H00&}a{\c}{\fs} great > {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. > +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 > 가상왕국의\N권력 분쟁 이야기입니다{\s0} > +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game > of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} > about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} > struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} > kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} > +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 > +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a > power struggle\Nfor the Iron Throne,{\c} > +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 > 있는
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
On Sat, Aug 8, 2015 at 8:17 AM, Clément Bœsch wrote: >> 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 000..b766130 >> --- /dev/null >> +++ b/libavcodec/htmlsubtitles.c >> @@ -0,0 +1,198 @@ >> +/* > >> + * > > nit: drop that empty line > >> + * Copyright (c) 2010 Aurelien Jacobs >> + * >> + * 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? It appeared to me that it didn't do anything even in original code. But I can put it back. (It didn't make any difference in fate test or other simple test whether I commented it out or not.) > >> +ff_htmlmarkup_to_ass(avctx, dst, in); >> } > > -- > Clément B. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
On Sat, Aug 8, 2015 at 8:23 AM, Clément Bœsch wrote: > On Fri, Aug 07, 2015 at 11:03:29PM -0700, Yayoi wrote: >> --- >> libavcodec/samidec.c| 59 >> + >> tests/ref/fate/sub-sami | 18 +++ >> 2 files changed, 44 insertions(+), 33 deletions(-) >> >> diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c >> index 47850e2..41826a7 100644 >> --- a/libavcodec/samidec.c >> +++ b/libavcodec/samidec.c >> @@ -27,6 +27,7 @@ >> #include "ass.h" >> #include "libavutil/avstring.h" >> #include "libavutil/bprint.h" >> +#include "htmlsubtitles.h" >> >> typedef struct { >> AVBPrint source; >> @@ -41,11 +42,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, >> const char *src) >> char *tag = NULL; >> char *dupsrc = av_strdup(src); >> char *p = dupsrc; >> +char *pcopy = NULL; >> +int index = 0; >> +int second_paragraph = 0; >> >> -av_bprint_clear(&sami->content); >> for (;;) { >> char *saveptr = NULL; >> -int prev_chr_is_space = 0; >> AVBPrint *dst = &sami->content; >> >> /* parse & extract paragraph tag */ >> @@ -77,37 +79,46 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, >> const char *src) >> goto end; >> } >> > >> -/* extract the text, stripping most of the tags */ >> +/* check for the second paragrph */ > > Why change the comment? What does "check" mean here? What is the "second > paragraph"? I answer it below with the other questions you have because you are basically asking the same things. And I will document better too. > >> +pcopy = av_strdup(p); >> while (*p) { >> if (*p == '<') { >> -if (!av_strncasecmp(p, "> av_isspace(p[2]))) >> +if (!av_strncasecmp(p, "> av_isspace(p[2]))) { >> +second_paragraph = 1; >> break; >> -if (!av_strncasecmp(p, "> -av_bprintf(dst, "\\N"); >> -p++; >> -while (*p && *p != '>') >> -p++; >> -if (!*p) >> -break; >> -if (*p == '>') >> -p++; >> -continue; >> +} >> } >> -if (!av_isspace(*p)) >> -av_bprint_chars(dst, *p, 1); >> -else if (!prev_chr_is_space) >> -av_bprint_chars(dst, ' ', 1); >> -prev_chr_is_space = av_isspace(*p); >> p++; >> +index++; >> +} >> +p = p - index; >> +if (second_paragraph) { >> +p[index] = 0; >> } >> -} >> >> -av_bprint_clear(&sami->full); >> -if (sami->source.len) >> -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); >> -av_bprintf(&sami->full, "%s", sami->content.str); >> +ff_htmlmarkup_to_ass(avctx, dst, p); >> + >> +/* add the source if there are any. */ >> +av_bprint_clear(&sami->full); >> +if (sami->source.len) { >> +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); >> +av_bprintf(&sami->full, "%s", sami->content.str); >> +if (second_paragraph) { >> +second_paragraph = 0; >> +p = pcopy; >> +p += index; >> +index = 0; >> +continue; >> +} >> +} else { >> +av_bprintf(&sami->full, "%s", sami->content.str); >> +} >> +av_bprint_clear(&sami->content); >> + >> +} >> > > This looks clumsy at best: you are finalizing the subtitle event inside > the paragraph loop when it should be outside. It also seems there is a > duplicating "second paragraph" logic even though the loop is supposed to > handle one paragraph at a time. I know. It is clumsy.. I explain it below as well. > > If you are uncomfortable with the current logic or believe it's badly > desi
Re: [FFmpeg-devel] [PATCH 4/4] fate/subtitles: add a new test for SAMI demuxer
And sample with a new name. On Sun, Aug 9, 2015 at 9:39 PM, Yayoi wrote: > and decoder > --- > tests/fate/subtitles.mak | 3 ++ > tests/ref/fate/sub-sami2 | 91 > > 2 files changed, 94 insertions(+) > create mode 100644 tests/ref/fate/sub-sami2 > > diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak > index d8b2034..f5270ea 100644 > --- a/tests/fate/subtitles.mak > +++ b/tests/fate/subtitles.mak > @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/RealText_capabil > FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami > fate-sub-sami: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi > > +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 > +fate-sub-sami2: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi > + > FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt > fate-sub-srt: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt > > diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 > new file mode 100644 > index 000..5703652 > --- /dev/null > +++ b/tests/ref/fate/sub-sami2 > @@ -0,0 +1,91 @@ > +[Script Info] > +; Script generated by FFmpeg/Lavc > +ScriptType: v4.00+ > +PlayResX: 384 > +PlayResY: 288 > + > +[V4+ Styles] > +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, > OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, > ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, > MarginR, MarginV, Encoding > +Style: > Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 > + > +[Events] > +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, > Text > +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence > Fictionist\npsyencefiction...@gmail.com > +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and > Kerensky\Nwww.Addic7ed.com > +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 > 이야기죠{\b0} > +Dialogue: > 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} > {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} > {\c&H8000&}and{\c}{\c&H00&} > bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} > and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. > +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 > 대해서\N대립하는 가치관을 가진{\c} > +Dialogue: > 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} > {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} > intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} > {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} > +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 > 펼쳐집니다{\u1} > +Dialogue: > 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} > what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} > +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 > 철학으로\N담아내고 있어요{\i0} > +Dialogue: > 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} > has {\fs15}{\c&H00&}a{\c}{\fs} great > {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. > +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 > 가상왕국의\N권력 분쟁 이야기입니다{\s0} > +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game > of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} > about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} > struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} > kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} > +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 > +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a > power struggle\Nfor the Iron Throne,{\c} > +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 > 있는 자리에요{\fs} > +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of > power\Nin this kingdom. > +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 > +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, > Ned. >
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
On Sat, Aug 15, 2015 at 11:08 AM, Clément Bœsch wrote: > On Sat, Aug 08, 2015 at 12:52:04PM -0700, Yayoi Ukai wrote: > [...] >> >> -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? >> >> It appeared to me that it didn't do anything even in original code. >> But I can put it back. >> (It didn't make any difference in fate test or other simple test >> whether I commented it out or not.) >> > > This commit is supposed to be factoring out the code, not do any > functional change. If you want to do such changes it belongs in a separate > commit (but you probably don't want to because it's likely wrong). > > Anyway, I had to have a look to the diff again to check if you hadn't > added more unwanted changes. And unfortunately, you did. So first of all, > this following diff I extracted belongs in a separated commit (typically > squashed in the one where you make SAMI use it, or eventually just > before). > > Here is a review of that part assuming it is extracted/moved: > > diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c > index a138955..b2f2273 100644 > --- a/libavcodec/htmlsubtitles.c > +++ b/libavcodec/htmlsubtitles.c > @@ -71,6 +71,21 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint > *dst, const char *in) > end = 1; > break; > } > + > +/* check if it is end of the paragraph or not*/ > +in++; > +count = 1; > +while(*in == ' ') { > +in++; > +count++; > +} > +if (*in == '\0' || *in == '\n'){ > +in = in - count; > +break; > +} > +in = in - count; > + > +/*if not the end of the paragraph, add line break */ > > Why? What are you trying to do here that isn't already handled by the code > already? Yes removed. > > There is no concept of "paragraph" in SubRip markup, so it probably > doesn't belong here, assuming it's necessary. > > rstrip_spaces_buf(dst); > av_bprintf(dst, "\\N"); > line_start = 1; > @@ -90,6 +105,15 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint > *dst, const char *in) > av_bprint_chars(dst, *in, 1); > break; > case '<': > +if (!av_strncasecmp(in, " > here and below, check your style > > +av_bprintf(dst, "\\N"); > +len = 3; > +while (in[len] != '>' && (av_isspace(in[len]) || in[len] == > '/')){ > > if in[len] is a space or a '/', it's obviously different than '>', so the > condition is redundant. > > +len++; > > wrong indent > > +} > > +in += len + 1; > > this +1 is very dangerous, there is a risk of overread. Well, I was not sure what it could be replaced for checking the closed '>' for the tag.. So this one stayed... Please let me know if you have any suggestion. Thank you! > > +} > + > tag_close = in[1] == '/'; > len = 0; > if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && > len > 0) { > > [...] > > -- > Clément B. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
Thank you for the suggestion.. It took me a while to get it but I think it looks much better now. Please let me know what you think! Cheers, On Sat, Aug 15, 2015 at 11:24 AM, Clément Bœsch wrote: > On Sat, Aug 08, 2015 at 09:24:03PM -0700, Yayoi Ukai wrote: >> On Sat, Aug 8, 2015 at 8:23 AM, Clément Bœsch wrote: >> > On Fri, Aug 07, 2015 at 11:03:29PM -0700, Yayoi wrote: >> >> --- >> >> libavcodec/samidec.c| 59 >> >> + >> >> tests/ref/fate/sub-sami | 18 +++ >> >> 2 files changed, 44 insertions(+), 33 deletions(-) >> >> >> >> diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c >> >> index 47850e2..41826a7 100644 >> >> --- a/libavcodec/samidec.c >> >> +++ b/libavcodec/samidec.c >> >> @@ -27,6 +27,7 @@ >> >> #include "ass.h" >> >> #include "libavutil/avstring.h" >> >> #include "libavutil/bprint.h" >> >> +#include "htmlsubtitles.h" >> >> >> >> typedef struct { >> >> AVBPrint source; >> >> @@ -41,11 +42,12 @@ static int sami_paragraph_to_ass(AVCodecContext >> >> *avctx, const char *src) >> >> char *tag = NULL; >> >> char *dupsrc = av_strdup(src); >> >> char *p = dupsrc; >> >> +char *pcopy = NULL; >> >> +int index = 0; >> >> +int second_paragraph = 0; >> >> >> >> -av_bprint_clear(&sami->content); >> >> for (;;) { >> >> char *saveptr = NULL; >> >> -int prev_chr_is_space = 0; >> >> AVBPrint *dst = &sami->content; >> >> >> >> /* parse & extract paragraph tag */ >> >> @@ -77,37 +79,46 @@ static int sami_paragraph_to_ass(AVCodecContext >> >> *avctx, const char *src) >> >> goto end; >> >> } >> >> >> > >> >> -/* extract the text, stripping most of the tags */ >> >> +/* check for the second paragrph */ >> > >> > Why change the comment? What does "check" mean here? What is the "second >> > paragraph"? >> >> >> I answer it below with the other questions you have because you are >> basically asking the same things. >> And I will document better too. >> >> > >> >> +pcopy = av_strdup(p); >> >> while (*p) { >> >> if (*p == '<') { >> >> -if (!av_strncasecmp(p, "> >> av_isspace(p[2]))) >> >> +if (!av_strncasecmp(p, "> >> av_isspace(p[2]))) { >> >> +second_paragraph = 1; >> >> break; >> >> -if (!av_strncasecmp(p, "> >> -av_bprintf(dst, "\\N"); >> >> -p++; >> >> -while (*p && *p != '>') >> >> -p++; >> >> -if (!*p) >> >> -break; >> >> -if (*p == '>') >> >> -p++; >> >> -continue; >> >> +} >> >> } >> >> -if (!av_isspace(*p)) >> >> -av_bprint_chars(dst, *p, 1); >> >> -else if (!prev_chr_is_space) >> >> -av_bprint_chars(dst, ' ', 1); >> >> -prev_chr_is_space = av_isspace(*p); >> >> p++; >> >> +index++; >> >> +} >> >> +p = p - index; >> >> +if (second_paragraph) { >> >> +p[index] = 0; >> >> } >> >> -} >> >> >> >> -av_bprint_clear(&sami->full); >> >> -if (sami->source.len) >> >> -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); >> >> -av_bprintf(&sami->full, "%s", sami->content.str); >> >> +ff_htmlmarkup_to_ass(avctx, dst, p); >> >> + >> >> +/* add the source if there are any. */ >> >> +av_bprint_clear(&sami->full); >> >> +if (sami
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
>> >> rstrip_spaces_buf(dst); >> av_bprintf(dst, "\\N"); >> line_start = 1; >> @@ -90,6 +105,15 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, >> AVBPrint *dst, const char *in) >> av_bprint_chars(dst, *in, 1); >> break; >> case '<': >> +if (!av_strncasecmp(in, "> >> here and below, check your style >> >> +av_bprintf(dst, "\\N"); >> +len = 3; >> +while (in[len] != '>' && (av_isspace(in[len]) || in[len] == >> '/')){ >> >> if in[len] is a space or a '/', it's obviously different than '>', so the >> condition is redundant. >> >> +len++; >> >> wrong indent >> >> +} >> >> +in += len + 1; >> >> this +1 is very dangerous, there is a risk of overread. > > Well, I was not sure what it could be replaced for checking the closed > '>' for the tag.. > So this one stayed... Please let me know if you have any suggestion. > > Thank you! Okay I realized that this is rather silly. So the above code is removed and moved back to samidec.c now. > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Outreach Program For Women
Hi Mosha, I recommend that you ask someone to give you something to do or you look at old google summer of code or outreachy (it was called opw) page and pick what you like to work on or pick up something to do from the ticket. (And again talk to relevant people to ask exactly or overall what to do.) I decided to apply for outreachy when ffmpeg was not listed in outreachy for this summer not far before the application deadline. I was already working on something on ffmpeg. So I contacted outreachy organizer and ffmpeg people (people listed old outreachy and google summer of code) by saying I wanted to do outreachy with ffmpeg and they decided ffmpeg will be part of outreachy for this summer after not so long. So I have no idea how they decided to join outreachy or not but I can say it can happen if you want make it happen. Sadly I had to withdrawal my application and I felt pretty sad/bad about it (because I understood that ffmpeg people had to fund raise to support these interns not just to take care of them.. So once I knew I couldn't do.. I even tried to convince my friend to do it..) But it seemed that it worked out pretty well with this summer's person (Ludmila) so you can just start I think. Also actually I heard that selection process is pretty competitive. (They have a tons of qualified candidates by the time they take a pick) So earlier is better I think. I hope it goes well and good luck~. Cheers, Yayoi On Tue, Sep 1, 2015 at 12:04 AM, Imaculate Mosha < imaculatemosha-at-yahoo@ffmpeg.org> wrote: > Hi ffmpeg! > I'm interested in doing an OPW(Outreach Program for Women) internship from December 2015 with ffmpeg. I would like to know if ffmpeg will be participating in this coming round. If it is, How can I get started? Thank you very much and looking forward to hearing from you! > > Kind regards,Imaculate Mosha. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Outreachy][nyanyanya] Summary of this summer
Hi Ludmila, Congrats!! I am super super happy you that your internship was successful! And congrats for being selected for the intern too!!! I also like your blog! It's great. I think you are really smart!! Cheers, Yayoi On Mon, Aug 31, 2015 at 12:17 PM, Ludmila Glinskih wrote: > Hi guys! > > My internship is finished (5 days ago) (if you still don't know: I was your > Outreachy intern;)). It was a great time with this project, thank you! > > Thank you for all jokes on irc, all answers, all silly questions which > showed me that it's normal (to ask silly questions). > > If you want to read about all my emotions during this summer, you can read > my Outreachy blog: http://lglinskih.blogspot.ru/. > > I hope to see you on VideoLAN DevDays. I'll come to Paris on Thursday > evening and leave on Monday morning, so there will be a lot of time to meet > me (if you want) (because I want) (really). And I hope you will let me take > a selfie with you :) > > Also if you want to contact me, it's easy: I'm lglinskih almost everywhere. > Because I'm really crazy about social networks, be prepared that I'll > subscribe to your account somewhere. > > And yes...I won't leave you! Tomorrow is the first day of my university > year, so my rare patches will be twice more rare. > > P.S. Please recommend Outreachy internship to all relevant women you know. > It's really a great chance to become...at least a better programmer=) > > Kind regards, > Ludmila Glinskih > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Mon, Sep 7, 2015 at 4:41 AM, Michael Niedermayer wrote: > On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: >> Hi, >> >> I propose to have an official IRC meeting on the next Saturday, and I >> propose the tentative time of 15:00 UTC, but feel free to propose a >> different time if this can't suit you. >> >> The IRC meeting channel will be public and the log will be published >> at the end of the meeting. >> >> This meeting is also meant as a preparation for the real-life meeting >> that will be held in Paris at the next VDD >> (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg >> developers who will attend it. >> >> I propose these topics of the day (suggested by ubitux on IRC): >> 1. ABI compatibility policy >> 2. general policy decision process >> 3. VDD15 >> 4. Any other business > > 5. Outreachy funding, we again need funding for the next round (winter 2015) > i guess this doesnt need "discussion" but we need to find a sponsor or > use our limited funds I am happy to help fundraising for the next round of Outreachy. Please let me know if I can help. Yayoi > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I am the wisest man alive, for I know one thing, and that is that I know > nothing. -- Socrates > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Sep 8, 2015 3:21 AM, "Michael Niedermayer" wrote: > > On Mon, Sep 07, 2015 at 09:25:20PM -0700, Yayoi Ukai wrote: > > On Mon, Sep 7, 2015 at 4:41 AM, Michael Niedermayer wrote: > > > On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: > > >> Hi, > > >> > > >> I propose to have an official IRC meeting on the next Saturday, and I > > >> propose the tentative time of 15:00 UTC, but feel free to propose a > > >> different time if this can't suit you. > > >> > > >> The IRC meeting channel will be public and the log will be published > > >> at the end of the meeting. > > >> > > >> This meeting is also meant as a preparation for the real-life meeting > > >> that will be held in Paris at the next VDD > > >> (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg > > >> developers who will attend it. > > >> > > >> I propose these topics of the day (suggested by ubitux on IRC): > > >> 1. ABI compatibility policy > > >> 2. general policy decision process > > >> 3. VDD15 > > >> 4. Any other business > > > > > > 5. Outreachy funding, we again need funding for the next round (winter 2015) > > > i guess this doesnt need "discussion" but we need to find a sponsor or > > > use our limited funds > > > > I am happy to help fundraising for the next round of Outreachy. > > Please let me know if I can help. > > sure you can help! Cool > if you can find some company to fund FFmpeg 1 slot in the next > round of outreachy. But its not easy! > please see https://wiki.gnome.org/Outreachy/Admin/InfoForOrgs > AFAIK 6500 USD are required to sponsor 1 slot which is the minimum > needed to participate I see. I will start a separate thread. I have a few questions. (Especially since you said it's not easy..) > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Many things microsoft did are stupid, but not doing something just because > microsoft did it is even more stupid. If everything ms did were stupid they > would be bankrupt already. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Outreachy
Hi, These are my questions: - If you have an email template that you used for your last fundraiser, I am happy to use some of it. If not, I will write one based on outreachy's sample email and I will send it you to look over. (It will go out all the companies who would be a potential sponsor, right? So I really want to make sure that people are happy with what is written.) - I also want a contact list that you used for your last fundraiser as well. If you don't have one, you can send me the list of the companies who gave ffmpeg money before (either donation or contract work) and contact information from these companies. This is important because we have to coordinate with Outreachy for asking for donations from big companies. Also, it is important to contact a lot of companies since fundraising is not so easy. Please let me know if you have any questions and suggestions. Thank you, Yayoi ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Outreachy
Hi, The below is the draft of the letter. Please let me know, if you have any opinion about it. Yayoi Dear (Name of the candidate sponsor organization), FFmpeg(https://www.ffmpeg.org) is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter, and play pretty much anything that humans and machines have created. It supports formats from the most obscure up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. We have been working on increasing the diversity in our community while adhering to high standards. We welcome everyone and everyone's contributions in many different forms. While we have been putting a lot of effort to recruit women and other underrepresented populations in technical field, our progress has been slower than we had been hoped for. We still have fewer female contributors compared to other FOSS organizations. Since the end of last year, we have participated in a program called Outreachy(http://outreachy.org), which was the successor of the GNOME project's Outreach Program for Women (OPW), and we significantly increased our representation of women by accepting the interns from this program. The selected interns were given an opportunity to contribute to FFmpeg full time for 3 months with the stipend that is provided by the program. Our last two interns successfully completed the program. We gave them several options for projects to contribute to FFmpeg, in the same format as the Google Summer of Code. They made notable contributions and the candidates who were not selected also chose to contribute code to the project. In order to accept an intern from the Outreachy program, we either have to provide $6500 of our own funding to Outreachy (from our limited funds) or we need to find a company or organization which can sponsor our intern. Last year, Samsung sponsored one intern for us. We would like to invite your organization to be a sponsor for our interns. We ask for $6500 to cover the required amount for one Outreachy intern ($5500 for the stipend for the intern, $500 for a travel grant, and $500 for administrative fees.) However, we will be happy to accept any contribution for this program. If your organization can support one intern, please let us know by the Nov 2nd deadline for the upcoming December 2015 round. We are pleased to contribute to increasing diversity in the technology community and help advance the technical careers of people belonging to underrepresented groups. Being an intern and having an experience contributing to FFmpeg, which is highly valued in the technology industry, makes them stand-out candidates for further opportunities. We also hope that selected interns will choose to continue to contribute to FFmpeg, increasing the health of the project. Your contribution will directly support our efforts for diversity in our community and advance the careers of underrepresented minorities in general. Please let us know if you have any questions about supporting our interns. You can contact us. .(.. name of the contact..) We look forward to hearing from you. Best, On Tue, Sep 8, 2015 at 11:52 PM, Yayoi Ukai wrote: > Hi, > > These are my questions: > > - If you have an email template that you used for your last > fundraiser, I am happy to use some of it. If not, I will write one > based on outreachy's sample email and I will send it you to look over. > (It will go out all the companies who would be a potential sponsor, > right? So I really want to make sure that people are happy with what > is written.) > > - I also want a contact list that you used for your last fundraiser as > well. If you don't have one, you can send me the list of the companies > who gave ffmpeg money before (either donation or contract work) and > contact information from these companies. This is important because we > have to coordinate with Outreachy for asking for donations from big > companies. Also, it is important to contact a lot of companies since > fundraising is not so easy. > > Please let me know if you have any questions and suggestions. > > Thank you, > Yayoi ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Thu, Sep 10, 2015 at 8:37 PM, Ganesh Ajjanagadde wrote: > On Mon, Sep 7, 2015 at 5:37 AM, Stefano Sabatini wrote: >> Hi, >> >> I propose to have an official IRC meeting on the next Saturday, and I >> propose the tentative time of 15:00 UTC, but feel free to propose a >> different time if this can't suit you. >> >> The IRC meeting channel will be public and the log will be published >> at the end of the meeting. >> >> This meeting is also meant as a preparation for the real-life meeting >> that will be held in Paris at the next VDD >> (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg >> developers who will attend it. >> >> I propose these topics of the day (suggested by ubitux on IRC): >> 1. ABI compatibility policy >> 2. general policy decision process >> 3. VDD15 >> 4. Any other business >> >> Feel free to suggest other topics. > > A less important issue; but I think a clear stance on use of > Github/Gitorious and their pull request development model would be > useful. I think it is clear that in general many people here do not > like it, and repeated comments on the FFmpeg Github page discourage > it. However, a user checking out README.md (which is the document > people see on Github) does not have an explicit note on this; and > instead only a hyperlink to the documentation which again lacks full > clarity on this point. My own proposed solution is an added line to > README.md clearly stating that FFmpeg does not do pull requests from > Github, and instead that we use the mailing list. This will hopefully > reduce the number of pull requests on Github; thus avoiding > fragmentation of development discussion. Also FYI, FFmpeg page says currently: (https://www.ffmpeg.org/developer.html#Contributing) """(beginning of quote) There are 3 ways by which code gets into ffmpeg. 1. Submitting Patches to the main developer mailing list see Submitting patches for details. 2. Directly committing changes to the main tree. 3. Committing changes to a git clone, for example on github.com or gitorious.org. And asking us to merge these changes. Whichever way, changes should be reviewed by the maintainer of the code before they are committed. And they should follow the Coding Rules. The developer making the commit and the author are responsible for their changes and should try to fix issues their commit causes. """(end of quote) Maybe No.3 needs to be removed? > >> -- >> FFmpeg = Fascinating & Fiendish Murdering Powerful Earthshaking Gymnast >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Thu, Sep 10, 2015 at 10:46 AM, Michael Niedermayer wrote: > On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: >> Hi, >> >> I propose to have an official IRC meeting on the next Saturday, and I >> propose the tentative time of 15:00 UTC, but feel free to propose a >> different time if this can't suit you. >> >> The IRC meeting channel will be public and the log will be published >> at the end of the meeting. >> >> This meeting is also meant as a preparation for the real-life meeting >> that will be held in Paris at the next VDD >> (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg >> developers who will attend it. >> >> I propose these topics of the day (suggested by ubitux on IRC): >> 1. ABI compatibility policy > >> 2. general policy decision process > > heres a suggestion, maybe useful as input for discussions on > Saturday ... > > FFmpeg used and uses "unanimous consent" in patch reviews > any person could make a suggestion > to improve a patch and it has to be taken care of one way or another > before the patch is ok. This system worked quite well almost all the > time. So i would suggest to use the same / a similar system for > policy decisions > > * Everyone should be able to comment and propose options/choices > * There should be enough time to understand, discuss and amend > proposals > * People should try to understand the other people and avoid strawman > arguments and other non constructive discussion tactics, people/the > commuity should step in if discussions become non constructive and > hostile and try to get people back toward constructive discussion. > * People should be able to declare reservations to a proposal without > blocking the proposal and as a seperate choice veto it in a blocking > fashion. A veto should be public with full name of the developer, > reason why it is bad for the community/project and ideally a > alternative proposal. Also developers vetoing a proposal must be > willing and able to work on finding an better solution. So you can add a deadline for the alternate proposal. For example, if the person who vetoed doesn't come up with an alternate proposal within 30 days, the original proposal must be passed. > * The authors of proposals should try to amend proposals based on > raised issues & reservations and restart the process if changes > where made. There could be a maximum number of such restarts after > which only vetos would block > > If this doesnt work due to too many vetos then it could be adjusted > to require 2 or more vetos to reject a proposal, but IMHO i dont think > this would be needed. Simply having ones full name in public with a > veto should result in people using the veto right wisely. > > A "unanimous consent" system also should push toward cooperation > and discussions intended to find compromises and understanding the > others. Because simply trying to be loud and push and troll are > unlikely effective means to find an agreement. also such a system, if > it works, would ensure noones oppinion or suggestion is just pushed > aside > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > There will always be a question for which you do not know the correct answer. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
FYI: Here is my experience with Python.org Step 1: If it the decision is not so important (simple patch etc.) and if 3 reviewers say yes, it will be merged. Also, it seems there are no maintainers for specific parts of the code, but instead they have "reviewers" and only reviewers can review the patch. And once they approved the patch, the patch will be submitted automated system and "reviewers" do not merge the patch by themselves. Step 2: If it is decided that the patch or change is worthy of escalation, it will be reviewed by more people. (I recall 6 but I am not sure) and they vote. (I am not sure which condition justify escalation.) Then, they will repeat the voting and escalation process and the final decision is made by a vote of the "committee" (majority rules, I am also not sure how they choose the committee etc. the python.org person might have told me but I don't remember..) I got really confused when I first came to FFmpeg. I thought it would be very similar to Python, and I didn't know that an Open Source Free Software Project could be run so dramatically different.. but it made sense though. and I see a lot of good things about the existing FFmpeg system too.. I think deciding point would be.. (I am just summarizing what is discussed so far.) - Deciding what events or arguments can causes/trigger the escalation. (I guess it means when do you need more than arguing over the email?) - Once it is decided to be escalated/vote, how the vote leads to the decisions. (majority rules or veto rules?) (and who qualifies to vote for after escalation?) (Well, basically current patch review is everyone votes right?) - Well, you can always try one and you can come back later to see how well it is working. (you need to test any system so...and there will be one problem in one system and the other (oh democracy..).. so.. You can see how happy you are and come back next year..or next time. now your guys are leaderless by the leader's own decision and your guys are pretty okay.. so i think you are fine. :) ) -- -- On Fri, Sep 11, 2015 at 6:11 AM, Ronald S. Bultje wrote: > Hi, > > On Fri, Sep 11, 2015 at 8:46 AM, Nicolas George wrote: > >> Le quintidi 25 fructidor, an CCXXIII, Michael Niedermayer a écrit : >> > I have a few problems with using the UN security council as >> > comparission >> > [..] > >> The project needs a way of making a decision when people do not agree. > > > +1, that's exactly what I meant. > > (Thank you for putting it into words.) > > Ronald > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] IRC meeting summary for Outeachy Fundraising (Item No.5)
Hello everyone, Here is the meeting summary for yesterday meeting (Item No.5 about Outreachy). I also added possible future agenda. And please let me know if you have any questions. Also, I will probably start a separate mailing list for just regarding outreachy related issues, unless I should keep writing here. So please let me know if you want to subscribe or I should just keep writing it here. But in any cases, if you are very sad that you missed the meeting and especially about the discussion item No.5 of yesterday's meeting, Here is the summary. (So you know what happened in this topic at least! So don't be sad! Also, you can read the log as well) Please let me know that if you want to help, or you want to know what's going on more! Also, Meeting Summary: (Start of the summary) Action Items: 1. FFmpeg will participate Outreachy 2. FFmpeg has a money to support intern but prefer to raise funds 3. Micheal will be a mentor (tentative). Developers will discuss the idea of the project and will be determined. (possibly more mentor candidates and Mentors need to commit 5 hours a week during the internship period.) 4. Lou will review the email template that Yayoi wrote last week and will be decided on the final template 5. Yayoi will ask to Outreach Organizer about the deadline for the Ffmpeg participation 6. Yayoi will start emailing to companies once we are set on email template Other Topics: 1. Micheal and Stafano oversees Outreachy budget and continue to be so. 2. Yayoi's logistical question about fundraising will be answered separately (End of Summary) Future agenda (Suggestion): 1. Candidate recruiting 2. Mentor/Intern happiness Cheers, Yayoi ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting summary for Outeachy Fundraising (Item No.5)
I missed a very very important point from the summary I wrote. Action Item: Raynald: He will write a news entry about last Outreachy project. Also, thanking Samsung to fund at least two interns in the past rounds. THANK YOU SAMSUNG! I am terribly sorry for missing this!! I was super nervous on IRC meeting. Also, please let me know if I missed something else or any comments. Cheers, Yayoi On Sun, Sep 13, 2015 at 10:33 PM, Ngassa Finjap wrote: > Hi Yayoi, > > Thank you for writing a summary of the IRC Meeting which took place > yesterday regarding the upcoming Outreachy program. Yaaay! ^_^ [ Sadness > levels drop. ] > > IMHO, It's fine leaving discussions concerning Outreachy on this mailing > list since it also concerns development of FFmpeg. Please continue to keep > the community informed on upcoming Outreachy meetings on IRC as you've > always done. :) > > Best of luck with Outreachy Organization. > > Regards, > Ngassa Amalia. > > On Mon, Sep 14, 2015, 6:10 AM Yayoi Ukai wrote: > >> Hello everyone, >> >> Here is the meeting summary for yesterday meeting (Item No.5 about >> Outreachy). >> I also added possible future agenda. And please let me know if you >> have any questions. Also, I will probably start a separate mailing >> list for just regarding outreachy related issues, unless I should keep >> writing here. So please let me know if you want to subscribe or I >> should just keep writing it here. >> >> But in any cases, if you are very sad that you missed the meeting and >> especially about the discussion item No.5 of yesterday's meeting, >> Here is the summary. (So you know what happened in this topic at >> least! So don't be sad! Also, you can read the log as well) Please let >> me know that if you want to help, or you want to know what's going on >> more! >> >> Also, >> >> Meeting Summary: >> (Start of the summary) >> >> Action Items: >> >> 1. FFmpeg will participate Outreachy >> >> 2. FFmpeg has a money to support intern but prefer to raise funds >> >> 3. Micheal will be a mentor (tentative). Developers will discuss the >> idea of the project and will be determined. (possibly more mentor >> candidates and Mentors need to commit 5 hours a week during the >> internship period.) >> >> 4. Lou will review the email template that Yayoi wrote last week and will >> be >> decided on the final template >> >> 5. Yayoi will ask to Outreach Organizer about the deadline for the >> Ffmpeg participation >> >> 6. Yayoi will start emailing to companies once we are set on email template >> >> Other Topics: >> >> 1. Micheal and Stafano oversees Outreachy budget and continue to be so. >> >> 2. Yayoi's logistical question about fundraising will be answered >> separately >> >> (End of Summary) >> >> Future agenda (Suggestion): >> >> 1. Candidate recruiting >> >> 2. Mentor/Intern happiness >> >> Cheers, >> >> Yayoi >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting summary for Outeachy Fundraising (Item No.5)
Hi Ngassa, On Sun, Sep 13, 2015 at 10:33 PM, Ngassa Finjap wrote: > Hi Yayoi, > > Thank you for writing a summary of the IRC Meeting which took place > yesterday regarding the upcoming Outreachy program. Yaaay! ^_^ [ Sadness > levels drop. ] I am glad to hear that. > > IMHO, It's fine leaving discussions concerning Outreachy on this mailing > list since it also concerns development of FFmpeg. Please continue to keep > the community informed on upcoming Outreachy meetings on IRC as you've > always done. :) Not really... but I will definitely keep informing upcoming Outreachy things for the best of my knowledge! I think next stuff will be news update. (last years Outreachy summary etc..) > > Best of luck with Outreachy Organization. Thank you! -Yayoi > > Regards, > Ngassa Amalia. > > On Mon, Sep 14, 2015, 6:10 AM Yayoi Ukai wrote: > >> Hello everyone, >> >> Here is the meeting summary for yesterday meeting (Item No.5 about >> Outreachy). >> I also added possible future agenda. And please let me know if you >> have any questions. Also, I will probably start a separate mailing >> list for just regarding outreachy related issues, unless I should keep >> writing here. So please let me know if you want to subscribe or I >> should just keep writing it here. >> >> But in any cases, if you are very sad that you missed the meeting and >> especially about the discussion item No.5 of yesterday's meeting, >> Here is the summary. (So you know what happened in this topic at >> least! So don't be sad! Also, you can read the log as well) Please let >> me know that if you want to help, or you want to know what's going on >> more! >> >> Also, >> >> Meeting Summary: >> (Start of the summary) >> >> Action Items: >> >> 1. FFmpeg will participate Outreachy >> >> 2. FFmpeg has a money to support intern but prefer to raise funds >> >> 3. Micheal will be a mentor (tentative). Developers will discuss the >> idea of the project and will be determined. (possibly more mentor >> candidates and Mentors need to commit 5 hours a week during the >> internship period.) >> >> 4. Lou will review the email template that Yayoi wrote last week and will >> be >> decided on the final template >> >> 5. Yayoi will ask to Outreach Organizer about the deadline for the >> Ffmpeg participation >> >> 6. Yayoi will start emailing to companies once we are set on email template >> >> Other Topics: >> >> 1. Micheal and Stafano oversees Outreachy budget and continue to be so. >> >> 2. Yayoi's logistical question about fundraising will be answered >> separately >> >> (End of Summary) >> >> Future agenda (Suggestion): >> >> 1. Candidate recruiting >> >> 2. Mentor/Intern happiness >> >> Cheers, >> >> Yayoi >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Voting committee
On Mon, Sep 14, 2015 at 10:20 AM, Nicolas George wrote: > L'octidi 28 fructidor, an CCXXIII, Ganesh Ajjanagadde a écrit : >> Looks mostly good to me. One thing I think that should be clarified is >> the meaning of "linear combination" - I assume you meant a non-trivial >> (exclude all zeros) linear combination over the nonnegative integers? > > Thanks. You are right, this was imprecise. I meant linear combination with > total coefficients one; barycenter in other words. For example: 10 commits > are ok, 20 devel mails are ok, then 5 commits and 10 devel mails are ok too. > > Of course, the value I have put are rather arbitrary. Please people feel > free to propose other values. Yes. There is an value and I will explain why later. Well, unfortunately I couldn't quite understand after a certain point the point you tried to make but I would say don't worry about it. I mean you have been contributing more than... so many years.. of course what you really care would be respected. I am sure. I offered to volunteer for Outreachy related to stuff because I want to make the applicants and mentors experience better. (and hopefully it will be a better organization too.) Before I got REALLY ANGRY during interacting with the FFmpeg developers related to issues about Outreachy. So I made some effort to resolve my concern by communicating with developers but in the end, the answer I got was "They(the people who made me really angry) are not real FFmpeg developers." (I mean.. you really can't tell people much when one party was really angry and people were acting obviously not nice.) I also thought that it was wrong that how some of the FFmpeg developer treated/regarded this Outreachy organization. For example, it seemed that Outreachy was regarded more like a source of cheap talented labor to accomplish FFmpeg agenda further rather than an instrument for FFmpeg to be more inclusive organization. It is not respectable to Outreachy which helped to raise funds for interns and look for the talent to work for the FFmpeg and put a lot of work on these activities while they were only hoping to the betterment of the us. I can quote someone's remarks on this email list but it is not the point. I just feel like sometimes people were trying solve wrong question (have to pay and need to get things done..) than right questions such as how to increase no. of developers and be more inclusive, have a right ideas have more cooperative environment, and have a good structure of the organization etc. (So in the end, you can be productive as well.) Of course, I can't force you or organization or anyone to be nice or considerate or inclusive but at the same time but you can educate them at least. You can't blame people acting badly or acting like an asshole when they don't have a proper knowledge or education or training or schooling. Maybe they are not really an assholes but they are just lacking a certain kinds of knowledge and they were doing their best on whatever their motivation is. (I feel even more so for my current work. People seems very nice at my current work. I mean you can argue the organization that has interview process and be able to screening people etc but it is not every companies people are nice. So I think it is result of awareness and training.) So I thought it may be easier to just show it how things needs to be done. (Like how I wrote a letter and stuff like that) Anyways, thank you for writing so much stuff!! I am sorry that I can't follow you completely your logic! but it definitely inspire me to write more. PS. Again, please please please consider to be a mentor if I actually stay being a volunteer. Cheers, Yayoi > > Regards, > > -- > Nicolas George > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Voting committee
On Fri, Sep 18, 2015 at 1:58 AM, wm4 wrote: > On 16.09.2015 07:32, Yayoi Ukai wrote: > >> I also thought that it was wrong that how some of the FFmpeg developer >> treated/regarded this Outreachy >> organization. For example, it seemed that Outreachy was regarded more >> like a source of cheap >> talented labor to accomplish FFmpeg agenda further rather than an >> instrument for FFmpeg to be more inclusive organization. >> It is not respectable to Outreachy which helped to raise funds for >> interns and look for >> the talent to work for the FFmpeg and put a lot of work on these >> activities while they were only hoping to >> the betterment of the us. > > > I don't get this mindset. FFmpeg is an open source software project, and of > course the main focus is on developing software. Further, everyone is free > to work on it for free (without _any_ compensation). Outreachy candidates > were even paid for their work. > > So whatever you expected for Outreachy, why can't you simply make the best > of it? Hi, When I was reading the past email/conversation, I remembered that I got an impression that Outreachy was regarded as more like a "contractor" in the way Outreachy was mentioned. (we want to get xyz done but we have to pay x amount of money to them.) However, I looked through the email in the past and I couldn't find the record of it. (It looks all reasonable to me.) So I must have been mistaken. Please forget about what I said and I am sorry about the confusion. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Voting committee
On Wed, Sep 16, 2015 at 7:59 AM, Nicolas George wrote: > Le nonidi 29 fructidor, an CCXXIII, Yayoi Ukai a écrit : >> > Thanks. You are right, this was imprecise. I meant linear combination with >> > total coefficients one; barycenter in other words. For example: 10 commits >> > are ok, 20 devel mails are ok, then 5 commits and 10 devel mails are ok >> > too. >> > >> > Of course, the value I have put are rather arbitrary. Please people feel >> > free to propose other values. >> >> Yes. There is an value and I will explain why later. >> >> Well, unfortunately I couldn't quite understand after a certain point >> the point you tried to make >> but I would say don't worry about it. I mean you have been >> contributing more than... so many years.. >> of course what you really care would be respected. I am sure. > > > I am really sorry, I read your mail several times and I do not understand > how it relates to mine. I am sorry you needed to read it several times I wanted to say was.. 1. I understood that voting committee there to resolve some conflict/decide on policy that can not be agreed on normal email discussion and not the means to replace the leadership..(So I understood more like a court system not the congress or president..I guess congress is still email list and president may still be Michael (I mean technically he resigned it so maybe it is void right now. I actually don't know)) 2. It means that if your voice was not considered fairly in the even of the dispute because.. a. "important/voting" developer decided to ignore or didn't acknowledge your opinion even when you are in the middle of the dispute. b. All of the rest of the "important/voting" developers decided to treat your opinion unfairly (maybe it need to define 'unfair'... technical evaluation by committee is not clear/enough etc..) c. you were not in the voting committee But I haven't observe that many dispute so I guess it needs to be handled case by case and voting committee is just a first step? So i thought that if it is handled case by case, I would genuinely surprise that people just ignore you. I mean you have to pick one system or the other for deciding.. Also, I feel like it would be good to have leadership discussion may be helpful?? So that you can kind avoid the dispute to begin with? (People already agree on overall direction and how things are run in general, it is easier to resolve then by waiting someone gets angry or unhappy or start the dispute? Do you have that kind of system currently in placed?? I guess your guys talk every once in a while?) > > Was something I wrote disparaging for Outreachy? I am not aware of it, but > if so, please point it to me. As I wrote in the other email, no. Not you. I am sorry for the confusion again. I thought that I read some email in the discussion in the past that made me felt that it was a bit disparaging for Outreachy before. But at that time, I didn't really consider myself part of this group. So i didn't say anything. And now I looked for the email and I couldn't find it. So I must have been mistaken, misread etc.. (And even if I found it, it was a long time ago anyways) > > Or do you think that the voting rules I proposed make FFmpeg as a project > less inclusive? Then can you suggest how to amend them? I don't think so. I think your proposal is good but for me actually all sounds reasonable to me.. (I mean you got pick one and see from it there right and no system is going to be perfect anyways.) Maybe you want to talk more on the leadership as well? How overall the group is run? > > Or... really, I can not see what. Sorry. ah,,, I am really sorry that I confused you!! I wish the best of the luck of that you are content with the system or decision that people come up with in the future!! > > Regards, > > -- > Nicolas George > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Outreachy 2016 december
On Jul 22, 2016 10:18 AM, "Michael Niedermayer" wrote: > > On Wed, Jul 06, 2016 at 11:25:21PM +0200, Michael Niedermayer wrote: > > Hi all > > > > The next Outreachy round starts soon > > FFmpeg has till august 22 IIUC (https://www.gnome.org/outreachy/) > > to express interrest to participate. > > > > We need an admin and backup admins. > > ping! Hi everyone! I'm happy to help with the administrative tasks of this project. As far as Outreachy goes, I will not be able to fully commit as a participant. I can help with fundraising, recruitment, and any administrarative tasks that you would like me to assist with. I would be happy to contribute code, but I would be limited to 10 hours per week working on small coding projects. I attempted to familiarise myself with Trac, but there are still some aspects of it I need guidance with. If there are any documentation available that I am not aware of, I would be happy to review it. I look forward to working with each and everyone of you on FFmpeg! Cheers, Yayoi > > > > They need to create the wiki page(s) for this round, and make sure > > the pages are in shape by the time applicants start pouring in. > > make sure applicants questions (like "[FFmpeg-devel] need guidance") > > get awnsered > > recruite mentors, > > > secure funding (as in confirming with the community and stefano that > > SPI/FFIS funding can be used for one slot or find another sponsor) > > @stefano, do we have funding for a slot in the next outreachy round? > > also if someone is against it speak now, before we contact Outreachy > and state that we want to participate and have funding ... > > > > contact the Outreachy admins and express that FFmpeg wants to > > participate, ... > > Reply to any questions the outreachy admins have > > Make sure that during the project nothing goes wrong like a mentor > > disappearing and if something goes wrong deal with it > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Freedom in capitalist society always remains about the same as it was in > ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel