summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-14 23:45:58 +0200
committerwm4 <wm4@nowhere>2014-08-14 23:53:53 +0200
commit498644afafbcff1bf4f4bcdc1bbc8ef41aae9546 (patch)
tree518b9a7257994bb52a42a89fddb05de99281b899 /sub/sd_lavc.c
parenta7107686d74250d4e4966b661c0e41994df71952 (diff)
downloadmpv-498644afafbcff1bf4f4bcdc1bbc8ef41aae9546.tar.bz2
mpv-498644afafbcff1bf4f4bcdc1bbc8ef41aae9546.tar.xz
sub: call sub_reset() on seeks only
sub_reset() was called on cycling subtitle tracks and on seeking. Since we don't want that subtitles disppear on cycling, sd_lavc.c didn't clear its internal subtitle queue on reset, which meant that seeking with PGS subtitles could leave the subtitle on screen (PGS subtitles usually don't have a duration set). Call it only on seeking, so we can also strictly clear the subtitle queue in sd_lavc. (This still can go very wrong if you disable a subtitle, seek, and enable it again - for example, if used with libavformat that uses "SSA" style demuxed ASS subtitle packets. That shouldn't happen with newer libavformat versions, and the user can "correct" it anyway by executing a seek while the subtitle is selected.)
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index f47bd94f19..72a6915287 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -51,7 +51,6 @@ struct sd_lavc_priv {
struct sub_bitmap *outbitmaps;
int64_t displayed_id;
int64_t new_id;
- bool unknown_pts; // at least one sub with MP_NOPTS_VALUE start
struct mp_image_params video_params;
};
@@ -199,10 +198,8 @@ static void decode(struct sd *sd, struct demux_packet *packet)
if (duration == 0)
duration = -1;
- if (pts == MP_NOPTS_VALUE) {
+ if (pts == MP_NOPTS_VALUE)
MP_WARN(sd, "Subtitle with unknown start time.\n");
- priv->unknown_pts = true;
- }
av_init_packet(&pkt);
pkt.data = packet->buffer;
@@ -317,11 +314,8 @@ static void reset(struct sd *sd)
{
struct sd_lavc_priv *priv = sd->priv;
- if (priv->unknown_pts) {
- for (int n = 0; n < MAX_QUEUE; n++)
- clear_sub(&priv->subs[n]);
- priv->unknown_pts = false;
- }
+ for (int n = 0; n < MAX_QUEUE; n++)
+ clear_sub(&priv->subs[n]);
// lavc might not do this right for all codecs; may need close+reopen
avcodec_flush_buffers(priv->avctx);
}