[vlc-commits] avcodec: fix PGS timestamps

Petri Hintukainen git at videolan.org
Tue Dec 1 14:09:37 CET 2015


vlc/vlc-2.2 | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Nov 25 14:47:37 2015 +0200| [ab894eeee8cc7e20b7383b60afd42e54d1093ecb] | committer: Jean-Baptiste Kempf

avcodec: fix PGS timestamps

Display time is not pts of the last block.
avcodec returns decoded subtitle with the correct timestamp.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 9fc361dea16db17f3220974d9b68f1af955b236a)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=ab894eeee8cc7e20b7383b60afd42e54d1093ecb
---

 modules/codec/avcodec/subtitle.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index a8bb19f..db2fbf4 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -82,6 +82,10 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     context->extradata_size = 0;
     context->extradata = NULL;
 
+#if LIBAVFORMAT_VERSION_MICRO >= 100
+    av_codec_set_pkt_timebase(context, AV_TIME_BASE_Q);
+#endif
+
     /* */
     int ret;
     char *psz_opts = var_InheritString(dec, "avcodec-options");
@@ -154,6 +158,7 @@ subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
     av_init_packet(&pkt);
     pkt.data = block->p_buffer;
     pkt.size = block->i_buffer;
+    pkt.pts  = block->i_pts;
 
     int has_subtitle = 0;
     int used = avcodec_decode_subtitle2(sys->p_context,
@@ -176,7 +181,7 @@ subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
     subpicture_t *spu = NULL;
     if (has_subtitle)
         spu = ConvertSubtitle(dec, &subtitle,
-                              block->i_pts > 0 ? block->i_pts : block->i_dts,
+                              subtitle.pts,
                               sys->p_context);
 
     /* */



More information about the vlc-commits mailing list