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 C857745FE8 for ; Fri, 28 Apr 2023 15:42:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7111268C004; Fri, 28 Apr 2023 18:42:20 +0300 (EEST) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF4A268BFED for ; Fri, 28 Apr 2023 18:42:12 +0300 (EEST) Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-74adf6adac6so981574785a.0 for ; Fri, 28 Apr 2023 08:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20221208.gappssmtp.com; s=20221208; t=1682696531; x=1685288531; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=DzQy+uTBYt4op9TDj0lkU4GTw46/UXsWTEH2+pLpR7Y=; b=e09Iv9AM4Nj/7j/8eH+Vv5m7Nm3OmYu01qShDGxZNnZSVvH8hrPAWR3G+badMDG2r+ EvEVgq+s30RWGGu6sCzssKHKYLvhyR+WXDi7IZ96tI9I16YcNt0B9PRQ5X0kTeq7xYKr 0T0K6PozSnb4qxC8If58372q+WEvWpvwFJ03h6kClpCiA4kHXjey5Sk+axmWRGp2vzkw SZ3rMg2tr0m18zga1C+b2npRHIIQWZStiPEjmZymAgafDnmtYdRg0csGDtfB6JPexMIF l9W2I2WbfP5hJJxvuMWziZDI7yqlt7YjcnBOreqOASwPGxYTdvlLt67q7LvUdoNBNCAB VlGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682696531; x=1685288531; 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=DzQy+uTBYt4op9TDj0lkU4GTw46/UXsWTEH2+pLpR7Y=; b=Rvfn/Exd8i2mB//i6I80gn0AJQWOUSnktRuKsCe11wEiHUpyxy3vlF3QQmoOymwktO lzOqStVrhA/iOI/24MFXyO73WSGWFE765dVTpgfNckfHKsezdRSCuSB4r18BA64uAZKt gm6yDxPzr5oh+W2BFOxshmyNsJOiukA/m7ZrQ/fEg2HCFM/ciC0nM2uastxLJbu6vc3I Wi3f93w39yHy+j/JMHX/a/bHzx9+EyGr6FpI4K+0APpSxntFckHO6u43UfjarW1TW3Qu jCIoNFy7Z/5yqMAeR0OsgjJfIsd8iXibJwHYr+JnI/bHfAED4EL8fKsVUGKyWGfLGifO HLIQ== X-Gm-Message-State: AC+VfDzAjkZ6j7bvCwkhHcw4/xOrJhG+2ACmjWi0QEwbh2GgAVU1ReL+ NKdjVNaIkF3IyC6NF5wVU7Re7FrpTQrSEx52lqE= X-Google-Smtp-Source: ACHHUZ5+3bZDh57Bukd5fkgCPZEN2wp5ZmiYT+8zTcX98RMAdIYyCa22lswMLNDiVKRex1G4vfNv3Q== X-Received: by 2002:a05:6214:2523:b0:56c:13cc:d21f with SMTP id gg3-20020a056214252300b0056c13ccd21fmr9053356qvb.50.1682696531413; Fri, 28 Apr 2023 08:42:11 -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 do54-20020a05620a2b3600b0074e13ed6ee9sm6733873qkb.132.2023.04.28.08.42.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Apr 2023 08:42:11 -0700 (PDT) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Apr 2023 12:37:47 -0400 Message-Id: <1682699871-22331-3-git-send-email-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682699871-22331-1-git-send-email-dheitmueller@ltnglobal.com> References: <1682699871-22331-1-git-send-email-dheitmueller@ltnglobal.com> Subject: [FFmpeg-devel] [PATCH v4 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index 051d278..19c727e 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,9 @@ 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_VERBOSE, "Failure to setup CC FIFO queue\n"); + av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", outlink->frame_rate.num, outlink->frame_rate.den); return 0; @@ -242,6 +248,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 +296,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".