From patchwork Fri Nov 25 18:00:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39447 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp5590689pzb; Fri, 25 Nov 2022 10:01:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Hz19kNxCL7lAb/SrTcnlGUfzN0Jn8BAj/+Qr61x6PaEtXGPJb8wsmpDs2vOXPsPNgfVMo X-Received: by 2002:a17:906:901:b0:7ae:23c:3cb4 with SMTP id i1-20020a170906090100b007ae023c3cb4mr32528127ejd.599.1669399261651; Fri, 25 Nov 2022 10:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669399261; cv=none; d=google.com; s=arc-20160816; b=J+GMVLPVcHxBW/yblXzvEiEVA6UoiGQXtZ/ZnY7vJwHIL/zEmvqS0TtB1D4Ir5Iqrx j1redC3qaM3WUZa33dH2ZbIpTgHsPmobvSQUQGABNK/gGpHk9sASMnJFUslajJXfO77g 85LbBWnLwUaTUI4sNUgYuEJXOFwyskhXZRNLPQ/L6odKOTHzXIomwVRvnGwSbCxmejq1 wBhcaAxROFrracNliZITvDqaJlkY46UPpakpUC9vadUI3Nt2TJ1hGdV/Xd5TPKEJTxAN rv5mGiwq+3V0pCfNTHVWehpcXChWwfhTXTxFoMm0fQ8My4RQcwPcyfnZIUNQ3TVbkk++ u2+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=YG2IUVImIJp2u8P0bdDMmi7qjoOlTL9/zv8vTArnVn8=; b=KBVl+lch9OTTYzsGQ7Y/SsoXveD2jmypUmzJ64Q/C7U49WjgpcDo+Y/1iKAGrZWzcc 3i1F7ti9NOYWGwICn51SnmuBuJdV0Rq2RRrkRGhJlyeJnGb9XP7GrZLYng6CeyW25A8z uu+DUvzpSvbap+s73aKMYJDvwGoTMc1B2ZTd2gbS1X8AeIbNjyL5WT2vjlNkfEPBkJP4 a/u9Ndazeu0++HdVpn5x8UIWI6ndFWV0rGY/8p6imSQsUrgSMUgu4JL8pcfRit+tvDw5 Rsa7KUr5l2yk0HxIkWoJMnnmEhGPaepEVQY+yA/ottSVLjpCY1vAqDxDLDCE45FfhBiV eXAg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w13-20020a05640234cd00b00463c29b5443si3133208edc.27.2022.11.25.10.00.38; Fri, 25 Nov 2022 10:01:01 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F22E268BC99; Fri, 25 Nov 2022 20:00:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA66F68A791 for ; Fri, 25 Nov 2022 20:00:26 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4EC6C2404F7 for ; Fri, 25 Nov 2022 19:00:26 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id CTlCxyfRmGUA for ; Fri, 25 Nov 2022 19:00:25 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 7C27C2400F5 for ; Fri, 25 Nov 2022 19:00:25 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 204283A01F1 for ; Fri, 25 Nov 2022 19:00:19 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 25 Nov 2022 19:00:15 +0100 Message-Id: <20221125180016.13830-1-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavf: stop honoring AVFMT_FLAG_AUTO_BSF 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: 878KmhSPSTj2 There should no longer be reason for the callers to disable this. In-muxer bitstream filtering should be considered a part of the muxer internals and invisible to the caller. --- libavformat/internal.h | 5 +++++ libavformat/movenc.c | 5 +++-- libavformat/mux.c | 3 ++- libavformat/options_table.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index ce837fefc76..e96bf4cc56d 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -186,6 +186,11 @@ typedef struct FFFormatContext { * Contexts and child contexts do not contain a metadata option */ int metafree; + + /** + * Disable muxer-level bitstream filtering. + */ + int disable_bsf; } FFFormatContext; static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 064b5419721..a4dd8619dcc 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6829,6 +6829,7 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track, static int mov_init(AVFormatContext *s) { + FFFormatContext *const si = ffformatcontext(s); MOVMuxContext *mov = s->priv_data; int i, ret; @@ -6875,9 +6876,9 @@ static int mov_init(AVFormatContext *s) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF | FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS; - if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) { + if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV) { av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); - s->flags &= ~AVFMT_FLAG_AUTO_BSF; + si->disable_bsf = 1; } if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX && mov->flags & FF_MOV_FLAG_SKIP_SIDX) { diff --git a/libavformat/mux.c b/libavformat/mux.c index 37fe19358de..fff500dd554 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1072,9 +1072,10 @@ const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream) static int check_bitstream(AVFormatContext *s, FFStream *sti, AVPacket *pkt) { + FFFormatContext *const si = ffformatcontext(s); int ret; - if (!(s->flags & AVFMT_FLAG_AUTO_BSF)) + if (si->disable_bsf) return 1; if (s->oformat->check_bitstream) { diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 86d836cfebb..83e6c6fb3cb 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -39,7 +39,7 @@ static const AVOption avformat_options[] = { {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D}, {"formatprobesize", "number of bytes to probe file format", OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, INT_MAX-1, D}, {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, -{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_AUTO_BSF }, INT_MIN, INT_MAX, D|E, "fflags"}, +{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, INT_MIN, INT_MAX, D|E, "fflags"}, {"flush_packets", "reduce the latency by flushing out packets immediately", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, E, "fflags"}, {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"},