summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-08-07 08:25:28 +0200
committerJohn Stebbins <[email protected]>2017-11-09 09:04:15 -0800
commit9d67804d059c9d0946ba73bba229c69a78ea7439 (patch)
tree5374a1e371698fd22a70b65a2f1071065131d27c /libhb/stream.c
parent8f7da9e73c6fcd98b4d3d1b3fb55d56af555ce05 (diff)
libhb: read video rotation from libav.
Diffstat (limited to 'libhb/stream.c')
-rw-r--r--libhb/stream.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index a2d50447e..ba1d41761 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5543,6 +5543,37 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream, hb_title_t *title )
title->geometry.par.den = ic->streams[i]->sample_aspect_ratio.den;
}
+ int j;
+ for (j = 0; j < ic->streams[i]->nb_side_data; j++)
+ {
+ AVPacketSideData sd = ic->streams[i]->side_data[j];
+ switch (sd.type)
+ {
+ case AV_PKT_DATA_DISPLAYMATRIX:
+ {
+ int rotation = av_display_rotation_get((int32_t *)sd.data);
+ switch (rotation) {
+ case 90:
+ title->rotation = HB_ROTATION_90;
+ break;
+ case 180:
+ case -180:
+ title->rotation = HB_ROTATION_180;
+ break;
+ case -90:
+ case 270:
+ title->rotation = HB_ROTATION_270;
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
title->video_codec = WORK_DECAVCODECV;
title->video_codec_param = codecpar->codec_id;
if (ic->iformat->raw_codec_id != AV_CODEC_ID_NONE)