From patchwork Mon Sep 26 05:57:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 38322 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp2046066pzh; Sun, 25 Sep 2022 22:58:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Fgb4/OdcxU/XDvxFjtIwoUQ0AqEsneyzX91NfdlBqKsi8loKIh3k4OCeaB1mXfrsVo4DE X-Received: by 2002:a05:6402:2804:b0:439:83c2:8be2 with SMTP id h4-20020a056402280400b0043983c28be2mr20956042ede.292.1664171905902; Sun, 25 Sep 2022 22:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664171905; cv=none; d=google.com; s=arc-20160816; b=D0xSYgw+9nBYA0Nw9RK4+IvZQ9u1v80dNxlJFlcSmXIJ1rWST4N9AbgyGyr4vsNQs8 BERAI0rZLP8tTOefuej9SBHB14jmm/MVFLu2g5iqIy/4b6SSBaZCOuthPv/cyo5UpUWq gBt8Bs7GOWJvQiiqQ3q3nYPFw8PMAFg1WxYJi2lv28o6nI5oDXlDRmiur2vsBK+ppQXw nis2Bf9ApuMSbEHn0fRiDXFs8kcPKk+jYZlvJO0EMhLrPjBVTk5eI+nlvUFZT1sfuEHX ZzHoMn+LWi+hBx7Y9FqjMyS5oWSy9hEgBOb5SH9pZxHRYkSO3QqJW+yG/lhyKwkVbLC4 xsTw== 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=iQPgTTdxeruY8NGREHkyPN9luGVhePs1CvSmIox4QAg=; b=iCXLlw3ZUGj0DY1guMJPwFrOVc4FHUY8LLM24Y5MDgMI/D8SO8O8tPgLv393hQ9Bla O7zwtudAAst3mAnZoP662pbrc3nIY7oVndkVbTIf0+ktea89nlUmS2EZBIi88RLMkzAf 67n/gjnYOKIMI5NDLPZq/NpDidw2JDRdJlAXHa1I2infj3PWLgwS2YHY5MAwy/eDIqkh nzkCq6l3/Nhb5I0RN4Wk1rcxiYQDOTY+/QQSKP+I5E/AOhvdsN+0cfKfadmoakqn4lJm wQKgVWOkB1KvW6Ifq9iqpbu2/Wk6ZcYymi4yxe8Gz8ex3CuMT/M/7DouFa+vtRTgRMMe lgQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de header.s=mailde202009 header.b="votu/GIR"; 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 ay16-20020a170906d29000b007703822e214si14286292ejb.807.2022.09.25.22.58.25; Sun, 25 Sep 2022 22:58: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=@mail.de header.s=mailde202009 header.b="votu/GIR"; 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 B26BE68BA4E; Mon, 26 Sep 2022 08:58:04 +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 4872E68B5C8 for ; Mon, 26 Sep 2022 08:57:56 +0300 (EEST) Received: from postfix01.mail.de (postfix01.bt.mail.de [10.0.121.125]) by shout01.mail.de (Postfix) with ESMTP id DF2FEA0762 for ; Mon, 26 Sep 2022 07:57:55 +0200 (CEST) Received: from smtp04.mail.de (smtp04.bt.mail.de [10.0.121.214]) by postfix01.mail.de (Postfix) with ESMTP id C651880172 for ; Mon, 26 Sep 2022 07:57:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1664171875; bh=hH1CGFhWKzur437m9uR2HF4dOGeL7DNftBsCXo4Raww=; h=From:To:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=votu/GIRKFNgj4xGj5nZ6PZLrCkNwR8mmAQQg2mCs1JnSmcgQKb/uaAX4SWus9wtN aYNLo5/cS1PtBotdKE/x6M67BeZCStt2/FakhQ2CifWBSwoUCq3Zoll988EVkxB0vK BBEXyg3GLYI1mqrwNYfgi6ZldjanKcomnK04LLn2dvJTkVRFzBiDvZh29yRgFtadtw pV++21o7Yud3VMpFLIJkvPu7CEZxavZzkxI5aKiyVEGOsJ8HppWQNuxz44sl3MP5n4 cGLr4GI0ISqiTJqHdzf7jOr0QV4+h52evFe1mtg8QC3QvRpu12CkSKYOQQT0LtsVom hSohihEJXRJbw== 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 smtp04.mail.de (Postfix) with ESMTPSA id 8E6E9C003B for ; Mon, 26 Sep 2022 07:57:55 +0200 (CEST) From: Thilo Borgmann To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Sep 2022 07:57:53 +0200 Message-Id: <20220926055753.88407-3-thilo.borgmann@mail.de> In-Reply-To: <20220926055753.88407-1-thilo.borgmann@mail.de> References: <20220926055753.88407-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::1664171875-000016C9-B1E5DEE0/0/0 Subject: [FFmpeg-devel] [PATCH v6 2/2] 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: nnJL3BP7BQ8E 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 c529baacc4..529d94bea8 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, @@ -536,11 +537,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 f07858333d..3f2409ee28 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2859,16 +2859,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); }