On 11/02/2012 08:20 AM, Diego Biurrun wrote:
> On Sun, Oct 14, 2012 at 04:52:12PM +0200, John Stebbins wrote:
>> pts should be that of the packet containing the presentation segment.
>> ---
>>  libavcodec/pgssubdec.c |    9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
> ping, anybody?
>
>
Patch updated to apply cleanly to head.

-- 
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7

From d4522c73106fe37686154ca924811bb895817782 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins...@gmail.com>
Date: Fri, 2 Nov 2012 09:30:39 -0700
Subject: [PATCH] PGS subtitles: Set AVSubtitle pts value

pts should be that of the packet containing the presentation segment.
---
 libavcodec/pgssubdec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 0326ea8..f22088a 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -46,6 +46,7 @@ typedef struct PGSSubPresentation {
     int id_number;
     int object_number;
     uint8_t composition_flag;
+    int64_t pts;
 } PGSSubPresentation;
 
 typedef struct PGSSubPicture {
@@ -272,7 +273,8 @@ static void parse_palette_segment(AVCodecContext *avctx,
  * @todo TODO: Implement forcing of subtitles
  */
 static void parse_presentation_segment(AVCodecContext *avctx,
-                                       const uint8_t *buf, int buf_size)
+                                       const uint8_t *buf, int buf_size,
+                                       int64_t pts)
 {
     PGSSubContext *ctx = avctx->priv_data;
 
@@ -281,6 +283,8 @@ static void parse_presentation_segment(AVCodecContext *avctx,
     int w = bytestream_get_be16(&buf);
     int h = bytestream_get_be16(&buf);
 
+    ctx->presentation.pts = pts;
+
     av_dlog(avctx, "Video Dimensions %dx%d\n",
             w, h);
     if (av_image_check_size(w, h, 0, avctx) >= 0)
@@ -358,6 +362,8 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
      */
 
     memset(sub, 0, sizeof(*sub));
+    sub->pts = ctx->presentation.pts;
+
     // Blank if last object_number was 0.
     // Note that this may be wrong for more complex subtitles.
     if (!ctx->presentation.object_number)
@@ -446,7 +452,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
             parse_picture_segment(avctx, buf, segment_length);
             break;
         case PRESENTATION_SEGMENT:
-            parse_presentation_segment(avctx, buf, segment_length);
+            parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
             break;
         case WINDOW_SEGMENT:
             /*
-- 
1.7.11.7

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to