aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-02 22:21:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-02 22:31:20 +0200
commitdeedf3e590027e53cf999b11a25fc9be9615b5f2 (patch)
treea08c124244e22d1a0e416fbfcaaaff7e2238f469
parente874772f70908ad5b1754c0373a35bec08fad547 (diff)
parente2d50fc2f5f3600e13055acf1a10fec35e941f37 (diff)
downloadffmpeg-deedf3e590027e53cf999b11a25fc9be9615b5f2.tar.gz
Merge commit 'e2d50fc2f5f3600e13055acf1a10fec35e941f37'
* commit 'e2d50fc2f5f3600e13055acf1a10fec35e941f37': avplay: Add support for rotated video Conflicts: configure doc/ffplay.texi ffplay.c See: 08c51e12b1c3f3e3e68e33eb46be7131df5b3682 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/ffplay.texi2
-rw-r--r--ffplay.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index d5397a9ecb..1ee3c30469 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -161,7 +161,7 @@ Force a specific video decoder.
Force a specific subtitle decoder.
@item -autorotate
-Automatically rotate the video according to presentation metadata. Enabled by
+Automatically rotate the video according to file metadata. Enabled by
default, use @option{-noautorotate} to disable it.
@item -framedrop
diff --git a/ffplay.c b/ffplay.c
index 28868053cd..826a4732e8 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -32,6 +32,7 @@
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
+#include "libavutil/display.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
@@ -2017,6 +2018,9 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
if (autorotate) {
AVDictionaryEntry *rotate_tag = av_dict_get(is->video_st->metadata, "rotate", NULL, 0);
+ uint8_t* displaymatrix = av_stream_get_side_data(is->video_st,
+ AV_PKT_DATA_DISPLAYMATRIX, NULL);
+
if (rotate_tag && *rotate_tag->value && strcmp(rotate_tag->value, "0")) {
if (!strcmp(rotate_tag->value, "90")) {
INSERT_FILT("transpose", "clock");
@@ -2030,6 +2034,16 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
snprintf(rotate_buf, sizeof(rotate_buf), "%s*PI/180", rotate_tag->value);
INSERT_FILT("rotate", rotate_buf);
}
+ } else if (displaymatrix) {
+ double rot = av_display_rotation_get((int32_t*) displaymatrix);
+ if (rot < -135 || rot > 135) {
+ INSERT_FILT("vflip", NULL);
+ INSERT_FILT("hflip", NULL);
+ } else if (rot < -45) {
+ INSERT_FILT("transpose", "dir=clock");
+ } else if (rot > 45) {
+ INSERT_FILT("transpose", "dir=cclock");
+ }
}
}