summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-29 01:38:21 +0200
committerwm4 <wm4@nowhere>2013-06-29 22:58:14 +0200
commit588eef86c27daec76b573866e1bf0a163bebd3cc (patch)
tree9cdc643ad9a4d5f463e9daca64ba8d554af35818
parentada06703fbc78d2218b045e0e72156a9d9ee240a (diff)
downloadmpv-588eef86c27daec76b573866e1bf0a163bebd3cc.tar.bz2
mpv-588eef86c27daec76b573866e1bf0a163bebd3cc.tar.xz
sd_lavc: respect forced subs only setting for DVD subs
Like the old spudec.c code did. Untested, I (probably) don't have a sample with subtitles that have this flag set.
-rw-r--r--sub/sd_lavc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index cb90e78a56..696f323e60 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -23,6 +23,7 @@
#include "talloc.h"
#include "core/mp_msg.h"
#include "core/av_common.h"
+#include "core/options.h"
#include "demux/stheader.h"
#include "sd.h"
#include "dec_sub.h"
@@ -126,6 +127,7 @@ static void clear(struct sd_lavc_priv *priv)
static void decode(struct sd *sd, struct demux_packet *packet)
{
+ struct MPOpts *opts = sd->opts;
struct sd_lavc_priv *priv = sd->priv;
AVCodecContext *ctx = priv->avctx;
double pts = packet->pts;
@@ -157,6 +159,9 @@ static void decode(struct sd *sd, struct demux_packet *packet)
if (sub.num_rects > 0) {
switch (sub.rects[0]->type) {
case SUBTITLE_BITMAP:
+ priv->count = 0;
+ priv->pts = pts;
+ priv->endpts = endpts;
priv->inbitmaps = talloc_array(priv, struct sub_bitmap,
sub.num_rects);
priv->imgs = talloc_array(priv, struct osd_bmp_indexed,
@@ -165,6 +170,9 @@ static void decode(struct sd *sd, struct demux_packet *packet)
struct AVSubtitleRect *r = sub.rects[i];
struct sub_bitmap *b = &priv->inbitmaps[i];
struct osd_bmp_indexed *img = &priv->imgs[i];
+ if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) &&
+ opts->forced_subs_only)
+ continue;
img->bitmap = r->pict.data[0];
assert(r->nb_colors > 0);
assert(r->nb_colors * 4 <= sizeof(img->palette));
@@ -175,10 +183,8 @@ static void decode(struct sd *sd, struct demux_packet *packet)
b->h = r->h;
b->x = r->x;
b->y = r->y;
+ priv->count++;
}
- priv->count = sub.num_rects;
- priv->pts = pts;
- priv->endpts = endpts;
break;
default:
mp_msg(MSGT_SUBREADER, MSGL_ERR, "sd_lavc: unsupported subtitle "