[Mplayer-cvslog] CVS: main/TOOLS/netstream netstream.c,1.1,1.2

Alban Bedel CVS albeu at mplayerhq.hu
Sun Apr 6 20:16:14 CEST 2003


Update of /cvsroot/mplayer/main/TOOLS/netstream
In directory mail:/var/tmp.root/cvs-serv21041/TOOLS/netstream

Modified Files:
	netstream.c 
Log Message:
It should now be endian aware. Untested as i only have le box :(
Would be cool if someone with a be,le network could test.


Index: netstream.c
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/netstream/netstream.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- netstream.c	6 Apr 2003 16:39:16 -0000	1.1
+++ netstream.c	6 Apr 2003 18:16:11 -0000	1.2
@@ -36,6 +36,7 @@
 
 #include <libmpdemux/stream.h>
 #include <mp_msg.h>
+#include <bswap.h>
 
 /// Netstream packets def and some helpers
 #include <libmpdemux/netstream.h>
@@ -79,6 +80,7 @@
   ret.sector_size = cl->stream->sector_size;
   ret.start_pos = cl->stream->start_pos;
   ret.end_pos = cl->stream->end_pos;
+  net_stream_opened_2_me(&ret);
 
   if(!write_packet(cl->fd,NET_STREAM_OK,(char*)&ret,sizeof(mp_net_stream_opened_t)))
     return 0;
@@ -102,8 +104,8 @@
   pack = malloc(max_len + sizeof(mp_net_stream_packet_t));
   pack->cmd = NET_STREAM_OK;
   r = stream_read(cl->stream,pack->data,max_len);
-  pack->len = r + sizeof(mp_net_stream_packet_t);
-  if(!net_write(cl->fd,(char*)pack,pack->len)) {
+  pack->len = le2me_16(r + sizeof(mp_net_stream_packet_t));
+  if(!net_write(cl->fd,(char*)pack,le2me_16(pack->len))) {
     free(pack);
     return 0;
   }
@@ -173,13 +175,13 @@
       mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid fill buffer packet\n");
       return 0;
     }
-    return net_stream_fill_buffer(cl,*((uint16_t*)pack->data));
+    return net_stream_fill_buffer(cl,le2me_16(*((uint16_t*)pack->data)));
   case NET_STREAM_SEEK:
     if(pack->len != sizeof(mp_net_stream_packet_t) + 8) {
       mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid fill buffer packet\n");
       return 0;
     }
-    return net_stream_seek(cl,*((uint64_t*)pack->data));
+    return net_stream_seek(cl,le2me_64(*((uint64_t*)pack->data)));
   case NET_STREAM_RESET:
     return net_stream_reset(cl);
   case NET_STREAM_CLOSE:



More information about the MPlayer-cvslog mailing list