diff options
Diffstat (limited to 'player/osd.c')
-rw-r--r-- | player/osd.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/player/osd.c b/player/osd.c index 8401f75b36..1f15e3ddc7 100644 --- a/player/osd.c +++ b/player/osd.c @@ -292,8 +292,8 @@ static mp_osd_msg_t *get_osd_msg(struct MPContext *mpctx) if (mpctx->osd_visible && now >= mpctx->osd_visible) { mpctx->osd_visible = 0; - mpctx->osd->progbar_type = -1; // disable - osd_changed(mpctx->osd, OSDTYPE_PROGBAR); + mpctx->osd_progbar.type = -1; // disable + osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); } if (mpctx->osd_function_visible && now >= mpctx->osd_function_visible) { mpctx->osd_function_visible = 0; @@ -335,10 +335,10 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name, if (mpctx->video_out && opts->term_osd != 1) { mpctx->osd_visible = mp_time_sec() + opts->osd_duration / 1000.0; - mpctx->osd->progbar_type = type; - mpctx->osd->progbar_value = (val - min) / (max - min); - mpctx->osd->progbar_num_stops = 0; - osd_changed(mpctx->osd, OSDTYPE_PROGBAR); + mpctx->osd_progbar.type = type; + mpctx->osd_progbar.value = (val - min) / (max - min); + mpctx->osd_progbar.num_stops = 0; + osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); return; } @@ -351,20 +351,19 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name, static void update_osd_bar(struct MPContext *mpctx, int type, double min, double max, double val) { - if (mpctx->osd->progbar_type == type) { + if (mpctx->osd_progbar.type == type) { float new_value = (val - min) / (max - min); - if (new_value != mpctx->osd->progbar_value) { - mpctx->osd->progbar_value = new_value; - osd_changed(mpctx->osd, OSDTYPE_PROGBAR); + if (new_value != mpctx->osd_progbar.value) { + mpctx->osd_progbar.value = new_value; + osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); } } } static void set_osd_bar_chapters(struct MPContext *mpctx, int type) { - struct osd_state *osd = mpctx->osd; - osd->progbar_num_stops = 0; - if (osd->progbar_type == type) { + mpctx->osd_progbar.num_stops = 0; + if (mpctx->osd_progbar.type == type) { double len = get_time_length(mpctx); if (len > 0) { int num = get_chapter_count(mpctx); @@ -372,12 +371,13 @@ static void set_osd_bar_chapters(struct MPContext *mpctx, int type) double time = chapter_start_time(mpctx, n); if (time >= 0) { float pos = time / len; - MP_TARRAY_APPEND(osd, osd->progbar_stops, - osd->progbar_num_stops, pos); + MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, + mpctx->osd_progbar.num_stops, pos); } } } } + osd_set_progbar(mpctx->osd, &mpctx->osd_progbar); } // osd_function is the symbol appearing in the video status, such as OSD_PLAY @@ -394,7 +394,7 @@ void set_osd_function(struct MPContext *mpctx, int osd_function) */ void set_osd_subtitle(struct MPContext *mpctx, const char *text) { - osd_set_sub(mpctx->osd, mpctx->osd->objs[OSDTYPE_SUB], text); + osd_set_text(mpctx->osd, OSDTYPE_SUB, text); term_osd_set_subs(mpctx, text); } @@ -495,7 +495,7 @@ void update_osd_msg(struct MPContext *mpctx) // Look if we have a msg mp_osd_msg_t *msg = get_osd_msg(mpctx); if (msg && !msg->show_position) { - osd_set_text(osd, msg->msg); + osd_set_text(osd, OSDTYPE_OSD, msg->msg); term_osd_set_text(mpctx, msg->msg); return; } @@ -510,7 +510,7 @@ void update_osd_msg(struct MPContext *mpctx) if (osd_level >= 2) sadd_osd_status(&text, mpctx, osd_level == 3); - osd_set_text(osd, text); + osd_set_text(osd, OSDTYPE_OSD, text); talloc_free(text); // always clear (term-osd has separate status line) |