summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-08 17:07:24 +0100
committerCarl Hetherington <cth@carlh.net>2018-06-08 17:07:24 +0100
commit383c3b6c81e916c59b08a765540784d3f2350276 (patch)
tree8726ada4d0bf1aa5cb8d97901a53b1fcd1966ea7 /src/lib/ffmpeg_content.cc
parent677344e05e5c8483d39430ab5058f1ff8114fd9e (diff)
Auto-rotate videos.
Diffstat (limited to 'src/lib/ffmpeg_content.cc')
-rw-r--r--src/lib/ffmpeg_content.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 2233f5f8c..cbeebd817 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -274,6 +274,18 @@ FFmpegContent::examine (shared_ptr<Job> job)
_color_trc = examiner->color_trc ();
_colorspace = examiner->colorspace ();
_bits_per_pixel = examiner->bits_per_pixel ();
+
+ if (examiner->rotation()) {
+ double rot = *examiner->rotation ();
+ if (fabs (rot - 180) < 1.0) {
+ _filters.push_back (Filter::from_id ("vflip"));
+ _filters.push_back (Filter::from_id ("hflip"));
+ } else if (fabs (rot - 90) < 1.0) {
+ _filters.push_back (Filter::from_id ("90clock"));
+ } else if (fabs (rot - 270) < 1.0) {
+ _filters.push_back (Filter::from_id ("90anticlock"));
+ }
+ }
}
if (!examiner->audio_streams().empty ()) {