mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 08:12:17 +00:00
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21209 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
fce8c944ed
commit
c913e7dba1
34
libvo/sub.c
34
libvo/sub.c
@ -8,6 +8,11 @@
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_DVDNAV
|
||||
#include <dvdnav.h>
|
||||
#define OSD_NAV_BOX_ALPHA 0x7f
|
||||
#endif
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "help_mp.h"
|
||||
#include "video_out.h"
|
||||
@ -192,6 +197,24 @@ inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DVDNAV
|
||||
inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) {
|
||||
extern dvdnav_highlight_event_t dvd_nav_hl;
|
||||
int len;
|
||||
|
||||
obj->bbox.x1 = obj->x = dvd_nav_hl.sx;
|
||||
obj->bbox.y1 = obj->y = dvd_nav_hl.sy;
|
||||
obj->bbox.x2 = dvd_nav_hl.ex;
|
||||
obj->bbox.y2 = dvd_nav_hl.ey;
|
||||
|
||||
alloc_buf (obj);
|
||||
len = obj->stride * (obj->bbox.y2 - obj->bbox.y1);
|
||||
memset (obj->bitmap_buffer, OSD_NAV_BOX_ALPHA, len);
|
||||
memset (obj->alpha_buffer, OSD_NAV_BOX_ALPHA, len);
|
||||
obj->flags |= OSDFLAG_BBOX | OSDFLAG_VISIBLE | OSDFLAG_CHANGED;
|
||||
}
|
||||
#endif
|
||||
|
||||
int vo_osd_progbar_type=-1;
|
||||
int vo_osd_progbar_value=100; // 0..256
|
||||
|
||||
@ -817,6 +840,11 @@ int vo_update_osd(int dxs,int dys){
|
||||
int vis=obj->flags&OSDFLAG_VISIBLE;
|
||||
obj->flags&=~OSDFLAG_BBOX;
|
||||
switch(obj->type){
|
||||
#ifdef USE_DVDNAV
|
||||
case OSDTYPE_DVDNAV:
|
||||
vo_update_nav(obj,dxs,dys);
|
||||
break;
|
||||
#endif
|
||||
case OSDTYPE_SUBTITLE:
|
||||
vo_update_text_sub(obj,dxs,dys);
|
||||
break;
|
||||
@ -884,6 +912,9 @@ void vo_init_osd(void){
|
||||
new_osd_obj(OSDTYPE_SUBTITLE);
|
||||
new_osd_obj(OSDTYPE_PROGBAR);
|
||||
new_osd_obj(OSDTYPE_SPU);
|
||||
#ifdef USE_DVDNAV
|
||||
new_osd_obj(OSDTYPE_DVDNAV);
|
||||
#endif
|
||||
#ifdef HAVE_FREETYPE
|
||||
force_load_font = 1;
|
||||
#endif
|
||||
@ -919,6 +950,9 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,
|
||||
case OSDTYPE_SPU:
|
||||
vo_draw_spudec_sub(obj, draw_alpha); // FIXME
|
||||
break;
|
||||
#ifdef USE_DVDNAV
|
||||
case OSDTYPE_DVDNAV:
|
||||
#endif
|
||||
case OSDTYPE_OSD:
|
||||
case OSDTYPE_SUBTITLE:
|
||||
case OSDTYPE_PROGBAR:
|
||||
|
@ -10,6 +10,7 @@ typedef struct mp_osd_bbox_s {
|
||||
#define OSDTYPE_SUBTITLE 2
|
||||
#define OSDTYPE_PROGBAR 3
|
||||
#define OSDTYPE_SPU 4
|
||||
#define OSDTYPE_DVDNAV 5
|
||||
|
||||
#define OSDFLAG_VISIBLE 1
|
||||
#define OSDFLAG_CHANGED 2
|
||||
|
@ -4696,6 +4696,15 @@ if(auto_quality>0){
|
||||
|
||||
} // end if(sh_video)
|
||||
|
||||
#ifdef USE_DVDNAV
|
||||
if (stream->type == STREAMTYPE_DVDNAV) {
|
||||
extern int dvd_nav_hl_on;
|
||||
|
||||
if (dvd_nav_hl_on)
|
||||
vo_osd_changed (OSDTYPE_DVDNAV);
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================ Handle PAUSE ===============================
|
||||
|
||||
current_module="pause";
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "libmpdemux/demuxer.h"
|
||||
#include "stream_dvdnav.h"
|
||||
#include "libvo/video_out.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "spudec.h"
|
||||
#include "m_option.h"
|
||||
#include "m_struct.h"
|
||||
@ -53,6 +54,8 @@ int osd_show_dvd_nav_ex;
|
||||
int osd_show_dvd_nav_sy;
|
||||
int osd_show_dvd_nav_ey;
|
||||
int dvd_nav_still=0; /* are we on a still picture? */
|
||||
dvdnav_highlight_event_t dvd_nav_hl;
|
||||
int dvd_nav_hl_on = 0;
|
||||
|
||||
static int seek(stream_t *s, off_t newpos);
|
||||
|
||||
@ -108,6 +111,46 @@ 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) {
|
||||
pci_t *pnavpci = NULL;
|
||||
int btnum = -1;
|
||||
|
||||
if (!priv || !priv->dvdnav || !hlev)
|
||||
return;
|
||||
|
||||
pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav);
|
||||
if (!pnavpci)
|
||||
return;
|
||||
|
||||
dvdnav_get_current_highlight (priv->dvdnav, &(hlev->buttonN));
|
||||
hlev->display = display_mode; /* show */
|
||||
|
||||
if (hlev->buttonN > 0 && pnavpci->hli.hl_gi.btn_ns > 0 && hlev->display) {
|
||||
for (btnum = 0; btnum < pnavpci->hli.hl_gi.btn_ns; btnum++) {
|
||||
btni_t *btni = &(pnavpci->hli.btnit[btnum]);
|
||||
|
||||
if (hlev->buttonN == btnum + 1) {
|
||||
hlev->sx = FFMIN (btni->x_start, btni->x_end);
|
||||
hlev->ex = FFMAX (btni->x_start, btni->x_end);
|
||||
hlev->sy = FFMIN (btni->y_start, btni->y_end);
|
||||
hlev->ey = FFMAX (btni->y_start, btni->y_end);
|
||||
|
||||
hlev->palette = (btni->btn_coln == 0) ? 0 :
|
||||
pnavpci->hli.btn_colit.btn_coli[btni->btn_coln - 1][0];
|
||||
dvd_nav_hl_on = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { /* hide button or no button */
|
||||
hlev->sx = hlev->ex = 0;
|
||||
hlev->sy = hlev->ey = 0;
|
||||
hlev->palette = hlev->buttonN = 0;
|
||||
dvd_nav_hl_on = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) {
|
||||
int event = DVDNAV_NOP;
|
||||
|
||||
@ -137,6 +180,10 @@ 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);
|
||||
break;
|
||||
}
|
||||
case DVDNAV_CELL_CHANGE: {
|
||||
dvdnav_cell_change_event_t *ev = (dvdnav_cell_change_event_t*)buf;
|
||||
if(ev->pgc_length)
|
||||
@ -222,6 +269,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);
|
||||
if(priv->title > 0 && tit != priv->title)
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user