Commit 79e5902c authored by hakuya's avatar hakuya Committed by Michael Niedermayer

Exposing forced flag for DVD and PGS subtitles

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1f46b50a
...@@ -3158,6 +3158,12 @@ typedef struct AVSubtitleRect { ...@@ -3158,6 +3158,12 @@ typedef struct AVSubtitleRect {
* struct. * struct.
*/ */
char *ass; char *ass;
/**
* 1 indicates this subtitle is a forced subtitle.
* A forced subtitle should be displayed even when subtitles are hidden.
*/
int forced;
} AVSubtitleRect; } AVSubtitleRect;
typedef struct AVSubtitle { typedef struct AVSubtitle {
......
...@@ -356,6 +356,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, ...@@ -356,6 +356,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
sub_header->rects[0]->h = h; sub_header->rects[0]->h = h;
sub_header->rects[0]->type = SUBTITLE_BITMAP; sub_header->rects[0]->type = SUBTITLE_BITMAP;
sub_header->rects[0]->pict.linesize[0] = w; sub_header->rects[0]->pict.linesize[0] = w;
sub_header->rects[0]->forced = is_menu;
} }
} }
if (next_cmd_pos < cmd_pos) { if (next_cmd_pos < cmd_pos) {
......
...@@ -264,6 +264,7 @@ static const AVOption subtitle_rect_options[]={ ...@@ -264,6 +264,7 @@ static const AVOption subtitle_rect_options[]={
{"w", "", SROFFSET(w), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0}, {"w", "", SROFFSET(w), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0},
{"h", "", SROFFSET(h), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0}, {"h", "", SROFFSET(h), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0},
{"type", "", SROFFSET(type), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0}, {"type", "", SROFFSET(type), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0},
{"forced", "", SROFFSET(forced), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 0},
{NULL}, {NULL},
}; };
......
...@@ -423,6 +423,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data, ...@@ -423,6 +423,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
sub->rects[rect]->nb_colors = 256; sub->rects[rect]->nb_colors = 256;
sub->rects[rect]->pict.data[1] = av_mallocz(AVPALETTE_SIZE); sub->rects[rect]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
/* Copy the forced flag */
sub->rects[rect]->forced = (ctx->presentation.objects[rect].composition & 0x40) != 0;
if (!ctx->forced_subs_only || ctx->presentation.objects[rect].composition & 0x40) if (!ctx->forced_subs_only || ctx->presentation.objects[rect].composition & 0x40)
memcpy(sub->rects[rect]->pict.data[1], ctx->clut, sub->rects[rect]->nb_colors * sizeof(uint32_t)); memcpy(sub->rects[rect]->pict.data[1], ctx->clut, sub->rects[rect]->nb_colors * sizeof(uint32_t));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment