From 556bb1cf138711153b4fe5a51f22372f717a0b1e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 1 Jun 2014 17:56:10 +0200 Subject: demux_lavf: support new rotation metadata API --- demux/demux_lavf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'demux/demux_lavf.c') 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 #endif +#if HAVE_AV_DISPLAYMATRIX +# include +#endif #include #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"); -- cgit v1.2.3