summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index db4c8edac9..a765ce8a44 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -575,9 +575,11 @@ static void handle_stream(demuxer_t *demuxer, int i)
/ (float)(codec->height * codec->sample_aspect_ratio.den);
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);
- sh_video->rotate = ((sh_video->rotate % 360) + 360) % 360;
+ if (sd) {
+ double r = av_display_rotation_get((uint32_t *)sd);
+ if (!isnan(r))
+ sh_video->rotate = (((int)(-r) % 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");