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 53D1040158 for ; Thu, 4 May 2023 21:07:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19E3468C110; Fri, 5 May 2023 00:06:47 +0300 (EEST) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 62BA968BF32 for ; Fri, 5 May 2023 00:06:38 +0300 (EEST) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-3ef35d44612so9425721cf.1 for ; Thu, 04 May 2023 14:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20221208.gappssmtp.com; s=20221208; t=1683234397; x=1685826397; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=VhC2/eK2+zuscWyj1kOpnDgubrv9ynrNIh/81ZaAl1g=; b=qfpW1c02NPafU5Fg2S95iWW+fgPFwKU8SOjm01vmddLj6wk/XOXOf7Kw+7tEshsBBS XnNWku9HH2tbgb9DylFdxtCTPZKzA3V7O2r9hHL9xxZ8Z8UjWVJj67TkzpXD2g9imFpw xUBiR3ryTyMrO1rWMXve9M3CA7bVQ/hWTdt+51AD+1Fk2GerNhlr39ZNR7MvJ7PODq75 8GUkC8/CJGks43XJoed/gFzXremDSy7a2/Uidk/SdkhiHFVuO2hhJYRUvJ/Kffj5APMh x+C8+coco3T+Bkn9iENptVqgDjy84UNzxOK8AQt3Iel1M49oVjLcI0gehrXVbXf1TZI8 I3ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683234397; x=1685826397; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VhC2/eK2+zuscWyj1kOpnDgubrv9ynrNIh/81ZaAl1g=; b=gBWwDqPYGKjGQ7Sjgr5YDa67u2GDAitXqrfkITJgMRmxIvISr9kzmcW8IJ1S13zzee 3PHE+KqJTCfCBTKNJ/FdldX9ql7rLR3Xs1b9x5UbW7IckCw12O5dL19XrlFTwGtquKt8 EpcSrq5/mUeC9h4OZw5vmEEnr2pLEXUkSle3IXHzufTSPydOAcVWBiaf0Ao/1E8Lvexo v93E7dfW5619L83lW9Z4o2oB47Pd3YtXcEKAggrReQIhZGOUm/rVK3v6MXcB7tmq5Rtu ST6+FWWIOI/pW1sASqXFgNxhmFXzce1OLhIbe0QujrBH2XpvKrh4UDW5CorbW7Hp3yFV KINQ== X-Gm-Message-State: AC+VfDzJLuwqShotYTqBZ3MhxfdyakoMa0yEVO1T1szitNusgh/wrS9m ggq1gx28n2tp7YNtZJ2ptBiePtsfKQiWyHaG9NY= X-Google-Smtp-Source: ACHHUZ7QUfMMBgQ2/X5x4FpPjVRPQQe8xvplUQTh3R3gpcIqp4a2zHuAmuglHF2dm3hoPbm/VDaU9w== X-Received: by 2002:ac8:5a8e:0:b0:3f0:ae16:685c with SMTP id c14-20020ac85a8e000000b003f0ae16685cmr7267087qtc.61.1683234396966; Thu, 04 May 2023 14:06:36 -0700 (PDT) Received: from ltnt-nyc-580testdevin.livetimenet.com (pool-71-105-132-214.nycmny.fios.verizon.net. [71.105.132.214]) by smtp.gmail.com with ESMTPSA id 4-20020a05620a070400b0074e21c3bc8asm67996qkc.126.2023.05.04.14.06.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2023 14:06:36 -0700 (PDT) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 May 2023 18:02:16 -0400 Message-Id: <1683237740-32743-3-git-send-email-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1683237740-32743-1-git-send-email-dheitmueller@ltnglobal.com> References: <1683237740-32743-1-git-send-email-dheitmueller@ltnglobal.com> Subject: [FFmpeg-devel] [PATCH v5 2/6] vf_fps: properly preserve CEA-708 captions 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: Devin Heitmueller MIME-Version: 1.0 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: The existing implementation made an attempt to remove duplicate captions if increasing the framerate, but made no attempt to handle reducing the framerate, nor did it rewrite the caption payloads to have the appropriate cc_count (e.g. the cc_count needs to change from 20 to 10 when going from 1080i59 to 720p59 and vice-versa). Make use of the new ccfifo mechanism to ensure that caption data is properly preserved. Signed-off-by: Devin Heitmueller --- libavfilter/vf_fps.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index 051d278..824e7a1 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -34,6 +34,7 @@ #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "avfilter.h" +#include "ccfifo.h" #include "filters.h" #include "internal.h" @@ -85,6 +86,7 @@ typedef struct FPSContext { AVFrame *frames[2]; ///< buffered frames int frames_count; ///< number of buffered frames + AVCCFifo *cc_fifo; ///< closed captions int64_t next_pts; ///< pts of the next frame to output @@ -165,6 +167,7 @@ static av_cold void uninit(AVFilterContext *ctx) frame = shift_frame(ctx, s); av_frame_free(&frame); } + ff_ccfifo_freep(&s->cc_fifo); av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, " "%d frames duplicated.\n", s->frames_in, s->frames_out, s->drop, s->dup); @@ -210,6 +213,11 @@ static int config_props(AVFilterLink* outlink) s->in_pts_off, s->out_pts_off, s->start_time); } + if (!(s->cc_fifo = ff_ccfifo_alloc(outlink->frame_rate, ctx))) { + av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n"); + return AVERROR(ENOMEM); + } + av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", outlink->frame_rate.num, outlink->frame_rate.den); return 0; @@ -242,6 +250,7 @@ static int read_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, av_log(ctx, AV_LOG_DEBUG, "Read frame with in pts %"PRId64", out pts %"PRId64"\n", in_pts, frame->pts); + ff_ccfifo_extract(s->cc_fifo, frame); s->frames[s->frames_count++] = frame; s->frames_in++; @@ -289,7 +298,7 @@ static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlin if (!frame) return AVERROR(ENOMEM); // Make sure Closed Captions will not be duplicated - av_frame_remove_side_data(s->frames[0], AV_FRAME_DATA_A53_CC); + ff_ccfifo_inject(s->cc_fifo, frame); frame->pts = s->next_pts++; frame->duration = 1; -- 1.8.3.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".