From patchwork Sat May 7 11:27:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35644 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2121272pzb; Sat, 7 May 2022 04:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznCsoU43nrHhlbTJ4LGIpAr/sWqVe5tahJFboVAi54Od11uBa7RSnaZEXYXvwOEbJxjtq9 X-Received: by 2002:a17:907:1b15:b0:6d7:13bd:dd62 with SMTP id mp21-20020a1709071b1500b006d713bddd62mr6851574ejc.673.1651923015905; Sat, 07 May 2022 04:30:15 -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 s17-20020a1709066c9100b006f38c2a3d04si6658899ejr.310.2022.05.07.04.30.15; Sat, 07 May 2022 04:30:15 -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=RPSjHGcf; 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 427B068B409; Sat, 7 May 2022 14:29:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2020.outbound.protection.outlook.com [40.92.91.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2ECBE68B3DE for ; Sat, 7 May 2022 14:29:14 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NKe59UstS4HIBja/bckWHlUWGOHf4rFOcfWPwlTw2wN+y5cVVHk1Rv0//ILQyOub5nQdQbB6jH9WXpUXQrTKsHmSAeXz4+Kz/V8CXiRBNswhzEckPD638gV71zXMsQcgw3/U1dmvoQ0RwluLEiC1ikeTT8ckjE8QNIuyN7uKS4G1yVASf2coYHEFQgO3FuwslHtJpvBf+zMJFAbm0ybrOMjWn7pBdua2eHGFFRrRTJvk32lxq12zOp9nZZcbHGJAgjze2vy5By6w9f3iwRHnod5QJ2YU/WO6ARzZesGLNFaoOpg8hy+ngf2GLzXj2IsFRboeqNQVA+mXB7ukWolbcw== 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=1/8ZvdPGLmb6ty/2DtMbTRVFkynTCu7bvM1ooINoQsE=; b=leIgG5HuMOoxBV622RP+mNzTym9ZBwIQlCjISlJWIggi9V74o/D9teZzUeUG4rrnVnfbLzsbC4vyZgHUJhWiNZ0SnyZggTOKXRKXOoB2Y2dOlE0isH4XXdjHvzOeIcYr+Ij1gWXtnS2zReyHydzX539gCc7rTEGJ6UiP2zTkyVKqc1eElp327GpC6kudJDIiqYkf3GesjIaDCMg/fByYnkDzqzermOfmkSpdQN367/tiS1+zrhYTbqgD+syzTJAbFgLOJQuI2aw9WZWUcB5U8YgIaWdv+6OeJ7kxcp/5amIw8hwMvYLnXxes17RcZNbL+KazDran3kxL8zqRKxBnSg== 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=1/8ZvdPGLmb6ty/2DtMbTRVFkynTCu7bvM1ooINoQsE=; b=RPSjHGcfdH1wALSGeVz57zW/3PPUksg7L0U1PnnEjDLARRgOIsIhOcOflij97SWnO/oGfV1X2sEeSYcYu71+AseRihFPeC1MPtBPHvBDyjv9ISYdGI4tQSFy56KOnOOLq/FHKxDVQlKL/kjn2QRUlmDvolGHJeZSgMUmfM9DTDpSMkCLj+G9o9cR9kBV+iqodqknSb3Y7I3GILP7QQeG5LpsPwtfx++vLk3If/oWd6a85rqnhoR/LKMqEpj8TLSYY7SZVZPwriG55Edn6xhHUQI2BjGY/kHC0q/WJp7txeHma/Rt4/PPY8gPfhbJtTUCL5SceYanMNETUYoPi8NFOQ== Received: from AS8PR01MB7944.eurprd01.prod.exchangelabs.com (2603:10a6:20b:373::5) by DB6PR0102MB2663.eurprd01.prod.exchangelabs.com (2603:10a6:6:e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sat, 7 May 2022 11:29:12 +0000 Received: from AS8PR01MB7944.eurprd01.prod.exchangelabs.com ([fe80::1854:2c30:7ba1:c431]) by AS8PR01MB7944.eurprd01.prod.exchangelabs.com ([fe80::1854:2c30:7ba1:c431%6]) with mapi id 15.20.5206.024; Sat, 7 May 2022 11:29:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 May 2022 13:27:56 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [DUUfQFAlyshTy1zszSg+JDDlSbMUOFW5] X-ClientProxiedBy: ZRAP278CA0004.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::14) To AS8PR01MB7944.eurprd01.prod.exchangelabs.com (2603:10a6:20b:373::5) X-Microsoft-Original-Message-ID: <20220507112830.406162-9-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92acc2d0-a5cd-431b-6882-08da301cceb5 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRIovyFjHwHllp74iOQFItwPQ3wEsJI1MZQ6lZkcIrfaJriUz4UB13uBfVZw/x73gUvB13ktRuz+y1otE5/bo54AUTvPdMxD3j2Ol6Pybjq1FWDbuhQrO8RK7dB0Gz0JbZX+/GgKiLDuNoqlznTNWwGwrEfjljSgD22WGQkImMbWLzVN2ujt2gQ+qlecqB7/bFaLGSZRoNSeAnpcTjnNx3V9ftH+SM8e0bBIjcO7wnZC5MPCsxOxub2cBwC24lAcyAX1nuEBOC4Yb5RP+lQpHBnKE84OGZOqfGN5qtGT5bIizIUSX/s0fK2shMFGKCiVFeuTpiobVKrPzXbzJ5LLnZ/zTs+OELKUTk7j4nz1Kqkikr3MCpzmuIB6qHhoIaew9lhIjQszpIo3a0KJgNRkThm+5WVLzco8bzZBej5dkspduw8TuUEfNVareTtCWvmMCUMWspW2m7mcaK3A9/AmYV9k0C3OnJL+enBNo7KCJrg1v2boaxnKWbyz4nhUkC4ubB8FETU5OLB//hLvf8U7/86flZjnbx8Dmh1QA8mmpS+ivOzVZcVxgKoGol3FnCBMI3ck0d8RFmuI0YdTIv2Eqa5XK/onrnWYEMRtEIDTEVwfNWT3fX7lMIGqRevyDFJs8kIX4zoSiA/Fnr+It4oksL7n4KwGuz7PmXBId6xIF970Htf5hYpPvjqiE2Un6Z4he2OX5gmuETJ7yhnTd5pWXhcXprl2oQReFI9/UYU7ZmMRSZumt+PaRJ02xL0b5qlqT0= X-MS-TrafficTypeDiagnostic: DB6PR0102MB2663:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ya7HcVT/i5qBYyYueGgpM2rXBbt7cr738QcAjBhtXlDO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Exchange-CrossTenant-Network-Message-Id: 92acc2d0-a5cd-431b-6882-08da301cceb5 X-MS-Exchange-CrossTenant-AuthSource: AS8PR01MB7944.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2022 11:29:11.8589 (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: DB6PR0102MB2663 Subject: [FFmpeg-devel] [PATCH 10/44] avformat/utils: Move creation-time functions to mux_utils 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: bqJSAnHrx9Wa Only used by muxers. Signed-off-by: Andreas Rheinhardt --- libavformat/apetag.c | 2 +- libavformat/asfenc.c | 1 + libavformat/cafenc.c | 1 + libavformat/dvenc.c | 3 +-- libavformat/id3v2enc.c | 1 + libavformat/internal.h | 20 -------------------- libavformat/lrcenc.c | 1 + libavformat/mux.h | 20 ++++++++++++++++++++ libavformat/mux_utils.c | 31 +++++++++++++++++++++++++++++++ libavformat/nutenc.c | 1 + libavformat/smjpegenc.c | 1 + libavformat/utils.c | 27 --------------------------- libavformat/wtvenc.c | 2 +- 13 files changed, 60 insertions(+), 51 deletions(-) diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 6f82fbe202..cc6becc182 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -22,12 +22,12 @@ #include -#include "libavutil/intreadwrite.h" #include "libavutil/dict.h" #include "avformat.h" #include "avio_internal.h" #include "apetag.h" #include "internal.h" +#include "mux.h" #define APE_TAG_FLAG_CONTAINS_HEADER (1U << 31) #define APE_TAG_FLAG_LACKS_FOOTER (1 << 30) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 5b34f98a2b..e1563b1da6 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -29,6 +29,7 @@ #include "avlanguage.h" #include "avio_internal.h" #include "internal.h" +#include "mux.h" #include "riff.h" #include "asf.h" diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c index 396e946ceb..fedb430b17 100644 --- a/libavformat/cafenc.c +++ b/libavformat/cafenc.c @@ -23,6 +23,7 @@ #include "caf.h" #include "isom.h" #include "avio_internal.h" +#include "mux.h" #include "libavutil/intfloat.h" #include "libavutil/dict.h" diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 23b99062c7..1917c00694 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -31,15 +31,14 @@ #include "libavutil/time_internal.h" #include "avformat.h" -#include "internal.h" #include "libavcodec/dv_profile.h" #include "libavcodec/dv.h" #include "dv.h" +#include "mux.h" #include "libavutil/avassert.h" #include "libavutil/fifo.h" #include "libavutil/mathematics.h" #include "libavutil/intreadwrite.h" -#include "libavutil/opt.h" #include "libavutil/timecode.h" #define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32-bit audio diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c index 5d821ea4db..515d2efd7d 100644 --- a/libavformat/id3v2enc.c +++ b/libavformat/id3v2enc.c @@ -28,6 +28,7 @@ #include "avio.h" #include "avio_internal.h" #include "id3v2.h" +#include "mux.h" static void id3v2_put_size(AVIOContext *pb, int size) { diff --git a/libavformat/internal.h b/libavformat/internal.h index da9abde637..03b9bb8e37 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -881,26 +881,6 @@ void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb); */ int ff_is_http_proto(const char *filename); -/** - * Parse creation_time in AVFormatContext metadata if exists and warn if the - * parsing fails. - * - * @param s AVFormatContext - * @param timestamp parsed timestamp in microseconds, only set on successful parsing - * @param return_seconds set this to get the number of seconds in timestamp instead of microseconds - * @return 1 if OK, 0 if the metadata was not present, AVERROR(EINVAL) on parse error - */ -int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds); - -/** - * Standardize creation_time metadata in AVFormatContext to an ISO-8601 - * timestamp string. - * - * @param s AVFormatContext - * @return <0 on error - */ -int ff_standardize_creation_time(AVFormatContext *s); - struct AVBPrint; /** * Finalize buf into extradata and set its size appropriately. diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c index 5703a95180..cdf94e6cd2 100644 --- a/libavformat/lrcenc.c +++ b/libavformat/lrcenc.c @@ -27,6 +27,7 @@ #include "internal.h" #include "lrc.h" #include "metadata.h" +#include "mux.h" #include "version.h" #include "libavutil/dict.h" #include "libavutil/log.h" diff --git a/libavformat/mux.h b/libavformat/mux.h index c220738942..246101f0c8 100644 --- a/libavformat/mux.h +++ b/libavformat/mux.h @@ -103,4 +103,24 @@ enum AVWriteUncodedFrameFlags { */ int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size); +/** + * Parse creation_time in AVFormatContext metadata if exists and warn if the + * parsing fails. + * + * @param s AVFormatContext + * @param timestamp parsed timestamp in microseconds, only set on successful parsing + * @param return_seconds set this to get the number of seconds in timestamp instead of microseconds + * @return 1 if OK, 0 if the metadata was not present, AVERROR(EINVAL) on parse error + */ +int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds); + +/** + * Standardize creation_time metadata in AVFormatContext to an ISO-8601 + * timestamp string. + * + * @param s AVFormatContext + * @return <0 on error + */ +int ff_standardize_creation_time(AVFormatContext *s); + #endif /* AVFORMAT_MUX_H */ diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c index 7b79ffd1fb..df264fc6a0 100644 --- a/libavformat/mux_utils.c +++ b/libavformat/mux_utils.c @@ -19,6 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/dict.h" +#include "libavutil/internal.h" +#include "libavutil/log.h" +#include "libavutil/mem.h" +#include "libavutil/parseutils.h" #include "avformat.h" #include "avio.h" #include "internal.h" @@ -79,3 +84,29 @@ end: av_free(buf); return ret; } + +int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds) +{ + AVDictionaryEntry *entry; + int64_t parsed_timestamp; + int ret; + if ((entry = av_dict_get(s->metadata, "creation_time", NULL, 0))) { + if ((ret = av_parse_time(&parsed_timestamp, entry->value, 0)) >= 0) { + *timestamp = return_seconds ? parsed_timestamp / 1000000 : parsed_timestamp; + return 1; + } else { + av_log(s, AV_LOG_WARNING, "Failed to parse creation_time %s\n", entry->value); + return ret; + } + } + return 0; +} + +int ff_standardize_creation_time(AVFormatContext *s) +{ + int64_t timestamp; + int ret = ff_parse_creation_time_metadata(s, ×tamp, 0); + if (ret == 1) + return avpriv_dict_set_timestamp(&s->metadata, "creation_time", timestamp); + return ret; +} diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 0cea1fabb3..1afdeeb8ab 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -30,6 +30,7 @@ #include "libavutil/opt.h" #include "libavcodec/bytestream.h" #include "libavcodec/mpegaudiodata.h" +#include "mux.h" #include "nut.h" #include "internal.h" #include "avio_internal.h" diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c index 8b40c09329..888ece2f7c 100644 --- a/libavformat/smjpegenc.c +++ b/libavformat/smjpegenc.c @@ -26,6 +26,7 @@ #include "avformat.h" #include "internal.h" +#include "mux.h" #include "smjpeg.h" typedef struct SMJPEGMuxContext { diff --git a/libavformat/utils.c b/libavformat/utils.c index cc5507a19e..a695f19b03 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -29,7 +29,6 @@ #include "libavutil/dict.h" #include "libavutil/internal.h" #include "libavutil/opt.h" -#include "libavutil/parseutils.h" #include "libavutil/pixfmt.h" #include "libavutil/thread.h" #include "libavutil/time.h" @@ -1689,32 +1688,6 @@ int ff_is_http_proto(const char *filename) { return proto ? (!av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https")) : 0; } -int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds) -{ - AVDictionaryEntry *entry; - int64_t parsed_timestamp; - int ret; - if ((entry = av_dict_get(s->metadata, "creation_time", NULL, 0))) { - if ((ret = av_parse_time(&parsed_timestamp, entry->value, 0)) >= 0) { - *timestamp = return_seconds ? parsed_timestamp / 1000000 : parsed_timestamp; - return 1; - } else { - av_log(s, AV_LOG_WARNING, "Failed to parse creation_time %s\n", entry->value); - return ret; - } - } - return 0; -} - -int ff_standardize_creation_time(AVFormatContext *s) -{ - int64_t timestamp; - int ret = ff_parse_creation_time_metadata(s, ×tamp, 0); - if (ret == 1) - return avpriv_dict_set_timestamp(&s->metadata, "creation_time", timestamp); - return ret; -} - int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf) { int ret; diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index 9c67a6d3e8..7e28b2082e 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -25,12 +25,12 @@ * @author Zhentan Feng */ -#include "libavutil/intreadwrite.h" #include "libavutil/avassert.h" #include "avformat.h" #include "avio_internal.h" #include "internal.h" #include "mpegts.h" +#include "mux.h" #include "wtv.h" #define WTV_BIGSECTOR_SIZE (1 << WTV_BIGSECTOR_BITS)