aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/patches
diff options
context:
space:
mode:
authorMemphiz <memphis@machzwo.de>2012-09-16 14:59:53 +0200
committerMemphiz <memphis@machzwo.de>2012-09-30 22:19:35 +0200
commitff6eaed9c5d8663afb0bfbc6f95eb7a6c2d7aafc (patch)
treeb3acee4eaee7db2cc64075a56bab93989618c5e4 /lib/ffmpeg/patches
parente3b35ff1f7aac89e72e32224d2e08191d8015532 (diff)
[ffmpeg] - patch file for PGS subtitle fixes
Diffstat (limited to 'lib/ffmpeg/patches')
-rw-r--r--lib/ffmpeg/patches/0032-PGS-use-the-PTS-from-the-presentation-segment.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/lib/ffmpeg/patches/0032-PGS-use-the-PTS-from-the-presentation-segment.patch b/lib/ffmpeg/patches/0032-PGS-use-the-PTS-from-the-presentation-segment.patch
new file mode 100644
index 0000000000..7e26c66bb3
--- /dev/null
+++ b/lib/ffmpeg/patches/0032-PGS-use-the-PTS-from-the-presentation-segment.patch
@@ -0,0 +1,64 @@
+diff --git a/lib/ffmpeg/libavcodec/pgssubdec.c b/lib/ffmpeg/libavcodec/pgssubdec.c
+index 2785d25..02e650a 100644
+--- a/lib/ffmpeg/libavcodec/pgssubdec.c
++++ b/lib/ffmpeg/libavcodec/pgssubdec.c
+@@ -64,6 +64,7 @@ typedef struct PGSSubContext {
+ PGSSubPresentation presentation;
+ uint32_t clut[256];
+ PGSSubPicture pictures[UINT16_MAX];
++ int64_t pts;
+ } PGSSubContext;
+
+ static av_cold int init_decoder(AVCodecContext *avctx)
+@@ -377,6 +378,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
+ {
+ AVSubtitle *sub = data;
+ PGSSubContext *ctx = avctx->priv_data;
++ int64_t pts;
+
+ uint16_t rect;
+
+@@ -386,7 +388,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)
+@@ -431,8 +436,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;
+@@ -477,6 +484,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:
+ /*
+diff --git a/lib/ffmpeg/libavcodec/utils.c b/lib/ffmpeg/libavcodec/utils.c
+index 99bf27c..c1cde2c 100644
+--- a/lib/ffmpeg/libavcodec/utils.c
++++ b/lib/ffmpeg/libavcodec/utils.c
+@@ -1396,6 +1396,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
+ avctx->pkt = avpkt;
+ *got_sub_ptr = 0;
+ avcodec_get_subtitle_defaults(sub);
++ if (avctx->time_base.den && avpkt->pts != AV_NOPTS_VALUE)
++ sub->pts = av_rescale_q(avpkt->pts,
++ avctx->time_base, AV_TIME_BASE_Q);
+ ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
+ if (*got_sub_ptr)
+ avctx->frame_number++;