diff options
-rw-r--r-- | libvo/sub.c | 20 | ||||
-rw-r--r-- | libvo/sub.h | 4 | ||||
-rw-r--r-- | mplayer.c | 7 | ||||
-rw-r--r-- | stream/stream_dvdnav.c | 25 | ||||
-rw-r--r-- | stream/stream_dvdnav.h | 3 |
5 files changed, 37 insertions, 22 deletions
diff --git a/libvo/sub.c b/libvo/sub.c index bdee948650..e4a3978113 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -74,6 +74,9 @@ int sub_visibility=1; int sub_bg_color=0; /* subtitles background color */ int sub_bg_alpha=0; int sub_justify=0; +#ifdef USE_DVDNAV +static nav_highlight_t nav_hl; +#endif // return the real height of a char: static inline int get_height(int c,int h){ @@ -199,15 +202,20 @@ inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){ } #ifdef USE_DVDNAV +void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey) { + nav_hl.sx = sx; + nav_hl.sy = sy; + nav_hl.ex = ex; + nav_hl.ey = ey; +} + inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) { - nav_highlight_t hl; int len; - mp_dvdnav_get_highlight (&hl); - obj->bbox.x1 = obj->x = hl.sx; - obj->bbox.y1 = obj->y = hl.sy; - obj->bbox.x2 = hl.ex; - obj->bbox.y2 = hl.ey; + obj->bbox.x1 = obj->x = nav_hl.sx; + obj->bbox.y1 = obj->y = nav_hl.sy; + obj->bbox.x2 = nav_hl.ex; + obj->bbox.y2 = nav_hl.ey; alloc_buf (obj); len = obj->stride * (obj->bbox.y2 - obj->bbox.y1); diff --git a/libvo/sub.h b/libvo/sub.h index d9e295b6f8..ba54046fdb 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -124,5 +124,9 @@ extern int vo_osd_changed_flag; unsigned utf8_get_char(char **str); +#ifdef USE_DVDNAV +void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); +#endif + #endif #endif @@ -4729,10 +4729,9 @@ if(auto_quality>0){ #ifdef USE_DVDNAV if (stream->type == STREAMTYPE_DVDNAV) { nav_highlight_t hl; - - mp_dvdnav_get_highlight (&hl); - if (hl.sx != 0 && hl.sy != 0) /* highlighting on */ - vo_osd_changed (OSDTYPE_DVDNAV); + mp_dvdnav_get_highlight (stream, &hl); + osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); + vo_osd_changed (OSDTYPE_DVDNAV); } #endif diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 25ec6b387a..7dc566b577 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -46,7 +46,6 @@ static struct m_struct_st stream_opts = { }; int dvd_nav_still=0; /* are we on a still picture? */ -static dvdnav_highlight_event_t dvd_nav_hl; static int seek(stream_t *s, off_t newpos); @@ -102,11 +101,12 @@ static dvdnav_priv_t * new_dvdnav_stream(char * filename) { return priv; } -static void dvdnav_get_highlight (dvdnav_priv_t *priv, dvdnav_highlight_event_t *hlev, int display_mode) { +static void dvdnav_get_highlight (dvdnav_priv_t *priv, int display_mode) { pci_t *pnavpci = NULL; - int btnum = -1; + dvdnav_highlight_event_t *hlev = &(priv->hlev); + int btnum; - if (!priv || !priv->dvdnav || !hlev) + if (!priv || !priv->dvdnav) return; pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav); @@ -168,7 +168,7 @@ static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len break; } case DVDNAV_HIGHLIGHT: { - dvdnav_get_highlight (priv, &dvd_nav_hl, 1); + dvdnav_get_highlight (priv, 1); break; } case DVDNAV_CELL_CHANGE: { @@ -256,7 +256,7 @@ static int fill_buffer(stream_t *s, char *but, int len) update_title_len(s); if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK) { mp_msg(MSGT_CPLAYER,MSGL_V, "\r\nDVDNAV, NEW TITLE %d\r\n", tit); - dvdnav_get_highlight (priv, &dvd_nav_hl, 0); + dvdnav_get_highlight (priv, 0); if(priv->title > 0 && tit != priv->title) return 0; } @@ -496,11 +496,14 @@ int dvdnav_number_of_subs(stream_t *stream) { return n; } -void mp_dvdnav_get_highlight (nav_highlight_t *hl) { - hl->sx = dvd_nav_hl.sx; - hl->sy = dvd_nav_hl.sy; - hl->ex = dvd_nav_hl.ex; - hl->ey = dvd_nav_hl.ey; +void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl) { + dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv; + dvdnav_highlight_event_t hlev = priv->hlev; + + hl->sx = hlev.sx; + hl->sy = hlev.sy; + hl->ex = hlev.ex; + hl->ey = hlev.ey; } stream_info_t stream_info_dvdnav = { diff --git a/stream/stream_dvdnav.h b/stream/stream_dvdnav.h index dea847ba38..46a3a2f32d 100644 --- a/stream/stream_dvdnav.h +++ b/stream/stream_dvdnav.h @@ -24,6 +24,7 @@ typedef struct { unsigned int duration; /* in milliseconds */ int mousex, mousey; int title; + dvdnav_highlight_event_t hlev; } dvdnav_priv_t; @@ -31,6 +32,6 @@ int dvdnav_number_of_subs(stream_t *stream); int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language); int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button); void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button); -void mp_dvdnav_get_highlight (nav_highlight_t *hl); +void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl); #endif |