diff options
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r-- | sub/sd_lavc.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 30aa641..cf49f2d 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -96,6 +96,9 @@ static int init(struct sd *sd) ctx = avcodec_alloc_context3(sub_codec); if (!ctx) goto error; + + mp_set_avopts(sd->log, ctx, sd->opts->sub_avopts); + priv->avpkt = av_packet_alloc(); if (!priv->avpkt) goto error; @@ -308,9 +311,15 @@ static void decode(struct sd *sd, struct demux_packet *packet) mp_set_av_packet(priv->avpkt, packet, &priv->pkt_timebase); if (ctx->codec_id == AV_CODEC_ID_DVB_TELETEXT) { - char page[4]; - snprintf(page, sizeof(page), "%d", opts->teletext_page); - av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN); + if (!opts->teletext_page) { + av_opt_set(ctx, "txt_page", "subtitle", AV_OPT_SEARCH_CHILDREN); + } else if (opts->teletext_page == -1) { + av_opt_set(ctx, "txt_page", "*", AV_OPT_SEARCH_CHILDREN); + } else { + char page[4]; + snprintf(page, sizeof(page), "%d", opts->teletext_page); + av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN); + } } int got_sub; @@ -318,6 +327,8 @@ static void decode(struct sd *sd, struct demux_packet *packet) if (res < 0 || !got_sub) return; + packet->sub_duration = sub.end_display_time; + if (sub.pts != AV_NOPTS_VALUE) pts = sub.pts / (double)AV_TIME_BASE; @@ -403,6 +414,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d, { struct sd_lavc_priv *priv = sd->priv; struct mp_subtitle_opts *opts = sd->opts; + struct mp_subtitle_shared_opts *shared_opts = sd->shared_opts; priv->current_pts = pts; @@ -450,8 +462,8 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d, h = MPMAX(priv->video_params.h, current->src_h); } - if (opts->sub_pos != 100.0f && opts->ass_style_override) { - float offset = (100.0f - opts->sub_pos) / 100.0f * h; + if (shared_opts->sub_pos[sd->order] != 100.0f && shared_opts->ass_style_override[sd->order]) { + float offset = (100.0f - shared_opts->sub_pos[sd->order]) / 100.0f * h; for (int n = 0; n < res->num_parts; n++) { struct sub_bitmap *sub = &res->parts[n]; @@ -469,7 +481,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d, osd_rescale_bitmaps(res, w, h, d, video_par); - if (opts->sub_scale != 1.0 && opts->ass_style_override) { + if (opts->sub_scale != 1.0 && shared_opts->ass_style_override[sd->order]) { for (int n = 0; n < res->num_parts; n++) { struct sub_bitmap *sub = &res->parts[n]; |