From patchwork Fri Oct 1 21:08:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30865 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp2090229iob; Fri, 1 Oct 2021 14:12:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywPvFHPq8joM8ICMnjWcuNVQBdrHjwCRsjGjx3DOV5UCCfhUG2n3NlBtrR04Wba9xGfy58 X-Received: by 2002:a17:906:d14e:: with SMTP id br14mr134937ejb.61.1633122745360; Fri, 01 Oct 2021 14:12:25 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id de1si8003638edb.375.2021.10.01.14.12.25; Fri, 01 Oct 2021 14:12:25 -0700 (PDT) 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=jw1v4JQt; 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 E137768AA97; Sat, 2 Oct 2021 00:10:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068101.outbound.protection.outlook.com [40.92.68.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6AE6768A877 for ; Sat, 2 Oct 2021 00:10:03 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8u3on+iV3MrI1NHSbu2GuzK7WJZ9E2jVGL6iVv1dPV0Xqxj6WcOtGSIDtbggvD3L9dIcFPwGoYdgqUpTvWrblDOHoLCQ9eibuxAP0gfBqanI+cLX24YAzIigdA8ERo4p2VnCd4zx128Vpmt+TGISba0iklEcUGzvAJ8hUeO/PY2gRDbWKIxga/7OyQsO3qGcyEuYAli0NBdztGAEeLwJi4oy4OCcJH4FZQ5RUOn+OS3Gmgh9+q922YBU04Vm08fXCvlB09qF9Jtepajm9hsRWa2AquhsXETVTSsaCBVwiCJRIA1aLRjbUp8KJvPdsWe4xLIJ+3Wfe/XAAQtbsKHBA== 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=+pjP7+soSvaHYM3yenrw7EyhDZ+jMts9yTxW58x6/Zo=; b=T4qz/G0F6h+8Ged59EjwezXpfoMpu1wStUh08L4RGBw480ppa6AaNaHGCXlDevWlwZSxc2RR5Al7jML2aTTlWHXZBwQ78/FFMzTLc49OyR+zgKVwNuNQe7lc0p5wWukCHfgbu36ilyWf5tX0kbq764vGu399hiHp7GVruUEXKf+yK38a7iNo1ziypXrlzK38GI0HDQQBjBsXPVNvdRSoDVsHShVUVZrAY5B7ku3bikKiW1wU8Ms11UAHkVJI/YWvjK9kWIw8kJsRpvHQKaPvVltBHtS8i/EZEJ97SJTNc1pHHybSg+XxIq92LnXrW/YTauM0QCY2PItVtg9KPb1msA== 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=+pjP7+soSvaHYM3yenrw7EyhDZ+jMts9yTxW58x6/Zo=; b=jw1v4JQtmrtBGySMtMlUXj4BmlolJ1xMCxYsAP5KNlz5wjv3vLa8kI2h8hzOkjcOaE4ZRuKuIR1nRdZyVPM1GQNe3bmLSlSPgLztgxANd1sb9yqeGvWfPCGL5qJLXFyFCfUttFx6WR3La0Yk4t5FpKxdmVG/qFszctNy6nfLzP6y1Rct3Q2AD74O9oeml9QyAHxY0yQ1fXs9KIbl75DnPKj0hTq+R2MXUxmQYEd8v7g4V7++tax990XR/UD2T2Pqea+baDtCvbCD6Tm+IVya2BUKqc5B7sSMPjMtK+oN4YRNMnX+M7WgGhiW6RJ2HpuHaWsLga500AQoRZVgXV7BJw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB6952.eurprd03.prod.outlook.com (2603:10a6:20b:29a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17; Fri, 1 Oct 2021 21:10:02 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51%7]) with mapi id 15.20.4566.019; Fri, 1 Oct 2021 21:10:02 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 1 Oct 2021 23:08:36 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [Z1f1ttsK7Tn4sMdvcXblURjlQPT/styb] X-ClientProxiedBy: FR3P281CA0071.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::7) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211001210837.2879205-18-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by FR3P281CA0071.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.8 via Frontend Transport; Fri, 1 Oct 2021 21:10:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bc77bf7-984c-4014-fdbc-08d9851fd542 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UL387mJJPv+D1gZZJNbM3QQM5verKeruayumwV7+jBy+k5SF2Rb0Yjsw4tJf3QP/wABANu1iIwbQj6ei7bSSRtqhoYqX7MoxrWNk3+P0HoEghzuEeSY01wJTUtpbLfRaCUXF7vHXbwc+meo105uto5uheTcWE36PwFa5mNytWP20yZkP+FR0QPdnSJFIzIS0xITwt8oirp6+govtfdQE5phXcFzLnAsjUtaDohqVJMTwexFX1KcVXalGAVJiQ02zs7Wxgvxus65Ya/uXDDSfShn7U3fZPPI1UlHgdhkjvSZUW+hdYA8YCMW3wdMIO0QQyHyDenUgEX8r+xHNrsBxS++ex7Vf8kJ752DrGxKV/wJBAkj6asSu+NH6zG/b2desMHbuit1MVjpBhk0qZ0OvpM7Kz7nQPNWtgzh1VwGlHR4dAANDIF0JFtMDA9rXBz5W5l3nt6lhJCTSXKRA2galuH9SEeR3lX9kHH5XGS3Tbf1gFb1JgesaLLBZWFLpY/stDHB+g/fVwWJRAsY8Hovz0hK3F/gUBNyD2RIX8/uKTJP7k4UjsLbSL6v4sLYJwUOxzau7p4YSQClGhoDkeEkJH0mvmXyaDfp0+dMs2TluCh8Y/YlgWxfUbVaqetgvXODnABv8rP2nNs9/gya77Fgjkh9oxkll7RCJpqFnpSM7vLRqtCev6vB7ESGHRzTIUeotZ/bL9I6db/f5g== X-MS-TrafficTypeDiagnostic: AS8PR03MB6952: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3PAA4dFPVL8JJgjxFFe9Re9hiaE1raAfPO4LcUHsuVwaTfLmeJkKh0j+QfEHkBqkrF65LUc7ZnOO8RmjWILgvrEZgNOD5tTFG9iNwZDBVvENuIiuzaNULpLsZft6+qUYh7pMaQ5Dzx24cYP154Y1G/oBnezp1frhmM3Sq8VBL18y3cLjLJoDsLelasJnfbq9KMyJXOwKZTODBs0JNKGkqRw57Kn4NtiAoikN6hGrKz2j6Clr+B1rrlb5cIOF9LyNnhxYUa3OCh4DmSPyUSBR0zrUUYgvig9Uc6sz1ZM2QoOGa9hD4atxwHQ5xODjZ5VFiW8r2Xv2dtYbmxiqaMhga2hxifM/TGJc10bptc6WI67IGtgkaGglhxMkVDQjSBxK9gWDAtod+fuiiUCeHu7QAruBcXmFa8dXfuS9Fdss5g4bFW8BMogD1YCpldQ/vZ9q X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vcaybDhTkV0oTk6UH8X+fya3A1eNX1pCEJtxWcGyKc57MJiSrWIwiNjPhB24UNbR6pHenldTsvcvi966zElceqzOlGIhgrO+rUh8qdvCgBcxyMGoU+y0DDxyYdlC0H1RVe/OEFUAGJM8bzzPjJ7mSA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bc77bf7-984c-4014-fdbc-08d9851fd542 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2021 21:10:01.9905 (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: AS8PR03MB6952 Subject: [FFmpeg-devel] [PATCH 19/20] avformat/lrcenc: Unify writing timestamps 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: il2UeX2w7uYF Signed-off-by: Andreas Rheinhardt --- libavformat/lrcenc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c index 21cb3860ab..4fa14ea427 100644 --- a/libavformat/lrcenc.c +++ b/libavformat/lrcenc.c @@ -111,19 +111,14 @@ static int lrc_write_packet(AVFormatContext *s, AVPacket *pkt) "Subtitle starts with '[', may cause problems with LRC format.\n"); } - if(pkt->pts >= 0) { - avio_printf(s->pb, "[%02"PRId64":%02"PRId64".%02"PRId64"]", - (pkt->pts / 6000), - ((pkt->pts / 100) % 60), - (pkt->pts % 100)); - } else { - /* Offset feature of LRC can easily make pts negative, - * we just output it directly and let the player drop it. */ - avio_printf(s->pb, "[-%02"PRId64":%02"PRId64".%02"PRId64"]", - (-pkt->pts) / 6000, - ((-pkt->pts) / 100) % 60, - (-pkt->pts) % 100); - } + /* Offset feature of LRC can easily make pts negative, + * we just output it directly and let the player drop it. */ + avio_write(s->pb, "[-", 1 + (pkt->pts < 0)); + avio_printf(s->pb, "%02"PRIu64":%02"PRIu64".%02"PRIu64"]", + (FFABS64U(pkt->pts) / 6000), + ((FFABS64U(pkt->pts) / 100) % 60), + (FFABS64U(pkt->pts) % 100)); + avio_write(s->pb, line, size); avio_w8(s->pb, '\n'); line = next_line;