[FFmpeg-devel] [PATCH] lavc: use packet duration for subtitles if necessary.

Clément Bœsch ubitux at gmail.com
Thu Apr 4 12:58:57 CEST 2013


On Sun, Mar 24, 2013 at 03:54:34PM +0100, Nicolas George wrote:
> Fix trac ticket #2397.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/utils.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 70c6129..4d99a9a 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2226,6 +2226,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>              ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
>              av_assert1((ret >= 0) >= !!*got_sub_ptr &&
>                         !!*got_sub_ptr >= !!sub->num_rects);
> +
> +            if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
> +                avctx->pkt_timebase.num) {
> +                AVRational ms = { 1, 1000 };
> +                sub->end_display_time = av_rescale_q(avpkt->duration,
> +                                                     avctx->pkt_timebase, ms);
> +            }
> +
>              if (tmp.data != pkt_recoded.data) { // did we recode?
>                  /* prevent from destroying side data from original packet */
>                  pkt_recoded.side_data = NULL;


I confirm it fixes the issue with the sample of the issue for the two
Chinese sub streams with ffmpeg. OTOH, I'm still unable to get them
displayed with ffplay (only first French stream shows up, cycling with 't'
"disables" them). Is this is ffplay specific issue?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130404/f4665c25/attachment.asc>


More information about the ffmpeg-devel mailing list