diff options
Diffstat (limited to 'sub')
-rw-r--r-- | sub/dec_sub.h | 1 | ||||
-rw-r--r-- | sub/osd.c | 2 | ||||
-rw-r--r-- | sub/osd.h | 8 | ||||
-rw-r--r-- | sub/sd_lavc.c | 19 |
4 files changed, 26 insertions, 4 deletions
diff --git a/sub/dec_sub.h b/sub/dec_sub.h index 4fa62d7b97..36b947fffa 100644 --- a/sub/dec_sub.h +++ b/sub/dec_sub.h @@ -19,6 +19,7 @@ struct sd; enum sd_ctrl { SD_CTRL_SUB_STEP, SD_CTRL_SET_VIDEO_PARAMS, + SD_CTRL_GET_RESOLUTION, }; struct dec_sub *sub_create(struct MPOpts *opts); @@ -167,6 +167,8 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, *out_imgs = osd->external2; osd->external2.bitmap_id = osd->external2.bitmap_pos_id = 0; } + } else if (obj->type == OSDTYPE_NAV_HIGHLIGHT) { + mp_nav_get_highlight(osd, obj->vo_res, out_imgs); } else { osd_object_get_bitmaps(osd, obj, out_imgs); } @@ -86,6 +86,8 @@ enum mp_osdtype { OSDTYPE_SUB, OSDTYPE_SUBTEXT, + OSDTYPE_NAV_HIGHLIGHT, // dvdnav fake highlights + OSDTYPE_PROGBAR, OSDTYPE_OSD, @@ -148,6 +150,8 @@ struct osd_state { struct sub_bitmaps external2; // OSDTYPE_SUB struct dec_sub *dec_sub; + // OSDTYPE_NAV_HIGHLIGHT + void *highlight_priv; struct MPOpts *opts; @@ -244,4 +248,8 @@ void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function); void osd_init_backend(struct osd_state *osd); void osd_destroy_backend(struct osd_state *osd); +// defined in player +void mp_nav_get_highlight(struct osd_state *osd, struct mp_osd_res res, + struct sub_bitmaps *out_imgs); + #endif /* MPLAYER_SUB_H */ diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 724a4fe77c..da8a07e48e 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -83,6 +83,14 @@ static void guess_resolution(enum AVCodecID type, int *w, int *h) } } +static void get_resolution(struct sd *sd, int wh[2]) +{ + struct sd_lavc_priv *priv = sd->priv; + wh[0] = priv->avctx->width; + wh[1] = priv->avctx->height; + guess_resolution(priv->avctx->codec_id, &wh[0], &wh[1]); +} + static int init(struct sd *sd) { struct sd_lavc_priv *priv = talloc_zero(NULL, struct sd_lavc_priv); @@ -216,9 +224,7 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts, if (!priv->outbitmaps) priv->outbitmaps = talloc_size(priv, size); memcpy(priv->outbitmaps, priv->inbitmaps, size); - int inw = priv->avctx->width; - int inh = priv->avctx->height; - guess_resolution(priv->avctx->codec_id, &inw, &inh); + res->parts = priv->outbitmaps; res->num_parts = priv->count; if (priv->bitmaps_changed) @@ -234,7 +240,9 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts, (priv->video_params.d_w / (double)priv->video_params.d_h) / (priv->video_params.w / (double)priv->video_params.h); } - osd_rescale_bitmaps(res, inw, inh, d, video_par); + int insize[2]; + get_resolution(sd, insize); + osd_rescale_bitmaps(res, insize[0], insize[1], d, video_par); } static void reset(struct sd *sd) @@ -264,6 +272,9 @@ static int control(struct sd *sd, enum sd_ctrl cmd, void *arg) case SD_CTRL_SET_VIDEO_PARAMS: priv->video_params = *(struct mp_image_params *)arg; return CONTROL_OK; + case SD_CTRL_GET_RESOLUTION: + get_resolution(sd, arg); + return CONTROL_OK; default: return CONTROL_UNKNOWN; } |