From patchwork Wed Jan 19 21:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 33667 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp5187377iog; Wed, 19 Jan 2022 13:30:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNZki3nROHuT2i/3Z8s2Jtmrqm+az4YNHAYmnsEGc5uyVS2XcdiLwEz/vN1jCJApClz2Qf X-Received: by 2002:a17:907:1c88:: with SMTP id nb8mr3547257ejc.110.1642627808816; Wed, 19 Jan 2022 13:30:08 -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 q4si539166edb.472.2022.01.19.13.30.08; Wed, 19 Jan 2022 13:30:08 -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=KYMefDg9; 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 6E79968B1A0; Wed, 19 Jan 2022 23:30:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075047.outbound.protection.outlook.com [40.92.75.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 270C768B17A for ; Wed, 19 Jan 2022 23:29:55 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXAWHZHsQLU4IvEhq5oIdKQ07HMF9av/a4pJ2erfMpWXObWRAcsFsANy9YjClpKyCtNhjUUqWovuarp4VLw3ehckgryNjXm2qs50efVjdHgdxB41YblkhvrfUFCda7sUl3g9pZPMNG2OFe2aIcrmtdwX9vcRqIsmro15ma5xRiYW62uvnpdSOmzlkkVseOTJTO3nWhkI+XYjKOH0F5Zp6d1hTFpgs4yKHxj8BPhSBTZXEJn5G2oQszgdnMUEiPova1F4JSRYr9vaCR+4Imf79NMoALkcm+JrJfG7eH5esnJ1w2JiOhL1xaq3Hx/H8h4nOSMXoCGPjbmt7hjR1SOl8Q== 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=XWxYFJ6M9DQRt1xEDhmaDM8EFwhFnusAjsZ+Fi9L63c=; b=FRvc3JKBS32tpZGOLY6ezCGsbgzIKpcFYvWa7PJZoPEIqc/1MzHRtmgFJS5Puh/UHEGpLrXEzxd+oBP8FkLTiwz9EoRsZGL94MeTCtZWPZAp6JQMiszZ0RizYXJj0C5zU1cSV+i80beLrpv6an/FvGTG7BB0rm6ZQOarvDTKf7KclNXE56kgnE2BGVo58ILPgtOz21Z0x2VrHRmRsVn0jxzx1+T4wBgofg/ucPHZiJNcK4UAKMfCMMcwAbldxsqQkuvzjbgGN0et74r8XbFto+kg08hVZdf1vpVhOKXGxcauzDoQrbtavGVcXcI7xQPQNWV12fvT53qc/E/HO1IeoQ== 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=XWxYFJ6M9DQRt1xEDhmaDM8EFwhFnusAjsZ+Fi9L63c=; b=KYMefDg9hWX8U3+T5iIOptZqPB0e2cJmKhtd14+o0yeFEPPa2/o0JzGYtsfiugZSwzU8T2scTzFlCzDq331mjHd/uZA8CvDBsSOjkPVFujxD4OUaSYbBurqc5BGK5rlBqmKyF3nqTCI7aT12MKYhrqrCAxVYH8QJVixIuZf7l8kqdGqO7q8GBDwBcw/fDWUG5sufVUzbH7+W2kWywIfkR0p2gL/HdnmS0ZTSI5Rp2THzpljFSFxbjVxsgzjadu1YCzE495E5uxQj3ldQfth6vipc/H/OxdpT1uWnnQvpkx8QybwLXRoZXKTUFB/LWXIc3Y5/bOT/LbJPJnxc6GHPbw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by DBBPR03MB6796.eurprd03.prod.outlook.com (2603:10a6:10:207::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7; Wed, 19 Jan 2022 21:29:53 +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.008; Wed, 19 Jan 2022 21:29:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Jan 2022 22:29:37 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220119212940.1071477-1-andreas.rheinhardt@outlook.com> References: <20220119212940.1071477-1-andreas.rheinhardt@outlook.com> X-TMN: [Ml3ieP1Or50nyxBoL8fHJcPZl4RHwMeY] X-ClientProxiedBy: AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220119212940.1071477-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50a3f6dd-e6f8-4190-4dd4-08d9db92d4b5 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEu2NlvrW5n64XaJ9+lJW+MeCSqumr8FZTDFhrxcb3ToXokbVBaxhsVESgbnRSd7Y8QmtvmpPX6KAICAj1+nW1UGfrovJYYVUsHxhiraN9ELXZ94C6uIa0jwfg43m+QxhDQaaoSsB+7KM9YngwIOK6C13OUI7esnlGy/Kj2Afwex1f3vPCFe27K6KQQk3HbPr/wbHhX52zHfk3oD84tCTvvH38JyRdYTIr5eEKB0vveuuSXyaLzZHrRrrbjl8totVEwzi+kluhhFJnQ28w7RpVT2PJnEeR31a3mTBOAUnZN3tuFGnEGm07iHXuwc/fbL9eYY1SsaR135n9HNZUUzkFy/EkP3WWNmUCPyq1B+GHPbY7ZzxlBhXYhoRROg2DiCTyY98Q+xP2vM6/j78jTNncY1n6HPM94g2vIwWd754wLfPcW1M7NKl3s90zJ98njexhrsOXmB1MV7Xs+y48nCdoBsbC1gSxqYr1opmfrObVho/mk8U37lkw/LuCZO3crJMJhz7IV5f7NKZk4osuBvKwBwGCHIZDDXZ+GtIx5xVQoV13uhic6Rb4MLi48cR1FDJ8YWk6vb3YoAEAyjizXhovKGl5s9gidcajznccy4ISwm6OogCbhWMIH0KGUtqJdGzuLJ9W9r5AA21ui9bwYHCviL4WW0Xi2q91CTwkTE6wtWO87hpxIBYjc1kPGZYR8S5FSUjh7+R1AeNf4GN0gkP3CvdPJFO4EVdDVCzymxhidxIqjigUBvAjbHh119qPTvFUWcPXyKKDx2VEZCO7VWqqwp X-MS-TrafficTypeDiagnostic: DBBPR03MB6796:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PA1vNR5ziEUt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O9dzahdTDX4Wkxz8NbtEMrGmV73P80x1toLZratIta9RoaF+RbWYgpiwHw8lReHUSetVkdF7LK+h1NByDIgFtypqxDFFrmR7m3HB/gX6u0CvJo8BLKmCCkVtPOBqrwvb0l67YxInIkYgW6u2m8C/qFACAZMIJ/bQswOKiOVHGCrBV4+KpSiQb7aFfqfoc3iLO6y1oly6ktzp02OCuVKi4o+RMIH0/eqlHKe3vKIfRWgp0qXHiO8X+ubPstnT3Sxm/Z49Q0iP+VssT/p+pAnjrm4SUZqsRm+SAQ9XMNm38yi92oKuZRnjD1ARcODfUkxQI0l/wZPRjwIu6bq1KAxhyVisuspbLnvypqpX8MPBXEgZYq9cjHPmXudu1gGnu+mJCBaoGAqSYSvYtv6nNvcHGmkpF3iW6tR8I6matHyxDy1Gpz/yfx3ki4A+qs1xsBb2rQrvbskwvQDrw+HQ9xE4AoKE72hoPSSG5US3e5Yf97DWGmS/3EVvqg21tQc+wGchGpWNuOcXJig5J6EOkSFOCvmw3swQNtRWyw+bGQQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50a3f6dd-e6f8-4190-4dd4-08d9db92d4b5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2022 21:29:53.1870 (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: DBBPR03MB6796 Subject: [FFmpeg-devel] [PATCH v2 3/6] 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: moS3kqPDYbxz And also don't use explicit constants in the movenc test. Signed-off-by: Andreas Rheinhardt --- 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; }