Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-09-09 18:08:39 +0400
committerNicolas George <nicolas.george@normalesup.org>2012-09-15 18:14:33 +0400
commit37bbc9eb8bdae43d38a6fb7cc1356d1ce7d41e1c (patch)
treec69751d0f6afe6deb0707a3c10a1c9afe36bb634 /libavcodec/pgssubdec.c
parent9dd82724315d651891f2a1ed733c4de06e9cb07a (diff)
lavc/pgssubdec: use the PTS from the presentation segment.
According to the sample for trac ticket #1722, PGS subtitles are decoded from several packets at the same DTS and varying PTS. The PTS from the presentation segment seem to be the valid one; in particular, clear subtitles are too early with the other PTS.
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r--libavcodec/pgssubdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 79ebb55e67..728f178ebd 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -67,6 +67,7 @@ typedef struct PGSSubContext {
PGSSubPresentation presentation;
uint32_t clut[256];
PGSSubPicture pictures[UINT16_MAX];
+ int64_t pts;
int forced_subs_only;
} PGSSubContext;
@@ -378,6 +379,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
{
AVSubtitle *sub = data;
PGSSubContext *ctx = avctx->priv_data;
+ int64_t pts;
uint16_t rect;
@@ -387,7 +389,10 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
* not been cleared by a subsequent empty display command.
*/
+ pts = ctx->pts != AV_NOPTS_VALUE ? ctx->pts : sub->pts;
memset(sub, 0, sizeof(*sub));
+ sub->pts = pts;
+ ctx->pts = AV_NOPTS_VALUE;
// Blank if last object_count was 0.
if (!ctx->presentation.object_count)
@@ -436,8 +441,10 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
static int decode(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
+ PGSSubContext *ctx = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
+ AVSubtitle *sub = data;
const uint8_t *buf_end;
uint8_t segment_type;
@@ -482,6 +489,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
break;
case PRESENTATION_SEGMENT:
parse_presentation_segment(avctx, buf, segment_length);
+ ctx->pts = sub->pts;
break;
case WINDOW_SEGMENT:
/*