comparison libmpdemux/stream.c @ 15476:5eb4994a691f

ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
author nicodvb
date Sun, 15 May 2005 07:38:42 +0000
parents ae5e1b9e3c92
children 9391bf60ccdf
comparison
equal deleted inserted replaced
15475:ffe2b5261af5 15476:5eb4994a691f
33 33
34 34
35 extern int verbose; // defined in mplayer.c 35 extern int verbose; // defined in mplayer.c
36 void cache_uninit(stream_t *s); // defined in cache2.c 36 void cache_uninit(stream_t *s); // defined in cache2.c
37 37
38 #include "cue_read.h"
39
40 //#include "vcd_read_bincue.h" 38 //#include "vcd_read_bincue.h"
41 39
42 #ifdef USE_DVDREAD 40 #ifdef USE_DVDREAD
43 int dvd_read_sector(dvd_priv_t *d,unsigned char* data); 41 int dvd_read_sector(dvd_priv_t *d,unsigned char* data);
44 void dvd_seek(dvd_priv_t *d,int pos); 42 void dvd_seek(dvd_priv_t *d,int pos);
66 #endif 64 #endif
67 #ifdef HAVE_VSTREAM 65 #ifdef HAVE_VSTREAM
68 extern stream_info_t stream_info_vstream; 66 extern stream_info_t stream_info_vstream;
69 #endif 67 #endif
70 68
69 extern stream_info_t stream_info_cue;
71 extern stream_info_t stream_info_null; 70 extern stream_info_t stream_info_null;
72 extern stream_info_t stream_info_file; 71 extern stream_info_t stream_info_file;
73 72
74 stream_info_t* auto_open_streams[] = { 73 stream_info_t* auto_open_streams[] = {
75 #ifdef HAVE_VCD 74 #ifdef HAVE_VCD
88 &stream_info_ftp, 87 &stream_info_ftp,
89 #endif 88 #endif
90 #ifdef HAVE_VSTREAM 89 #ifdef HAVE_VSTREAM
91 &stream_info_vstream, 90 &stream_info_vstream,
92 #endif 91 #endif
92 &stream_info_cue,
93 &stream_info_null, 93 &stream_info_null,
94 &stream_info_file, 94 &stream_info_file,
95 NULL 95 NULL
96 }; 96 };
97 97
201 len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break; 201 len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
202 } 202 }
203 #else 203 #else
204 len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break; 204 len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
205 #endif 205 #endif
206 case STREAMTYPE_VCDBINCUE:
207 len=cue_vcd_read(s->buffer);break;
208 #ifdef USE_DVDNAV 206 #ifdef USE_DVDNAV
209 case STREAMTYPE_DVDNAV: { 207 case STREAMTYPE_DVDNAV: {
210 dvdnav_stream_read((dvdnav_priv_t*)s->priv,s->buffer,&len); 208 dvdnav_stream_read((dvdnav_priv_t*)s->priv,s->buffer,&len);
211 if (len==0) return 0; // this was an event, so repeat the read 209 if (len==0) return 0; // this was an event, so repeat the read
212 break; 210 break;
251 #ifdef _LARGEFILE_SOURCE 249 #ifdef _LARGEFILE_SOURCE
252 newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break; 250 newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
253 #else 251 #else
254 newpos=pos&(~(STREAM_BUFFER_SIZE-1));break; 252 newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
255 #endif 253 #endif
256 case STREAMTYPE_VCDBINCUE:
257 newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
258 case STREAMTYPE_DVD: 254 case STREAMTYPE_DVD:
259 newpos=pos/2048; newpos*=2048; break; 255 newpos=pos/2048; newpos*=2048; break;
260 default: 256 default:
261 // Round on sector size 257 // Round on sector size
262 if(s->sector_size) 258 if(s->sector_size)
289 case STREAMTYPE_SMB: 285 case STREAMTYPE_SMB:
290 s->pos=newpos; // real seek 286 s->pos=newpos; // real seek
291 if(smbc_lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1; 287 if(smbc_lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1;
292 break; 288 break;
293 #endif 289 #endif
294 case STREAMTYPE_VCDBINCUE:
295 s->pos=newpos; // real seek
296 cue_set_msf(s->pos/VCD_SECTOR_DATA);
297 break;
298 #ifdef USE_DVDNAV 290 #ifdef USE_DVDNAV
299 case STREAMTYPE_DVDNAV: { 291 case STREAMTYPE_DVDNAV: {
300 if (newpos==0) { 292 if (newpos==0) {
301 if (dvdnav_stream_reset((dvdnav_priv_t*)s->priv)) 293 if (dvdnav_stream_reset((dvdnav_priv_t*)s->priv))
302 s->pos=0; 294 s->pos=0;