From patchwork Sun Sep 25 16:15:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 38290 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1759919pzh; Sun, 25 Sep 2022 09:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AFWiw5ueUY4KZnV6znQ9+fi/XQyRP74pZVNS/snEDBY+Cdhd9I7X4gMM/ihtOxDelCUkQ X-Received: by 2002:a05:6402:380a:b0:451:ae08:7a6c with SMTP id es10-20020a056402380a00b00451ae087a6cmr17906172edb.161.1664122545397; Sun, 25 Sep 2022 09:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664122545; cv=none; d=google.com; s=arc-20160816; b=W76XwxfB+XjXNccyIeP4I9V0xs9dE63w+EhReRELqky2KxcLUkaDreF+IfH2xPIda/ ZfqXQ9S7xgrAUsAB3vQg/oBO8VcDXgT/gjQR/q/mb++jYCbmvkTgNun3m36nmgLdN1OU DBcWa4TKT8e1hQ5RCh2XReGa8jncXARdzdmP4DtQdBcTtM6lfp86sna94Y/CzWuHttdC fm4p1P3FySK51yExZs8L7kZiIC1DWw3tpcZw4L9NKZ3EvhWA7ak4OECb7KEX21CDFPcq Xc/z5v8by25aNSSCq7A80dQf2LGjDqrcL5rjsBBljhiDwX8UtQWgo7rpa4lDLfkyCb5N r0nA== 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=C92Z671h6zRTX57AeBH9YodM+w+7rSwqLV2I5ijzYR0=; b=lh1kRVsZ0rVAx6j+bh8SfhMIQLyizTpl5Fs5n4S4NswgrAB4nUlFXz3vbweD1Lzw/c BcI9VZQqZQeBYufucAeW9oZtnmeb7JhEUaw9t4ZweBMOJk/FeJNXG03R0iI6GkwcbktD Y4EW9N/JWiAPK44EaFXCyZR0Fxdezu2mbYIBJfHlIFU1TRl6LMU/1vcVYnomf0T7msqj PXkpnZD8Q/2Wv5iZ7jPLMxz4LmL7fc1MG7THmmdCQfHLSmGpXjQcXki+l5uwknglzoBt htouOdl9ihvMLMYBiCRSwsgNXyEvP1eZ+OLY6ps/lhBfFMypX+Rd65i1X9P+Hc1Y/F9M ekVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de header.s=mailde202009 header.b=25PLTwiF; 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 qk30-20020a1709077f9e00b00779a07b4e90si8217502ejc.711.2022.09.25.09.15.45; Sun, 25 Sep 2022 09:15:45 -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=25PLTwiF; 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 EF9FE68BB36; Sun, 25 Sep 2022 19:15:20 +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 3561768B75F for ; Sun, 25 Sep 2022 19:15:14 +0300 (EEST) Received: from postfix02.mail.de (postfix02.bt.mail.de [10.0.121.126]) by shout01.mail.de (Postfix) with ESMTP id 255FEA057B for ; Sun, 25 Sep 2022 18:15:09 +0200 (CEST) Received: from smtp01.mail.de (smtp01.bt.mail.de [10.0.121.211]) by postfix02.mail.de (Postfix) with ESMTP id 0C80FA03C1 for ; Sun, 25 Sep 2022 18:15:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1664122509; bh=5aQT8xjZOu61UTTEfsF7ywb25VdqzZaomNh0cEbc/00=; h=From:To:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=25PLTwiFDdScvMJuGuow8olKC0kmx+9wPD8fvV3rOTwB9zYTrmJMPTeGkkzuo8cob xB0R9SnOxExjOf650CUmqieF0eCdUVTB0yIIvP7xSV21rXLW5k3eI7VpnI35OSy4OH sswUz0s9vQ35dy2mLat/gZStDX/g6dxAN1Jmcby2nQ1P6+UvjtuHyi0rGbMaRdzD55 V04zTn9L8mwBaInw6r/j/Nkkfyj3JfSpTRkHL1J0luUCtb4rO4ucfsYk/Ulhj/Tbll KvoK0UdV7cC8tmmOAWvyZ4HqZwJM4rRV04Lxc5WFV97QjwxLbr6cZ7xiIRvvkqm7sq Q5rRdZPussEvQ== 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 BCF4E100114 for ; Sun, 25 Sep 2022 18:15:08 +0200 (CEST) From: Thilo Borgmann To: ffmpeg-devel@ffmpeg.org Date: Sun, 25 Sep 2022 18:15:06 +0200 Message-Id: <20220925161506.80724-4-thilo.borgmann@mail.de> In-Reply-To: <20220925161506.80724-1-thilo.borgmann@mail.de> References: <20220925161506.80724-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: 3363 X-purgate-ID: 154282::1664122508-DDDB75FC-3E936B43/0/0 Subject: [FFmpeg-devel] [PATCH v5 3/3] 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: bG2PWj2H1DDf 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 44a838d29b..3d2b39b78a 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, @@ -538,11 +539,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 52709ca133..a609f01599 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2870,16 +2870,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_rotation 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); }