@@ -2837,12 +2837,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_dst->codec_type) {
case AVMEDIA_TYPE_AUDIO:
@@ -47,6 +47,8 @@
#include "libswresample/swresample.h"
+#define FFMPEG_ROTATION_METADATA 1
+
enum VideoSyncMethod {
VSYNC_AUTO = -1,
VSYNC_PASSTHROUGH,
@@ -497,10 +499,14 @@ typedef struct OutputStream {
int is_cfr;
int force_fps;
int top_field_first;
+#if FFMPEG_ROTATION_METADATA
int rotate_overridden;
+#endif
int autoscale;
int bits_per_raw_sample;
+#if FFMPEG_ROTATION_METADATA
double rotate_override_value;
+#endif
AVRational frame_aspect_ratio;
@@ -2916,6 +2916,7 @@ loop_end:
for (j = 0; j < oc->nb_streams; j++) {
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);
@@ -2923,9 +2924,18 @@ loop_end:
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);
}