[FFmpeg-devel] [PATCH] lavc/utils: use pkt_timebase for legacy subtitles timing code

Clément Bœsch u at pkh.me
Mon Mar 28 14:15:50 CEST 2016


This is consistent with other AVSubtitle timing adjustments.
---
 libavcodec/utils.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c625bbc..2c8fc9c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2582,8 +2582,13 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
 
 #if FF_API_ASS_TIMING
             if (avctx->sub_text_format == FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS
-                && *got_sub_ptr && sub->num_rects)
-                ret = convert_sub_to_old_ass_form(sub, avpkt, avctx->time_base);
+                && *got_sub_ptr && sub->num_rects) {
+                if (!avctx->pkt_timebase.num) {
+                    av_log(avctx, AV_LOG_ERROR, "packet time base not set\n");
+                    return AVERROR_BUG;
+                }
+                ret = convert_sub_to_old_ass_form(sub, avpkt, avctx->pkt_timebase);
+            }
 #endif
 
             if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
-- 
2.7.4



More information about the ffmpeg-devel mailing list