[Mplayer-cvslog] CVS: main/libmpdemux stream.c,1.22,1.23
Bertrand Baudet
bertrand at mplayer.dev.hu
Tue Nov 20 23:22:24 CET 2001
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv23381
Modified Files:
stream.c
Log Message:
Added a network read function call and a seek network function call.
Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- stream.c 9 Nov 2001 23:46:06 -0000 1.22
+++ stream.c 20 Nov 2001 22:22:21 -0000 1.23
@@ -36,7 +36,15 @@
switch(s->type){
case STREAMTYPE_FILE:
case STREAMTYPE_STREAM:
+#ifdef STREAMING
+ if( s->streaming_ctrl!=NULL ) {
+ len=s->streaming_ctrl->streaming_read(s->fd,s->buffer,STREAM_BUFFER_SIZE, s->streaming_ctrl);break;
+ } else {
+ len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
+ }
+#else
len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
+#endif
case STREAMTYPE_VCD:
#ifdef VCD_CACHE
len=vcd_cache_read(s->fd,s->buffer);break;
@@ -125,6 +133,17 @@
#endif
case STREAMTYPE_STREAM:
//s->pos=newpos; // real seek
+ // Some streaming protocol allow to seek backward and forward
+ // A function call that return -1 can tell that the protocol
+ // doesn't support seeking.
+#ifdef STREAMING
+ if( s->streaming_ctrl!=NULL ) {
+ if( s->streaming_ctrl->streaming_seek( s->fd, pos, s->streaming_ctrl )<0 ) {
+ mp_msg(MSGT_STREAM,MSGL_INFO,"Stream not seekable!\n");
+ return 1;
+ }
+ }
+#else
if(newpos<s->pos){
mp_msg(MSGT_STREAM,MSGL_INFO,"Cannot seek backward in linear streams!\n");
return 1;
@@ -132,6 +151,7 @@
while(s->pos<newpos){
if(stream_fill_buffer(s)<=0) break; // EOF
}
+#endif
break;
#ifdef USE_TV
case STREAMTYPE_TV:
More information about the MPlayer-cvslog
mailing list