summaryrefslogtreecommitdiff
path: root/libavcodec/dvdsubdec.c
diff options
context:
space:
mode:
authorNicholas Robbins <nickrobbins-at-yahoo.com@ffmpeg.org>2014-09-20 07:53:44 -0400
committerMichael Niedermayer <michaelni@gmx.at>2014-09-22 21:01:13 +0200
commitc7d21dee2856da817b5c1ce3746adbcce5420f9e (patch)
treef57186aaa3620021fe2ccdc06027956a270ce619 /libavcodec/dvdsubdec.c
parent1cf28fd5f3f6fa406fc15aef59e3551807e75cee (diff)
libavcodec/dvdsubdec: Add option forced_subs_only to only decode forced subtitle frames.
Signed-off-by: Nicholas Robbins <nickrobbins@yahoo.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dvdsubdec.c')
-rw-r--r--libavcodec/dvdsubdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index c7973f05aa..bb28d9e3b7 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -39,6 +39,7 @@ typedef struct DVDSubContext
uint8_t alpha[256];
uint8_t *buf;
int buf_size;
+ int forced_subs_only;
#ifdef DEBUG
int sub_id;
#endif
@@ -548,6 +549,9 @@ static int dvdsub_decode(AVCodecContext *avctx,
if (!is_menu && find_smallest_bounding_rectangle(sub) == 0)
goto no_subtitle;
+ if (ctx->forced_subs_only && !(sub->rects[0]->flags & AV_SUBTITLE_FLAG_FORCED))
+ goto no_subtitle;
+
#if defined(DEBUG)
{
char ppm_name[32];
@@ -652,6 +656,7 @@ static av_cold int dvdsub_close(AVCodecContext *avctx)
#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "palette", "set the global palette", OFFSET(palette_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
+ { "forced_subs_only", "Only show forced subtitles", OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SD},
{ NULL }
};
static const AVClass dvdsub_class = {