[Mplayer-cvslog] CVS: main stream.h,1.8,1.9 stream.c,1.18,1.19

Arpi of Ize arpi at mplayer.dev.hu
Wed Oct 10 02:47:50 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv31403

Modified Files:
	stream.h stream.c 
Log Message:
new_memory_stream() added

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/stream.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- stream.h	20 Aug 2001 20:17:44 -0000	1.8
+++ stream.h	10 Oct 2001 00:47:17 -0000	1.9
@@ -7,6 +7,7 @@
 #define STREAMTYPE_VCD  1
 #define STREAMTYPE_STREAM 2    // same as FILE but no seeking (for stdin)
 #define STREAMTYPE_DVD  3
+#define STREAMTYPE_MEMORY  4
 
 #define VCD_SECTOR_SIZE 2352
 #define VCD_SECTOR_OFFS 24
@@ -26,8 +27,8 @@
   int type; // 0=file 1=VCD
   unsigned int buf_pos,buf_len;
   off_t start_pos,end_pos;
-  unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
   void* priv; // used for DVD
+  unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
 } stream_t;
 
 int stream_fill_buffer(stream_t *s);
@@ -135,6 +136,6 @@
 void stream_reset(stream_t *s);
 stream_t* new_stream(int fd,int type);
 void free_stream(stream_t *s);
-
+stream_t* new_memory_stream(unsigned char* data,int len);
 
 #endif // __STREAM_H

Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/stream.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- stream.c	2 Oct 2001 21:45:41 -0000	1.18
+++ stream.c	10 Oct 2001 00:47:17 -0000	1.19
@@ -65,7 +65,7 @@
 int stream_seek_long(stream_t *s,off_t pos){
 off_t newpos;
 
-//  if(verbose>=3) printf("seek to 0x%X\n",(unsigned int)pos);
+//  if(verbose>=3) printf("seek_long to 0x%X\n",(unsigned int)pos);
 
   s->buf_pos=s->buf_len=0;
 
@@ -155,6 +155,18 @@
     s->eof=0;
   }
   //stream_seek(s,0);
+}
+
+stream_t* new_memory_stream(unsigned char* data,int len){
+  stream_t *s=malloc(sizeof(stream_t)+len);
+  s->fd=-1;
+  s->type=STREAMTYPE_MEMORY;
+  s->buf_pos=0; s->buf_len=len;
+  s->start_pos=0; s->end_pos=len;
+  stream_reset(s);
+  s->pos=len;
+  memcpy(s->buffer,data,len);
+  return s;
 }
 
 stream_t* new_stream(int fd,int type){




More information about the MPlayer-cvslog mailing list