diff options
Diffstat (limited to 'contrib/ffmpeg/A09-pgs-pts.patch')
-rw-r--r-- | contrib/ffmpeg/A09-pgs-pts.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A09-pgs-pts.patch b/contrib/ffmpeg/A09-pgs-pts.patch new file mode 100644 index 000000000..b03f5acce --- /dev/null +++ b/contrib/ffmpeg/A09-pgs-pts.patch @@ -0,0 +1,82 @@ +diff -Naur ffmpeg-v0.7-1696-gcae4f4b.orig/libavcodec/avcodec.h ffmpeg-v0.7-1696-gcae4f4b/libavcodec/avcodec.h +--- ffmpeg-v0.7-1696-gcae4f4b.orig/libavcodec/avcodec.h 2011-11-03 12:29:48.000000000 +0100 ++++ ffmpeg-v0.7-1696-gcae4f4b/libavcodec/avcodec.h 2012-04-22 10:59:41.122351884 +0200 +@@ -3193,6 +3193,7 @@ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE ++ uint8_t forced; + } AVSubtitle; + + /* packet functions */ +diff -Naur ffmpeg-v0.7-1696-gcae4f4b.orig/libavcodec/pgssubdec.c ffmpeg-v0.7-1696-gcae4f4b/libavcodec/pgssubdec.c +--- ffmpeg-v0.7-1696-gcae4f4b.orig/libavcodec/pgssubdec.c 2011-11-03 12:29:48.000000000 +0100 ++++ ffmpeg-v0.7-1696-gcae4f4b/libavcodec/pgssubdec.c 2012-04-22 13:09:29.499671541 +0200 +@@ -45,6 +45,8 @@ + int y; + int id_number; + int object_number; ++ uint8_t composition_flag; ++ int64_t pts; + } PGSSubPresentation; + + typedef struct PGSSubPicture { +@@ -271,7 +273,8 @@ + * @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; + +@@ -280,6 +283,8 @@ + 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) +@@ -299,16 +304,17 @@ + buf += 3; + + ctx->presentation.object_number = bytestream_get_byte(&buf); ++ ctx->presentation.composition_flag = 0; + if (!ctx->presentation.object_number) + return; + + /* +- * Skip 4 bytes of unknown: ++ * Skip 3 bytes of unknown: + * object_id_ref (2 bytes), + * window_id_ref, +- * composition_flag (0x80 - object cropped, 0x40 - object forced) + */ +- buf += 4; ++ buf += 3; ++ ctx->presentation.composition_flag = bytestream_get_byte(&buf); + + x = bytestream_get_be16(&buf); + y = bytestream_get_be16(&buf); +@@ -356,6 +362,9 @@ + */ + + memset(sub, 0, sizeof(*sub)); ++ sub->pts = ctx->presentation.pts; ++ sub->forced = (ctx->presentation.composition_flag & 0x40) != 0; ++ + // Blank if last object_number was 0. + // Note that this may be wrong for more complex subtitles. + if (!ctx->presentation.object_number) +@@ -441,7 +450,7 @@ + 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: + /* |