Mercurial > mplayer.hg
comparison stream/stream_dvdnav.c @ 19909:282e93cf7617
removed dead code
author | nicodvb |
---|---|
date | Tue, 19 Sep 2006 22:01:27 +0000 |
parents | b6aa47caeb72 |
children | 3fdb44285fe7 |
comparison
equal
deleted
inserted
replaced
19908:b6aa47caeb72 | 19909:282e93cf7617 |
---|---|
103 //dvdnav_event_clear(dvdnav_priv); | 103 //dvdnav_event_clear(dvdnav_priv); |
104 | 104 |
105 return dvdnav_priv; | 105 return dvdnav_priv; |
106 } | 106 } |
107 | 107 |
108 int dvdnav_stream_reset(dvdnav_priv_t * dvdnav_priv) { | |
109 if (!dvdnav_priv) return 0; | |
110 | |
111 // if (dvdnav_reset(dvdnav_priv->dvdnav)!=DVDNAV_STATUS_OK) | |
112 return 0; | |
113 | |
114 dvdnav_priv->started=0; | |
115 | |
116 return 1; | |
117 } | |
118 | |
119 int dvdnav_stream_sleeping(dvdnav_priv_t * dvdnav_priv) { | |
120 unsigned int now; | |
121 | |
122 if (!dvdnav_priv) return 0; | |
123 | |
124 if(dvdnav_priv->sleeping) | |
125 { | |
126 now=GetTimer(); | |
127 while(dvdnav_priv->sleeping>1 || now<dvdnav_priv->sleep_until) { | |
128 // printf("%s %u<%u\n",__FUNCTION__,now,dvdnav_priv->sleep_until); | |
129 // usec_sleep(1000); /* 1ms granularity */ | |
130 return 1; | |
131 } | |
132 dvdnav_still_skip(dvdnav_priv->dvdnav); // continue past... | |
133 dvdnav_priv->sleeping=0; | |
134 mp_msg(MSGT_OPEN,MSGL_V, "%s: woke up!\n",__FUNCTION__); | |
135 } | |
136 dvd_nav_still=0; | |
137 mp_msg(MSGT_OPEN,MSGL_V, "%s: active\n",__FUNCTION__); | |
138 return 0; | |
139 } | |
140 | |
141 void dvdnav_stream_sleep(dvdnav_priv_t * dvdnav_priv, int seconds) { | |
142 if (!dvdnav_priv) return; | |
143 | |
144 if (!dvdnav_priv->started) return; | |
145 | |
146 dvdnav_priv->sleeping=0; | |
147 switch (seconds) { | |
148 case 0: | |
149 return; | |
150 case 0xff: | |
151 mp_msg(MSGT_OPEN,MSGL_V, "Sleeping indefinately\n" ); | |
152 dvdnav_priv->sleeping=2; | |
153 break; | |
154 default: | |
155 mp_msg(MSGT_OPEN,MSGL_V, "Sleeping %d sec(s)\n", seconds ); | |
156 dvdnav_priv->sleep_until = GetTimer();// + seconds*1000000; | |
157 dvdnav_priv->sleeping=1; | |
158 break; | |
159 } | |
160 //if (dvdnav_priv->started) dvd_nav_still=1; | |
161 } | |
162 | |
163 void dvdnav_stream_add_event(dvdnav_priv_t* dvdnav_priv, int event, unsigned char *buf, int len) { | |
164 //printf("%s: %d\n",__FUNCTION__,event); | |
165 | |
166 dvdnav_event_t * dvdnav_event; | |
167 | |
168 if (!dvdnav_priv->started) return; | |
169 | |
170 if (!(dvdnav_event=calloc(1,sizeof(*dvdnav_event)))) { | |
171 mp_msg(MSGT_OPEN,MSGL_V, "%s: dvdnav_event: out of memory!\n",__FUNCTION__); | |
172 return; | |
173 } | |
174 dvdnav_event->event=event; | |
175 dvdnav_event->details=calloc(1,len); | |
176 memcpy(dvdnav_event->details,buf,len); | |
177 dvdnav_event->len=len; | |
178 } | |
179 | |
180 int dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len) { | 108 int dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len) { |
181 int event = DVDNAV_NOP; | 109 int event = DVDNAV_NOP; |
182 | 110 |
183 if (!len) return -1; | 111 if (!len) return -1; |
184 *len=-1; | 112 *len=-1; |
216 case DVDNAV_WAIT: | 144 case DVDNAV_WAIT: |
217 dvdnav_wait_skip(dvdnav_priv->dvdnav); | 145 dvdnav_wait_skip(dvdnav_priv->dvdnav); |
218 break; | 146 break; |
219 } | 147 } |
220 | 148 |
221 // got an event, repeat the read | |
222 dvdnav_stream_add_event(dvdnav_priv,event,buf,*len); | |
223 *len=0; | 149 *len=0; |
224 } | 150 } |
225 // printf("%s: got %d\n",__FUNCTION__,*len); | |
226 return event; | 151 return event; |
227 } | |
228 | |
229 void dvdnav_stream_fullstart(dvdnav_priv_t * dvdnav_priv) { | |
230 if (dvdnav_priv && !dvdnav_priv->started) { | |
231 dvdnav_stream_reset(dvdnav_priv->dvdnav); | |
232 dvdnav_priv->started=1; | |
233 } | |
234 } | |
235 | |
236 unsigned int * dvdnav_stream_get_palette(dvdnav_priv_t * dvdnav_priv) { | |
237 if (!dvdnav_priv) { | |
238 mp_msg(MSGT_OPEN,MSGL_V, "%s: NULL dvdnav_priv\n",__FUNCTION__); | |
239 return NULL; | |
240 } | |
241 if (!dvdnav_priv->dvdnav) { | |
242 mp_msg(MSGT_OPEN,MSGL_V, "%s: NULL dvdnav_priv->dvdnav\n",__FUNCTION__); | |
243 return NULL; | |
244 } | |
245 } | 152 } |
246 | 153 |
247 static void update_title_len(stream_t *stream) { | 154 static void update_title_len(stream_t *stream) { |
248 dvdnav_priv_t *priv = stream->priv; | 155 dvdnav_priv_t *priv = stream->priv; |
249 dvdnav_status_t status; | 156 dvdnav_status_t status; |
261 | 168 |
262 | 169 |
263 static int seek(stream_t *s, off_t newpos) { | 170 static int seek(stream_t *s, off_t newpos) { |
264 uint32_t pos = 0, len = 0, sector = 0; | 171 uint32_t pos = 0, len = 0, sector = 0; |
265 dvdnav_priv_t *priv = s->priv; | 172 dvdnav_priv_t *priv = s->priv; |
266 | |
267 if(newpos==0) | |
268 dvdnav_stream_reset(priv->dvdnav); | |
269 | 173 |
270 if(s->end_pos && newpos > s->end_pos) | 174 if(s->end_pos && newpos > s->end_pos) |
271 newpos = s->end_pos; | 175 newpos = s->end_pos; |
272 sector = newpos / 2048ULL; | 176 sector = newpos / 2048ULL; |
273 if(dvdnav_sector_search(priv->dvdnav, (uint64_t) sector, SEEK_SET) != DVDNAV_STATUS_OK) | 177 if(dvdnav_sector_search(priv->dvdnav, (uint64_t) sector, SEEK_SET) != DVDNAV_STATUS_OK) |
311 case DVDNAV_VTS_CHANGE: { | 215 case DVDNAV_VTS_CHANGE: { |
312 s->end_pos = 0; | 216 s->end_pos = 0; |
313 update_title_len(s); | 217 update_title_len(s); |
314 break; | 218 break; |
315 } | 219 } |
316 #if 0 | |
317 case DVDNAV_STILL_FRAME: { | |
318 if(!dvdnav_priv->stillok) dvdnav_priv->stillcounter++; | |
319 dvdnav_priv->lockstillcounter++; | |
320 return len; | |
321 break; | |
322 } | |
323 | |
324 case DVDNAV_WAIT: { | |
325 if(dvdnav_priv->waitcounter>=DVDNAV_MAX_WAIT_FRAME) return len; | |
326 break; | |
327 } | |
328 #endif | |
329 } | 220 } |
330 #if 0 | |
331 if(dvdnav_priv->event.cell_really_change && | |
332 dvdnav_priv->started && | |
333 !dvdnav_priv->vts_domain) | |
334 return len; | |
335 #endif | |
336 } | 221 } |
337 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len); | 222 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len); |
338 return len; | 223 return len; |
339 } | 224 } |
340 | 225 |
391 int event,len,tmplen=0; | 276 int event,len,tmplen=0; |
392 uint32_t pos, l2; | 277 uint32_t pos, l2; |
393 dvdnav_priv_t *dvdnav_priv; | 278 dvdnav_priv_t *dvdnav_priv; |
394 dvdnav_status_t status; | 279 dvdnav_status_t status; |
395 | 280 |
396 //mp_msg(MSGT_OPEN,MSGL_INFO,"URL: %s\n", filename); | |
397 | |
398 if(p->device) filename = p->device; | 281 if(p->device) filename = p->device; |
399 else if(dvd_device) filename= dvd_device; | 282 else if(dvd_device) filename= dvd_device; |
400 else filename = DEFAULT_DVD_DEVICE; | 283 else filename = DEFAULT_DVD_DEVICE; |
401 if(!(dvdnav_priv=new_dvdnav_stream(filename))) { | 284 if(!(dvdnav_priv=new_dvdnav_stream(filename))) { |
402 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename); | 285 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename); |