From patchwork Mon Sep 19 09:46:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 38044 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1112910pzh; Mon, 19 Sep 2022 02:46:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GIo3bQGZakKOGuSvfFRAzSkfjZnU2+dAHPckLFvOtaQZzOTQ0NPn/bcOE7Fzt2iYFPDOy X-Received: by 2002:aa7:d6d9:0:b0:44d:e1b7:d905 with SMTP id x25-20020aa7d6d9000000b0044de1b7d905mr14866978edr.32.1663580815732; Mon, 19 Sep 2022 02:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663580815; cv=none; d=google.com; s=arc-20160816; b=Q+N5wIpsMJ3/XktAC0j8pf2zqD2C6LzSKm5QwZE0jjcvXP7o//Tp0kMp/sY+uVpXZj Bi1/mt/ubzOoSKX3KpWqsCes+XYWyu18LCXzWjE0Ia0JeNgLNUIiNeK3npuj7ea3oK5Y 5RBehO0+8NcOGlyBNK1U8SrbH1W81YFdEwsovpv5UoW5azZABP1HuoE/i5F5mtyIZ47d Cjm2q+8Se11EQw5SdteKwag36hJvXvZy02gi7YJPOx/18+TbuzOpO6jyQJuHkitBrsgD g6lrOkGnUaep8dgGXnKfal7q+4+9hrUi/mRwewJIsL4bFbL0iN35xigCLvXQ482kOgKo NT6g== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=2/wD969omf/yNRBDBw8DhAto81zGucjst01l483mQ60=; b=loGndAWJcf1AyZlNz9Qt2yY2e6W98uMDDFL2GtJn3GCpKcxqsMClvPsOlLWwAl6axb dxKInsKjKRAG6svg+9dk8MAfkR31at182US4rWlF8izjize0L1LC3ghtd34TCM6ciPL6 jsUBYKSOcE3jWxItF8yrNP85stnAG5IZlObwKTEXas6i6S1yiAgb+HTijkfaSKidH4hy AziITt1qt/iLmwhu5hLCrRN3tkVTXs0SVCdEstZJRqzQr+kgyyVXZknz2j4dFA7Ymd0c kUMdJ5zkGw2i8Nic7+hHyIDoPLubkUn021OHgz9KjlUZ+MP/jH9KJGeAxsp2Sx5U7FPN izxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de header.s=mailde202009 header.b=0dRtNrBQ; 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=NONE dis=NONE) header.from=mail.de Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bf26-20020a0564021a5a00b0044ea569baa2si8171208edb.557.2022.09.19.02.46.55; Mon, 19 Sep 2022 02:46:55 -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=@mail.de header.s=mailde202009 header.b=0dRtNrBQ; 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=NONE dis=NONE) header.from=mail.de Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64A4E68BC73; Mon, 19 Sep 2022 12:46:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from shout01.mail.de (shout01.mail.de [62.201.172.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B995D68BC13 for ; Mon, 19 Sep 2022 12:46:11 +0300 (EEST) Received: from postfix01.mail.de (postfix01.bt.mail.de [10.0.121.125]) by shout01.mail.de (Postfix) with ESMTP id 4F9E7A060D for ; Mon, 19 Sep 2022 11:46:07 +0200 (CEST) Received: from smtp01.mail.de (smtp01.bt.mail.de [10.0.121.211]) by postfix01.mail.de (Postfix) with ESMTP id 36907802BB for ; Mon, 19 Sep 2022 11:46:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1663580767; bh=5OnZzPO2Ai5D9vjuBDp/Y4pMweq4FJg0VpKhbkEGy5E=; h=From:To:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=0dRtNrBQmN/UMcUgSdzcwVU4WTzc3n3Ix3U/rdnU9zBOxaTjDk9e7PG5Gm83drZ8d 9cTU5YhuHI9Gg0rwr6rv6uK192rJvhSlwoj56n5TIqo+sylg3dk8Ji40dBSDzNh003 +HzJqiv9OoClP1FNgaCXwpnE4IppjsXMameb9UzC8PSsFtCm1oum1WcWQPoYn0K4wF 8BBS8xr8fhz5UARS2kHsmMnjEBIdpOozUrz42YjIt2pn+OWLBxoXJ+DbSwTCZg4fHn OWbhoLGYWQAiKi62bqVzZpu0gxo/LrXJJbpHy7My/hBT5GZdSPcf4Q/T2wXCcr4buZ 9m4Qt1CA7ygKw== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp01.mail.de (Postfix) with ESMTPSA id E887B10015D for ; Mon, 19 Sep 2022 11:46:06 +0200 (CEST) From: Thilo Borgmann To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Sep 2022 11:46:04 +0200 Message-Id: <20220919094604.4645-7-thilo.borgmann@mail.de> In-Reply-To: <20220919094604.4645-1-thilo.borgmann@mail.de> References: <20220919094604.4645-1-thilo.borgmann@mail.de> MIME-Version: 1.0 X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 3361 X-purgate-ID: 154282::1663580767-CD7F95FC-7CDBB470/0/0 Subject: [FFmpeg-devel] [PATCH v4 6/6] ffmpeg: Deprecate display rotation override with a metadata key 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: ztE22cBbfyOR From: Jan Ekström Now that we have proper options for defining display matrix overrides, this should no longer be required. fftools does not have its own versioning, so for now the define is just set to 1 and disables the functionality if set to zero. --- fftools/ffmpeg.c | 2 ++ fftools/ffmpeg.h | 5 +++++ fftools/ffmpeg_opt.c | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0e1477299d..65b0b83a18 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2831,12 +2831,14 @@ static int init_output_stream_streamcopy(OutputStream *ost) } } +#if FFMPEG_ROTATION_METADATA if (ost->rotate_overridden) { uint8_t *sd = av_stream_new_side_data(ost->st, AV_PKT_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9); if (sd) av_display_rotation_set((int32_t *)sd, -ost->rotate_override_value); } +#endif switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 524a1d415a..c134b15726 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -53,6 +53,7 @@ #define FFMPEG_OPT_PSNR 1 #define FFMPEG_OPT_MAP_CHANNEL 1 #define FFMPEG_OPT_MAP_SYNC 1 +#define FFMPEG_ROTATION_METADATA 1 enum VideoSyncMethod { VSYNC_AUTO = -1, @@ -532,11 +533,15 @@ typedef struct OutputStream { int is_cfr; int force_fps; int top_field_first; +#if FFMPEG_ROTATION_METADATA int rotate_overridden; +#endif int autoscale; int bitexact; int bits_per_raw_sample; +#if FFMPEG_ROTATION_METADATA double rotate_override_value; +#endif AVRational frame_aspect_ratio; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index ba56267460..71e62d0aa7 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2960,16 +2960,26 @@ static void of_add_metadata(AVFormatContext *oc, const OptionsContext *o) for (int j = 0; j < oc->nb_streams; j++) { OutputStream *ost = output_streams[nb_output_streams - oc->nb_streams + j]; if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { +#if FFMPEG_ROTATION_METADATA if (!strcmp(o->metadata[i].u.str, "rotate")) { char *tail; double theta = av_strtod(val, &tail); if (!*tail) { ost->rotate_overridden = 1; ost->rotate_override_value = theta; + + av_log(NULL, AV_LOG_WARNING, + "Conversion of a 'rotate' metadata key to a " + "proper display matrix rotation is deprecated. " + "See -display_matrix for setting rotation " + "instead."); } } else { +#endif av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0); +#if FFMPEG_ROTATION_METADATA } +#endif } else if (ret < 0) exit_program(1); }