diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-06 18:16:11 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-06 18:16:11 +0000 |
commit | 42ce6511351061cb3ec870eb6f31d435f22e672d (patch) | |
tree | 64e13d3a025a2f13947eb9b56712e1b96ec991ad /libmpdemux/netstream.h | |
parent | 73257ca2757e45a60ea5012e742b63fedd357ac2 (diff) | |
download | mpv-42ce6511351061cb3ec870eb6f31d435f22e672d.tar.bz2 mpv-42ce6511351061cb3ec870eb6f31d435f22e672d.tar.xz |
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.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9864 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/netstream.h')
-rw-r--r-- | libmpdemux/netstream.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libmpdemux/netstream.h b/libmpdemux/netstream.h index ade6ee4092..b505027b02 100644 --- a/libmpdemux/netstream.h +++ b/libmpdemux/netstream.h @@ -3,6 +3,8 @@ * Common stuff for netstream * Packets and so on are defined here along with a few helpers * wich are used by both the client and the server + * + * Data is always low endian */ typedef struct mp_net_stream_packet_st { @@ -64,7 +66,8 @@ static mp_net_stream_packet_t* read_packet(int fd) { free(pack); return NULL; } - + pack->len = le2me_16(pack->len); + if(pack->len < sizeof(mp_net_stream_packet_t)) { mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid packet (too small: %d)\n",pack->len); free(pack); @@ -113,6 +116,7 @@ static int write_packet(int fd, uint8_t cmd,char* data,int len) { pack->cmd = cmd; // printf("Write packet %d %d (%p) %d\n",fd,cmd,data,len); + pack->len = le2me_16(pack->len); if(net_write(fd,(char*)pack,pack->len)) { free(pack); return 1; @@ -120,3 +124,11 @@ static int write_packet(int fd, uint8_t cmd,char* data,int len) { free(pack); return 0; } + +static void net_stream_opened_2_me(mp_net_stream_opened_t* o) { + o->file_format = le2me_32(o->file_format); + o->flags = le2me_32(o->flags); + o->sector_size = le2me_32(o->sector_size); + o->start_pos = le2me_64(o->start_pos); + o->end_pos = le2me_64(o->end_pos); +} |