diff options
author | wm4 <wm4@nowhere> | 2014-06-01 17:56:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-01 17:56:10 +0200 |
commit | 556bb1cf138711153b4fe5a51f22372f717a0b1e (patch) | |
tree | f4f35ca738980aef1a63503840ae5a0b272fc7da /demux/demux_lavf.c | |
parent | b5e40e15a3e35f0b48345b949a86f8862bca3b8b (diff) | |
download | mpv-556bb1cf138711153b4fe5a51f22372f717a0b1e.tar.bz2 mpv-556bb1cf138711153b4fe5a51f22372f717a0b1e.tar.xz |
demux_lavf: support new rotation metadata API
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r-- | demux/demux_lavf.c | 12 |
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"); |