Mercurial > mplayer.hg
comparison stream/stream_dvdnav.c @ 21193:a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
author | ben |
---|---|
date | Sat, 25 Nov 2006 11:20:02 +0000 |
parents | 6602a90a06ec |
children | 7ecd9de03435 |
comparison
equal
deleted
inserted
replaced
21192:1bcff3db7a7c | 21193:a067e7e18b50 |
---|---|
9 #include "input/input.h" | 9 #include "input/input.h" |
10 #include "stream.h" | 10 #include "stream.h" |
11 #include "libmpdemux/demuxer.h" | 11 #include "libmpdemux/demuxer.h" |
12 #include "stream_dvdnav.h" | 12 #include "stream_dvdnav.h" |
13 #include "libvo/video_out.h" | 13 #include "libvo/video_out.h" |
14 #include "libavutil/common.h" | |
14 #include "spudec.h" | 15 #include "spudec.h" |
15 #include "m_option.h" | 16 #include "m_option.h" |
16 #include "m_struct.h" | 17 #include "m_struct.h" |
17 #include "help_mp.h" | 18 #include "help_mp.h" |
18 | 19 |
51 int osd_show_dvd_nav_sx; /* start x .... */ | 52 int osd_show_dvd_nav_sx; /* start x .... */ |
52 int osd_show_dvd_nav_ex; | 53 int osd_show_dvd_nav_ex; |
53 int osd_show_dvd_nav_sy; | 54 int osd_show_dvd_nav_sy; |
54 int osd_show_dvd_nav_ey; | 55 int osd_show_dvd_nav_ey; |
55 int dvd_nav_still=0; /* are we on a still picture? */ | 56 int dvd_nav_still=0; /* are we on a still picture? */ |
57 dvdnav_highlight_event_t dvd_nav_hl; | |
58 int dvd_nav_hl_on = 0; | |
56 | 59 |
57 static int seek(stream_t *s, off_t newpos); | 60 static int seek(stream_t *s, off_t newpos); |
58 | 61 |
59 static dvdnav_priv_t * new_dvdnav_stream(char * filename) { | 62 static dvdnav_priv_t * new_dvdnav_stream(char * filename) { |
60 char * title_str; | 63 char * title_str; |
106 //dvdnav_event_clear(priv); | 109 //dvdnav_event_clear(priv); |
107 | 110 |
108 return priv; | 111 return priv; |
109 } | 112 } |
110 | 113 |
114 static void dvdnav_get_highlight (dvdnav_priv_t *priv, | |
115 dvdnav_highlight_event_t *hlev, | |
116 int display_mode) { | |
117 pci_t *pnavpci = NULL; | |
118 int btnum = -1; | |
119 | |
120 if (!priv || !priv->dvdnav || !hlev) | |
121 return; | |
122 | |
123 pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav); | |
124 if (!pnavpci) | |
125 return; | |
126 | |
127 dvdnav_get_current_highlight (priv->dvdnav, &(hlev->buttonN)); | |
128 hlev->display = display_mode; /* show */ | |
129 | |
130 if (hlev->buttonN > 0 && pnavpci->hli.hl_gi.btn_ns > 0 && hlev->display) { | |
131 for (btnum = 0; btnum < pnavpci->hli.hl_gi.btn_ns; btnum++) { | |
132 btni_t *btni = &(pnavpci->hli.btnit[btnum]); | |
133 | |
134 if (hlev->buttonN == btnum + 1) { | |
135 hlev->sx = FFMIN (btni->x_start, btni->x_end); | |
136 hlev->ex = FFMAX (btni->x_start, btni->x_end); | |
137 hlev->sy = FFMIN (btni->y_start, btni->y_end); | |
138 hlev->ey = FFMAX (btni->y_start, btni->y_end); | |
139 | |
140 hlev->palette = (btni->btn_coln == 0) ? 0 : | |
141 pnavpci->hli.btn_colit.btn_coli[btni->btn_coln - 1][0]; | |
142 dvd_nav_hl_on = 1; | |
143 break; | |
144 } | |
145 } | |
146 } else { /* hide button or no button */ | |
147 hlev->sx = hlev->ex = 0; | |
148 hlev->sy = hlev->ey = 0; | |
149 hlev->palette = hlev->buttonN = 0; | |
150 dvd_nav_hl_on = 0; | |
151 } | |
152 } | |
153 | |
111 static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) { | 154 static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) { |
112 int event = DVDNAV_NOP; | 155 int event = DVDNAV_NOP; |
113 | 156 |
114 if (!len) return -1; | 157 if (!len) return -1; |
115 *len=-1; | 158 *len=-1; |
133 dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(buf); | 176 dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(buf); |
134 //if (priv->started) dvd_nav_still=1; | 177 //if (priv->started) dvd_nav_still=1; |
135 //else | 178 //else |
136 dvdnav_still_skip(priv->dvdnav); // don't let dvdnav stall on this image | 179 dvdnav_still_skip(priv->dvdnav); // don't let dvdnav stall on this image |
137 | 180 |
181 break; | |
182 } | |
183 case DVDNAV_HIGHLIGHT: { | |
184 dvdnav_get_highlight (priv, &dvd_nav_hl, 1); | |
138 break; | 185 break; |
139 } | 186 } |
140 case DVDNAV_CELL_CHANGE: { | 187 case DVDNAV_CELL_CHANGE: { |
141 dvdnav_cell_change_event_t *ev = (dvdnav_cell_change_event_t*)buf; | 188 dvdnav_cell_change_event_t *ev = (dvdnav_cell_change_event_t*)buf; |
142 if(ev->pgc_length) | 189 if(ev->pgc_length) |
220 int tit = 0, part = 0; | 267 int tit = 0, part = 0; |
221 s->end_pos = 0; | 268 s->end_pos = 0; |
222 update_title_len(s); | 269 update_title_len(s); |
223 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK) { | 270 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK) { |
224 mp_msg(MSGT_CPLAYER,MSGL_V, "\r\nDVDNAV, NEW TITLE %d\r\n", tit); | 271 mp_msg(MSGT_CPLAYER,MSGL_V, "\r\nDVDNAV, NEW TITLE %d\r\n", tit); |
272 dvdnav_get_highlight (priv, &dvd_nav_hl, 0); | |
225 if(priv->title > 0 && tit != priv->title) | 273 if(priv->title > 0 && tit != priv->title) |
226 return 0; | 274 return 0; |
227 } | 275 } |
228 break; | 276 break; |
229 } | 277 } |