From patchwork Sat Sep 11 06:03:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 30117 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2168724iov; Fri, 10 Sep 2021 23:05:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwiPvJqxK4qXZ63tuTzITkl9+mHDiWa41qvRPNUYB1HtEeEIQZX8oTtsbJpFTE4A/H9pSs X-Received: by 2002:a05:6402:221b:: with SMTP id cq27mr1731932edb.374.1631340358777; Fri, 10 Sep 2021 23:05:58 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b10si1366211ejj.295.2021.09.10.23.05.58; Fri, 10 Sep 2021 23:05:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@hotmail.com header.s=selector1 header.b=F+8vS4Y7; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CAB5E68A7BD; Sat, 11 Sep 2021 09:03:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2033.outbound.protection.outlook.com [40.92.19.33]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D41868A723 for ; Sat, 11 Sep 2021 09:03:11 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VtExP61PvXneheN7+T1/z4QAkT6YjKsGCtovmGaDMwAJFkheb4+ehxfePCEgcj7h9uzbEtj2U3RwMzc1/FGwyPSA4wxITxuGFHhsKio+wsCeLu66vDR7YpFWWqlRjGGGV1FQIUiKPzwKnmmDY11dCYwpAEnyLn9id82OmTdDkalDg9Jug//860XUUgbh9p9VoeMmkn1GsCTCcaBRHwBaGu8R8b6mJmEuB3UG8xMmkEL4vREo7++WVHzdzh3clBTrF926DKbFpnOXHkAWV+z0LvLdtWYitN5tb6pHQT4sB9P+FB59rwigpo35XWYQJWB+5bPQ8rHy+fIJ1wtsb+nqog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0nyuaiY5mPVbIKOCMx6EO/d1jiVLT5AaPfrXgEBOpqs=; b=Oi3//0YwdYyPcKr7heBa2aEb8nLLf7dyUtdQF9U4XtR1AiuoYiRimyh+2ZHGWN1MKSPsXT0ZlyWTQGTv3qrY1FHFaxRbklZZ1XPyYPY0voUNhgTNiX9F+3NdtuBv1aqtTgZ+6EVV9U7iqSX+TlTnPX389vtoFI9zaFdfllGqepD053S9jtoPDhTaKRxlmUAtFAYmQf6UHogPfnd1gkGzOJDtx60Qo+QWanz5Ck6+h3dozRkKLaXdaRDVtfEDzzKavvb+NFiKJdNfdFVNmMdAg1MWGYtxNHonvGcLCWmvc9IfJa/NFsWaAuUO2Z8lqgmQslkYC2QgrlqagCLLaYFhyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0nyuaiY5mPVbIKOCMx6EO/d1jiVLT5AaPfrXgEBOpqs=; b=F+8vS4Y7DBCK1ftrt/8fYEHsZld7zUt4QVwhUKWqjFbwgknORrBVa4iq1IEDc08blBGsVx4M0VTzCb0ME0gD57GwFtaa7FeNPfyMF7D4/2PYFHqjWAOAlpMKCWQJorBuBNODXrIk146XeSrdSmnLXuuY30mqFQUBsB6Jki7wsSSlLfQF7R8X7wbPYkFICo133vWnXAAmXGwwXnh9WxYk1Q23Le5j3dt7BYBSHFjxpTk9ppGCHNzhcn6ldkdKPMOxQKr7nSg1P0R0+LCQEgnlJVyP5u7JvzJ/Wru3TAqxU9mSjxetMJbCBVPFD3oeeVPYCf7k0/m5jF3bCCa7QD3ltQ== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB5776.namprd04.prod.outlook.com (2603:10b6:208:a2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Sat, 11 Sep 2021 06:03:09 +0000 Received: from MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb]) by MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb%5]) with mapi id 15.20.4500.018; Sat, 11 Sep 2021 06:03:09 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v3 15/18] avfilter/textmod: Add textmod filter Thread-Index: AdemwZgDwIA9K4PTQdeRzTemCjedDw== Date: Sat, 11 Sep 2021 06:03:09 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Bg9crcMMVDCCJiFtI2Uq+tyUJsULWRHKi6df/KiEouw=] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 24093fa7-a4f9-4f7c-b501-08d974e9d4a9 x-ms-traffictypediagnostic: MN2PR04MB5776: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RBfcNevvFIC9onDAk886XdyWhrqDQAKjk43e/Grp1nM3Yaa36QTFmPwroxPt5Fxsvs/11gOWOJqeuFlefrrxAVbUTOhjrAFUr78TLGzwe1zDVPw0UA6DBsjLl6KcCGJnHKqS5uyqW1GXa890rpkxSiaAmq1B6NPUAXW4ecSIeF5YviSPXiLeY+r/U/qOO3lv27Bd6iiaEdu6iYIm7Z2rvkpcpzvrd2hcwfGCXug+ZA/bv7w39KX4ST5x1MvhqUumLMSGpnEeRv4cKNDf8gFhNp8mJ5oICFlL3l0Uz7IuLHEOacA3b1qwpumVxrG1l3nvazXFUVSsM7aTdPefMcUsr6FMVLgoDElXGBz+CfY1AvhjTkqcijQ8BFL9zYo3xFWJ+PxSZAgfgjskNbQN/5HVcJqfz3aLYFY2t9YW1aLwTJC/8EotQrqQqnbNR898Q6u7 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: enjLsGU/q7Y2RlMm3BXLcOFt1aiH2v9sZGWoOlHoOXO4sGzk8Z96QMi/BaOS6fd9i3/X9HzOyH5asmfhVb69eoX6JK4FzjV+WNuITbQ6hGu6iuSIL4ktyWZiH3OjBj+bEFpQHEEdKNVchcH/1c34KQ== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-529c7.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB5981.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 24093fa7-a4f9-4f7c-b501-08d974e9d4a9 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2021 06:03:09.2850 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5776 Subject: [FFmpeg-devel] [PATCH v3 15/18] avfilter/textmod: Add textmod filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lbydrgVzjltT Signed-off-by: softworkz --- libavfilter/Makefile | 3 + libavfilter/allfilters.c | 1 + libavfilter/sf_textmod.c | 409 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 413 insertions(+) create mode 100644 libavfilter/sf_textmod.c diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 0e752c5bf9..5a5a4be47e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -534,6 +534,9 @@ OBJS-$(CONFIG_YUVTESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o +# subtitle filters +OBJS-$(CONFIG_TEXTMOD_FILTER) += sf_textmod.o + # multimedia filters OBJS-$(CONFIG_ABITSCOPE_FILTER) += avf_abitscope.o OBJS-$(CONFIG_ADRAWGRAPH_FILTER) += f_drawgraph.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 77463aa4c8..6d7a535ee8 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -524,6 +524,7 @@ extern const AVFilter ff_avf_showvolume; extern const AVFilter ff_avf_showwaves; extern const AVFilter ff_avf_showwavespic; extern const AVFilter ff_vaf_spectrumsynth; +extern const AVFilter ff_sf_textmod; extern const AVFilter ff_svf_graphicsub2video; extern const AVFilter ff_svf_textsub2video; diff --git a/libavfilter/sf_textmod.c b/libavfilter/sf_textmod.c new file mode 100644 index 0000000000..fca47d68da --- /dev/null +++ b/libavfilter/sf_textmod.c @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2021 softworkz + * + * 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 + */ + +/** + * @file + * text subtitle filter which allows to modify subtitle text in several ways + */ + +#include + +#include "libavutil/avassert.h" +#include "libavutil/avstring.h" +#include "libavutil/opt.h" +#include "avfilter.h" +#include "internal.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/ass_split.h" + +static const char* leet_src = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static const char* leet_dst = "abcd3f6#1jklmn0pq257uvwxyzAB(D3F6#1JKLMN0PQ257UVWXYZ"; + +enum TextModOperation { + OP_LEET, + OP_TO_UPPER, + OP_TO_LOWER, + OP_REPLACE_CHARS, + OP_REMOVE_CHARS, + OP_REPLACE_WORDS, + OP_REMOVE_WORDS, + NB_OPS, +}; + +typedef struct TextModContext { + const AVClass *class; + enum AVSubtitleType format; + enum TextModOperation operation; + char *find; + char *replace; + char *separator; + char **find_list; + int nb_find_list; + char **replace_list; + int nb_replace_list; +} TextModContext; + +static char **split_string(char *source, int *nb_elems, char delim) +{ + char **list = NULL; + char *temp = NULL; + char *ptr = av_strtok(source, &delim, &temp); + + while (ptr) { + av_dynarray_add(&list, nb_elems, ptr); + if (!list) + return NULL; + + ptr = av_strtok(NULL, &delim, &temp); + } + + av_dynarray_add(&list, nb_elems, NULL); + + return list; +} + +static int init(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + + switch (s->operation) { + case OP_REPLACE_CHARS: + case OP_REMOVE_CHARS: + case OP_REPLACE_WORDS: + case OP_REMOVE_WORDS: + if (!s->find || !strlen(s->find)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'find' parameter to be specified"); + return AVERROR(EINVAL); + } + break; + } + + switch (s->operation) { + case OP_REPLACE_CHARS: + case OP_REPLACE_WORDS: + if (!s->replace || !strlen(s->replace)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'replace' parameter to be specified"); + return AVERROR(EINVAL); + } + break; + } + + if (s->operation == OP_REPLACE_CHARS && strlen(s->find) != strlen(s->replace)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'find' and 'replace' parameters to have the same length"); + return AVERROR(EINVAL); + } + + if (s->operation == OP_REPLACE_WORDS || s->operation == OP_REMOVE_WORDS) { + if (!s->separator || strlen(s->separator) != 1) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires a single separator char to be specified"); + return AVERROR(EINVAL); + } + + s->find_list = split_string(s->find, &s->nb_find_list, *s->separator); + if (!s->find_list) + return AVERROR(ENOMEM); + + if (s->operation == OP_REPLACE_WORDS) { + + s->replace_list = split_string(s->replace, &s->nb_replace_list, *s->separator); + if (!s->replace_list) + return AVERROR(ENOMEM); + + if (s->nb_find_list != s->nb_replace_list) { + av_log(ctx, AV_LOG_ERROR, "The number of words in 'find' and 'replace' needs to be equal"); + return AVERROR(EINVAL); + } + } + } + + return 0; +} + +static void uninit(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + int i; + + for (i = 0; i < s->nb_find_list; i++) { + av_free(&s->find_list[i]); + } + s->nb_find_list = 0; + av_freep(&s->find_list); + + for (i = 0; i < s->nb_replace_list; i++) { + av_free(&s->replace_list[i]); + } + s->nb_replace_list = 0; + av_freep(&s->replace_list); +} + +static int query_formats(AVFilterContext *ctx) +{ + AVFilterFormats *formats; + AVFilterLink *inlink = ctx->inputs[0]; + AVFilterLink *outlink = ctx->outputs[0]; + static const enum AVSubtitleType subtitle_fmts[] = { AV_SUBTITLE_FMT_ASS, AV_SUBTITLE_FMT_NONE }; + int ret; + + /* set input subtitle format */ + formats = ff_make_format_list(subtitle_fmts); + if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0) + return ret; + + /* set output video format */ + if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0) + return ret; + + return 0; +} + +static char *process_text(TextModContext *s, char *text) +{ + const char *char_src = s->find; + const char *char_dst = s->replace; + char *result = NULL; + int escape_level = 0, k = 0; + + switch (s->operation) { + case OP_LEET: + case OP_REPLACE_CHARS: + + if (s->operation == OP_LEET) { + char_src = leet_src; + char_dst = leet_dst; + } + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + if (result[n] == '{') + escape_level++; + + if (!escape_level) { + for (size_t t = 0; t < FF_ARRAY_ELEMS(char_src); t++) { + if (result[n] == char_src[t]) { + result[n] = char_dst[t]; + break; + } + } + } + + if (result[n] == '}') + escape_level--; + } + + break; + case OP_TO_UPPER: + case OP_TO_LOWER: + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + if (result[n] == '{') + escape_level++; + if (!escape_level) + result[n] = s->operation == OP_TO_LOWER ? av_tolower(result[n]) : av_toupper(result[n]); + if (result[n] == '}') + escape_level--; + } + + break; + case OP_REMOVE_CHARS: + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + int skip_char = 0; + + if (result[n] == '{') + escape_level++; + + if (!escape_level) { + for (size_t t = 0; t < FF_ARRAY_ELEMS(char_src); t++) { + if (result[n] == char_src[t]) { + skip_char = 1; + break; + } + } + } + + if (!skip_char) + result[k++] = result[n]; + + if (result[n] == '}') + escape_level--; + } + + result[k] = 0; + + break; + case OP_REPLACE_WORDS: + case OP_REMOVE_WORDS: + + result = av_strdup(text); + if (!result) + return NULL; + + for (int n = 0; n < s->nb_find_list; n++) { + char *tmp = result; + const char *replace = (s->operation == OP_REPLACE_WORDS) ? s->replace_list[n] : ""; + + result = av_strireplace(result, s->find_list[n], replace); + if (!result) + return NULL; + + av_free(tmp); + } + + break; + } + + return result; +} + +static char *process_dialog(TextModContext *s, char *ass_line) +{ + ASSDialog *dialog = ff_ass_split_dialog(NULL, ass_line); + char *result, *text; + + if (!dialog) + return NULL; + + text = process_text(s, dialog->text); + if (!text) + return NULL; + + result = ff_ass_get_dialog(dialog->readorder, dialog->layer, dialog->style, dialog->name, text); + + av_free(text); + ff_ass_free_dialog(&dialog); + return result; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *src_frame) +{ + TextModContext *s = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVSubtitle *sub; + int ret; + AVFrame *out; + + outlink->format = inlink->format; + + out = av_frame_alloc(); + if (!out) { + av_frame_free(&src_frame); + return AVERROR(ENOMEM); + } + + out->format = outlink->format; + + if ((ret = av_frame_get_buffer2(out, AVMEDIA_TYPE_SUBTITLE, 0)) < 0) + return ret; + + out->pts = src_frame->pts; + out->pkt_dts = src_frame->pkt_dts; + out->pkt_duration = src_frame->pkt_duration; + out->best_effort_timestamp = src_frame->best_effort_timestamp; + + sub = (AVSubtitle *)src_frame->data[0]; + + if (sub) { + AVSubtitle *out_sub = av_memdup(sub, sizeof(*out_sub)); + if (!out_sub) + return AVERROR(ENOMEM); + + out->buf[0] = av_buffer_create((uint8_t*)out_sub, sizeof(*out_sub), avsubtitle_free_ref, NULL, AV_BUFFER_FLAG_READONLY); + out->data[0] = (uint8_t*)out_sub; + + if (sub->num_rects) { + out_sub->rects = av_malloc_array(sub->num_rects, sizeof(AVSubtitleRect *)); + } + + for (unsigned i = 0; i < sub->num_rects; i++) { + + const AVSubtitleRect *src_rect = sub->rects[i]; + AVSubtitleRect *dst_rect = av_memdup(src_rect, sizeof(*dst_rect)); + out_sub->rects[i] = dst_rect; + + if (src_rect->ass) { + dst_rect->ass = process_dialog(s, src_rect->ass); + if (!dst_rect->ass) + return AVERROR(ENOMEM); + } + } + } + + av_frame_free(&src_frame); + return ff_filter_frame(outlink, out); +} + +#define OFFSET(x) offsetof(TextModContext, x) +#define FLAGS (AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_FILTERING_PARAM) + +static const AVOption textmod_options[] = { + { "mode", "set operation mode", OFFSET(operation), AV_OPT_TYPE_INT, {.i64=OP_LEET}, OP_LEET, NB_OPS-1, FLAGS, "mode" }, + { "leet", "convert text to 'leet speak'", 0, AV_OPT_TYPE_CONST, {.i64=OP_LEET}, 0, 0, FLAGS, "mode" }, + { "to_upper", "change to upper case", 0, AV_OPT_TYPE_CONST, {.i64=OP_TO_UPPER}, 0, 0, FLAGS, "mode" }, + { "to_lower", "change to lower case", 0, AV_OPT_TYPE_CONST, {.i64=OP_TO_LOWER}, 0, 0, FLAGS, "mode" }, + { "replace_chars", "replace characters", 0, AV_OPT_TYPE_CONST, {.i64=OP_REPLACE_CHARS}, 0, 0, FLAGS, "mode" }, + { "remove_chars", "remove characters", 0, AV_OPT_TYPE_CONST, {.i64=OP_REMOVE_CHARS}, 0, 0, FLAGS, "mode" }, + { "replace_words", "replace words", 0, AV_OPT_TYPE_CONST, {.i64=OP_REPLACE_WORDS}, 0, 0, FLAGS, "mode" }, + { "remove_words", "remove words", 0, AV_OPT_TYPE_CONST, {.i64=OP_REMOVE_WORDS}, 0, 0, FLAGS, "mode" }, + { "find", "chars/words to find or remove", OFFSET(find), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "replace", "chars/words to replace", OFFSET(replace), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "separator", "word separator (default: ',')", OFFSET(separator), AV_OPT_TYPE_STRING, {.str = ","}, 0, 0, FLAGS, NULL }, + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(textmod); + +static const AVFilterPad inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_SUBTITLE, + .filter_frame = filter_frame, + }, +}; + +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_SUBTITLE, + }, +}; + +const AVFilter ff_sf_textmod = { + .name = "textmod", + .description = NULL_IF_CONFIG_SMALL("Modify subtitle text in several ways"), + .init = init, + .uninit = uninit, + .query_formats = query_formats, + .priv_size = sizeof(TextModContext), + .priv_class = &textmod_class, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), +};