From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8EC7942CD8 for ; Tue, 3 May 2022 16:14:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DA04368B38A; Tue, 3 May 2022 19:13:56 +0300 (EEST) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18E0968B37A for ; Tue, 3 May 2022 19:13:51 +0300 (EEST) Received: by mail-qk1-f173.google.com with SMTP id e128so14106973qkd.7 for ; Tue, 03 May 2022 09:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o3oBhOtsQLpEU5KT3KHYlSGTxv6Gdy8Z9odcZowbEgQ=; b=Sq0D8TFY3d/32XBsqy40xaf4lw7Bkw7hIPY8NP5hMaXa7WqpXzskKp4rdr7HeF7UO5 KLLOPJ2MUUS/6buLpcd3b9YtqUR6J+CBHv5wSFSdbdKOc+U3FQxqhHCLaXhHuDL0D0bm u7vFADN9HKiI9PjApKpWKpMHDRs0RMbn/h9jhIkzFefJ7z0I+cyeC8b/6MKo0moV4KBF op5Q3m/DsDusJ1QknnSaSGx38QOcouvqMsomf7UQ2PjW2NCED4FZOfMBdtSgTKYZl3+l /Tf7Paa3zsDwtlVKUnrllgADGEFebU+RxoY0YcYvSJna+vwjkeI5tY+dQjrkkDXY1CMY TQgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o3oBhOtsQLpEU5KT3KHYlSGTxv6Gdy8Z9odcZowbEgQ=; b=DlmUuxnKTygt3Xtg4tbf9tqpf/DKSukZAUzxVrCwSHDfAUBncZmkJPJEWYDE7HcMeW l0WnFeHlx2YgoqAh+Ey0GFzWAIjZju6xBVOFBJkWXJZnX6n1jqq+tjdHGUTuZy8ZixVI 7Q/GT7GB2WXhB/yNZIYNnsFMi6EuY0Esf7NR0Y3uiELHG5DQmLQR0txFWLPdXQr/ge4P bhhslS5cSwdUsRDrmdoZX+JNOsrcgpmEdYPWIvid1cjGmZgz6a522F/cXuoE72hK2Mig +RVnOcxdUNEd6r8YKaePItXiwiydkG8wK8wyKl4nWWo33ICeTDiVYRT5mL1oLY7LFCmq o0Kw== X-Gm-Message-State: AOAM531PubAIApTXmUUc/B6CvNp5asfFGNQMZ+LrQO1trWCOEr5IC0MF b3vHi59Mc/3lZleMNP9Rljj3g+pcjp4d X-Google-Smtp-Source: ABdhPJwW4QzPUWkawP/zI1KFEilfzDuccx62hhpcnBGa5rNabZRq/jfRTs7tLVQf4r31/T1dhinY0w== X-Received: by 2002:a05:620a:448f:b0:69f:e9a2:9403 with SMTP id x15-20020a05620a448f00b0069fe9a29403mr6516268qkp.122.1651594429371; Tue, 03 May 2022 09:13:49 -0700 (PDT) Received: from thinkpad.. ([66.220.203.136]) by smtp.gmail.com with ESMTPSA id fp35-20020a05622a50a300b002f39b99f67asm5812731qtb.20.2022.05.03.09.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 09:13:48 -0700 (PDT) From: Traian Coza To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 May 2022 12:13:18 -0400 Message-Id: <20220503161328.842587-3-traian.coza@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220503161328.842587-1-traian.coza@gmail.com> References: <20220503161328.842587-1-traian.coza@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/12] Render only when necessary 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 Cc: Traian Coza Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- fftools/ffmpeg.c | 12 ++++++++++-- libavfilter/vf_subtitles.c | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 53717d3ebb..dea2aec2ce 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2422,9 +2422,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output, goto out; ist->frames_decoded++; - - render_avsub_ass(ist, &subtitle); + int rendered = 0; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -2432,6 +2431,15 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output, || ost->enc->type != AVMEDIA_TYPE_SUBTITLE) continue; + if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB) + if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB) + if (!rendered) { + render_avsub_ass(ist, &subtitle); + for (int r = 0; r < subtitle.num_rects; r++) + subtitle.rects[r]->type = SUBTITLE_BITMAP; + rendered = 1; + } + do_subtitle_out(output_files[ost->file_index], ost, &subtitle); } diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index f751786033..16f9c3fff6 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -307,7 +307,6 @@ void render_avsub_ass(InputStream *ist, AVSubtitle *sub) rect->data[0][y_rect * rect->w + x_rect] = color; } } - rect->type = SUBTITLE_BITMAP; ass_free_track(track); } -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".