summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorbertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-20 22:22:21 +0000
committerbertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-20 22:22:21 +0000
commit65800caaaaaf51104c0b5e1584c5ae98e8123cf0 (patch)
tree11550a1f8e08eee76c3d5e1719a0f0415b11a0f2 /libmpdemux
parente9f3fd3e94a6d3c6d8204ebd3f4170e5615a503a (diff)
downloadmpv-65800caaaaaf51104c0b5e1584c5ae98e8123cf0.tar.bz2
mpv-65800caaaaaf51104c0b5e1584c5ae98e8123cf0.tar.xz
Added a network read function call and a seek network function call.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3045 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/stream.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c
index 11f94cb29d..b51fe147b7 100644
--- a/libmpdemux/stream.c
+++ b/libmpdemux/stream.c
@@ -36,7 +36,15 @@ int stream_fill_buffer(stream_t *s){
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 @@ if(newpos==0 || newpos!=s->pos){
#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 @@ if(newpos==0 || newpos!=s->pos){
while(s->pos<newpos){
if(stream_fill_buffer(s)<=0) break; // EOF
}
+#endif
break;
#ifdef USE_TV
case STREAMTYPE_TV: