[FFmpeg-cvslog] hevc: set time_base when possible

Guillaume Martres git at videolan.org
Wed Dec 11 23:18:09 CET 2013


ffmpeg | branch: master | Guillaume Martres <smarter at ubuntu.com> | Tue Dec 10 15:42:29 2013 +0100| [17a10d51b8351ce9a57fcb6537b6a3c6ec8ba5e9] | committer: Anton Khirnov

hevc: set time_base when possible

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17a10d51b8351ce9a57fcb6537b6a3c6ec8ba5e9
---

 libavcodec/hevc.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index d969f5e..4af5aee 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -388,6 +388,7 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
 static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 {
     int ret;
+    int num = 0, den = 0;
 
     pic_arrays_free(s);
     ret = pic_arrays_init(s, sps);
@@ -432,6 +433,19 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 
     s->sps = sps;
     s->vps = (HEVCVPS*) s->vps_list[s->sps->vps_id]->data;
+
+    if (s->vps->vps_timing_info_present_flag) {
+        num = s->vps->vps_num_units_in_tick;
+        den = s->vps->vps_time_scale;
+    } else if (sps->vui.vui_timing_info_present_flag) {
+        num = sps->vui.vui_num_units_in_tick;
+        den = sps->vui.vui_time_scale;
+    }
+
+    if (num != 0 && den != 0)
+        av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
+                  num, den, 1 << 30);
+
     return 0;
 
 fail:



More information about the ffmpeg-cvslog mailing list