On Mon, Mar 28, 2016 at 06:52:26PM +0200, wm4 wrote:
> On Mon, 28 Mar 2016 18:44:33 +0200
> Michael Niedermayer <mich...@niedermayer.cc> wrote:
> 
> > On Mon, Mar 28, 2016 at 02:15:50PM +0200, Clément Bœsch wrote:
> > > 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  
> > 
> > this change does make sense
> > 
> > do all apps that get into this code set avctx->pkt_timebase so that
> > this works though or is it otherwise guranteed to be set ?
> > 
> > [...]
> 
> No they don't. It's an API change.

New patch attached.

-- 
Clément B.
From a885683c02fce7037e882e52216afa8a96aaf1e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <u...@pkh.me>
Date: Mon, 28 Mar 2016 14:15:42 +0200
Subject: [PATCH 2/2] lavc/utils: use pkt_timebase for legacy subtitles timing
 code

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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c625bbc..793f589 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2582,8 +2582,11 @@ 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) {
+                const AVRational tb = avctx->pkt_timebase.num ? avctx->pkt_timebase
+                                                              : avctx->time_base;
+                ret = convert_sub_to_old_ass_form(sub, avpkt, tb);
+            }
 #endif
 
             if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
-- 
2.7.4

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to