diff options
author | John Stebbins <jstebbins.hb@gmail.com> | 2012-10-20 09:56:11 -0700 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-11-02 16:13:35 +0100 |
commit | 85f67c4865d8014ded2aaa64b3cba6e2970342d7 (patch) | |
tree | 58d705b05fbb64214147173afb4dda35f3426816 /libavcodec/pgssubdec.c | |
parent | 26f01bd106f62ffe501a9baf609c476051d919da (diff) | |
download | ffmpeg-85f67c4865d8014ded2aaa64b3cba6e2970342d7.tar.gz |
PGS subtitles: Expose forced flag
Useful for detection of subtitles displayed during foreign language
scenes.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r-- | libavcodec/pgssubdec.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 9fd26d80aa..0326ea8f1b 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -45,6 +45,7 @@ typedef struct PGSSubPresentation { int y; int id_number; int object_number; + uint8_t composition_flag; } PGSSubPresentation; typedef struct PGSSubPicture { @@ -299,16 +300,17 @@ static void parse_presentation_segment(AVCodecContext *avctx, 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); @@ -368,6 +370,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data, sub->rects[0] = av_mallocz(sizeof(*sub->rects[0])); sub->num_rects = 1; + if (ctx->presentation.composition_flag & 0x40) + sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED; + sub->rects[0]->x = ctx->presentation.x; sub->rects[0]->y = ctx->presentation.y; sub->rects[0]->w = ctx->picture.w; |