Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Thilo Borgmann <thilo.borgmann@mail.de>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v2 3/4] ffmpeg: Deprecate display rotation override with a metadata key
Date: Mon, 15 Aug 2022 22:02:14 +0200
Message-ID: <16f3b7f9-2296-d459-9135-8e6e86e8e3de@mail.de> (raw)
In-Reply-To: <b4fb59b6-de3a-c011-8ea2-5595fca39568@mail.de>

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

$subject

-Thilo

[-- Attachment #2: v2-0003-ffmpeg-Deprecate-display-rotation-override-with-a.patch --]
[-- Type: text/plain, Size: 3493 bytes --]

From 2c556c126b77b7bc90749096f858daa6124cf097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= <jeebjp@gmail.com>
Date: Mon, 15 Aug 2022 20:58:05 +0200
Subject: [PATCH v2 3/4] ffmpeg: Deprecate display rotation override with a
 metadata key

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 8eb7759392..b0a8839129 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2824,12 +2824,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 0ea730fd42..12125ac006 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,
@@ -520,11 +521,15 @@ typedef struct OutputStream {
     const char *fps_mode;
     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 e184b4239c..f6551621c3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2930,16 +2930,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);
             }
-- 
2.20.1 (Apple Git-117)


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2022-08-15 20:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 19:58 [FFmpeg-devel] [PATCH v2 1/4] fftools: Add support for dictionary options Thilo Borgmann
2022-08-15 20:02 ` [FFmpeg-devel] [PATCH v2 2/4] ffmpeg: Add display_matrix option Thilo Borgmann
2022-08-16  4:03   ` Gyan Doshi
2022-08-16 14:10   ` Anton Khirnov
2022-08-16 18:48     ` Thilo Borgmann
2022-08-17  8:18       ` Anton Khirnov
2022-08-17  8:50         ` Gyan Doshi
2022-08-17  8:59           ` Nicolas George
2022-08-17  9:05           ` Anton Khirnov
2022-08-17 10:53             ` Gyan Doshi
2022-08-17 12:25               ` Anton Khirnov
2022-08-18 10:58                 ` Gyan Doshi
2022-08-20 13:32                   ` Thilo Borgmann
2022-08-20 13:39                     ` Nicolas George
2022-08-20 13:48                       ` Thilo Borgmann
2022-08-22 12:30                         ` Nicolas George
2022-09-07 16:05                           ` Thilo Borgmann
2022-08-18  7:11           ` Anton Khirnov
2022-08-17  6:26   ` Marton Balint
2022-08-15 20:02 ` Thilo Borgmann [this message]
2022-08-15 20:02 ` [FFmpeg-devel] [PATCH v2 4/4] ffmpeg: Allow printing of option arguments in help output Thilo Borgmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16f3b7f9-2296-d459-9135-8e6e86e8e3de@mail.de \
    --to=thilo.borgmann@mail.de \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git