From patchwork Thu Aug 19 07:43:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 29601 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp64394iov; Thu, 19 Aug 2021 00:43:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlx9/8GSAQLywdnca+c5MnJyfL5bvaU40f5ccZ7UEUmQptgnZ2pPXTI1oUWwtXIxF2Q5mr X-Received: by 2002:aa7:d4d3:: with SMTP id t19mr14662045edr.131.1629359030137; Thu, 19 Aug 2021 00:43:50 -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 r16si2408810edq.576.2021.08.19.00.43.49; Thu, 19 Aug 2021 00:43:50 -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="UryPXNQ/"; 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 4A19E68A2B9; Thu, 19 Aug 2021 10:43:33 +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-dm6nam11olkn2099.outbound.protection.outlook.com [40.92.19.99]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CB756880AF for ; Thu, 19 Aug 2021 10:43:26 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYyenVBw9JU4boW2KFLWdkU5XtX57PHhABHJRnaNS4/yhgxFikyOxnNQR0bQawtR+bBdc42evHrR4vCDWmc0GNVULiyd0fyeQ1ZwyPsYSAzzELMJZz8O0DmAAqoMe3E6HzthbD7rc+K5tfDBRUBEsN/+nLVCL4hxYImdFg6vxu+YeyMsOV25aaQ4qSPR3inIC7ivQaYF8Qp8HuJa7GaTRs+wOtoAwR39asNeiwV87k04JJEfDSGLa5uSZGftL9zbZm0SsvInTbvXclzncQKeh6Nlhgm0/CuoUTutWzRc7C+KLdJ4URKcodqBQeoRDQRkACM9xBCkRRmT+POVDuUWKQ== 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:X-MS-Exchange-SenderADCheck; bh=0+7uPs/TpEzsqHfmNCYSYYwUDSKVe5PUcxeDCxkmWEs=; b=HPzg1ft4xXx4rP62L+KHaUmgprwkIq2BSO37mpRGx+iTRltNI+XJszuUnTslj7aUwmB3AEvlME9NrDXcui8JfSqdi00wQVPXgqeUmrP5Tab43KLVp12Bqb4XNijFV3TZFPU8DXcdgzYTC7mAHTYHu3ZbpIMnUu7lP5+njF/HvKA1jH4rDK4e1i8DWUSEZJeRw5OHIrIi8EzM5wrb4/2YFzikh94PZcvGnC8ilhBGIqiwiBK2RXmfb1f6WpRmZjWZR+UlagkSRa8ZQfS2An7vdCLGUm25vHCRPaSLH0Otuc1OqjOqQM/H3XybeCxDzTUU7rdlPN/CseAhW4rzgr43yw== 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=0+7uPs/TpEzsqHfmNCYSYYwUDSKVe5PUcxeDCxkmWEs=; b=UryPXNQ/lmt2lu4FK1asaL3L4JKwf6+upQ3Q341poTzpz16SNLqMo6n5suYqfzBeq1QaXyfPeSC3SFixX8+M+9nd6on14lSm5hVRRw+UuvTkzbgUvP1lz8Lt+QwZT5FgPzchupav3rbW5gwQVWnLokqOcKyrmga5oDur/UDNFHQUtQdni2OMVewJ5YxokVk8a6CpIxEC0ew2tmAcc9Ffpp5CVbVtUiJWIoDAJelbcfMr09BJcoYAZcWW7TBCrgQgDEkllY6BJP5SuOxPXM3TJ1cHmytkwqT6TTloc1xr4kxVRxjYtPylP9ZARxnKqcMK9Qo56oL6Zr+dQDYSEU30hQ== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB6255.namprd04.prod.outlook.com (2603:10b6:208:d5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.22; Thu, 19 Aug 2021 07:43:16 +0000 Received: from MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::5d83:1c26:c2b1:3a30]) by MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::5d83:1c26:c2b1:3a30%6]) with mapi id 15.20.4415.024; Thu, 19 Aug 2021 07:43:16 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH 3/9] avfilter/avfilter: Handle subtitle frames Thread-Index: AdeUdjgpzWhLa5/+TnKpj/TXwsxYhg== Date: Thu, 19 Aug 2021 07:43:16 +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: [q3+pKiOY2lLZWg1OAZPWWUV9h3GZyBnz] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3310b30b-5d74-4434-1881-08d962e5019a x-ms-traffictypediagnostic: MN2PR04MB6255: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AeGTE/K6OSKwxjbLn5LaGauXaHm/SmYXINNsr5MyOrreKkuzK6nsWC97wZM+eXjgoLE7JfB02StcHLUVWF1dku2Lbpp/YFRz9SGZtuUYwQGCIal6oIDvtF6fk19GT0fi/xTGExxZFcsegLUfPLoDjV4hHxyDwLgygF7maGVlZiNrKRIj1UD7BhodAkL1IIAAgWnh3Lb5kRMa/yBIZO882yHNWLx9BaQZTDwP/t/zuMHgD6UTulsVc40D9lN0Ik4LfAw+CyYUb0Af9Vd70wo1Sn9cTuVNw23V1VvbDCcZ7l6ty824p54Ar4Ds0s71h0Lo6S2rNS5O3O3ubwT6ZDsyO7Nlbrx8sldNxgMLFushOsnmuE2rqS4Nvb0CAJ8e/td+JVK/Y1yRCyh3L/QLBqd6JIbdXyDoZoo4gw9qNks/HEKJHZaVM7kkHx3PPt4h2KeO x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: nV3co6FT2S0A6disFmKIh52/i2XdWP3q82p+y2fDKXZwIvefpQJ/aOG9D4Gk9o8mUxa+AnVmloKrnNL19qvoGekHBroVKGAd3aVu73Ho0+iNMr5mWo9iTeyOYz6ThYl5X0C/dPT3/qFjX1Ev0QiMvg== 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: 3310b30b-5d74-4434-1881-08d962e5019a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2021 07:43:16.3174 (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: MN2PR04MB6255 Subject: [FFmpeg-devel] [PATCH 3/9] avfilter/avfilter: Handle subtitle frames 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: X++UVu4uyZl/ Signed-off-by: softworkz --- libavfilter/avfilter.c | 8 +++++--- libavfilter/avfiltergraph.c | 5 +++++ libavfilter/formats.c | 11 +++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ea22b247de..5505c34678 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -56,7 +56,8 @@ void ff_tlog_ref(void *ctx, AVFrame *ref, int end) ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], ref->pts, ref->pkt_pos); - if (ref->width) { + switch(ref->type) { + case AVMEDIA_TYPE_VIDEO: ff_tlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", ref->sample_aspect_ratio.num, ref->sample_aspect_ratio.den, ref->width, ref->height, @@ -64,12 +65,13 @@ void ff_tlog_ref(void *ctx, AVFrame *ref, int end) ref->top_field_first ? 'T' : 'B', /* Top / Bottom */ ref->key_frame, av_get_picture_type_char(ref->pict_type)); - } - if (ref->nb_samples) { + break; + case AVMEDIA_TYPE_AUDIO: ff_tlog(ctx, " cl:%"PRId64"d n:%d r:%d", ref->channel_layout, ref->nb_samples, ref->sample_rate); + break; } ff_tlog(ctx, "]%s", end ? "\n" : ""); diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 41a91a9bda..4f581bc7a6 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -328,6 +328,8 @@ static int filter_link_check_formats(void *log, AVFilterLink *link, AVFilterForm return ret; break; + case AVMEDIA_TYPE_SUBTITLE: + return 0; default: av_assert0(!"reached"); } @@ -463,6 +465,9 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) if (!link) continue; + if (link->type == AVMEDIA_TYPE_SUBTITLE) + continue; + neg = ff_filter_get_negotiation(link); av_assert0(neg); for (neg_step = 1; neg_step < neg->nb; neg_step++) { diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 9e39d65a3c..26d8e45263 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavcodec/avcodec.h" #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/common.h" @@ -430,6 +431,12 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout) return 0; } +static int ff_add_subtitle_type(AVFilterFormats **avff, int64_t fmt) +{ + ADD_FORMAT(avff, fmt, ff_formats_unref, int, formats, nb_formats); + return 0; +} + AVFilterFormats *ff_all_formats(enum AVMediaType type) { AVFilterFormats *ret = NULL; @@ -447,6 +454,10 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type) return NULL; fmt++; } + } else if (type == AVMEDIA_TYPE_SUBTITLE) { + ff_add_subtitle_type(&ret, SUBTITLE_BITMAP); + ff_add_subtitle_type(&ret, SUBTITLE_ASS); + ff_add_subtitle_type(&ret, SUBTITLE_TEXT); } return ret;