From patchwork Tue Jan 18 23:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 33651 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp4236462iog; Tue, 18 Jan 2022 15:33:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvBPFpOZXJBhTcg8Fe+GUVzEwKna688wKK/7eKz68AY/IdckyTt1yI+BRXhIKSr+/Fbf2Q X-Received: by 2002:a17:906:7307:: with SMTP id di7mr6836006ejc.65.1642548799147; Tue, 18 Jan 2022 15:33:19 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ga23si9524441ejc.40.2022.01.18.15.33.18; Tue, 18 Jan 2022 15:33:19 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=HTkND1eB; 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=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AF7B868B163; Wed, 19 Jan 2022 01:33:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067031.outbound.protection.outlook.com [40.92.67.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1ACD368B148 for ; Wed, 19 Jan 2022 01:33:05 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lNZpQ7z54Wy9MVeUsDrABra4sdByK6Rmc5kzvlvbz5ljKvLvb5zaOpu5dKE8a76+/xjwNItup5bKy5gzaY4BUta54aceAGd1TysAdf390eB2neBpCFoZC34OS992ivCJxKAXpa35vYU99Xih+ki2orcueWjpqcTsNgAeeJ22u/hnUn0dgrJiZ8qVsoPsLfcrbR2HXNMXNIjSQyzZQL55cOnzCpUn3lT/rqm9Nw4A06sLbaAaHQ7I8HCOyuugXTD9I4lNxuLe5mQwDdvvBze/lND5FyvzFVrBlcNKbo6ABIBn6kjh1jRX7s37wRfCcClntZNOXsftjQQAye7HKL43SQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fJv2AiDTbEBcWuzdc7t8HgX/sCkC7JXPYetzyusDJOc=; b=isMOxpZKrQBw7831vE3MOSwwndFPtohzRMUfSjGFmC4O3OoRXOrsyJ5hJB2k1GT3Zsi49eD5R1KfwBwWxM40dEp2C+r0Yc6Uyb8XhHiyVzU5TQHQKCofJrgj7r1fMdi20tF9NgKJSSUj9oUpZVyloQV8xDIqhVrdo3ZB2Nl588lBvRq5k/OSbStTWRFUP46JkUdeFYYK51K6IjNrBSGA8bdOSpU0hGnxC3ZD5q5JfqbMyoAGsOzbZjOaeqS0P0XTCNvS/ZohD48ktJe0winPPVL22WNmWjvAdRDTQM+xfj8F/4pyGZCRHnzkzWE1XC6lHAWppwFGXwhLliOxEmik4g== 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=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fJv2AiDTbEBcWuzdc7t8HgX/sCkC7JXPYetzyusDJOc=; b=HTkND1eBlrcrM1b6JYdkhJA0upE94mr18pekZLAxxYcgPUQ6M/EOOUD2fMWOj5PQUYc1qWfiIehrcc66g18OzmpRjMrqjcFcwsgv6SDtHCak16rNB6hZ6BwuEeKDpTratCuDl0UuWf9+ioj20CWiaSyaKrBefnxdvVk8nXqYW1hcQLJFUb97aaI2uheBm7nNlk213g/2OMmDdsnqR8oIvE/5m0nR7f9CKaBTmef4IZQUVW0rEJwFGhprEfK4z0sdng60CZBQeCAJCeNMQBplaKzse+DVjbR4ldrBlG1VmvEsTqqDcnZ1DqQQuFIwCvYWmW1mfcScs6BihoIIn6+vJg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM0PR03MB4529.eurprd03.prod.outlook.com (2603:10a6:208:c4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 23:33:00 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::19fc:be9f:2c9c:53f5]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::19fc:be9f:2c9c:53f5%9]) with mapi id 15.20.4909.007; Tue, 18 Jan 2022 23:33:00 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Jan 2022 00:32:27 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [aKPdZEz0jrO9q3gXNvm5DSSmywLpnFLr] X-ClientProxiedBy: FR3P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::7) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220118233230.743570-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54230551-811d-4dd0-3156-08d9dadadda8 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEugsGLGn4w/4Os1SUPxX6CvG5gBLmvUBSDroU1apO5t/H/puUGOvj9FHVD6UeVw+pRQ/pC+fOzGfUidX5CrRHkiJwyV16+ZkP0nntvMWL8leRU0uBk1IOetPLfwEaWewOep7kUbZFgBbb928V4Dg0t1xkwpIe+OR8uthDxGCebs9e3n0UbLdLaAKGrq31ZRD/PpMjOR4N2L/Nz6U4eO7xsnEhp/xpe+c9rtoIpLZqC2Ns3iBUmBAYlSp/qWenGGExUCEMVi25hdFy1lFqdqDFYhDwiYe8Iqd47NEoyCYW8ou5gyKgoOka6Fiz1xejUEhiff4e2VxGhH0Q1X8W5VzT35WmKWJGHHBtEMk+LjVFnQoR4DJ29oRk/cfKR1sKnI4jS8Exh08sWUa0jQTE4IZVxWpdviDSG0z0ESgpg+o5Oh0/v9EXS9hF4hjY0ucqPa1lzv/oorbhUvI6O/H1qM9xOsFSNKUAnEbeClYkkLnbpbindJINEhkc8ef4U8S+bXTLdFPx+xLh8WkvQ59lK7rxIRZs3q4lNIirICs/AZs+jCYmSq/GGPuwZBPhqLPnObmXXdFXcP4n4TvWDf9MvR7PorgTyFNAoZHkNtYuxzxcnkzEKuTOsYhXVFs92b8BaQ0OTO2AZjCWxt93RWMAa1onJ+nHu5oq/Xkwnu1IGwnVx9FR5+Fb561Xmj5O+w3db54vUY6up2YejD5Nagb9ZhJMc2aqvDbDFvGxMkmZ70H9+qV5YkioWPOdyND5cqhob/eHVWPG3Xzc9t7ugrrK00mmdg X-MS-TrafficTypeDiagnostic: AM0PR03MB4529:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: is3KeInKkDcJX1IK+pbB20UiZN+Ar8dbYh5XGqEZvLnklEkcwbuPlD2dA5IwMkMqxVDcwCFcQIXxS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IG1/B//q+7j0rAyuqhz5xtY7pPajljbPWyvzzABdLf2QC+ZiDAwtFbR9HThgIHSh7Ui2NMvYzKZmyuth+suIOvjmdbTQj9ZfykVE6EXnVInqq5UlpSPXXqFoSBQEiUZNKeZAvpqOxdhi72UtXZ5s/rf/IEwiY563ejUy2LY1l8o8fj89pTUp0biC86Qo7DRd1rmh1eT41lSUXc01HIq/jZ4y6uxtxTHTufwLEkq4qn6xdfft+DVLLih9uxAo7hYQMoGyHhEED4lTzj0ulXo6Ogac0p3pcRIADFxPzQweK5lPJ7oqpOoiA7WZ3nknc1TQA/ik5ePdwTfZFJqOfz7YEQwqqjdeNiPNIMhXUppi/25zyoli5/9t9bvj6zq2IleNZ/wfcDSA59tQLcjSwf9wVpCypA5ndXgLkHTMt3OolMHM7/NENZJMp6GKxM53DwLjGn9lRa/ZtIKZIhiaheQZuAJDoSMnNUtQowfyw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54230551-811d-4dd0-3156-08d9dadadda8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 23:33:00.8192 (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: AM0PR03MB4529 Subject: [FFmpeg-devel] [PATCH 28/31] avformat/avformat: Add AVFMT_AVOID_NEG_TS_DISABLED 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 16TYtDvzEK6S And also don't use explicit constants in the movenc test. Signed-off-by: Andreas Rheinhardt --- Missing version bump and APIchanges entry. libavformat/avformat.h | 1 + libavformat/mux.c | 2 +- libavformat/options_table.h | 2 +- libavformat/tests/movenc.c | 4 ++-- libavformat/webm_chunk.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 6ce367e854..cd253fb28e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1533,6 +1533,7 @@ typedef struct AVFormatContext { */ int avoid_negative_ts; #define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format +#define AVFMT_AVOID_NEG_TS_DISABLED 0 ///< Do not shift timestamps even when they are negative. #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 diff --git a/libavformat/mux.c b/libavformat/mux.c index e34fd88f05..a1917878a5 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -421,7 +421,7 @@ static int init_pts(AVFormatContext *s) if (s->avoid_negative_ts < 0) { av_assert2(s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO); if (s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) { - s->avoid_negative_ts = 0; + s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED; } else s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE; } diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 62c5bb40a3..86d836cfeb 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -95,7 +95,7 @@ static const AVOption avformat_options[] = { {"max_ts_probe", "maximum number of packets to read while waiting for the first timestamp", OFFSET(max_ts_probe), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, D }, {"avoid_negative_ts", "shift timestamps so they start at 0", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, E, "avoid_negative_ts"}, {"auto", "enabled when required by target format", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_AUTO }, INT_MIN, INT_MAX, E, "avoid_negative_ts"}, -{"disabled", "do not change timestamps", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, E, "avoid_negative_ts"}, +{"disabled", "do not change timestamps", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_DISABLED }, INT_MIN, INT_MAX, E, "avoid_negative_ts"}, {"make_non_negative", "shift timestamps so they are non negative", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE }, INT_MIN, INT_MAX, E, "avoid_negative_ts"}, {"make_zero", "shift timestamps so they start at 0", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_AVOID_NEG_TS_MAKE_ZERO }, INT_MIN, INT_MAX, E, "avoid_negative_ts"}, {"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = ", "}, 0, 0, D|E}, diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index 2af72f11c7..ddcb053bf2 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -455,7 +455,7 @@ int main(int argc, char **argv) init_count_warnings(); init_out("empty-moov-no-elst-no-adjust"); av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0); - av_dict_set(&opts, "avoid_negative_ts", "0", 0); + av_dict_set(&opts, "avoid_negative_ts", "disabled", 0); init(1, 0); mux_gops(2); finish(); @@ -578,7 +578,7 @@ int main(int argc, char **argv) // one before. av_dict_set(&opts, "movflags", "frag_custom+empty_moov+dash+frag_discont", 0); av_dict_set(&opts, "fragment_index", "2", 0); - av_dict_set(&opts, "avoid_negative_ts", "0", 0); + av_dict_set(&opts, "avoid_negative_ts", "disabled", 0); av_dict_set(&opts, "use_editlist", "0", 0); init(0, 0); skip_gops(1); diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c index 24390e8e74..9348e6680a 100644 --- a/libavformat/webm_chunk.c +++ b/libavformat/webm_chunk.c @@ -127,7 +127,7 @@ fail: s->avoid_negative_ts = oc->avoid_negative_ts; ffformatcontext(s)->avoid_negative_ts_use_pts = ffformatcontext(oc)->avoid_negative_ts_use_pts; - oc->avoid_negative_ts = 0; + oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED; return 0; }