summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 0d33219dd9..23a89386b7 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -36,6 +36,9 @@
#if HAVE_AVCODEC_REPLAYGAIN_SIDE_DATA
# include <libavutil/replaygain.h>
#endif
+#if HAVE_AV_DISPLAYMATRIX
+# include <libavutil/display.h>
+#endif
#include <libavutil/opt.h>
#include "compat/libav.h"
@@ -482,13 +485,20 @@ static void handle_stream(demuxer_t *demuxer, int i)
if (sh_video->bitrate == 0)
sh_video->bitrate = avfc->bit_rate;
+#if HAVE_AV_DISPLAYMATRIX
+ uint8_t *sd = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+ if (sd)
+ sh_video->rotate = av_display_rotation_get((uint32_t *)sd);
+#else
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
if (rot && rot->value) {
char *end = NULL;
long int r = strtol(rot->value, &end, 10);
if (end && !end[0])
- sh_video->rotate = ((r % 360) + 360) % 360;
+ sh_video->rotate = r;
}
+#endif
+ sh_video->rotate = ((sh_video->rotate % 360) + 360) % 360;
// This also applies to vfw-muxed mkv, but we can't detect these easily.
sh_video->avi_dts = matches_avinputformat_name(priv, "avi");