Mercurial > mplayer.hg
annotate stream/stream_dvdnav.c @ 25827:3fc9f549b5d0
remove the spu_set field, replaced by a flag
author | ben |
---|---|
date | Sat, 26 Jan 2008 13:06:42 +0000 |
parents | d8ed72fc61f8 |
children | 8a1627f693a6 |
rev | line source |
---|---|
19302 | 1 #include "config.h" |
2 | |
3 #include <stdlib.h> | |
4 #include <stdio.h> | |
5 #include <unistd.h> | |
6 #include <string.h> | |
25031
5e1e61012a05
report why the dvd couldn't be opened. Patch by Jan Knutar jknutar+nic+fi
nicodvb
parents:
25025
diff
changeset
|
7 #include <errno.h> |
19302 | 8 #include "mp_msg.h" |
9 #include "osdep/timer.h" | |
10 #include "input/input.h" | |
11 #include "stream.h" | |
19312
ab8d6b6deb63
proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents:
19302
diff
changeset
|
12 #include "libmpdemux/demuxer.h" |
25539
47f2a9304623
include dvdnav.h from its installation directory rather than appending
nicodvb
parents:
25536
diff
changeset
|
13 #include <dvdnav/dvdnav.h> |
19302 | 14 #include "stream_dvdnav.h" |
15 #include "libvo/video_out.h" | |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
16 #include "libavutil/common.h" |
19302 | 17 #include "spudec.h" |
18 #include "m_option.h" | |
19 #include "m_struct.h" | |
20 #include "help_mp.h" | |
25824 | 21 #include "stream_dvd_common.h" |
22 | |
23 /* state flags */ | |
24 typedef enum { | |
25 NAV_FLAG_EOF = 1 << 0, /* end of stream has been reached */ | |
26 NAV_FLAG_WAIT = 1 << 1, /* wait event */ | |
27 NAV_FLAG_WAIT_SKIP = 1 << 2, /* wait skip disable */ | |
28 NAV_FLAG_CELL_CHANGED = 1 << 3, /* cell change event */ | |
29 NAV_FLAG_WAIT_READ_AUTO = 1 << 4, /* wait read auto mode */ | |
30 NAV_FLAG_WAIT_READ = 1 << 5, /* suspend read from stream */ | |
31 NAV_FLAG_VTS_DOMAIN = 1 << 6, /* vts domain */ | |
25827 | 32 NAV_FLAG_SPU_SET = 1 << 7, /* spu_clut is valid */ |
25824 | 33 } dvdnav_state_t; |
19302 | 34 |
25536
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
35 typedef struct { |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
36 dvdnav_t * dvdnav; /* handle to libdvdnav stuff */ |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
37 char * filename; /* path */ |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
38 unsigned int duration; /* in milliseconds */ |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
39 int mousex, mousey; |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
40 int title; |
25827 | 41 unsigned int spu_clut[16]; |
25536
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
42 dvdnav_highlight_event_t hlev; |
25824 | 43 int still_length; /* still frame duration */ |
44 unsigned int state; | |
25536
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
45 } dvdnav_priv_t; |
a7eec00ebb9c
private structures belong to the C file using them, not to header files included somewhere else
nicodvb
parents:
25296
diff
changeset
|
46 |
19302 | 47 extern char *dvd_device; |
48 extern char *audio_lang, *dvdsub_lang; | |
25196
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
49 extern char *dvd_audio_stream_channels[6], *dvd_audio_stream_types[8]; |
19302 | 50 |
51 static struct stream_priv_s { | |
52 int track; | |
53 char* device; | |
54 } stream_priv_dflts = { | |
19764
499e5525d706
if no track number specified play the whole disc, or the menus can't be shown at start
nicodvb
parents:
19477
diff
changeset
|
55 0, |
19302 | 56 NULL |
57 }; | |
58 | |
59 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) | |
60 /// URL definition | |
25242 | 61 static const m_option_t stream_opts_fields[] = { |
19302 | 62 {"filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL }, |
63 {"hostname", ST_OFF(track), CONF_TYPE_INT, 0, 0, 0, NULL}, | |
64 { NULL, NULL, 0, 0, 0, 0, NULL } | |
65 }; | |
25691 | 66 static const struct m_struct_st stream_opts = { |
19302 | 67 "dvd", |
68 sizeof(struct stream_priv_s), | |
69 &stream_priv_dflts, | |
70 stream_opts_fields | |
71 }; | |
72 | |
19892
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
73 static int seek(stream_t *s, off_t newpos); |
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
74 |
19914
dfd1bb3fc7c0
made file-static new_dvdnav_stream() and dvdnav_stream_read()
nicodvb
parents:
19912
diff
changeset
|
75 static dvdnav_priv_t * new_dvdnav_stream(char * filename) { |
25819 | 76 const char * title_str; |
20809 | 77 dvdnav_priv_t *priv; |
19302 | 78 |
79 if (!filename) | |
80 return NULL; | |
81 | |
20809 | 82 if (!(priv=calloc(1,sizeof(dvdnav_priv_t)))) |
19302 | 83 return NULL; |
84 | |
20809 | 85 if (!(priv->filename=strdup(filename))) { |
86 free(priv); | |
19302 | 87 return NULL; |
88 } | |
89 | |
20809 | 90 if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK) |
19302 | 91 { |
20809 | 92 free(priv->filename); |
93 free(priv); | |
19302 | 94 return NULL; |
95 } | |
96 | |
20809 | 97 if (!priv->dvdnav) { |
98 free(priv); | |
19302 | 99 return NULL; |
100 } | |
101 | |
102 if(1) //from vlc: if not used dvdnav from cvs will fail | |
103 { | |
104 int len, event; | |
105 char buf[2048]; | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
106 |
20809 | 107 dvdnav_get_next_block(priv->dvdnav,buf,&event,&len); |
108 dvdnav_sector_search(priv->dvdnav, 0, SEEK_SET); | |
19302 | 109 } |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
110 |
19454 | 111 /* turn off dvdnav caching */ |
20809 | 112 dvdnav_set_readahead_flag(priv->dvdnav, 0); |
113 if(dvdnav_set_PGC_positioning_flag(priv->dvdnav, 1) != DVDNAV_STATUS_OK) | |
19302 | 114 mp_msg(MSGT_OPEN,MSGL_ERR,"stream_dvdnav, failed to set PGC positioning\n"); |
115 #if 1 | |
116 /* report the title?! */ | |
20809 | 117 if (dvdnav_get_title_string(priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) { |
19302 | 118 mp_msg(MSGT_IDENTIFY, MSGL_INFO,"Title: '%s'\n",title_str); |
119 } | |
120 #endif | |
121 | |
20809 | 122 //dvdnav_event_clear(priv); |
19302 | 123 |
20809 | 124 return priv; |
19302 | 125 } |
126 | |
21219 | 127 static void dvdnav_get_highlight (dvdnav_priv_t *priv, int display_mode) { |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
128 pci_t *pnavpci = NULL; |
21219 | 129 dvdnav_highlight_event_t *hlev = &(priv->hlev); |
130 int btnum; | |
21198
fbe50a67612a
COSMETICS: consistently reformatted after ben's mess
nicodvb
parents:
21197
diff
changeset
|
131 |
21219 | 132 if (!priv || !priv->dvdnav) |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
133 return; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
134 |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
135 pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
136 if (!pnavpci) |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
137 return; |
21198
fbe50a67612a
COSMETICS: consistently reformatted after ben's mess
nicodvb
parents:
21197
diff
changeset
|
138 |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
139 dvdnav_get_current_highlight (priv->dvdnav, &(hlev->buttonN)); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
140 hlev->display = display_mode; /* show */ |
21198
fbe50a67612a
COSMETICS: consistently reformatted after ben's mess
nicodvb
parents:
21197
diff
changeset
|
141 |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
142 if (hlev->buttonN > 0 && pnavpci->hli.hl_gi.btn_ns > 0 && hlev->display) { |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
143 for (btnum = 0; btnum < pnavpci->hli.hl_gi.btn_ns; btnum++) { |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
144 btni_t *btni = &(pnavpci->hli.btnit[btnum]); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
145 |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
146 if (hlev->buttonN == btnum + 1) { |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
147 hlev->sx = FFMIN (btni->x_start, btni->x_end); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
148 hlev->ex = FFMAX (btni->x_start, btni->x_end); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
149 hlev->sy = FFMIN (btni->y_start, btni->y_end); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
150 hlev->ey = FFMAX (btni->y_start, btni->y_end); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
151 |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
152 hlev->palette = (btni->btn_coln == 0) ? 0 : |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
153 pnavpci->hli.btn_colit.btn_coli[btni->btn_coln - 1][0]; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
154 break; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
155 } |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
156 } |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
157 } else { /* hide button or no button */ |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
158 hlev->sx = hlev->ex = 0; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
159 hlev->sy = hlev->ey = 0; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
160 hlev->palette = hlev->buttonN = 0; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
161 } |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
162 } |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
163 |
25824 | 164 static inline int dvdnav_get_duration (int length) { |
165 return (length == 255) ? 0 : length * 1000; | |
166 } | |
167 | |
20809 | 168 static int dvdnav_stream_read(dvdnav_priv_t * priv, unsigned char *buf, int *len) { |
19302 | 169 int event = DVDNAV_NOP; |
170 | |
171 *len=-1; | |
20809 | 172 if (dvdnav_get_next_block(priv->dvdnav,buf,&event,len)!=DVDNAV_STATUS_OK) { |
173 mp_msg(MSGT_OPEN,MSGL_V, "Error getting next block from DVD %d (%s)\n",event, dvdnav_err_to_string(priv->dvdnav) ); | |
19302 | 174 *len=-1; |
175 } | |
176 else if (event!=DVDNAV_BLOCK_OK) { | |
177 // need to handle certain events internally (like skipping stills) | |
178 switch (event) { | |
21332 | 179 case DVDNAV_NAV_PACKET: |
180 return event; | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
181 case DVDNAV_STILL_FRAME: { |
25824 | 182 dvdnav_still_event_t *still_event = (dvdnav_still_event_t *) buf; |
183 priv->still_length = still_event->length; | |
184 /* set still frame duration */ | |
185 priv->duration = dvdnav_get_duration (priv->still_length); | |
186 if (priv->still_length <= 1) { | |
187 pci_t *pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav); | |
188 priv->duration = mp_dvdtimetomsec (&pnavpci->pci_gi.e_eltm); | |
189 } | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
190 break; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
191 } |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
192 case DVDNAV_HIGHLIGHT: { |
21219 | 193 dvdnav_get_highlight (priv, 1); |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
194 break; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
20851
diff
changeset
|
195 } |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
196 case DVDNAV_CELL_CHANGE: { |
19453
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
197 dvdnav_cell_change_event_t *ev = (dvdnav_cell_change_event_t*)buf; |
25824 | 198 uint32_t nextstill; |
199 | |
200 priv->state &= ~NAV_FLAG_WAIT_SKIP; | |
19453
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
201 if(ev->pgc_length) |
20809 | 202 priv->duration = ev->pgc_length/90; |
25824 | 203 |
204 if (dvdnav_is_domain_vts(priv->dvdnav)) | |
205 priv->state &= ~NAV_FLAG_VTS_DOMAIN; | |
206 else | |
207 priv->state |= NAV_FLAG_VTS_DOMAIN; | |
208 | |
209 nextstill = dvdnav_get_next_still_flag (priv->dvdnav); | |
210 if (nextstill) { | |
211 priv->duration = dvdnav_get_duration (nextstill); | |
212 priv->still_length = nextstill; | |
213 if (priv->still_length <= 1) { | |
214 pci_t *pnavpci = dvdnav_get_current_nav_pci (priv->dvdnav); | |
215 priv->duration = mp_dvdtimetomsec (&pnavpci->pci_gi.e_eltm); | |
216 } | |
217 } | |
218 | |
19453
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
219 break; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
220 } |
21538
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
221 case DVDNAV_SPU_CLUT_CHANGE: { |
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
222 memcpy(priv->spu_clut, buf, 16*sizeof(unsigned int)); |
25827 | 223 priv->state |= NAV_FLAG_SPU_SET; |
21538
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
224 break; |
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
225 } |
25824 | 226 case DVDNAV_WAIT: { |
227 if ((priv->state & NAV_FLAG_WAIT_SKIP) && | |
228 !(priv->state & NAV_FLAG_WAIT)) | |
229 dvdnav_wait_skip (priv->dvdnav); | |
230 else | |
231 priv->state |= NAV_FLAG_WAIT; | |
19302 | 232 break; |
25824 | 233 } |
234 case DVDNAV_VTS_CHANGE: { | |
235 priv->state &= ~NAV_FLAG_WAIT_SKIP; | |
236 break; | |
237 } | |
19302 | 238 } |
239 | |
240 *len=0; | |
241 } | |
242 return event; | |
243 } | |
244 | |
245 static void update_title_len(stream_t *stream) { | |
246 dvdnav_priv_t *priv = stream->priv; | |
247 dvdnav_status_t status; | |
248 uint32_t pos = 0, len = 0; | |
249 | |
250 status = dvdnav_get_position(priv->dvdnav, &pos, &len); | |
19892
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
251 if(status == DVDNAV_STATUS_OK && len) { |
19302 | 252 stream->end_pos = (off_t) len * 2048; |
19892
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
253 stream->seek = seek; |
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
254 } else { |
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
255 stream->seek = NULL; |
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
256 stream->end_pos = 0; |
2c361743ce69
don't seek until dvdnav_get_position() returns something meaningful
nicodvb
parents:
19851
diff
changeset
|
257 } |
19302 | 258 } |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
259 |
19302 | 260 |
261 static int seek(stream_t *s, off_t newpos) { | |
23990 | 262 uint32_t sector = 0; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
263 dvdnav_priv_t *priv = s->priv; |
19302 | 264 |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
265 if(s->end_pos && newpos > s->end_pos) |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
266 newpos = s->end_pos; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
267 sector = newpos / 2048ULL; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
268 if(dvdnav_sector_search(priv->dvdnav, (uint64_t) sector, SEEK_SET) != DVDNAV_STATUS_OK) |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
269 goto fail; |
19302 | 270 |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
271 s->pos = newpos; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
272 |
19302 | 273 return 1; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
274 |
19302 | 275 fail: |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
276 mp_msg(MSGT_STREAM,MSGL_INFO,"dvdnav_stream, seeking to %"PRIu64" failed: %s\n", newpos, dvdnav_err_to_string(priv->dvdnav)); |
19302 | 277 |
278 return 1; | |
279 } | |
280 | |
281 static void stream_dvdnav_close(stream_t *s) { | |
282 dvdnav_priv_t *priv = s->priv; | |
283 dvdnav_close(priv->dvdnav); | |
284 priv->dvdnav = NULL; | |
285 free(priv); | |
286 } | |
287 | |
288 | |
289 static int fill_buffer(stream_t *s, char *but, int len) | |
290 { | |
291 int event; | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
292 |
20809 | 293 dvdnav_priv_t* priv=s->priv; |
25824 | 294 if (priv->state & NAV_FLAG_WAIT_READ) /* read is suspended */ |
295 return -1; | |
19302 | 296 len=0; |
297 if(!s->end_pos) | |
298 update_title_len(s); | |
299 while(!len) /* grab all event until DVDNAV_BLOCK_OK (len=2048), DVDNAV_STOP or DVDNAV_STILL_FRAME */ | |
300 { | |
20810 | 301 event=dvdnav_stream_read(priv, s->buffer, &len); |
302 if(event==-1 || len==-1) | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
303 { |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
304 mp_msg(MSGT_CPLAYER,MSGL_ERR, "DVDNAV stream read error!\n"); |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
305 return 0; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
306 } |
25825
4c17a62383a4
automatically set spu button highlight when nav cell has changed
ben
parents:
25824
diff
changeset
|
307 if (event != DVDNAV_BLOCK_OK) |
4c17a62383a4
automatically set spu button highlight when nav cell has changed
ben
parents:
25824
diff
changeset
|
308 dvdnav_get_highlight (priv, 1); |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
309 switch (event) { |
25824 | 310 case DVDNAV_STOP: { |
311 priv->state |= NAV_FLAG_EOF; | |
312 return len; | |
313 } | |
21333 | 314 case DVDNAV_BLOCK_OK: |
315 case DVDNAV_NAV_PACKET: | |
25824 | 316 case DVDNAV_STILL_FRAME: |
21333 | 317 return len; |
25824 | 318 case DVDNAV_WAIT: { |
319 if (priv->state & NAV_FLAG_WAIT) | |
320 return len; | |
321 break; | |
322 } | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
323 case DVDNAV_VTS_CHANGE: { |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
324 int tit = 0, part = 0; |
23043
4038852b041e
after a DVDNAV_VTS_CHANGE event report the title being played
nicodvb
parents:
22936
diff
changeset
|
325 dvdnav_vts_change_event_t *vts_event = (dvdnav_vts_change_event_t *)s->buffer; |
4038852b041e
after a DVDNAV_VTS_CHANGE event report the title being played
nicodvb
parents:
22936
diff
changeset
|
326 mp_msg(MSGT_CPLAYER,MSGL_INFO, "DVDNAV, switched to title: %d\r\n", vts_event->new_vtsN); |
25824 | 327 priv->state |= NAV_FLAG_CELL_CHANGED; |
328 priv->state &= ~NAV_FLAG_WAIT_SKIP; | |
329 priv->state &= ~NAV_FLAG_WAIT; | |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
330 s->end_pos = 0; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
331 update_title_len(s); |
25824 | 332 if (priv->state & NAV_FLAG_WAIT_READ_AUTO) |
333 priv->state |= NAV_FLAG_WAIT_READ; | |
20809 | 334 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK) { |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
335 mp_msg(MSGT_CPLAYER,MSGL_V, "\r\nDVDNAV, NEW TITLE %d\r\n", tit); |
21219 | 336 dvdnav_get_highlight (priv, 0); |
20809 | 337 if(priv->title > 0 && tit != priv->title) |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
338 return 0; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
339 } |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
340 break; |
19302 | 341 } |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
342 case DVDNAV_CELL_CHANGE: { |
25824 | 343 priv->state |= NAV_FLAG_CELL_CHANGED; |
344 priv->state &= ~NAV_FLAG_WAIT_SKIP; | |
345 priv->state &= ~NAV_FLAG_WAIT; | |
346 if (priv->state & NAV_FLAG_WAIT_READ_AUTO) | |
347 priv->state |= NAV_FLAG_WAIT_READ; | |
20809 | 348 if(priv->title > 0 && dvd_last_chapter > 0) { |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
349 int tit=0, part=0; |
20809 | 350 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) == DVDNAV_STATUS_OK && part > dvd_last_chapter) |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
351 return 0; |
25826 | 352 } |
25825
4c17a62383a4
automatically set spu button highlight when nav cell has changed
ben
parents:
25824
diff
changeset
|
353 dvdnav_get_highlight (priv, 1); |
19302 | 354 } |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
355 break; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
356 } |
19302 | 357 } |
358 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len); | |
359 return len; | |
360 } | |
361 | |
19443 | 362 static int control(stream_t *stream, int cmd, void* arg) { |
20809 | 363 dvdnav_priv_t* priv=stream->priv; |
19443 | 364 int tit, part; |
365 | |
366 switch(cmd) | |
367 { | |
368 case STREAM_CTRL_SEEK_TO_CHAPTER: | |
369 { | |
370 int chap = *((unsigned int *)arg)+1; | |
371 | |
20809 | 372 if(chap < 1 || dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK) |
19443 | 373 break; |
20809 | 374 if(dvdnav_part_play(priv->dvdnav, tit, chap) != DVDNAV_STATUS_OK) |
19443 | 375 break; |
376 return 1; | |
377 } | |
19477 | 378 case STREAM_CTRL_GET_NUM_CHAPTERS: |
379 { | |
20809 | 380 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK) |
19477 | 381 break; |
20809 | 382 if(dvdnav_get_number_of_parts(priv->dvdnav, tit, &part) != DVDNAV_STATUS_OK) |
19477 | 383 break; |
384 if(!part) | |
385 break; | |
386 *((unsigned int *)arg) = part; | |
387 return 1; | |
388 } | |
19443 | 389 case STREAM_CTRL_GET_CURRENT_CHAPTER: |
390 { | |
20809 | 391 if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK) |
19443 | 392 break; |
393 *((unsigned int *)arg) = part - 1; | |
394 return 1; | |
395 } | |
19453
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
396 case STREAM_CTRL_GET_TIME_LENGTH: |
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
397 { |
25824 | 398 if(priv->duration || priv->still_length) |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
399 { |
20851
6602a90a06ec
consistency fix: STREAM_CTRL_GET_TIME_LENGTH and STREAM_CTRL_GET_CURRENT_TIME now return time in (double) seconds
nicodvb
parents:
20810
diff
changeset
|
400 *((double *)arg) = (double)priv->duration / 1000.0; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
401 return 1; |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
402 } |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
403 break; |
19453
087d4a916ea3
implemented STREAM_CTRL_GET_TIME_LENGTH (duration of the pgc playing)
nicodvb
parents:
19452
diff
changeset
|
404 } |
24303 | 405 case STREAM_CTRL_GET_ASPECT_RATIO: |
406 { | |
407 uint8_t ar = dvdnav_get_video_aspect(priv->dvdnav); | |
408 *((double *)arg) = !ar ? 4.0/3.0 : 16.0/9.0; | |
409 return 1; | |
410 } | |
22936
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
411 case STREAM_CTRL_GET_CURRENT_TIME: |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
412 { |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
413 double tm; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
414 tm = dvdnav_get_current_time(priv->dvdnav)/90000.0f; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
415 if(tm != -1) |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
416 { |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
417 *((double *)arg) = tm; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
418 return 1; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
419 } |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
420 break; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
421 } |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
422 case STREAM_CTRL_SEEK_TO_TIME: |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
423 { |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
424 uint64_t tm = (uint64_t) (*((double*)arg) * 90000); |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
425 if(dvdnav_time_search(priv->dvdnav, tm) == DVDNAV_STATUS_OK) |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
426 return 1; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
427 break; |
a6486d2975d2
implemented STREAM_CTRL_GET_CURRENT_TIME and STREAM_CTRL_SEEK_TO_TIME - dvdnav from mphq required
nicodvb
parents:
21613
diff
changeset
|
428 } |
25574
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
429 case STREAM_CTRL_GET_NUM_ANGLES: |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
430 { |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
431 uint32_t curr, angles; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
432 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
433 break; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
434 *((int *)arg) = angles; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
435 return 1; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
436 } |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
437 case STREAM_CTRL_GET_ANGLE: |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
438 { |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
439 uint32_t curr, angles; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
440 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
441 break; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
442 *((int *)arg) = curr; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
443 return 1; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
444 } |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
445 case STREAM_CTRL_SET_ANGLE: |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
446 { |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
447 uint32_t curr, angles; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
448 int new_angle = *((int *)arg); |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
449 if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
450 break; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
451 if(new_angle>angles || new_angle<1) |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
452 break; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
453 if(dvdnav_angle_change(priv->dvdnav, new_angle) != DVDNAV_STATUS_OK) |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
454 return 1; |
bef7f820d179
implemented _ANGLE STREAM_CTRLs, patch by oattila chello hu
nicodvb
parents:
25539
diff
changeset
|
455 } |
19443 | 456 } |
457 | |
24257 | 458 return STREAM_UNSUPPORTED; |
19443 | 459 } |
460 | |
25165 | 461 static void identify_chapters(dvdnav_t *nav, uint32_t title) |
462 { | |
25177
a43d99a80f4a
-identify also shows the duration(s) of the title(s)
nicodvb
parents:
25176
diff
changeset
|
463 uint64_t *parts=NULL, duration=0; |
25165 | 464 uint32_t n, i, t; |
25177
a43d99a80f4a
-identify also shows the duration(s) of the title(s)
nicodvb
parents:
25176
diff
changeset
|
465 n = dvdnav_describe_title_chapters(nav, title, &parts, &duration); |
25165 | 466 if(parts) { |
25177
a43d99a80f4a
-identify also shows the duration(s) of the title(s)
nicodvb
parents:
25176
diff
changeset
|
467 t = duration / 90; |
a43d99a80f4a
-identify also shows the duration(s) of the title(s)
nicodvb
parents:
25176
diff
changeset
|
468 mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_DVD_TITLE_%d_LENGTH=%d.%03d\n", title, t / 1000, t % 1000); |
25167 | 469 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "TITLE %u, CHAPTERS: ", title); |
25165 | 470 for(i=0; i<n; i++) { |
471 t = parts[i] / 90000; | |
472 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "%02d:%02d:%02d,", t/3600, (t/60)%60, t%60); | |
473 } | |
474 free(parts); | |
475 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "\n"); | |
476 } | |
477 } | |
478 | |
25176
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
479 static void identify(dvdnav_priv_t *priv, struct stream_priv_s *p) |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
480 { |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
481 uint32_t titles=0, i; |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
482 if(p->track <= 0) { |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
483 dvdnav_get_number_of_titles(priv->dvdnav, &titles); |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
484 for(i=0; i<titles; i++) |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
485 identify_chapters(priv->dvdnav, i); |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
486 } |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
487 else |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
488 identify_chapters(priv->dvdnav, p->track); |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
489 } |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
490 |
25196
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
491 static void show_audio_subs_languages(dvdnav_t *nav) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
492 { |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
493 uint8_t lg; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
494 uint16_t i, lang, format, id, channels; |
25820
b43eaaa94dd3
array was defined for 6 elements while 7 were declared
ben
parents:
25819
diff
changeset
|
495 int base[7] = {128, 0, 0, 0, 160, 136, 0}; |
25196
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
496 char tmp[3]; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
497 for(i=0; i<8; i++) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
498 { |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
499 lg = dvdnav_get_audio_logical_stream(nav, i); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
500 if(lg == 0xff) continue; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
501 channels = dvdnav_audio_stream_channels(nav, lg); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
502 if(channels == 0xFFFF) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
503 channels = 2; //unknown |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
504 else |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
505 channels--; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
506 lang = dvdnav_audio_stream_to_lang(nav, lg); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
507 if(lang == 0xFFFF) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
508 tmp[0] = tmp[1] = '?'; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
509 else |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
510 { |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
511 tmp[0] = lang >> 8; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
512 tmp[1] = lang & 0xFF; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
513 } |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
514 tmp[2] = 0; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
515 format = dvdnav_audio_stream_format(nav, lg); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
516 if(format == 0xFFFF || format > 6) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
517 format = 1; //unknown |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
518 id = i + base[format]; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
519 mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo, i, |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
520 dvd_audio_stream_types[format], dvd_audio_stream_channels[channels], tmp, id); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
521 } |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
522 |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
523 for(i=0; i<32; i++) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
524 { |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
525 lg = dvdnav_get_spu_logical_stream(nav, i); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
526 if(lg == 0xff) continue; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
527 lang = dvdnav_spu_stream_to_lang(nav, lg); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
528 if(lang == 0xFFFF) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
529 tmp[0] = tmp[1] = '?'; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
530 else |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
531 { |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
532 tmp[0] = lang >> 8; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
533 tmp[1] = lang & 0xFF; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
534 } |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
535 tmp[2] = 0; |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
536 mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, i+0x20, tmp); |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
537 } |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
538 } |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
539 |
19302 | 540 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { |
541 struct stream_priv_s* p = (struct stream_priv_s*)opts; | |
542 char *filename; | |
20809 | 543 dvdnav_priv_t *priv; |
19302 | 544 |
545 if(p->device) filename = p->device; | |
546 else if(dvd_device) filename= dvd_device; | |
547 else filename = DEFAULT_DVD_DEVICE; | |
20809 | 548 if(!(priv=new_dvdnav_stream(filename))) { |
25031
5e1e61012a05
report why the dvd couldn't be opened. Patch by Jan Knutar jknutar+nic+fi
nicodvb
parents:
25025
diff
changeset
|
549 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename, strerror(errno)); |
24257 | 550 return STREAM_UNSUPPORTED; |
19302 | 551 } |
552 | |
19764
499e5525d706
if no track number specified play the whole disc, or the menus can't be shown at start
nicodvb
parents:
19477
diff
changeset
|
553 if(p->track > 0) { |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
554 if(dvd_chapter > 0 && dvd_last_chapter > 0 && dvd_chapter > dvd_last_chapter) { |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
555 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, invalid chapter range: %d > %d\n", dvd_chapter, dvd_last_chapter); |
24257 | 556 return STREAM_UNSUPPORTED; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
557 } |
20809 | 558 priv->title = p->track; |
559 if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) { | |
560 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav)); | |
24257 | 561 return STREAM_UNSUPPORTED; |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
562 } |
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
563 if(dvd_chapter > 0) |
20809 | 564 dvdnav_part_play(priv->dvdnav, p->track, dvd_chapter); |
25824 | 565 } else if (p->track == 0) { |
566 if(dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root) != DVDNAV_STATUS_OK) | |
567 dvdnav_menu_call(priv->dvdnav, DVD_MENU_Title); | |
19842
a43fa4ad378e
at start, when not playing a specific titleset, try to call the Title menu (as is common practice among players)
nicodvb
parents:
19840
diff
changeset
|
568 } |
25176
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
569 if(mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) |
6d9212e61af8
cosmetics: moved identification code to a separate function
nicodvb
parents:
25168
diff
changeset
|
570 identify(priv, p); |
25196
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
571 if(p->track > 0) |
5487d363a9ac
at startup show audio and subtitle streams available in the chosen title with all their properties
nicodvb
parents:
25177
diff
changeset
|
572 show_audio_subs_languages(priv->dvdnav); |
20754 | 573 if(dvd_angle > 1) |
20809 | 574 dvdnav_angle_change(priv->dvdnav, dvd_angle); |
19302 | 575 |
576 stream->sector_size = 2048; | |
577 stream->flags = STREAM_READ | STREAM_SEEK; | |
578 stream->fill_buffer = fill_buffer; | |
579 stream->seek = seek; | |
19443 | 580 stream->control = control; |
19302 | 581 stream->close = stream_dvdnav_close; |
582 stream->type = STREAMTYPE_DVDNAV; | |
20809 | 583 stream->priv=(void*)priv; |
19302 | 584 *file_format = DEMUXER_TYPE_MPEG_PS; |
585 | |
586 update_title_len(stream); | |
25824 | 587 if(!stream->pos && p->track > 0) |
24109 | 588 mp_msg(MSGT_OPEN,MSGL_ERR, "INIT ERROR: couldn't get init pos %s\r\n", dvdnav_err_to_string(priv->dvdnav)); |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
589 |
20406 | 590 mp_msg(MSGT_OPEN,MSGL_INFO, "Remember to disable MPlayer's cache when playing dvdnav:// streams (adding -nocache to your command line)\r\n"); |
19302 | 591 |
592 return STREAM_OK; | |
593 } | |
594 | |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
595 |
25824 | 596 void mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button) { |
20809 | 597 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; |
598 dvdnav_t *nav = priv->dvdnav; | |
19908
b6aa47caeb72
§Ænitial button value is -1. Only (button>0) is a correct button selection.
jonas
parents:
19895
diff
changeset
|
599 dvdnav_status_t status=DVDNAV_STATUS_ERR; |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
600 pci_t *pci = dvdnav_get_current_nav_pci(nav); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
601 |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
602 if(cmd != MP_CMD_DVDNAV_SELECT && !pci) |
25824 | 603 return; |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
604 |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
605 switch(cmd) { |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
606 case MP_CMD_DVDNAV_UP: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
607 status = dvdnav_upper_button_select(nav, pci); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
608 break; |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
609 case MP_CMD_DVDNAV_DOWN: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
610 status = dvdnav_lower_button_select(nav, pci); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
611 break; |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
612 case MP_CMD_DVDNAV_LEFT: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
613 status = dvdnav_left_button_select(nav, pci); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
614 break; |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
615 case MP_CMD_DVDNAV_RIGHT: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
616 status = dvdnav_right_button_select(nav, pci); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
617 break; |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
618 case MP_CMD_DVDNAV_MENU: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
619 status = dvdnav_menu_call(nav,DVD_MENU_Root); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
620 break; |
19777
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
621 case MP_CMD_DVDNAV_PREVMENU: { |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
622 int title=0, part=0; |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
623 |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
624 dvdnav_current_title_info(nav, &title, &part); |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
625 if(title) { |
25824 | 626 if((status=dvdnav_menu_call(nav, DVD_MENU_Part)) == DVDNAV_STATUS_OK) |
19777
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
627 break; |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
628 } |
25824 | 629 if((status=dvdnav_menu_call(nav, DVD_MENU_Title)) == DVDNAV_STATUS_OK) |
630 break; | |
631 status=dvdnav_menu_call(nav, DVD_MENU_Root); | |
19777
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
632 } |
bb1b570ac7c1
permit to select previous dvdnav menu, in the order chapter->title->root
nicodvb
parents:
19774
diff
changeset
|
633 break; |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
634 case MP_CMD_DVDNAV_SELECT: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
635 status = dvdnav_button_activate(nav, pci); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
636 break; |
19912
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
637 case MP_CMD_DVDNAV_MOUSECLICK: |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
638 /* |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
639 this is a workaround: in theory the simple dvdnav_lower_button_select()+dvdnav_button_activate() |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
640 should be enough (and generally it is), but there are cases when the calls to dvdnav_lower_button_select() |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
641 and friends fail! Hence we have to call dvdnav_mouse_activate(priv->mousex, priv->mousey) with |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
642 the coodinates saved by mp_dvdnav_update_mouse_pos(). |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
643 This last call always works well |
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
644 */ |
20809 | 645 status = dvdnav_mouse_activate(nav, pci, priv->mousex, priv->mousey); |
19912
3fdb44285fe7
introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0);
nicodvb
parents:
19909
diff
changeset
|
646 break; |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
647 default: |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
648 mp_msg(MSGT_CPLAYER, MSGL_V, "Unknown DVDNAV cmd %d\n", cmd); |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
649 break; |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
650 } |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
651 |
19840
ba3b77867047
in mp_dvdnav_handle_input() update current button only if the status of the previous operation succeeded; patch by Jonas Jermann
nicodvb
parents:
19839
diff
changeset
|
652 if(status == DVDNAV_STATUS_OK) |
20786
50b5a9e01009
COSMETICS: reformatted this ugly mess in a consistent manner
nicodvb
parents:
20754
diff
changeset
|
653 dvdnav_get_current_highlight(nav, button); |
19768
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
654 } |
1069a634fc92
added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
nicodvb
parents:
19764
diff
changeset
|
655 |
19851
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
656 void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button) { |
20809 | 657 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; |
658 dvdnav_t *nav = priv->dvdnav; | |
19851
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
659 dvdnav_status_t status; |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
660 pci_t *pci = dvdnav_get_current_nav_pci(nav); |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
661 |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
662 if(!pci) return; |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
663 |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
664 status = dvdnav_mouse_select(nav, pci, x, y); |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
665 if(status == DVDNAV_STATUS_OK) dvdnav_get_current_highlight(nav, button); |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
666 else *button = -1; |
20809 | 667 priv->mousex = x; |
668 priv->mousey = y; | |
19851
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
669 } |
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
670 |
21424
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
671 /** |
21600 | 672 * \brief dvdnav_aid_from_lang() returns the audio id corresponding to the language code 'lang' |
673 * \param stream: - stream pointer | |
674 * \param lang: 2-characters language code[s], eventually separated by spaces of commas | |
675 * \return -1 on error, current subtitle id if successful | |
676 */ | |
677 int dvdnav_aid_from_lang(stream_t *stream, unsigned char *language) { | |
678 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; | |
679 int k; | |
680 uint8_t format, lg; | |
681 uint16_t lang, lcode;; | |
682 | |
683 while(language && strlen(language)>=2) { | |
684 lcode = (language[0] << 8) | (language[1]); | |
685 for(k=0; k<32; k++) { | |
686 lg = dvdnav_get_audio_logical_stream(priv->dvdnav, k); | |
687 if(lg == 0xff) continue; | |
688 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg); | |
689 if(lang != 0xFFFF && lang == lcode) { | |
690 format = dvdnav_audio_stream_format(priv->dvdnav, lg); | |
691 switch(format) { | |
692 case DVDNAV_FORMAT_AC3: | |
693 return k+128; | |
694 case DVDNAV_FORMAT_DTS: | |
695 return k+136; | |
696 case DVDNAV_FORMAT_LPCM: | |
697 return k+160; | |
698 case DVDNAV_FORMAT_MPEGAUDIO: | |
699 return k; | |
700 default: | |
701 return -1; | |
702 } | |
703 } | |
704 } | |
705 language += 2; | |
706 while(language[0]==',' || language[0]==' ') ++language; | |
707 } | |
708 return -1; | |
709 } | |
710 | |
21603
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
711 /** |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
712 * \brief dvdnav_lang_from_aid() assigns to buf the language corresponding to audio id 'aid' |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
713 * \param stream: - stream pointer |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
714 * \param sid: physical subtitle id |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
715 * \param buf: buffer to contain the 2-chars language string |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
716 * \return 0 on error, 1 if successful |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
717 */ |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
718 int dvdnav_lang_from_aid(stream_t *stream, int aid, unsigned char *buf) { |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
719 uint8_t lg; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
720 uint16_t lang; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
721 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
722 |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
723 if(aid < 0) |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
724 return 0; |
21613
8547ae79e74b
simplified aid management in dvdnav_lang_from_aid(); patch by Joakim Patte
nicodvb
parents:
21603
diff
changeset
|
725 lg = dvdnav_get_audio_logical_stream(priv->dvdnav, aid & 0x7); |
21603
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
726 if(lg == 0xff) return 0; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
727 lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg); |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
728 if(lang == 0xffff) return 0; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
729 buf[0] = lang >> 8; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
730 buf[1] = lang & 0xFF; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
731 buf[2] = 0; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
732 return 1; |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
733 } |
4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
nicodvb
parents:
21600
diff
changeset
|
734 |
21600 | 735 |
736 /** | |
21424
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
737 * \brief dvdnav_sid_from_lang() returns the subtitle id corresponding to the language code 'lang' |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
738 * \param stream: - stream pointer |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
739 * \param lang: 2-characters language code[s], eventually separated by spaces of commas |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
740 * \return -1 on error, current subtitle id if successful |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
741 */ |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
742 int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language) { |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
743 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; |
23990 | 744 uint8_t lg, k; |
21204
1ddb1a86e419
support for comma-separated language codes in -slang
nicodvb
parents:
21200
diff
changeset
|
745 uint16_t lang, lcode; |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
746 |
21204
1ddb1a86e419
support for comma-separated language codes in -slang
nicodvb
parents:
21200
diff
changeset
|
747 while(language && strlen(language)>=2) { |
21333 | 748 lcode = (language[0] << 8) | (language[1]); |
749 for(k=0; k<32; k++) { | |
750 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k); | |
751 if(lg == 0xff) continue; | |
752 lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg); | |
753 if(lang != 0xFFFF && lang == lcode) { | |
754 return k; | |
755 } | |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
756 } |
21333 | 757 language += 2; |
758 while(language[0]==',' || language[0]==' ') ++language; | |
21204
1ddb1a86e419
support for comma-separated language codes in -slang
nicodvb
parents:
21200
diff
changeset
|
759 } |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
760 return -1; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
761 } |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
762 |
21424
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
763 /** |
21560
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
764 * \brief dvdnav_lang_from_sid() assigns to buf the language corresponding to subtitle id 'sid' |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
765 * \param stream: - stream pointer |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
766 * \param sid: physical subtitle id |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
767 * \param buf: buffer to contain the 2-chars language string |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
768 * \return 0 on error, 1 if successful |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
769 */ |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
770 int dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf) { |
23990 | 771 uint8_t lg; |
21560
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
772 uint16_t lang; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
773 dvdnav_priv_t *priv=(dvdnav_priv_t*)stream->priv; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
774 if(sid < 0) return 0; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
775 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, sid); |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
776 lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg); |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
777 if(lang == 0xffff) return 0; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
778 buf[0] = lang >> 8; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
779 buf[1] = lang & 0xFF; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
780 buf[2] = 0; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
781 return 1; |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
782 } |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
783 |
a16219e6d656
added function to return the language of the specified subtitle id. Patch by
nicodvb
parents:
21538
diff
changeset
|
784 /** |
21424
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
785 * \brief dvdnav_number_of_subs() returns the count of available subtitles |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
786 * \param stream: - stream pointer |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
787 * \return 0 on error, something meaningful otherwise |
3504737c4e96
doxygenized dvdnav_sid_from_lang() and dvdnav_number_of_subs()
nicodvb
parents:
21333
diff
changeset
|
788 */ |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
789 int dvdnav_number_of_subs(stream_t *stream) { |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
790 dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
791 uint8_t lg, k, n=0; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
792 |
25824 | 793 if (priv->state & NAV_FLAG_VTS_DOMAIN) return 0; |
21197
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
794 for(k=0; k<32; k++) { |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
795 lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k); |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
796 if(lg == 0xff) continue; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
797 n++; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
798 } |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
799 return n; |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
800 } |
7ecd9de03435
added code to identify subs language and count; needed for forthcoming support for -slang
nicodvb
parents:
21193
diff
changeset
|
801 |
23902 | 802 /** |
803 * \brief mp_dvdnav_get_spu_clut() returns the spu clut | |
804 * \param stream: - stream pointer | |
805 * \return spu clut pointer | |
806 */ | |
21538
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
807 unsigned int *mp_dvdnav_get_spu_clut(stream_t *stream) { |
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
808 dvdnav_priv_t *priv=(dvdnav_priv_t*)stream->priv; |
25827 | 809 if (!(priv->state & NAV_FLAG_SPU_SET)) return NULL; |
21538
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
810 return priv->spu_clut; |
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
811 } |
c9b6588932b5
export spu palette; part of a patch by Otvos Attila
nicodvb
parents:
21424
diff
changeset
|
812 |
23902 | 813 /** |
814 * \brief mp_dvdnav_get_highlight() get dvdnav highlight struct | |
815 * \param stream: - stream pointer | |
816 * \param hl : - highlight struct pointer | |
817 */ | |
21219 | 818 void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl) { |
819 dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv; | |
820 dvdnav_highlight_event_t hlev = priv->hlev; | |
821 | |
822 hl->sx = hlev.sx; | |
823 hl->sy = hlev.sy; | |
824 hl->ex = hlev.ex; | |
825 hl->ey = hlev.ey; | |
21200 | 826 } |
19851
adfd08588514
report mouse coordinates after movement to dvdnav; this permits to enable button selection using the mouse; patch by Jonas Jermann and me
nicodvb
parents:
19842
diff
changeset
|
827 |
25817 | 828 void mp_dvdnav_switch_title (stream_t *stream, int title) { |
829 dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv; | |
830 uint32_t titles; | |
831 | |
832 dvdnav_get_number_of_titles (priv->dvdnav, &titles); | |
833 if (title > 0 && title <= titles) | |
834 dvdnav_title_play (priv->dvdnav, title); | |
835 } | |
836 | |
25824 | 837 /** |
838 * \brief Check if end of stream has been reached | |
839 * \param stream: - stream pointer | |
840 * \return 1 on really eof | |
841 */ | |
842 int mp_dvdnav_is_eof (stream_t *stream) { | |
843 return ((dvdnav_priv_t *) stream->priv)->state & NAV_FLAG_EOF; | |
844 } | |
845 | |
846 /** | |
847 * \brief Skip still frame | |
848 * \param stream: - stream pointer | |
849 * \return 0 on success | |
850 */ | |
851 int mp_dvdnav_skip_still (stream_t *stream) { | |
852 dvdnav_priv_t *priv = stream->priv; | |
853 if (priv->still_length == 0xff) | |
854 return 1; | |
855 dvdnav_still_skip(priv->dvdnav); | |
856 return 0; | |
857 } | |
858 | |
859 /** | |
860 * \brief Skip wait event | |
861 * \param stream: - stream pointer | |
862 * \return 0 on success | |
863 */ | |
864 int mp_dvdnav_skip_wait (stream_t *stream) { | |
865 dvdnav_priv_t *priv = stream->priv; | |
866 if (!(priv->state & NAV_FLAG_WAIT)) | |
867 return 1; | |
868 priv->state &= ~NAV_FLAG_WAIT; | |
869 dvdnav_wait_skip(priv->dvdnav); | |
870 return 0; | |
871 } | |
872 | |
873 /** | |
874 * \brief Set wait mode | |
875 * \param stream : - stream pointer | |
876 * \param mode : - if true, then suspend block read | |
877 * \param automode: - if true, then VTS or cell change set wait mode | |
878 */ | |
879 void mp_dvdnav_read_wait (stream_t *stream, int mode, int automode) { | |
880 dvdnav_priv_t *priv = stream->priv; | |
881 if (mode == 0) | |
882 priv->state &= ~NAV_FLAG_WAIT_READ; | |
883 if (mode > 0) | |
884 priv->state |= NAV_FLAG_WAIT_READ; | |
885 if (automode == 0) | |
886 priv->state &= ~NAV_FLAG_WAIT_READ_AUTO; | |
887 if (automode > 0) | |
888 priv->state |= NAV_FLAG_WAIT_READ_AUTO; | |
889 } | |
890 | |
891 /** | |
892 * \brief Check if cell has changed | |
893 * \param stream: - stream pointer | |
894 * \param clear : - if true, then clear cell change flag | |
895 * \return 1 if cell has changed | |
896 */ | |
897 int mp_dvdnav_cell_has_changed (stream_t *stream, int clear) { | |
898 dvdnav_priv_t *priv = stream->priv; | |
899 if (!(priv->state & NAV_FLAG_CELL_CHANGED)) | |
900 return 0; | |
901 if (clear) | |
902 priv->state &= ~NAV_FLAG_CELL_CHANGED; | |
903 return 1; | |
904 } | |
905 | |
906 | |
25211 | 907 const stream_info_t stream_info_dvdnav = { |
19302 | 908 "DVDNAV stream", |
909 "null", | |
910 "", | |
911 "", | |
912 open_s, | |
913 { "dvdnav", NULL }, | |
914 &stream_opts, | |
915 1 // Urls are an option string | |
916 }; |